Angular UI Google Maps Clustering: Disappearance and Flashing - google-maps-markers

I have run into some pretty bad UX problems while developing with angular google maps and am looking for advice on the best way to proceed.
Relevant template:
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options" bounds="map.bounds">
<ui-gmap-markers doCluster="true" models="randomMarkers" coords="'self'" icon="'icon'">
</ui-gmap-markers>
</ui-gmap-google-map>
Plunkr: http://plnkr.co/edit/mZvN6wCT9LCl1DWGojZD?p=preview
Two problems, both related to clustering:
First, on any sort of map event, most annoyingly drag, the clusters blink as they repaint, even if the cluster did not change position.
Second, the clusters disappear when they fall off the visible section of the map, which is probably good for performance but more of a UI pain if you're dealing with maps at a high zoom level, where things are in and out of the map's view all the time.
These issues are not apparent at the markercluster demo page:
http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/1.0/examples/advanced_example.html
How have you addressed these issues? I've looked through the API's for both angular google maps and markerclustererplus, but to no avail.
I was under the assumption that the clusterer would just figure out which points belonged together, then make a marker that symbolized that collection. However it seems that the clusters behave so differently than markers (eg. the above issues) that this can't be the case.

Related

Poor ListView performance on Gluon

I have a custom ListCell implementation, shown in the picture below.
The left side, which represents the date, consisting of 3 labels, put in a VBox and the "CounterContent" consisting of the counter, with a TextField for each digit, contained in a HBox, and two Hboxes containing labels for kWh, kWh/day and so on. And that seem to be just too much, to be running performantly.
I've tried to load the data in a background task, showing a progress indicator, while the task is running, but unlike on desktop, on android the performance is very poor. Whenever I switch to the listview, the garbage collection kicks in, and blocks the ui thread, so that the progress indicator never shows up.
I've tried it on a Huawei Y-300, Android 4.1.1, javafxports 8.60.6 (because javafxports 8.60.7 causes a bug, that makes TextField unusable), and on a Samsung S5 mini, Android 5+. On the Samsung phone the performance in general is way better, just like expected, because of the Ahead-of-Time compilation I guess, but there is still the garbage collection issue. Furthermore after the listview has been populated with cells, the scrolling is not very smooth.
Is the listcell to complex or what else could be the matter for the poor performance?
UPDATE:
After running a lot of tests it seems the unsmooth scrolling is not caused by performance problems. At least on the S5 (javafxports 8.60.7).
I removed all css styling, and replaced the textfields by a single label (the counter node is already a custom control(forgot about that), which lays out the textfields in 2 Regions(not HBoxes) and the nodes of the ListCell are instantiated in the constructor). Furthermore I switched the ListView for a CharmListView and set android.monocle.input.touchRadius=1.
None of these steps resulted in considerable improvement.
Just to clarify: In contrast to the Huawei phone, the scrolling on the S5 and android 5+ is usable, but it's not very smooth, which makes for a unsatisfactory user experience.
On the Huawei (javafxports 8.60.6), changing the counter textfields for a label, gave a significant improvement, but not to the point where the scrolling became usable. Until I set this magical experimental switch: gluon.experimental.performance=true, which makes the listview scrolling lightning fast(after a little warmup delay), but still not really smooth.
There are many reasons why the performance of a complex scene is reduced, so this is just a list of possible ideas that might help improving it, in any order.
ListCell
For starters, the number of nodes in the cell is really high. Notice that every single scroll you make means the full rendering of the virtual flow that holds the visible cells. And for every cell, that means recreating its content all over again.
Without viewing your code I can't tell, but you should avoid creating new instances of every node in the cell all the time, by having just one single instance, and in the updateItem method only change the content of the nodes.
Have a look at this sample. The NoteCell class is a custom cell, where a ListTile is used.
Number of nodes
Have you tried using just a Label to replace the 8 textfields and 3 boxes?
Cache
If you use images downloaded from Internet, use Gluon Charm Down Cache to avoid the same image being downloaded over and over again.
Have a look at this sample. Without the cache, even on desktop the performance is really affected.
Also use the JavaFX built-in cache for any node, trying different cache strategies.
CSS
Complex CSS requires long CPU time. Try to simplify it. Even you can remove the whole CSS for a quick test. Then decide what you may or may not use.
The same goes for animations: Avoid animations, transitions or even CSS effects, if possible.
Custom Control
The counter complex node could probably be replaced by a custom control that optimizes the rendering.
CharmListView
Have you tried using the Gluon Charm CharmListView control instead of the ListView?
There's a new experimental flag that you can use to test a possible optimization that might improve performance while scrolling the list. Set gluon.experimental.performance=true on the java.custom.properties file, and give it a try.
JavaFXPorts version
You mentioned you are using 8.60.6 because of the TextField bug. In this case, are your TextField nodes editable? If not, I'd suggest replacing them with other nodes and running with 8.60.7, since it contains a lot of performance improvements.
Performance tools
Use performance tools like Monitor and use its profiling options so you can trace down any possible bottle neck.
CPU
Last but not least: your mobile device specs are always critical.
Trying to render a complex scene on a Cortex A5, given that "it is the smallest, lowest cost and lowest power ARMv7 application processor", or using a very old Android 4.1.1, can't perform as well as running it on a brand new device with higher specs.
As you also mentioned, running on a Cortex A7 performs "way better". Have a look at this comparison, and find the right architecture for the job.
Anyway, there's always room for improvement, and a lot of effort is put into it. Your feedback is always welcome.

