JMap symbology refreshing

1640
3
Jump to solution
01-15-2014 07:29 AM
CarlosColón-Maldonado
Occasional Contributor III
Greetings,

I'm getting feedback from users that military symbols posted to the map are not "posting to", or appearing on,  the map while it is minimized and then it is restored, after posting, to viewable window size, until a panning/zooming action occurs which causes the map to refresh. This does not occur while in viewable window size.

I'm guessing that there must be an internal mechanism for making the map refresh on window actions, without having to rely on extent manipulation, but I'm not seeing it on the API. Help?

Thanks in advanced.
0 Kudos
1 Solution

Accepted Solutions
MarkBaird
Esri Regular Contributor
Carlos,

I've been trying to reproduce this, but I've had no luck.  I've tried against the 10.2 release and also on the development code.

Now I can't replicate your enviroment exactly, but this is what I've done:

1. Set up a MessageGroupLayer on a map
2. Set up a Swing timer which after an initial 10 seconds starts adding random items to the map

I've tried running it with the application minimised and maximised and I can always see all of the points without needing to ask for a refesh by panning the map.

It's very important to note that I'm trying this with a Swing timer as I know my ProcessMessage will be called on the Event Dispatch Thread.  I'm sure you realise this though 😉

This is my code:

   
 public void swingTimer() {         Timer tm = new Timer(1000, new ActionListener() {       @Override    public void actionPerformed(ActionEvent arg0) {          System.out.println("Tick!");          Random rnd = new Random();          //point          Double xPos = (double) rnd.nextInt(10000000);     Double yPos = (double) rnd.nextInt(10000000);          Point pt = new Point(xPos, yPos);     SimpleMarkerSymbol sms = new SimpleMarkerSymbol(Color.red, 10, Style.CIRCLE);     Graphic gr = new Graphic(pt, sms);     gl.addGraphic(gr);          //mil symbol        Message message = new Message();           UUID uuid1 = UUID.randomUUID();           message.setID(uuid1.toString());           message.setProperty("_Type", "position_report");           message.setProperty("_Action", "update");           message.setProperty("_Control_Points", xPos + ","+ yPos);           //message.setProperty("sic", "SFGPUCRRL--E---");             message.setProperty("sic", "GHSPPT--------X");           message.setProperty("_WKID", "3857");           message.setProperty("UniqueDesignation", "Mad dog");                      mgl.getMessageProcessor().processMessage(message);    }   });                  tm.setInitialDelay(10000);         tm.start();     }


Can you post some code which reproduces your issue?

View solution in original post

0 Kudos
3 Replies
CarlosColón-Maldonado
Occasional Contributor III
military symbols posted to the map are not "posting to", or appearing on,  the map while it is minimized and then it is restored, after posting, to viewable window size, until a panning/zooming action occurs which causes the map to refresh. This does not occur while in viewable window size.


To clarify this long statement::confused:

1. Symbols are being created on receipt of network traffic data that is transformed into Message objects.

2. The MessageGroupLayer  process them via its MessageProcessor as evident in seeing them plotted.

3. This process works fine while the JMap's main window, which contains the group layer is in visible state (maximized or restored, not minimized).

4. In minimized state, the process continues successfully as evident via logging entries.

5. On restored or maximized from being minimized, it is noticed that the symbols that were processed during the time the window was minimized do not appear plotted.

6. A panning or zooming action on the map causes the symbols it had plotted as well as the ones that were not to appear.

My guess is that the action causes the group layer to refresh and repaint its containing symbols. I'm posting the question to determine what is best practice to avoid excessively, unnecessary work on the map to force redrawing of its layers on external window actions.
0 Kudos
MarkBaird
Esri Regular Contributor
Carlos,

I've been trying to reproduce this, but I've had no luck.  I've tried against the 10.2 release and also on the development code.

Now I can't replicate your enviroment exactly, but this is what I've done:

1. Set up a MessageGroupLayer on a map
2. Set up a Swing timer which after an initial 10 seconds starts adding random items to the map

I've tried running it with the application minimised and maximised and I can always see all of the points without needing to ask for a refesh by panning the map.

It's very important to note that I'm trying this with a Swing timer as I know my ProcessMessage will be called on the Event Dispatch Thread.  I'm sure you realise this though 😉

This is my code:

   
 public void swingTimer() {         Timer tm = new Timer(1000, new ActionListener() {       @Override    public void actionPerformed(ActionEvent arg0) {          System.out.println("Tick!");          Random rnd = new Random();          //point          Double xPos = (double) rnd.nextInt(10000000);     Double yPos = (double) rnd.nextInt(10000000);          Point pt = new Point(xPos, yPos);     SimpleMarkerSymbol sms = new SimpleMarkerSymbol(Color.red, 10, Style.CIRCLE);     Graphic gr = new Graphic(pt, sms);     gl.addGraphic(gr);          //mil symbol        Message message = new Message();           UUID uuid1 = UUID.randomUUID();           message.setID(uuid1.toString());           message.setProperty("_Type", "position_report");           message.setProperty("_Action", "update");           message.setProperty("_Control_Points", xPos + ","+ yPos);           //message.setProperty("sic", "SFGPUCRRL--E---");             message.setProperty("sic", "GHSPPT--------X");           message.setProperty("_WKID", "3857");           message.setProperty("UniqueDesignation", "Mad dog");                      mgl.getMessageProcessor().processMessage(message);    }   });                  tm.setInitialDelay(10000);         tm.start();     }


Can you post some code which reproduces your issue?
0 Kudos
CarlosColón-Maldonado
Occasional Contributor III
Can you post some code which reproduces your issue?


Mark, it turns out that there was an issue on our code that invoked swing calls later than caused it. After some refactoring, the problem no longer existed. I discerned that it must have been us after noticing on this forum that some users were actually creating map views and printing them without displaying.

Thanks.
0 Kudos