POST
|
bumping this since I asked it over the weekend. Anybody have any input on this?
... View more
02-09-2016
01:21 PM
|
0
|
0
|
326
|
POST
|
I have an application where I need to draw many Graphics on a map, and detect clicks on them. To make this process efficient, I maintain a bi-directional mapping of graphic IDs and object IDs, so basically given a graphic ID, I can determine which of my objects is represented by that graphic. And given one of my objects, I can tell which graphic on the map is representing it. This takes some initial setup, when the Graphics are first drawn on the map. Unfortunately, you can't obtain the id of a Graphics object with something like this: Graphic myGraphic = new Graphic() graphicLayer.addGraphic(myGraphic) graphic.getId() (or graphic.getUid()) the methods to get ID and UID both return -1 at this point, which I assume has to do with the immutability of Graphics objects. So what I end up having to do is adding attributes to each graphic that contain the object Id, and then do this: int[] graphicIds = graphicLayer.getGraphicIds() for (int i = 0; i < graphicIds.length; i++){ Graphic myGraphic = graphicsLayer.getGraphic(graphicIds) int objectId = myGraphic.getAttributes().get("MY_OBJECT_ID_KEY") //create mapping of graphicId <--> objectId } The issue with this is that the graphicsLayer.getGraphic(int id) method takes a long time, usually from 0.1 - 0.15 seconds. Once we get up to only thirty icons that we need to show on the map, the user will be waiting over three seconds, where the application is completely frozen, since this must be on the UI thread. Is there a way, if you have the graphic id, to get the attributes for a graphic without getting the graphic itself? I'm thinking that might speed up this process. Is there another approach I could take on this problem?
... View more
02-06-2016
07:27 AM
|
0
|
1
|
2321
|
POST
|
That did not do the trick for me unfortunately. Both loading from drawables and loading from assets have the same amount of blurriness, at least to the naked eye. I may be wrong, and feel free to correct me if I am, but I think I may know why you saw improvements in your example. If you use drawables and the PictureMarker(Drawable) constructor (not PictureMarkerSymbol(Context, Drawable) ), it will not resize the drawable. For some reason, using Drawable.createFromStream() does resize it. It looks like to me that loading from assets, and using the PictureMarkerSymbol(Context, Drawable) constructor accomplishes the same thing For anyone who comes across this later, my biggest issue was using `LayerDrawable`. To solve this problem, I just put multiple graphics on the screen to imitate one drawable with many layers
... View more
01-13-2016
09:22 AM
|
1
|
0
|
841
|
POST
|
That looks promising, I'll try it out and report back. Thanks!
... View more
01-13-2016
08:06 AM
|
0
|
0
|
841
|
POST
|
After more testing, I'm 99% certain it's the fact that I was using a LayerDrawable. For some reason, PictureMarkerSymbol doesn't scale these correctly. For testing, it should produce this effect for any LayerDrawable (or xml drawable <layer-list>)
... View more
01-13-2016
07:22 AM
|
0
|
4
|
841
|
POST
|
I've been working on a map that places PictureMarkerSymbols with custom drawables, and I've noticed that the PictureMarkerSymbols are blurry when displayed on the map. I've tried the following: drawables in drawable-mdpi, drawable-hdpi, drawable-xhdpi, etc. and the PictureMarkerSymbol(Context, Drawable) constructor. Images are not sharp at all (though appropriately sized) drawables in drawable-mdpi, drawable-hdpi, drawable-xhdpi, etc. and the PictureMarkerSymbol(Drawable) constructor. Images are somewhat sharp and way too big drawables in drawable-nodpi and PictureMarkerSymbol(Drawable) constructor. I just used the smallest Drawable I had, which was the mdpi one. Drawables were appropriately sized but still blurry drawable in the drawable (no qualifiers) folder and the PictureMarkerSymbol(Drawable) constructor. Huge and blurry The my location (blue dot) icon is very crisp. How do you achieve this. Note: after more testing, I've noticed the blurriness is more pronounced with a LayerDrawable. Could this be the source of my issue?
... View more
01-12-2016
03:14 PM
|
0
|
7
|
3773
|
Title | Kudos | Posted |
---|---|---|
1 | 01-13-2016 09:22 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|