private TypedObjectNode getPropValue( TypedObjectNode prop ) { if ( prop instanceof Property ) { return ( (Property) prop ).getValue(); } return prop; }
public PropertyNode( GMLObjectNode<? extends TypedObjectNode, ? extends TypedObjectNode> parent, final Property prop ) { super( prop.getName() ); this.parent = parent; this.prop = prop; }
public GenericProperty( PropertyType declaration, QName name, TypedObjectNode value, Map<QName, PrimitiveValue> attrs, List<TypedObjectNode> children, XSElementDeclaration xsType ) { this.declaration = declaration; if ( name == null ) { this.name = declaration.getName(); } else { this.name = name; } this.attrs = attrs; this.children = children; this.xsType = xsType; }
public final PropertyType findConcretePropertyType( final QName elemName, final PropertyType pt ) { // LOG.debug( "Checking if '" + elemName + "' is a valid substitution for '" + pt.getName() + "'" ); for ( final PropertyType substitutionPt : pt.getSubstitutions() ) { // TODO !substitutionPt.isAbstract() if ( elemName.equals( substitutionPt.getName() ) ) { // LOG.debug( "Yep. Substitutable for '" + substitutionPt.getName() + "'" ); return substitutionPt; } } // LOG.debug( "Nope." ); return null; }
/** * @param node * @return null, if the node cannot be interpreted as geometry */ public static Geometry getGeometryValue( TypedObjectNode node ) { Geometry geom = null; if ( node instanceof Geometry ) { geom = (Geometry) node; } else if ( node instanceof Property && ( (Property) node ).getValue() instanceof Geometry ) { geom = (Geometry) ( (Property) node ).getValue(); } return geom; }
/** * Creates a new {@link GenericGMLObjectType} instance. * * @param category * GML object category, must not be <code>null</code> * @param name * qualified element name, must not be <code>null</code> * @param propDecls * property declarations, may be empty or <code>null</code> * @param isAbstract * <code>true</code>, if this object type declaration is abstract, <code>false</code> otherwise */ public GenericGMLObjectType( GMLObjectCategory category, QName name, List<PropertyType> propDecls, boolean isAbstract ) { this.category = category; this.name = name; for ( PropertyType propDecl : propDecls ) { propNameToDecl.put( propDecl.getName(), propDecl ); } this.isAbstract = isAbstract; }
@Override public List<Property> getProperties( final QName propName ) { final List<Property> namedProps = new ArrayList<Property>( props.size() ); for ( final Property property : props ) { if ( propName.equals( property.getName() ) ) { namedProps.add( property ); } } return namedProps; }
@Override public List<Property> getGeometryProperties() { List<Property> geoProps = new ArrayList<Property>(); if ( props != null ) { for ( Property property : props ) { if ( property.getValue() instanceof Geometry && !( property.getValue() instanceof Envelope ) ) { geoProps.add( property ); } } } return geoProps; } }
@Override public List<Property> getProperties( final QName propName ) { final List<Property> namedProps = new ArrayList<Property>( props.size() ); for ( final Property property : props ) { if ( propName.equals( property.getName() ) ) { namedProps.add( property ); } } return namedProps; }
@Override public List<Property> getGeometryProperties() { List<Property> geoProps = new ArrayList<Property>( props.size() ); for ( Property property : props ) { if ( property.getValue() instanceof Geometry && !( property.getValue() instanceof Envelope ) ) { geoProps.add( property ); } } return geoProps; } }
@Override public List<Property> getProperties( QName propName ) { List<Property> namedProps = new ArrayList<Property>( props.size() ); for ( Property property : props ) { if ( propName.equals( property.getName() ) ) { namedProps.add( property ); } } return namedProps; }
private Geometry tryProperty( TypedObjectNode n ) { if ( n instanceof Property ) { TypedObjectNode val = ( (Property) n ).getValue(); if ( val instanceof Geometry ) { return (Geometry) val; } return tryCustomXML( val ); } return null; }
/** * @param sb * @param o */ public void eval( StringBuilder sb, Object o ) { if ( o instanceof Feature ) { sb.append( ( (Feature) o ).getName().getLocalPart() ); } if ( o instanceof Property ) { sb.append( ( (Property) o ).getName().getLocalPart() ); } }
private PrimitiveValue getPrimitiveValue( TypedObjectNode value ) { if ( value instanceof Property ) { value = ( (Property) value ).getValue(); } if ( value instanceof GenericXMLElement ) { value = ( (GenericXMLElement) value ).getValue(); } return (PrimitiveValue) value; }
private GmlXlinkOptions getResolveParams( Property prop, GmlXlinkOptions resolveState ) { PropertyName projection = requestedPropertyNames.get( prop.getName() ); if ( projection != null && projection.getResolveParams() != null ) { return new GmlXlinkOptions( projection.getResolveParams() ); } return resolveState; }
private void exportStandardProps( Geometry geom ) throws XMLStreamException, UnknownCRSException, TransformationException { if ( geom.getProperties() != null ) { for ( Property prop : geom.getProperties() ) { if ( isStandardProperty( prop.getName() ) ) { gmlStreamWriter.getFeatureWriter().export( prop ); } } } }
/** * Returns the string value of an element node. * * @param node * the target node * @return the text inside the node and its descendants if the node is an element, null otherwise */ @Override public String getElementStringValue( Object node ) { String value = null; if ( node instanceof PropertyNode ) { Property prop = ( (PropertyNode) node ).getValue(); Object propValue = prop.getValue(); // TODO check if conversion is feasible (e.g. Geometry.toString() may be expensive) value = propValue.toString(); } return value; }
private void exportAdditionalProps( Geometry geom ) throws XMLStreamException, UnknownCRSException, TransformationException { if ( geom.getProperties() != null ) { for ( Property prop : geom.getProperties() ) { if ( !isStandardProperty( prop.getName() ) ) { gmlStreamWriter.getFeatureWriter().export( prop ); } } } }
/** * @param sb * @param o */ public void eval( StringBuilder sb, Object o ) { if ( o instanceof Property ) { try { sb.append( ( (Property) o ).getValue() ); } catch ( UnsupportedOperationException e ) { LOG.error( "The error '{}' occurred while converting a property to a string, " + "probably the WKT writer cannot convert a geometry.", e.getLocalizedMessage() ); LOG.debug( "Stack trace:", e ); } } else { LOG.warn( "Trying to get value while current object is a feature." ); } }