Hi,
i have a StyledMapPane where i load ShapeFiles, when i insert a vehicle on the MAP:
...
   Feature feature1 = pointType.create( new Object[]{point1} );

   FeatureCollection fc = FeatureCollections.newCollection();
   fc.add( feature1 );

   StyleFactory sf = StyleFactory.createStyleFactory();
 
   ExternalGraphic icon = sb.createExternalGraphic( url ), "image/gif" );
   
   Graphic graph = sb.createGraphic( icon, null, null, 1, 20, 90 );
   PointSymbolizer ps = sb.createPointSymbolizer( graph );
   Rule r = sf.createRule();
   r.setSymbolizers( new Symbolizer[]{ps} );
   Style s = sf.createStyle();
   s.addFeatureTypeStyle( sf.createFeatureTypeStyle( new Rule[]{r} ) );
 
   DefaultMapLayer myLayer = new DefaultMapLayer( fc, s, name );
 
   myMapContext.add( myLayer );
 
...
things go ok, when i "zoom IN", the vehicle "desapear" .. when i hit the left, right , up or down keys, to scroll the map, it appears again..
 
the zoom out works fine.
 
CODE:
protected void setZoomIn( java.awt.geom.Point2D pnt )
 {
  Rectangle2D vizArea = mapPane.getVisibleArea();
  double width = vizArea.getWidth() / ZoomFactor;
  double height = vizArea.getHeight() / ZoomFactor;
  double x = pnt.getX() - ( 0.5 * width );
  double y = pnt.getY() - ( 0.5 * height );
  Rectangle2D newArea = new Rectangle2D.Double( x, y, width, height );
  mapPane.setVisibleArea( newArea );
 
 }
 
protected void setZoomOut( java.awt.geom.Point2D pnt )
 {
  Rectangle2D vizArea = mapPane.getVisibleArea();
  double width = vizArea.getWidth() * ZoomOutFactor;
  double height = vizArea.getHeight() * ZoomOutFactor;
  double x = pnt.getX() - ( 0.5 * width );
  double y = pnt.getY() - ( 0.5 * height );
  Rectangle2D newArea = new Rectangle2D.Double( x, y, width, height );
  mapPane.setVisibleArea( newArea );
 }
 
 
 
 
And, when i insert another vehicle, the existing ones desapear too.
 
Does anyone knows how to fix it?
 
THX, Frederico.
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to