use of org.geotoolkit.gml.xml.v311.MultiPointType in project ddf by codice.
the class WfsFilterDelegate method createMultiPoint.
private JAXBElement<MultiPointType> createMultiPoint(Geometry geometry) {
JAXBElement<MultiPointType> jaxbElement = null;
try {
String gml = Wfs10JTStoGML200Converter.convertGeometryToGML(geometry);
MultiPointType multiPointType = (MultiPointType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(gml, Wfs10Constants.POINT);
jaxbElement = (JAXBElement<MultiPointType>) Wfs10JTStoGML200Converter.convertGeometryTypeToJAXB(multiPointType);
} catch (JAXBException jbe) {
LOGGER.debug("Unable to create MultiPointType with geometry: [{}]", geometry);
}
return jaxbElement;
}
use of org.geotoolkit.gml.xml.v311.MultiPointType in project ddf by codice.
the class Wfs20JTStoGML321Converter method createGeometryPropertyType.
private static GeometryPropertyType createGeometryPropertyType(Geometry geometry, String srsName) {
final GeometryPropertyType geometryPropertyType = GML320_OBJECT_FACTORY.createGeometryPropertyType();
if (geometry instanceof Point) {
PointType pointType = convertToPointType((Point) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertPointTypeToJAXB(pointType));
} else if (geometry instanceof LineString) {
LineStringType lineStringType = convertToLineStringType((LineString) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertLineStringTypeToJAXB(lineStringType));
} else if (geometry instanceof Polygon) {
PolygonType polygonType = convertToPolygonType((Polygon) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertPolygonTypeToJAXB(polygonType));
} else if (geometry instanceof MultiPoint) {
MultiPointType multiPointType = convertToMultiPointType((MultiPoint) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiPointTypeToJAXB(multiPointType));
} else if (geometry instanceof MultiLineString) {
MultiCurveType multiCurveType = convertToMultiLineStringType((MultiLineString) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiCurveTypeToJAXB(multiCurveType));
} else if (geometry instanceof MultiPolygon) {
MultiSurfaceType multiSurfaceType = convertToMultiSurfaceType((MultiPolygon) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiSurfaceTypeToJAXB(multiSurfaceType));
} else if (geometry instanceof GeometryCollection) {
MultiGeometryType multiGeometryType = convertToMultiGeometryType((GeometryCollection) geometry, srsName);
geometryPropertyType.setAbstractGeometry(convertMultiGeometryTypeToJAXB(multiGeometryType));
} else {
throw new IllegalArgumentException();
}
return geometryPropertyType;
}
use of org.geotoolkit.gml.xml.v311.MultiPointType in project arctic-sea by 52North.
the class GmlEncoderv321 method createPosition.
private XmlObject createPosition(Geometry geom, EncodingContext ctx) throws EncodingException {
String foiId = ctx.<String>get(XmlBeansEncodingFlags.GMLID).orElse(null);
if (geom instanceof Point) {
PointType xbPoint = PointType.Factory.newInstance(getXmlOptions());
xbPoint.setId(getGmlID(geom, foiId));
createPointFromJtsGeometry((Point) geom, xbPoint);
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
PointDocument xbPointDoc = PointDocument.Factory.newInstance(getXmlOptions());
xbPointDoc.setPoint(xbPoint);
return xbPointDoc;
} else if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance(getXmlOptions());
geometryPropertyType.setAbstractGeometry(xbPoint);
geometryPropertyType.getAbstractGeometry().substitute(GmlConstants.QN_POINT_32, PointType.type);
return geometryPropertyType;
}
return xbPoint;
} else if (geom instanceof LineString) {
LineStringType xbLineString = LineStringType.Factory.newInstance(getXmlOptions());
xbLineString.setId(getGmlID(geom, foiId));
createLineStringFromJtsGeometry((LineString) geom, xbLineString);
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
LineStringDocument xbLineStringDoc = LineStringDocument.Factory.newInstance(getXmlOptions());
xbLineStringDoc.setLineString(xbLineString);
return xbLineStringDoc;
} else if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance(getXmlOptions());
geometryPropertyType.setAbstractGeometry(xbLineString);
geometryPropertyType.getAbstractGeometry().substitute(GmlConstants.QN_LINESTRING_32, LineStringType.type);
return geometryPropertyType;
}
return xbLineString;
} else if (geom instanceof MultiLineString) {
MultiCurveType xbMultiCurve = MultiCurveType.Factory.newInstance(getXmlOptions());
xbMultiCurve.setId(getGmlID(geom, foiId));
xbMultiCurve.setSrsName(getSrsName(geom));
for (int i = 0; i < geom.getNumGeometries(); ++i) {
Geometry lineString = geom.getGeometryN(i);
LineStringType xbLineString = LineStringType.Factory.newInstance(getXmlOptions());
xbLineString.setId(getGmlID(geom, foiId));
xbLineString.addNewPosList().setStringValue(JTSHelper.getCoordinatesString(lineString));
CurvePropertyType xbCurveMember = xbMultiCurve.addNewCurveMember();
xbCurveMember.addNewAbstractCurve().set(xbLineString);
XmlHelper.substituteElement(xbCurveMember.getAbstractCurve(), xbLineString);
}
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
MultiCurveDocument xbMultiCurveDoc = MultiCurveDocument.Factory.newInstance(getXmlOptions());
xbMultiCurveDoc.setMultiCurve(xbMultiCurve);
return xbMultiCurveDoc;
} else if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
GeometryPropertyType xbGeometryProperty = GeometryPropertyType.Factory.newInstance(getXmlOptions());
xbGeometryProperty.addNewAbstractGeometry().set(xbMultiCurve);
XmlHelper.substituteElement(xbGeometryProperty.getAbstractGeometry(), xbMultiCurve);
return xbGeometryProperty;
} else {
return xbMultiCurve;
}
} else if (geom instanceof Polygon) {
PolygonType xbPolygon = PolygonType.Factory.newInstance(getXmlOptions());
xbPolygon.setId(getGmlID(geom, foiId));
createPolygonFromJtsGeometry((Polygon) geom, xbPolygon);
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
PolygonDocument xbPolygonDoc = PolygonDocument.Factory.newInstance(getXmlOptions());
xbPolygonDoc.setPolygon(xbPolygon);
return xbPolygonDoc;
} else if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance(getXmlOptions());
geometryPropertyType.setAbstractGeometry(xbPolygon);
geometryPropertyType.getAbstractGeometry().substitute(GmlConstants.QN_POLYGON_32, PolygonType.type);
return geometryPropertyType;
}
return xbPolygon;
} else if (geom instanceof MultiPoint) {
MultiPointType xbMultiPoint = MultiPointType.Factory.newInstance(getXmlOptions());
String id = getGmlID(geom, foiId);
xbMultiPoint.setId(id);
createMultiPointFromJtsGeometry((MultiPoint) geom, xbMultiPoint, id);
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
MultiPointDocument xbMultiPointDoc = MultiPointDocument.Factory.newInstance(getXmlOptions());
xbMultiPointDoc.setMultiPoint(xbMultiPoint);
return xbMultiPointDoc;
} else if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
GeometryPropertyType geometryPropertyType = GeometryPropertyType.Factory.newInstance(getXmlOptions());
geometryPropertyType.setAbstractGeometry(xbMultiPoint);
geometryPropertyType.getAbstractGeometry().substitute(GmlConstants.QN_MULTI_POINT_32, PolygonType.type);
return geometryPropertyType;
}
return xbMultiPoint;
} else {
throw new UnsupportedEncoderInputException(this, geom);
}
}
use of org.geotoolkit.gml.xml.v311.MultiPointType in project geotoolkit by Geomatys.
the class JAXPStreamFeatureWriter method setId.
/**
* @param inc auto increment value, ids must be unique
*/
private void setId(AbstractGeometry gmlGeometry, String id) {
if (gmlGeometry.getId() == null || gmlGeometry.getId().isEmpty()) {
// do not override ids if they exist
gmlGeometry.setId(id + (gidInc));
gidInc++;
}
if (gmlGeometry instanceof MultiCurve) {
for (CurveProperty po : ((MultiCurve) gmlGeometry).getCurveMember()) {
final AbstractCurve child = po.getAbstractCurve();
if (child instanceof AbstractGeometry) {
setId((AbstractGeometry) child, id);
}
}
} else if (gmlGeometry instanceof MultiSurface) {
for (SurfaceProperty po : ((MultiSurface) gmlGeometry).getSurfaceMember()) {
final AbstractSurface child = po.getAbstractSurface();
if (child instanceof AbstractGeometry) {
setId((AbstractGeometry) child, id);
}
}
} else if (gmlGeometry instanceof MultiGeometryType) {
for (GeometryPropertyType po : ((MultiGeometryType) gmlGeometry).getGeometryMember()) {
final AbstractGeometryType child = po.getAbstractGeometry();
if (child instanceof AbstractGeometry) {
setId((AbstractGeometry) child, id);
}
}
} else if (gmlGeometry instanceof MultiSolidType) {
for (SolidPropertyType po : ((MultiSolidType) gmlGeometry).getSolidMember()) {
final AbstractSolidType child = po.getAbstractSolid().getValue();
if (child instanceof AbstractGeometry) {
setId((AbstractGeometry) child, id);
}
}
} else if (gmlGeometry instanceof MultiPointType) {
for (PointPropertyType po : ((MultiPointType) gmlGeometry).getPointMember()) {
final PointType child = po.getPoint();
if (child instanceof AbstractGeometry) {
setId((AbstractGeometry) child, id);
}
}
}
}
use of org.geotoolkit.gml.xml.v311.MultiPointType in project geotoolkit by Geomatys.
the class FilterToOGC110Converter method visit.
public JAXBElement<?> visit(final Filter filter) {
if (filter.equals(Filter.include())) {
return null;
}
if (filter.equals(Filter.exclude())) {
return null;
}
final CodeList<?> type = filter.getOperatorType();
if (filter instanceof BetweenComparisonOperator) {
final BetweenComparisonOperator pib = (BetweenComparisonOperator) filter;
final LowerBoundaryType lbt = ogc_factory.createLowerBoundaryType();
lbt.setExpression(extract(pib.getLowerBoundary()));
final UpperBoundaryType ubt = ogc_factory.createUpperBoundaryType();
ubt.setExpression(extract(pib.getUpperBoundary()));
final PropertyIsBetweenType bot = new PropertyIsBetweenType(extract(pib.getExpression()), lbt, ubt);
return ogc_factory.createPropertyIsBetween(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_EQUAL_TO) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsEqualToType bot = ogc_factory.createPropertyIsEqualToType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsEqualTo(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_GREATER_THAN) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsGreaterThanType bot = ogc_factory.createPropertyIsGreaterThanType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsGreaterThan(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_GREATER_THAN_OR_EQUAL_TO) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsGreaterThanOrEqualToType bot = ogc_factory.createPropertyIsGreaterThanOrEqualToType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsGreaterThanOrEqualTo(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_LESS_THAN) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsLessThanType bot = ogc_factory.createPropertyIsLessThanType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsLessThan(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_LESS_THAN_OR_EQUAL_TO) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsLessThanOrEqualToType bot = ogc_factory.createPropertyIsLessThanOrEqualToType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsLessThanOrEqualTo(bot);
} else if (filter instanceof LikeOperator) {
final LikeOperator pis = (LikeOperator) filter;
final List<Expression> expressions = filter.getExpressions();
final PropertyIsLikeType bot = ogc_factory.createPropertyIsLikeType();
bot.setEscapeChar(String.valueOf(pis.getEscapeChar()));
final LiteralType lt = ogc_factory.createLiteralType();
lt.setContent(((Literal) expressions.get(1)).getValue());
bot.setLiteral(lt.getStringValue());
final Expression expression = expressions.get(0);
if (!(expression instanceof ValueReference)) {
throw new IllegalArgumentException("LikeOperator can support ValueReference only, but was a " + expression);
}
final PropertyNameType pnt = (PropertyNameType) extract(expression).getValue();
bot.setPropertyName(pnt);
bot.setSingleChar(String.valueOf(pis.getSingleChar()));
bot.setWildCard(String.valueOf(pis.getWildCard()));
return ogc_factory.createPropertyIsLike(bot);
} else if (type == ComparisonOperatorName.PROPERTY_IS_NOT_EQUAL_TO) {
final BinaryComparisonOperator pit = (BinaryComparisonOperator) filter;
final PropertyIsNotEqualToType bot = ogc_factory.createPropertyIsNotEqualToType();
bot.getExpression().add(extract(pit.getOperand1()));
bot.getExpression().add(extract(pit.getOperand2()));
return ogc_factory.createPropertyIsNotEqualTo(bot);
} else if (filter instanceof NullOperator) {
final NullOperator pis = (NullOperator) filter;
final PropertyIsNullType bot = ogc_factory.createPropertyIsNullType();
final Object obj = extract((Expression) pis.getExpressions().get(0)).getValue();
bot.setPropertyName((PropertyNameType) obj);
return ogc_factory.createPropertyIsNull(bot);
} else if (type == LogicalOperatorName.AND) {
final LogicalOperator and = (LogicalOperator) filter;
final List<JAXBElement> children = new ArrayList<>();
for (final Filter f : (List<Filter>) and.getOperands()) {
final JAXBElement<? extends LogicOpsType> ele = (JAXBElement<? extends LogicOpsType>) visit(f);
if (ele != null) {
children.add(ele);
}
}
return ogc_factory.createAnd(new AndType(children.toArray()));
} else if (type == LogicalOperatorName.OR) {
final LogicalOperator or = (LogicalOperator) filter;
final List<JAXBElement> children = new ArrayList<>();
for (final Filter f : (List<Filter>) or.getOperands()) {
final JAXBElement<? extends LogicOpsType> ele = (JAXBElement<? extends LogicOpsType>) visit(f);
if (ele != null) {
children.add(ele);
}
}
return ogc_factory.createOr(new OrType(children.toArray()));
} else if (type == LogicalOperatorName.NOT) {
final LogicalOperator not = (LogicalOperator) filter;
JAXBElement<?> sf = visit((Filter) not.getOperands().get(0));
return ogc_factory.createNot(new NotType(sf.getValue()));
} else if (filter instanceof ResourceId) {
throw new IllegalArgumentException("Not parsed yet : " + filter);
} else if (type == SpatialOperatorName.BBOX) {
final BBOX bbox = BBOX.wrap((BinarySpatialOperator) filter);
final Expression left = bbox.getOperand1();
final Expression right = bbox.getOperand2();
final String property;
final double minx;
final double maxx;
final double miny;
final double maxy;
String srs;
if (left instanceof ValueReference) {
property = ((ValueReference) left).getXPath();
final Object objGeom = ((Literal) right).getValue();
if (objGeom instanceof org.opengis.geometry.Envelope) {
final org.opengis.geometry.Envelope env = (org.opengis.geometry.Envelope) objGeom;
minx = env.getMinimum(0);
maxx = env.getMaximum(0);
miny = env.getMinimum(1);
maxy = env.getMaximum(1);
try {
srs = IdentifiedObjects.lookupURN(env.getCoordinateReferenceSystem(), null);
if (srs == null) {
srs = ReferencingUtilities.lookupIdentifier(env.getCoordinateReferenceSystem(), true);
}
} catch (FactoryException ex) {
throw new IllegalArgumentException("invalid bbox element : " + filter + " " + ex.getMessage(), ex);
}
} else if (objGeom instanceof Geometry) {
final Geometry geom = (Geometry) objGeom;
final Envelope env = geom.getEnvelopeInternal();
minx = env.getMinX();
maxx = env.getMaxX();
miny = env.getMinY();
maxy = env.getMaxY();
srs = SRIDGenerator.toSRS(geom.getSRID(), SRIDGenerator.Version.V1);
} else {
throw new IllegalArgumentException("invalide bbox element : " + filter);
}
} else if (right instanceof ValueReference) {
property = ((ValueReference) right).getXPath();
final Object objGeom = ((Literal) left).getValue();
if (objGeom instanceof org.opengis.geometry.Envelope) {
final org.opengis.geometry.Envelope env = (org.opengis.geometry.Envelope) objGeom;
minx = env.getMinimum(0);
maxx = env.getMaximum(0);
miny = env.getMinimum(1);
maxy = env.getMaximum(1);
try {
srs = IdentifiedObjects.lookupURN(env.getCoordinateReferenceSystem(), null);
} catch (FactoryException ex) {
throw new IllegalArgumentException("invalide bbox element : " + filter + " " + ex.getMessage(), ex);
}
} else if (objGeom instanceof Geometry) {
final Geometry geom = (Geometry) objGeom;
final Envelope env = geom.getEnvelopeInternal();
minx = env.getMinX();
maxx = env.getMaxX();
miny = env.getMinY();
maxy = env.getMaxY();
srs = SRIDGenerator.toSRS(geom.getSRID(), SRIDGenerator.Version.V1);
} else {
throw new IllegalArgumentException("invalide bbox element : " + filter);
}
} else {
throw new IllegalArgumentException("invalide bbox element : " + filter);
}
final BBOXType bbtype = new BBOXType(property, minx, miny, maxx, maxy, srs);
return ogc_factory.createBBOX(bbtype);
} else if (filter instanceof ResourceId) {
// todo OGC filter can not handle ID when we are inside another filter type
// so here we make a small tric to change an id filter in a serie of propertyequal filter
// this is not really legal but we dont have the choice here
// we should propose an evolution of ogc filter do consider id filter as a comparison filter
final ValueReference n = FF.property(AttributeConvention.IDENTIFIER);
String ident = ((ResourceId) filter).getIdentifier();
return visit(FF.equal(n, FF.literal(ident)));
} else if (filter instanceof SpatialOperator) {
final BinarySpatialOperator spatialOp = (BinarySpatialOperator) filter;
Expression exp1 = spatialOp.getOperand1();
Expression exp2 = spatialOp.getOperand2();
if (!(exp1 instanceof ValueReference)) {
// flip order
final Expression ex = exp1;
exp1 = exp2;
exp2 = ex;
}
if (!(exp1 instanceof ValueReference)) {
throw new IllegalArgumentException("Filter can not be transformed in wml filter, " + "expression are not of the requiered type ");
}
final JAXBElement<PropertyNameType> pnt = (JAXBElement<PropertyNameType>) extract(exp1);
final JAXBElement<EnvelopeType> jaxEnv;
final JAXBElement<? extends AbstractGeometryType> jaxGeom;
final Object geom = ((Literal) exp2).getValue();
if (geom instanceof Geometry) {
final Geometry jts = (Geometry) geom;
final String srid = SRIDGenerator.toSRS(jts.getSRID(), SRIDGenerator.Version.V1);
CoordinateReferenceSystem crs;
try {
crs = CRS.forCode(srid);
} catch (Exception ex) {
Logger.getLogger("org.geotoolkit.sld.xml").log(Level.WARNING, null, ex);
crs = null;
}
final AbstractGeometryType gt = GMLUtilities.getGMLFromISO(JTSUtils.toISO(jts, crs));
// TODO use gml method to return any JAXBElement
if (gt instanceof PointType) {
jaxGeom = gml_factory.createPoint((PointType) gt);
} else if (gt instanceof CurveType) {
jaxGeom = gml_factory.createCurve((CurveType) gt);
} else if (gt instanceof LineStringType) {
jaxGeom = gml_factory.createLineString((LineStringType) gt);
} else if (gt instanceof PolygonType) {
jaxGeom = gml_factory.createPolygon((PolygonType) gt);
} else if (gt instanceof MultiPolygonType) {
jaxGeom = gml_factory.createMultiPolygon((MultiPolygonType) gt);
} else if (gt instanceof MultiLineStringType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiCurveType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiPointType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiGeometryType) {
jaxGeom = gml_factory.createMultiGeometry((MultiGeometryType) gt);
} else if (gt instanceof PolyhedralSurfaceType) {
jaxGeom = gml_factory.createPolyhedralSurface((PolyhedralSurfaceType) gt);
} else if (gt != null) {
throw new IllegalArgumentException("unexpected Geometry type:" + gt.getClass().getName());
} else {
jaxGeom = null;
}
jaxEnv = null;
} else if (geom instanceof org.opengis.geometry.Geometry) {
final AbstractGeometryType gt = GMLUtilities.getGMLFromISO((org.opengis.geometry.Geometry) geom);
// TODO use gml method to return any JAXBElement
if (gt instanceof PointType) {
jaxGeom = gml_factory.createPoint((PointType) gt);
} else if (gt instanceof CurveType) {
jaxGeom = gml_factory.createCurve((CurveType) gt);
} else if (gt instanceof LineStringType) {
jaxGeom = gml_factory.createLineString((LineStringType) gt);
} else if (gt instanceof PolygonType) {
jaxGeom = gml_factory.createPolygon((PolygonType) gt);
} else if (gt instanceof MultiPolygonType) {
jaxGeom = gml_factory.createMultiPolygon((MultiPolygonType) gt);
} else if (gt instanceof MultiLineStringType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiCurveType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiPointType) {
jaxGeom = gml_factory.createMultiLineString((MultiLineStringType) gt);
} else if (gt instanceof MultiGeometryType) {
jaxGeom = gml_factory.createMultiGeometry((MultiGeometryType) gt);
} else if (gt instanceof PolyhedralSurfaceType) {
jaxGeom = gml_factory.createPolyhedralSurface((PolyhedralSurfaceType) gt);
} else if (gt != null) {
throw new IllegalArgumentException("unexpected Geometry type:" + gt.getClass().getName());
} else {
jaxGeom = null;
}
jaxEnv = null;
} else if (geom instanceof org.opengis.geometry.Envelope) {
final org.opengis.geometry.Envelope genv = (org.opengis.geometry.Envelope) geom;
EnvelopeType ee = gml_factory.createEnvelopeType();
try {
ee.setSrsName(IdentifiedObjects.lookupURN(genv.getCoordinateReferenceSystem(), null));
} catch (FactoryException ex) {
Logger.getLogger("org.geotoolkit.sld.xml").log(Level.WARNING, null, ex);
}
ee.setLowerCorner(new DirectPositionType(genv.getLowerCorner()));
ee.setUpperCorner(new DirectPositionType(genv.getUpperCorner()));
jaxGeom = null;
jaxEnv = gml_factory.createEnvelope(ee);
} else {
throw new IllegalArgumentException("Type is not geometric or envelope.");
}
if (type == DistanceOperatorName.BEYOND) {
final BeyondType jaxelement = ogc_factory.createBeyondType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setPropertyName(pnt.getValue());
return ogc_factory.createBeyond(jaxelement);
} else if (type == SpatialOperatorName.CONTAINS) {
final ContainsType jaxelement = ogc_factory.createContainsType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createContains(jaxelement);
} else if (type == SpatialOperatorName.CROSSES) {
final CrossesType jaxelement = ogc_factory.createCrossesType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createCrosses(jaxelement);
} else if (type == DistanceOperatorName.WITHIN) {
final DWithinType jaxelement = ogc_factory.createDWithinType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setPropertyName(pnt.getValue());
return ogc_factory.createDWithin(jaxelement);
} else if (type == SpatialOperatorName.DISJOINT) {
final DisjointType jaxelement = ogc_factory.createDisjointType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createDisjoint(jaxelement);
} else if (type == SpatialOperatorName.EQUALS) {
final EqualsType jaxelement = ogc_factory.createEqualsType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createEquals(jaxelement);
} else if (type == SpatialOperatorName.INTERSECTS) {
final IntersectsType jaxelement = ogc_factory.createIntersectsType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createIntersects(jaxelement);
} else if (type == SpatialOperatorName.OVERLAPS) {
final OverlapsType jaxelement = new OverlapsType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createOverlaps(jaxelement);
} else if (type == SpatialOperatorName.TOUCHES) {
final TouchesType jaxelement = ogc_factory.createTouchesType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createTouches(jaxelement);
} else if (type == SpatialOperatorName.WITHIN) {
final WithinType jaxelement = ogc_factory.createWithinType();
jaxelement.setAbstractGeometry(jaxGeom);
jaxelement.setEnvelope(jaxEnv);
jaxelement.setPropertyName(pnt);
return ogc_factory.createWithin(jaxelement);
} else {
throw new IllegalArgumentException("Unknowed filter element : " + filter + " class :" + filter.getClass());
}
} else {
throw new IllegalArgumentException("Unknowed filter element : " + filter + " class :" + filter.getClass());
}
}
Aggregations