public Object getProperty(Object object, QName name) throws Exception { if ("posList".equals(name.getLocalPart())) { return GML3EncodingUtils.positions((LineString) object); } return null; } }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(InstanceComponent instance, Object value) throws Exception { return ((FilterFactory2) filterFactory) .property( (String) value, GML3EncodingUtils.copyNamespaceSupport((namespaceSupport))); } }
CoordinateReferenceSystem crs = GML3EncodingUtils.getCRS(geometry); if (crs != null) { return GML3EncodingUtils.toURI(crs, srsSyntax); return GML3EncodingUtils.getID(geometry); return GML3EncodingUtils.getName(geometry); return GML3EncodingUtils.getDescription(geometry); return GML3EncodingUtils.getUomLabels(geometry); return GML3EncodingUtils.getAxisLabels(geometry);
/** * Encode the simpleContent property of a ComplexAttribute (if any) as an XML text node. * * <p>A property named simpleContent is a convention for representing XSD complexType with * simpleContent in GeoAPI. * * @param complex the ComplexAttribute to be searched for simpleContent * @param document the containing document * @param element the element to which text node should be added */ public static void encodeSimpleContent( ComplexAttribute complex, Document document, Element element) { Object value = getSimpleContent(complex); encodeAsText(document, element, value); }
public Object getProperty(Object object, QName name) throws Exception { Geometry geometry = (Geometry) object; if ("srsName".equals( name.getLocalPart() ) ) { CoordinateReferenceSystem crs = GML3EncodingUtils.getCRS(geometry); if (crs != null) { return GML3EncodingUtils.crs(crs); } } if (GML.id.equals(name)) { return GML3EncodingUtils.getID(geometry); } if (GML.name.equals(name)) { return GML3EncodingUtils.getName(geometry); } if (GML.description.equals(name)) { return GML3EncodingUtils.getDescription(geometry); } return null; } }
CoordinateReferenceSystem crs = GML3EncodingUtils.getCRS(geometry); if (crs != null) { return GML3EncodingUtils.toURI(crs, srsSyntax); return GML3EncodingUtils.getID(geometry); return GML3EncodingUtils.getName(geometry); return GML3EncodingUtils.getDescription(geometry);
/** Test VocabFunction in a mapping file */ @Test public void testVocabFunctionInMappingFile() { final Map<String, String> VALUE_MAP = new HashMap<String, String>() { { put("sc.1", "urn:cgi:classifier:CGI:SimpleLithology:2008:gravel"); put("sc.2", "urn:cgi:classifier:CGI:SimpleLithology:2008:diamictite"); put("sc.3", "urn:cgi:classifier:CGI:SimpleLithology:2008:sediment"); } }; FeatureIterator<Feature> features = exCollection.features(); try { while (features.hasNext()) { Feature feature = features.next(); String fId = feature.getIdentifier().getID(); // gml[2]: <OCQL>Vocab(URN_ID, // 'src/test/java/org/geotools/filter/test-data/minoc_lithology_mapping.properties')</OCQL> ComplexAttribute complexAttribute = (ComplexAttribute) ff.property("gml:name[2]").evaluate(feature); String value = Converters.convert( GML3EncodingUtils.getSimpleContent(complexAttribute), String.class); assertEquals(VALUE_MAP.get(fId), value); } } finally { features.close(); } }
public void setSrsNameAttribute(AttributesImpl atts, CoordinateReferenceSystem crs) { URI srsName = GML3EncodingUtils.toURI(crs, srsSyntax); String crsName = srsName != null ? srsName.toString() : crs.getName().getCode(); atts.addAttribute(null, "srsName", "srsName", null, crsName); }
/** * Helper method used to implement {@link ComplexBinding#getProperties(Object)} * for bindings of geometry reference types: * <ul> * <li>GeometryPropertyType * <li>PointPropertyType * <li>LineStringPropertyType * <li>PolygonPropertyType * </ul> */ static List getProperties(Geometry geometry) { String id = GML3EncodingUtils.getID( geometry ); if ( !isEmpty(geometry) && id != null ) { // return a comment which is hte xlink href return Collections.singletonList(new Object[] { Encoder.COMMENT, "#" +id }); } return null; }
public Object getProperty(Object object, QName name) throws Exception { if ("srsName".equals(name.getLocalPart())) { Geometry geometry = (Geometry) object; if (geometry.getUserData() instanceof CoordinateReferenceSystem) { CoordinateReferenceSystem crs = (CoordinateReferenceSystem) geometry.getUserData(); return GML3EncodingUtils.crs(crs); } } return null; } }
/** * Set a synthetic gml:id on each child of a multigeometry. If the multigeometry has no gml:id, * this method has no effect. The synthetic gml:id of each child is constructed from that of the * parent by appending "." and then an integer starting from one for the first child. * * @param multiGeometry parent multigeometry containing the children to be modified */ static void setChildIDs(Geometry multiGeometry) { String id = getID(multiGeometry); if (id != null) { for (int i = 0; i < multiGeometry.getNumGeometries(); i++) { StringBuilder builder = new StringBuilder(id); builder.append("."); // separator builder.append(i + 1); // synthetic gml:id suffix one-based GML2EncodingUtils.setID(multiGeometry.getGeometryN(i), builder.toString()); } } }
String value = Converters.convert( GML3EncodingUtils.getSimpleContent(complexAttribute), String.class); assertEquals(expectedValues.get(fid), value);
public void setSrsNameAttribute(AttributesImpl atts, CoordinateReferenceSystem crs) { URI srsName = GML3EncodingUtils.toURI(crs, srsSyntax); String crsName = srsName != null ? srsName.toString() : crs.getName().getCode(); atts.addAttribute(null, "srsName", "srsName", null, crsName); }
public Object getProperty(Object object, QName name) { Envelope envelope = (Envelope) object; if (envelope.isNull()) { return null; } if (name.getLocalPart().equals("lowerCorner")) { return new DirectPosition2D(envelope.getMinX(), envelope.getMinY()); } if (name.getLocalPart().equals("upperCorner")) { return new DirectPosition2D(envelope.getMaxX(), envelope.getMaxY()); } if (name.getLocalPart().equals("srsName") && envelope instanceof ReferencedEnvelope) { return GML3EncodingUtils.crs(((ReferencedEnvelope) envelope) .getCoordinateReferenceSystem()); } return null; } }
/** * Set a synthetic gml:id on each child of a multigeometry. If the multigeometry has no gml:id, * this method has no effect. The synthetic gml:id of each child is constructed from that of the * parent by appending "." and then an integer starting from one for the first child. * * @param multiGeometry * parent multigeometry containing the children to be modified */ static void setChildIDs(Geometry multiGeometry) { String id = getID(multiGeometry); if (id != null) { for (int i = 0; i < multiGeometry.getNumGeometries(); i++) { StringBuilder builder = new StringBuilder(id); builder.append("."); // separator builder.append(i + 1); // synthetic gml:id suffix one-based GML2EncodingUtils.setID(multiGeometry.getGeometryN(i), builder.toString()); } } }
public Object getProperty(Object object, QName name) throws Exception { if ("posList".equals(name.getLocalPart())) { return GML3EncodingUtils.positions((LineString) object); } return null; } }
String value = Converters.convert( GML3EncodingUtils.getSimpleContent(complexAttribute), String.class); assertEquals(recodedName, value);
String localName = name.getLocalPart(); if (localName.equals("srsName")) { return GML3EncodingUtils.toURI( ((ReferencedEnvelope) envelope).getCoordinateReferenceSystem(), srsSyntax); } else if (localName.equals("srsDimension")) {
public Object getProperty(Object object, QName name) { Envelope envelope = (Envelope) object; if (envelope.isNull()) { return null; } if (name.getLocalPart().equals("lowerCorner")) { return new DirectPosition2D(envelope.getMinX(), envelope.getMinY()); } if (name.getLocalPart().equals("upperCorner")) { return new DirectPosition2D(envelope.getMaxX(), envelope.getMaxY()); } if (name.getLocalPart().equals("srsName") && envelope instanceof ReferencedEnvelope) { return GML3EncodingUtils.crs(((ReferencedEnvelope) envelope) .getCoordinateReferenceSystem()); } return null; } }