protected RuleImpl( org.geotools.styling.Symbolizer[] symbolizers, org.opengis.style.Description desc, org.geotools.styling.Graphic[] legends, String name, Filter filter, boolean isElseFilter, double maxScale, double minScale) { setSymbolizers(symbolizers); description.setAbstract(desc.getAbstract()); description.setTitle(desc.getTitle()); setLegendGraphic(legends); this.name = name; this.filter = filter; hasElseFilter = isElseFilter; this.maxScaleDenominator = maxScale; this.minScaleDenominator = minScale; }
/** Copy constructor */ public RuleImpl(Rule rule) { this.symbolizers = new ArrayList<Symbolizer>(); for (org.opengis.style.Symbolizer sym : rule.symbolizers()) { if (sym instanceof Symbolizer) { this.symbolizers.add((Symbolizer) sym); } } if (rule.getDescription() != null && rule.getDescription().getTitle() != null) { this.description.setTitle(rule.getDescription().getTitle()); } if (rule.getDescription() != null && rule.getDescription().getAbstract() != null) { this.description.setTitle(rule.getDescription().getAbstract()); } if (rule.getLegend() instanceof org.geotools.styling.Graphic) { org.geotools.styling.Graphic graphic = (org.geotools.styling.Graphic) rule.getLegend(); setLegendGraphic(new org.geotools.styling.Graphic[] {graphic}); } this.name = rule.getName(); this.filter = rule.getFilter(); this.hasElseFilter = rule.isElseFilter(); this.maxScaleDenominator = rule.getMaxScaleDenominator(); this.minScaleDenominator = rule.getMinScaleDenominator(); }
protected RuleImpl(org.geotools.styling.Symbolizer[] symbolizers, org.opengis.style.Description desc, org.geotools.styling.Graphic[] legends, String name, Filter filter, boolean isElseFilter, double maxScale, double minScale){ setSymbolizers(symbolizers); description.setAbstract(desc.getAbstract()); description.setTitle(desc.getTitle()); setLegendGraphic(legends); this.name = name; this.filter = filter; hasElseFilter = isElseFilter; this.maxScaleDenominator = maxScale; this.minScaleDenominator = minScale; }
/** * Creates a deep copy clone of the rule. * * @see org.geotools.styling.Rule#clone() */ public Object clone() { try { RuleImpl clone = (RuleImpl) super.clone(); clone.graphics = new GTList(clone, "graphics"); clone.symbolizers = new GTList(clone, "symbolizers"); clone.filter = filter; // TODO: we must duplicate! Graphic[] legends = new Graphic[graphics.size()]; for (int i = 0; i < legends.length; i++) { Graphic legend = (Graphic) graphics.get(i); legends[i] = (Graphic) ((Cloneable) legend).clone(); } clone.setLegendGraphic(legends); Symbolizer[] symbArray = new Symbolizer[symbolizers.size()]; for (int i = 0; i < symbArray.length; i++) { Symbolizer symb = (Symbolizer) symbolizers.get(i); symbArray[i] = (Symbolizer) ((Cloneable) symb).clone(); } clone.setSymbolizers(symbArray); return clone; } catch (CloneNotSupportedException e) { throw new RuntimeException("This will never happen", e); } }
/** Copy constructor */ public RuleImpl(Rule rule) { this.symbolizers = new ArrayList<Symbolizer>(); for( org.opengis.style.Symbolizer sym : rule.symbolizers() ){ if( sym instanceof Symbolizer ){ this.symbolizers.add( (Symbolizer) sym ); } } if( rule.getDescription() != null && rule.getDescription().getTitle() != null ){ this.description.setTitle( rule.getDescription().getTitle() ); } if( rule.getDescription() != null && rule.getDescription().getAbstract() != null ){ this.description.setTitle( rule.getDescription().getAbstract() ); } if( rule.getLegend() instanceof org.geotools.styling.Graphic ){ org.geotools.styling.Graphic graphic = (org.geotools.styling.Graphic) rule.getLegend(); setLegendGraphic( new org.geotools.styling.Graphic[]{ graphic } ); } this.name = rule.getName(); this.filter = rule.getFilter(); this.hasElseFilter = rule.isElseFilter(); this.maxScaleDenominator = rule.getMaxScaleDenominator(); this.minScaleDenominator = rule.getMinScaleDenominator(); }