- map.addLayer(FileDataStoreFinder.getDataStore(
- new File(dir, "highways-EastBalkan-OSM.shp"))
- .getFeatureSource(), null);
-
+ mapContext.addLayer(FileDataStoreFinder.getDataStore(
+ new File(dir, "highways-EastBalkan-OSM.shp"))
+ .getFeatureSource(), null);
+
+ MapLayer mapLayer = null;
+ while (true) {
+ SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(
+ POSITION);
+
+ // add the attributes
+ featureBuilder.add(positionProvider.currentPosition());
+ featureBuilder.add(12);
+ featureBuilder.add("My Name");
+
+ // build the feature
+ SimpleFeature feature = featureBuilder.buildFeature("Flag.12");
+ FeatureCollection<SimpleFeatureType, SimpleFeature> collection = new DefaultFeatureCollection(
+ "testCollection", POSITION);
+ collection.add(feature);
+ if (mapLayer != null)
+ mapContext.removeLayer(mapLayer);
+ Style style = SLD.createSimpleStyle(POSITION, Color.RED);
+ mapLayer = new DefaultMapLayer(collection, style, "");
+ mapContext.addLayer(mapLayer);
+ // mapContext.addLayer(collection,null);
+
+ Thread.sleep(1000);
+ }