Select to view content in your preferred language

Arcgis java - anomaly in map - freezing or dissapearing

1577
0
04-21-2016 11:23 AM
AvivDinitz
Deactivated User

I have a freezing/disappearing JMap problem.

I'm using the Arcgis for java developers for developing GUI. My main frame is java-fx application - stage and scene. On my scene I have couple of java-fx components. One of them is a corner small window StackPane with a SwingNode on it. The SwingNode contains a panel, which contains a JMap. On JMap I have tiled map something.tpk.

The code is here:

private void createAndSetSwingContent() {
  
UtilManager.getInstance().runInEDT(() -> {
  
JPanel mapPanel = new JPanel();
  mapPanel
.setPreferredSize(new Dimension(340, 290));
  map
= MapManager.getInstance().createMap(mapPanel);
  map
.addMapEventListener(new MapEventListenerAdapter() {
  
@Override
  
public void mapReady(MapEvent event) {
  mapReady
= true;
  graphicHolder
= new GraphicalIDHolder(map);  
  
});
  mapPanel
.setVisible(true);
  setPanel
(mapSwingNode, mapPanel);
  
});
}

private JMap createMap(JPanel panel, MapType mapType) {
  
JMap map = new JMap();
  map
.getLayers().clear();

  
ArcGISLocalTiledLayer tiledLayer = new   ArcGISLocalTiledLayer("c:/PRIMUS.tpk");

  map
.getLayers().add(tiledLayer);
  map
.setExtent(new Envelope(3883000, 3777000, 3884000, 3778000));

  
GraphicsLayer graphicsLayer = new GraphicsLayer();
  map
.getLayers().add(graphicsLayer);

  
// adding fill picture above the map, below the other graphics
  
Envelope env = new Envelope(-20037508.3427892, -11070723.3593911,
  
20037508.3427892, 11070723.359391);
  
SimpleFillSymbol fill = new SimpleFillSymbol(new Color(0,20,41,90));
  
Graphic g = new Graphic(env , fill);//getFillSymbol());//fill);//
  graphicsLayer
.addGraphic(g);

  map
.setPreferredSize(panel.getPreferredSize());
  map
.setMaximumSize(panel.getMaximumSize());
  panel
.add(map);
  
return map;
}

My problem is: After some time, the map disappears and some random junk showed there. When I touch this small window, the map reappears. Sometimes it also freezes for a while.

This is really bad looking, and I need to fix it. Is this a known problem? Should I refresh/repaint my map from time to time? If so, how can I do it?

Really appreciate your help,

Thanks,

Aviv.

Tags (1)
0 Kudos
0 Replies