Hi again,

I stumbled again upon an issue with my small test program. The program does 
nothing but create repeatedly a collection of points, clear all existing 
MapLayers, and add a new layer consisting of the collection.
However, the programm hangs after about 265 iterations. I assume on your 
machine this number might vary. I am using geotools 15-RC1.

Here is the small program:

public class JMapPaneTest extends JFrame {
 
 public JMapPane mp;
 
 public JMapPaneTest() {
  mp = new JMapPane();  
  mp.setMapContent(new MapContent());
  add(mp);
  setSize(400,400);
  setVisible(true);
 }
 
 public void updateMP() {
  GeometryFactory gf = new GeometryFactory();
  SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
  typeBuilder.setName("Points");
  typeBuilder.add("the_geom",Point.class);
  
  SimpleFeatureBuilder featureBuilder = new 
SimpleFeatureBuilder(typeBuilder.buildFeatureType());
  Random r = new Random();  
  DefaultFeatureCollection fc = new DefaultFeatureCollection();
  for( int i = 0; i < 1000; i++ ) {
   Point p = gf.createPoint(new Coordinate(r.nextDouble(),r.nextDouble()));
   featureBuilder.set("the_geom", p);
   fc.add( featureBuilder.buildFeature(""+fc.size()));
  }
  MapContent mc = mp.getMapContent();  
        
  for( Layer l : mc.layers() )
   mc.removeLayer(l);
  
  Symbolizer sym = new StyleBuilder().createPointSymbolizer();
  mc.addLayer(new FeatureLayer(fc, SLD.wrapSymbolizers(sym)));
  mc.setViewport( new MapViewport(fc.getBounds()));
 }
 
 public static void main(String[] args) {
  JMapPaneTest t = new JMapPaneTest();
  for( int i = 0; i < 1000; i++ ) {
   System.out.println(i);
   t.updateMP();
  }
  System.exit(1);
 }
}

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to