/** * Returns the feature type style in the style which matched a particular name. * * @param style the Style object * @param type the feature type (must be non-null) * @return The FeatureTypeStyle object if it exists, otherwise false. */ public static FeatureTypeStyle featureTypeStyle(Style style, SimpleFeatureType type) { if (style == null) { return null; } if ((type == null) || (type.getTypeName() == null)) { return null; } for (FeatureTypeStyle fts : style.featureTypeStyles()) { if (type.getTypeName().equalsIgnoreCase(fts.getName())) { return fts; } } return null; }
/** * Retrieve the first FeatureTypeStyle defined in the given StyledLayerDescriptor object that * matches the specified feature type * * @param sld a StyledLayerDescriptor object * @param type the feature type to match * @return a FeatureTypeStyle or null if there was no match */ public static FeatureTypeStyle featureTypeStyle( StyledLayerDescriptor sld, SimpleFeatureType type) { // alternatively, we could use a StyleVisitor here Style[] styles = styles(sld); for (int i = 0; i < styles.length; i++) { for (FeatureTypeStyle fts : styles[i].featureTypeStyles()) { if (type.getTypeName().equalsIgnoreCase(fts.getName())) { return fts; } } } return null; }
public FeatureTypeStyleBuilder reset(FeatureTypeStyle fts) { if (fts == null) { return unset(); } this.name = fts.getName(); this.description.reset(fts.getDescription()); this.definedFor.reset(fts.getFeatureInstanceIDs()); this.featureTypeNames.clear(); if (fts.featureTypeNames() != null) { this.featureTypeNames.addAll(fts.featureTypeNames()); } this.rules.clear(); if (fts.rules() != null) { for (Rule rule : fts.rules()) { this.rules.add(new RuleBuilder(this).reset(rule)); } } this.options.clear(); this.options.putAll(fts.getOptions()); this.transformation = fts.getTransformation(); this.unset = false; return this; }
public void visit(FeatureTypeStyle fts) { start("FeatureTypeStyle"); if ((fts.getName() != null) && (fts.getName().length() > 0)) { element("Name", fts.getName()); } if (fts.getDescription() != null && fts.getDescription().getTitle() != null) element("Title", fts.getDescription().getTitle()); if (fts.getDescription() != null && fts.getDescription().getAbstract() != null) element("Abstract", fts.getDescription().getAbstract()); if ((fts.featureTypeNames() != null) && (fts.featureTypeNames().size() > 0)) { element("FeatureTypeName", fts.featureTypeNames().iterator().next().toString()); } if (fts.getTransformation() != null) { element("Transformation", fts.getTransformation()); } String[] sti = fts.getSemanticTypeIdentifiers(); if (sti.length != 1 || !sti[0].equals(SemanticType.ANY.toString())) { for (int i = 0; i < sti.length; i++) { element("SemanticTypeIdentifier", sti[i]); } } Rule[] rules = fts.getRules(); for (int i = 0; i < rules.length; i++) { rules[i].accept(this); } encodeVendorOptions(fts.getOptions()); end("FeatureTypeStyle"); }
@Override protected void encode(FeatureTypeStyle featureStyle) { put("name", featureStyle.getName()); put("title", featureStyle.getTitle()); put("abstract", featureStyle.getAbstract()); if (featureStyle.getTransformation() != null) { push("transform").inline(new TransformEncoder(featureStyle.getTransformation())); pop(); } put("rules", new RuleEncoder(featureStyle)); vendorOptions(featureStyle.getOptions()); } }
public static FeatureTypeStyle featureTypeStyle(StyledLayerDescriptor sld, FeatureType type) { //alternatively, we could use a StyleVisitor here Style[] styles = styles(sld); for (int i = 0; i < styles.length; i++) { FeatureTypeStyle[] fts = styles[i].getFeatureTypeStyles(); for (int j = 0; j < fts.length; j++) { if (type.getTypeName().equals(fts[j].getName())) { return fts[j]; } } } return null; }
/** * Retrieve the first FeatureTypeStyle defined in the given StyledLayerDescriptor * object that matches the specified feature type * * @param sld a StyledLayerDescriptor object * @param type the feature type to match * @return a FeatureTypeStyle or null if there was no match */ public static FeatureTypeStyle featureTypeStyle(StyledLayerDescriptor sld, SimpleFeatureType type) { //alternatively, we could use a StyleVisitor here Style[] styles = styles(sld); for (int i = 0; i < styles.length; i++) { for (FeatureTypeStyle fts : styles[i].featureTypeStyles()) { if (type.getTypeName().equalsIgnoreCase(fts.getName())) { return fts; } } } return null; }
/** * Returns the feature type style in the style which matched a particular * name. * * @param style the Style object * @param type the feature type (must be non-null) * * @return The FeatureTypeStyle object if it exists, otherwise false. */ public static FeatureTypeStyle featureTypeStyle(Style style, SimpleFeatureType type) { if (style == null) { return null; } if ((type == null) || (type.getTypeName() == null)) { return null; } for (FeatureTypeStyle fts : style.featureTypeStyles()) { if (type.getTypeName().equalsIgnoreCase(fts.getName())) { return fts; } } return null; }
/** * Populate standard data. * * @param featureTypeStyle the feature type style */ protected void populateStandardData(FeatureTypeStyle featureTypeStyle) { StandardData standardData = new StandardData(); if (featureTypeStyle != null) { standardData.name = featureTypeStyle.getName(); standardData.description = featureTypeStyle.getDescription(); } populateStandardData(standardData); }
/** * Returns the feature type style in the style which matched a particular * name. * * @param style The style in question. * @param type The feature type must be non-null. * * @return Teh FeatureTypeStyle object if it exists, otherwise false. */ public static FeatureTypeStyle featureTypeStyle(Style style, FeatureType type) { if (style == null) { return null; } if ((type == null) || (type.getTypeName() == null)) { return null; } FeatureTypeStyle[] styles = style.getFeatureTypeStyles(); if (styles == null) { return null; } for (int i = 0; i < styles.length; i++) { FeatureTypeStyle ftStyle = styles[i]; if (type.getTypeName().equals(ftStyle.getName())) { return ftStyle; } } return null; }
/** * Sets the feature type style. * * @param fts the new feature type style */ public void setFeatureTypeStyle(FeatureTypeStyle fts) { symbolData.resetData(); this.symbolData.setFeatureTypeStyle(fts); updateInternalData(SelectedSymbolMask.SymbolMaskEnum.E_FEATURE_TYPE_STYLE); if (this.symbolData.getFeatureTypeStyle() == null) { logger.debug("FeatureTypeStyle cleared"); } else { logger.debug( String.format( "Selected feature type style : %s (FTS %d)", this.symbolData.getFeatureTypeStyle().getName(), this.symbolData.getSelectedFTSIndex())); } }
public void visit(FeatureTypeStyle fts) { start("FeatureTypeStyle"); if ((fts.getName() != null) && (fts.getName().length() > 0)) { element("Name", fts.getName()); } if ((fts.getTitle() != null) && (fts.getTitle().length() > 0)) { element("Title", fts.getTitle()); } if ((fts.getAbstract() != null) && (fts.getAbstract().length() > 0)) { element("Abstract", fts.getAbstract()); } if ((fts.getFeatureTypeName() != null) && (fts.getFeatureTypeName().length() > 0)) { element("FeatureTypeName", fts.getFeatureTypeName()); } String[] sti = fts.getSemanticTypeIdentifiers(); for (int i = 0; i < sti.length; i++) { element("SemanticTypeIdentifier", sti[i]); } Rule[] rules = fts.getRules(); for (int i = 0; i < rules.length; i++) { rules[i].accept(this); } end("FeatureTypeStyle"); }
public void visit(FeatureTypeStyle fts) { FeatureTypeStyle copy = null; Rule[] rules = fts.getRules(); int length=rules.length; Rule[] rulesCopy = new Rule[length]; for (int i = 0; i < length; i++) { if (rules[i] != null) { rules[i].accept(this); rulesCopy[i] = (Rule) pages.pop(); } } copy = sf.createFeatureTypeStyle(); copy.setName(fts.getName()); copy.setTitle(fts.getTitle()); copy.setAbstract(fts.getAbstract()); copy.setFeatureTypeName(fts.getFeatureTypeName()); copy.setRules(rulesCopy); copy.setSemanticTypeIdentifiers((String[]) fts.getSemanticTypeIdentifiers().clone()); pages.push(copy); }
new MBFormatException( "Generated feature type style " + fts.getName() + " is empty."));
public void visit(FeatureTypeStyle fts) { FeatureTypeStyle copy = null; Rule[] rules = fts.getRules(); int length=rules.length; Rule[] rulesCopy = new Rule[length]; for (int i = 0; i < length; i++) { if (rules[i] != null) { rules[i].accept(this); rulesCopy[i] = (Rule) getPages().pop(); } } copy = sf.createFeatureTypeStyle(); copy.setName(fts.getName()); copy.setTitle(fts.getTitle()); copy.setAbstract(fts.getAbstract()); copy.setFeatureTypeName(fts.getFeatureTypeName()); copy.setRules(rulesCopy); copy.setSemanticTypeIdentifiers((String[]) fts.getSemanticTypeIdentifiers().clone()); getPages().push(copy); }
fontSLDData.setFeatureTypeStyle(fts.getName()); fontSLDData.setStyle(style.getName()); fontSLDData.setRule(rule);
@Override protected void encode(FeatureTypeStyle featureStyle) { put("name", featureStyle.getName()); put("title", featureStyle.getTitle()); put("abstract", featureStyle.getAbstract()); if (featureStyle.getTransformation() != null) { push("transform").inline(new TransformEncoder(featureStyle.getTransformation())); pop(); } put("rules", new RuleEncoder(featureStyle)); vendorOptions(featureStyle.getOptions()); } }
scaleSLDData.setFeatureTypeStyle(fts.getName()); scaleSLDData.setStyle(style.getName()); scaleSLDData.setRule(rule);