Set a country background to my Google Geomap

A few days ago I've explored geomaps and, however, it turned out to be easy to change the properties of the elements.
But I have two questions:
I'd like to add rivers and forests on the maps. So Ive considered to set a background image instead of the geomaps figure. But I can't find a way to get this one fixed. Is there a way to set a background picture for a country or region?
How can I change the shape of the "bubbles" when you select a city e.g. "London"? I'd like to change it to a square.
Thanks in advance for your help!
Unfortunately what you're looking for is not available in geocharts in their current implementation.
Using a background image is possible in the sense that you can use CSS to make all shapes in the map transparent, and use a background image in the div to make it appear as if the little circles are being drawn on a map with forest and rivers, but you will run in to two big hurdles:
Your map will need to be identical in size/layout to the Google Maps SVG
If Google ever changes the SVG they use (or the view/projection they use) you will need to edit yours too
This isn't ideal, obviously. You could work around it by creating custom javascript to write rivers and forests on your map, but that is going to be a huge headache (especially if you are using multiple maps/views).
As for the circles, you can't change them to squares without hacking the actual SVG in the background with javascript. While this is definitely possible (if you're really good with SVG/Javascript), it again isn't using any of the fancy features of geocharts, and is more just a custom solution that will have to be updated if/when google updates their API.
Rather than doing it that way, you may want to look in to the same implementation on google maps itself. That will allow you to use custom markers, draw custom shapes, etc. with a lot more flexibility (and a much more stable API).

How to create big organization charts like google maps?

I don't know javascript (unfortunately) and I'd like to make a mindmap-like "organization chart" similar to this one:
This map should have an ability to zoom-in and zoom-out similar to google maps, and the ability to arbitrarily connect nodes. So it is more like a free graph, not like an ordinal tree. Mindomo makes this pretty well, but it is commercial and flash-oriented.
Does anybody know of a similar solution?
My research pointed me out that this could be a svg sketch, possibly generated offline, or maybe something using canvas. A click on the node should redirect to some web location.
Google maps is good because it also hides some details, and so should do this graph map in zoomed out projection.
A few important questions:
Do you need this generated in real time based on some underlying dataset?
Aside from zooming, should the user be able to manually open/close nodes?
You can manually generate this simply using some free tools:
MindMeister
xmind
freemind
although non-traditional, can you consider using Prezi?

Android Activity.setContentView(), smooth transition?

