use of org.opengis.style.FeatureTypeStyle in project geotoolkit by Geomatys.
the class GTtoSE100Transformer method visit.
/**
* Transform a GT Style in Jaxb UserStyle
*/
@Override
public org.geotoolkit.sld.xml.v100.UserStyle visit(final Style style, final Object data) {
final org.geotoolkit.sld.xml.v100.UserStyle userStyle = sld_factory_v100.createUserStyle();
userStyle.setName(style.getName());
if (style.getDescription() != null) {
if (style.getDescription().getAbstract() != null)
userStyle.setAbstract(style.getDescription().getAbstract().toString());
if (style.getDescription().getTitle() != null)
userStyle.setTitle(style.getDescription().getTitle().toString());
}
userStyle.setIsDefault(style.isDefault());
for (final FeatureTypeStyle fts : style.featureTypeStyles()) {
userStyle.getFeatureTypeStyle().add(visit(fts, null));
}
return userStyle;
}
use of org.opengis.style.FeatureTypeStyle in project geotoolkit by Geomatys.
the class GTtoSE110Transformer method visit.
/**
* Transform a GT Style in Jaxb UserStyle
*/
@Override
public org.geotoolkit.sld.xml.v110.UserStyle visit(final Style style, final Object data) {
final org.geotoolkit.sld.xml.v110.UserStyle userStyle = sld_factory_v110.createUserStyle();
userStyle.setName(style.getName());
userStyle.setDescription(visit(style.getDescription(), null));
userStyle.setIsDefault(style.isDefault());
for (final FeatureTypeStyle fts : style.featureTypeStyles()) {
userStyle.getFeatureTypeStyleOrCoverageStyleOrOnlineResource().add(visit(fts, null));
}
return userStyle;
}
use of org.opengis.style.FeatureTypeStyle in project geotoolkit by Geomatys.
the class StyleXmlIO method readFeatureTypeStyle.
/**
* Read a SE FeatureTypeStyle source and parse it in GT FTS object.
* Source can be : File, InputSource, InputStream, Node, Reader, Source, URL,
* XMLEventReader, XMLStreamReader or OnlineResource
*/
public MutableFeatureTypeStyle readFeatureTypeStyle(final Object source, final Specification.SymbologyEncoding version) throws JAXBException, FactoryException {
ensureNonNull("source", source);
ensureNonNull("version", version);
final Object obj;
switch(version) {
case SLD_1_0_0:
obj = unmarshallV100(source);
if (obj instanceof org.geotoolkit.sld.xml.v100.FeatureTypeStyle) {
return getTransformer100().visitFTS((org.geotoolkit.sld.xml.v100.FeatureTypeStyle) obj);
} else {
throw new JAXBException("Source is not a valid OGC SLD FeatureTypeStyle v1.0.0");
}
case V_1_1_0:
obj = unmarshallV110(source);
if (obj instanceof org.geotoolkit.se.xml.v110.FeatureTypeStyleType) {
return getTransformer110().visitFTS(obj);
} else if (obj instanceof JAXBElement<?> && (((JAXBElement<?>) obj).getValue() instanceof org.geotoolkit.se.xml.v110.OnlineResourceType || ((JAXBElement<?>) obj).getValue() instanceof org.geotoolkit.se.xml.v110.FeatureTypeStyleType)) {
return getTransformer110().visitFTS(((JAXBElement<?>) obj).getValue());
} else {
throw new JAXBException("Source is not a valid OGC SE FeatureTypeStyle v1.1.0");
}
default:
throw new IllegalArgumentException("Unable to read source, specified version is not supported");
}
}
Aggregations