Select to view content in your preferred language

Identify on Graphicslayer returns NULLPointException

4029
11
01-11-2013 02:35 AM
MartinRick
Deactivated User
Hi,

currently I try to implement an identify for the chemical lights layer from the vehicle commander template from esri. The chem lights get stored in a Graphicslayer, which has a method called getGraphicIDs(float x, float y, int tolerance).
Unfortunately I always get a NULL Pointer and I cannot find out the cause for this. Does anyone else have such experiences with the method?

Regards and thanks for response

Martin

Exception:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.esri.map.GraphicsLayer.getGraphicIDs(Unknown Source)
at com.esri.map.GraphicsLayer.getGraphicIDs(Unknown Source)
at com.esri.vehiclecommander.ChemLightsOverlay.checkSelection(ChemLightsOverlay.java:85)
at com.esri.vehiclecommander.ChemLightsOverlay.<init>(ChemLightsOverlay.java:52)
at com.esri.vehiclecommander.IdentifyResultsJPanel.setIdentifyPoint(IdentifyResultsJPanel.java:371)
at com.esri.vehiclecommander.VehicleCommanderJFrame.identifyComplete(VehicleCommanderJFrame.java:951)
at com.esri.vehiclecommander.MapController$4$1.removeListenerAndCheckResult(MapController.java:400)
at com.esri.vehiclecommander.MapController$4$1.onCallback(MapController.java:388)
at com.esri.vehiclecommander.MapController$4$1.onCallback(MapController.java:1)
at com.esri.core.tasks.TaskCallbackListener$1.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
0 Kudos
11 Replies
CarlosColón-Maldonado
Frequent Contributor
Thanks for confirming this. I never had a problem getting the sample code from ArcGIS Runtime SDK for Java 1.0 that uses a GraphicsLayer with a HitTestOverlay on symbols other than those created by a MessageGroupLayer. My issues came when I used it on graphic layers dynamically created by the MessageGroupLayer, where I added a HitTestOverlay to each as they were created (via layer event listener), but could not obtain graphic id's from them due to the thrown exception.

Regards,

Carlos
0 Kudos
CarlosColón-Maldonado
Frequent Contributor
I figured out how to get the getGraphicIDs method to work with a graphicslayer off a message group layer and worked fine. I made a post here about it on another thread.

I ran into a behavior that may become an issue at some point for some people (as it did me). I noticed that there is a limitation on the number of graphic ids being selected and, thus the number of Graphic objects being collected in order to obtain an associated Message object from the message processor for each.

After creating 1,000 symbols in near approximation then later zoom out in order to give the impression that they appeared on top of each other ([ATTACH=CONFIG]21078[/ATTACH]), I could only collect a maximum of 20 symbols. Furthermore, I noticed that the selected corresponding symbols were not approximate to each other([ATTACH=CONFIG]21079[/ATTACH]), while others were but unselected([ATTACH=CONFIG]21080[/ATTACH]). I've tried this using different  guessed tolerance levels but didn't seem to matter.

Is there a way to manipulate this behavior? It appears to have relevance of the current map scale, but I'm not sure how the tolerance can be dynamically modified to overcome this.

Any help will be appreciated.
0 Kudos