I'm developing my first Android game and I'm having a bit of difficulty making the UI as smooth as I would like. I've spent a couple of hours googling around with no luck, I'm probably just searching for the wrong thing.
I have two different XML layout resources where each layout contains just one SurfaceView subclass. When I call activity.setContentView(R.layout.second_layout) to transition from the first layout to the second layout there is a noticeable period of time where a black screen (with a small white bar along the top) is displayed in between the two views.
I've tried various things such as; constructing the second view manually at runtime (i.e not using a layout XML file), calling activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) after activity.setContentView(R.layout.second_layout) and attempting to render to the canvas before the view has loaded (turns out the canvas is unavailable).
I don't see other games (or apps) having this issue so I presume there is a reasonably simple solution.
If you need some more information about my particular situation in order to help out then please let me know what information is missing. Any help would be largely appreciated.
Update: My answer below was written in 2010. Since then Fragments have become the norm, particularly since Fragment nesting was made possible and the support library allows this functionality to be used in a backwards compatible fashion. As such, instead of transitioning to a new Activity to perform a new "user task", you can use the one Activity and push and pop fragments within that Activity's view hierarchy. Animations can also be performed as a part of a fragment transaction (e.g. Fragment transaction animation: slide in and slide out).
This became pretty apparent not long after posting this question, however I thought I should come back here and make it clear to everyone else.
Activities are positively the way to go when developing for Android. Don't be put off by the fact that a transition may seem too minor for a separate Activity, the very foundation of Android is built around the idea of an Activity.

Deep Zoom in Ajax - Possible? Any examples out there?

I have an idea to implement a deep zoom type interface hosted in a browser for sports training data (speed, distance, heart rate etc.) However, rather than images I actually want to zoom into a hierarchy of information. For example, the initial display would contain a grid of years - hover over 2008, for example, and spin the mouse wheel (or click) will zoom into that year but during the zoom I want 2008 to fade out and be replaced with a calendar of months. Again zoom into a month and the months are replaced with the months calendar, zoom into a day and you finally see a chart with the training data plotted on it. All the time only dates with actual data would be highlighted in some fashion.
My question is whether this would even be possible and whether anyone has seen examples of this already. I'm imagining that most of the time the next level of information could be cached in the browser (in fact, because this is calendar-based, I can calculate most of that and cache the dates to be highlighted.) I could also zoom into an empty chart whilst an Ajax thread is fetching the data to display.
I've never tried anything like this before and I'm especially interested in whether DHTML would be capable of this sort of zoom (I suspect not and I would have to resort to Silverlight) and whether the Ajax execution would be uninterrupted whilst the browser rendering thread is kept busy zooming.
For Deep Zoom on images in JavaScript/Ajax there's the excellent Seadragon Ajax library by Microsoft Live Labs.
If you're looking into smooth and interactive zooming on content besides images such as text, video & vectors, have a look at the open source OpenZoom SDK I've developed over the last couple of months.
You probably could not achieve very smooth zooming with an javascript/ajax type interface, but a zoom interface would be possible. The pragmatic ajax book has a great chapter on implementing a Google maps clone. Theres no need for the technique to be restricted to zooming in and out of tiled images. The image elements can just as easily be any HTML you want. A fade effect could be applied to the zoom operation so when you move up and down a layer you get something similar to what you described. I recommend grabbing the book (Its a pragmatic programmers book, so theres a cheap and immediately downloadable PDF version available. Read the chapter, think about the techniques and then see if you think its practical for your vision. good luck.
Seadragon Ajax continues to evolve and is now OpenSeadragon:
http://openseadragon.github.io/
I've also been keeping a list of various zooming technologies, many of which use JavaScript:
https://github.com/iangilman/zooming
I don't believe ajax or dhtml are good solutions for what you are trying to achieve. I think flash/flex or silverlight may be the best option.
Check out the "scale" effect in jQuery. Here's a link. I haven't used it myself, but it might be able to do what you want. You'd have to swap out some content for different content at the right point, or your html would get too big.

Resources