After adding a new layer it doesn't show inside JMapPane, is there a way to force this? I already tried using MapLayerEvent
styleSld = Stil.createFromSLD(inputStream);
layer = new FeatureLayer(pointCollection, styleSld);
layer.setTitle("G_POINT");
getMapPane().getMapContent().addLayer(layer);
MapLayerEvent mple = new MapLayerEvent(layer, MapLayerEvent.DATA_CHANGED);
MapLayerListEvent mplle = new MapLayerListEvent(getMapPane().getMapContent(), layer,
getMapPane().getMapContent().layers().indexOf(layer), mple);
getMapPane().layerChanged(mplle);
The same code is used for refreshing content when drawing new feature and it works normaly.
I also tried running new ResetAction and nothing happens. If I interacted with a map by (zoom change or by clicking ResetButton or Drag) it will render the layer.
EDIT
The problem is caused by,
getMapPane().getMapContent().getViewport().setBounds(new ReferencedEnvelope(-100, 100, -100, 100,
getMapPane().getMapContent().getCoordinateReferenceSystem()));
after I remove this it works nicely, but then need to go through the code and manually create bounds if a return is null, but it will be much easier with this part in the code.