/** * Static convenience method: displays a {@code JSimpleStyleDialog} to prompt the user for style * preferences to use with the given {@code StyleLayer}. The layer's existing style, if any, * will be used to initialize the dialog. * * @param parent parent component (may be null) * @param layer the map layer * @return a new Style instance or null if the user cancels the dialog */ public static Style showDialog(Component parent, StyleLayer layer) { /* * Grid coverages and readers are not supported yet... */ if (layer instanceof RasterLayer) { JOptionPane.showMessageDialog( null, "Sorry, styling for for grid coverages is not working yet", "Style dialog", JOptionPane.WARNING_MESSAGE); return null; } SimpleFeatureType type = (SimpleFeatureType) layer.getFeatureSource().getSchema(); return showDialog(parent, type, layer.getStyle()); }
/** * Sets the style for this layer. If a style has not been defined a default one is used. * * @param style The new style */ public void setStyle(Style style) { if (style == null) { throw new NullPointerException("Style required"); } else if (internal instanceof StyleLayer) { StyleLayer layer = (StyleLayer) internal; layer.setStyle(style); } // else if (internal instanceof GridCoverageLayer) { // GridCoverageLayer layer = (GridCoverageLayer) internal; // layer.setStyle(style); // } // else if (internal instanceof GridReaderLayer) { // GridReaderLayer layer = (GridReaderLayer) internal; // layer.setStyle(style); // } else { throw new IllegalStateException("Style not supported by " + internal); } }
@Override public void dispose() { // We assume that preDispose() has been called by the // by the sub-class if (source != null) { getUserData().remove("source"); source = null; } super.dispose(); }
public StyleLayer(Style style, String title) { this.style = style; setTitle(title); }
/** * Sets the style for this layer. * * @param style The new style */ public void setStyle(Style style) { if (style == null) { throw new NullPointerException("Style is required"); } this.style = style; fireMapLayerListenerLayerChanged(MapLayerEvent.STYLE_CHANGED); } }
public StyleLayer(Style style, String title) { this.style = style; setTitle(title); }
/** * Sets the style for this layer. * * @param style * The new style */ public void setStyle(Style style) { if (style == null) { throw new NullPointerException("Style is required"); } this.style = style; fireMapLayerListenerLayerChanged(MapLayerEvent.STYLE_CHANGED); }
/** * Show a style dialog to create a new Style for the layer * * @param layer the layer to be styled */ private void doSetStyle(Layer layer) { if (layer instanceof StyleLayer) { StyleLayer styleLayer = (StyleLayer) layer; Style style = JSimpleStyleDialog.showDialog(this, styleLayer); if (style != null) { styleLayer.setStyle(style); } } }
/** * Static convenience method: displays a {@code JSimpleStyleDialog} to prompt * the user for style preferences to use with the given {@code StyleLayer}. The * layer's existing style, if any, will be used to initialize the dialog. * * @param parent parent component (may be null) * @param layer the map layer * * @return a new Style instance or null if the user cancels the dialog */ public static Style showDialog(Component parent, StyleLayer layer) { /* * Grid coverages and readers are not supported yet... */ if (layer instanceof RasterLayer) { JOptionPane.showMessageDialog(null, "Sorry, styling for for grid coverages is not working yet", "Style dialog", JOptionPane.WARNING_MESSAGE); return null; } SimpleFeatureType type = (SimpleFeatureType) layer.getFeatureSource().getSchema(); return showDialog(parent, type, layer.getStyle()); }
@Override public void dispose() { preDispose(); if (featureSource != null) { if (sourceListener != null) { featureSource.removeFeatureListener(sourceListener); } featureSource = null; } style = null; query = null; super.dispose(); }
/** * Sets the style for this layer. If a style has not been defined a default one is used. * * @param style * The new style */ public void setStyle(Style style){ if (style == null) { throw new NullPointerException("Style required"); } else if (internal instanceof StyleLayer) { StyleLayer layer = (StyleLayer) internal; layer.setStyle(style); } // else if (internal instanceof GridCoverageLayer) { // GridCoverageLayer layer = (GridCoverageLayer) internal; // layer.setStyle(style); // } // else if (internal instanceof GridReaderLayer) { // GridReaderLayer layer = (GridReaderLayer) internal; // layer.setStyle(style); // } else { throw new IllegalStateException("Style not supported by "+internal); } }
@Override public void dispose() { // We assume that preDispose() has been called by the // by the sub-class if( source != null ){ getUserData().remove("source"); source = null; } super.dispose(); }
/** * Show a style dialog to create a new Style for the layer * * @param layer the layer to be styled */ private void doSetStyle(Layer layer) { if (layer instanceof StyleLayer) { StyleLayer styleLayer = (StyleLayer) layer; Style style = JSimpleStyleDialog.showDialog(this, styleLayer); if (style != null) { styleLayer.setStyle(style); } } }
@Override public void dispose() { preDispose(); if (featureSource != null) { if (sourceListener != null) { featureSource.removeFeatureListener(sourceListener); } featureSource = null; } style = null; query = null; super.dispose(); }