- protected void addFeatureSource(String path,
- FeatureSource<SimpleFeatureType, SimpleFeature> featureSource) {
- // TODO: deal with style and rasters
- mapPane.getMapContext().addLayer(featureSource, null);
- mapPane.reset();
+ protected void addFeatureSource(String layerId,
+ FeatureSource<SimpleFeatureType, SimpleFeature> featureSource,
+ Object style) {
+ if (style == null)
+ style = StylingUtils.createLineStyle("BLACK", 1);
+
+ MapLayer mapLayer = new DefaultMapLayer(featureSource, (Style) style);
+ addMapLayer(layerId, mapLayer);
+ }
+
+ protected void addMapLayer(String layerId, MapLayer mapLayer) {
+ mapLayers.put(layerId, mapLayer);
+ mapPane.getMapContext().addLayer(mapLayer);
+ }
+
+ public void addLayer(String layerId, Collection<?> collection, Object style) {
+ if (style == null)
+ style = StylingUtils.createLineStyle("BLACK", 1);
+ MapLayer mapLayer = new DefaultMapLayer(collection, (Style) style);
+ addMapLayer(layerId, mapLayer);
+ }
+
+ public void setStyle(String layerId, Object style) {
+ mapLayers.get(layerId).setStyle((Style) style);
+ }
+
+ public void setAreaOfInterest(ReferencedEnvelope areaOfInterest) {
+ // mapPane.getMapContext().setAreaOfInterest(areaOfInterest);
+ mapPane.setDisplayArea(areaOfInterest);