use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.
the class GTtoSE110Transformer method visit.
/**
* Transform a GT FTS in Jaxb FeatureTypeStyle or CoveragaStyle or
* OnlineResource.
*/
@Override
public Object visit(final FeatureTypeStyle fts, final Object data) {
if (fts.getOnlineResource() != null) {
// we store only the online resource
return visit(fts.getOnlineResource(), null);
} else {
// try to figure out if we have here a coverage FTS or not
boolean isCoverage = false;
if (fts.semanticTypeIdentifiers().contains(SemanticType.RASTER)) {
isCoverage = true;
} else if (fts.semanticTypeIdentifiers().contains(SemanticType.ANY) || fts.semanticTypeIdentifiers().isEmpty()) {
if (fts.getFeatureInstanceIDs() == null) {
// try to find a coverage style
ruleLoop: for (final Rule r : fts.rules()) {
for (final Symbolizer s : r.symbolizers()) {
if (s instanceof RasterSymbolizer) {
isCoverage = true;
break ruleLoop;
}
}
}
} else {
isCoverage = false;
}
} else {
isCoverage = false;
}
final Object obj;
// create the sld FTS
if (isCoverage) {
// coverage type
final CoverageStyleType cst = se_factory.createCoverageStyleType();
if (!fts.featureTypeNames().isEmpty()) {
cst.setCoverageName(fts.featureTypeNames().iterator().next().toString());
}
cst.setDescription(visit(fts.getDescription(), null));
cst.setName(fts.getName());
for (final SemanticType semantic : fts.semanticTypeIdentifiers()) {
if (SemanticType.ANY.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_ANY);
} else if (SemanticType.POINT.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_POINT);
} else if (SemanticType.LINE.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_LINE);
} else if (SemanticType.POLYGON.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_POLYGON);
} else if (SemanticType.TEXT.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_TEXT);
} else if (SemanticType.RASTER.equals(semantic)) {
cst.getSemanticTypeIdentifier().add(GENERIC_RASTER);
} else {
cst.getSemanticTypeIdentifier().add(semantic.identifier());
}
}
for (final Rule rule : fts.rules()) {
cst.getRuleOrOnlineResource().add(visit(rule, null));
}
obj = cst;
} else {
// feature type
final FeatureTypeStyleType ftst = se_factory.createFeatureTypeStyleType();
if (!fts.featureTypeNames().isEmpty()) {
final GenericName name = fts.featureTypeNames().iterator().next();
final String pre = name.scope().isGlobal() ? null : name.scope().name().toString();
final String local = name.toString();
ftst.setFeatureTypeName(new QName(pre + ':', local));
}
ftst.setDescription(visit(fts.getDescription(), null));
ftst.setName(fts.getName());
for (final SemanticType semantic : fts.semanticTypeIdentifiers()) {
if (SemanticType.ANY.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_ANY);
} else if (SemanticType.POINT.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_POINT);
} else if (SemanticType.LINE.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_LINE);
} else if (SemanticType.POLYGON.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_POLYGON);
} else if (SemanticType.TEXT.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_TEXT);
} else if (SemanticType.RASTER.equals(semantic)) {
ftst.getSemanticTypeIdentifier().add(GENERIC_RASTER);
} else {
ftst.getSemanticTypeIdentifier().add(semantic.identifier());
}
}
for (final Rule rule : fts.rules()) {
ftst.getRuleOrOnlineResource().add(visit(rule, null));
}
obj = ftst;
}
return obj;
}
}
use of org.opengis.style.RasterSymbolizer in project geotoolkit by Geomatys.
the class Styles method defaultRaster.
// ////////////////////////////////////////////////////////////////////
// RASTER SYMBOLIZER /////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////
public static MutableStyle defaultRaster() {
final RasterSymbolizer symbol = DEFAULT_RASTER_SYMBOLIZER;
final MutableStyle style = SF.style(symbol);
return style;
}
Aggregations