Class FeatureAgent<T>

  • All Implemented Interfaces:
    org.opengis.feature.Attribute, org.opengis.feature.ComplexAttribute, org.opengis.feature.Feature, org.opengis.feature.Property, org.opengis.feature.simple.SimpleFeature

    public class FeatureAgent<T>
    extends Object
    implements org.opengis.feature.simple.SimpleFeature
    Wraps a POJO in a GIS feature. The POJO's properties become feature attributes. The feature's geometry is derived from the POJO and a Geography. The FeatureAgent is primarily used by the GeoTools-based displays and the shapefile writer utility that require SimpleFeature instances that mirror the agent properties.
    Author:
    Nick Collier, Eric Tatara
    • Field Detail

      • id

        protected org.opengis.filter.identity.FeatureId id
      • featureType

        protected org.opengis.feature.simple.SimpleFeatureType featureType
      • geometryName

        protected String geometryName
    • Constructor Detail

      • FeatureAgent

        public FeatureAgent​(org.opengis.feature.simple.SimpleFeatureType type,
                            T agent,
                            Geography geog,
                            List<FeatureAttributeAdapter> adapters,
                            List<repast.simphony.space.gis.FeatureAgentFactory.ObjectClassAttributeData> classAttributeList)
        Creates a FeatureAgent from the specified FeatureType, agent and geography. The geometry of the feature will be supplied by the geography. The agent's properties will become attributes of the feature. The list of adapters will become additional attributes for those that cannot be mapped directly to an agents properties.
        Parameters:
        type -
        agent -
        geography -
        adapters -
    • Method Detail

      • getAgent

        public T getAgent()
        Gets the agent that this FeatureAgent wraps.
        Returns:
        the agent that this FeatureAgent wraps.
      • getID

        public String getID()
        Specified by:
        getID in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getID()
      • getType

        public org.opengis.feature.simple.SimpleFeatureType getType()
        Specified by:
        getType in interface org.opengis.feature.Attribute
        Specified by:
        getType in interface org.opengis.feature.ComplexAttribute
        Specified by:
        getType in interface org.opengis.feature.Feature
        Specified by:
        getType in interface org.opengis.feature.Property
        Specified by:
        getType in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getType()
      • getFeatureType

        public org.opengis.feature.simple.SimpleFeatureType getFeatureType()
        Specified by:
        getFeatureType in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getFeatureType()
      • getIdentifier

        public org.opengis.filter.identity.FeatureId getIdentifier()
        Specified by:
        getIdentifier in interface org.opengis.feature.Attribute
        Specified by:
        getIdentifier in interface org.opengis.feature.Feature
        See Also:
        Feature.getIdentifier()
      • getAttributes

        public List<Object> getAttributes()
        Specified by:
        getAttributes in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getAttributes()
      • getAttribute

        public Object getAttribute​(String name)
        Specified by:
        getAttribute in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getAttribute(String)
      • setAttribute

        public void setAttribute​(String name,
                                 Object obj)
        Specified by:
        setAttribute in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.setAttribute(String, Object)
      • getAttribute

        public Object getAttribute​(org.opengis.feature.type.Name name)
        Specified by:
        getAttribute in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getAttribute(Name)
      • setAttribute

        public void setAttribute​(org.opengis.feature.type.Name name,
                                 Object value)
        Specified by:
        setAttribute in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.setAttribute(Name, Object)
      • getAttribute

        public Object getAttribute​(int index)
        Specified by:
        getAttribute in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getAttribute(int)
      • getAttributeCount

        public int getAttributeCount()
        Specified by:
        getAttributeCount in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getAttributeCount()
      • getDefaultGeometry

        public org.locationtech.jts.geom.Geometry getDefaultGeometry()
        Specified by:
        getDefaultGeometry in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.getDefaultGeometry()
      • setDefaultGeometry

        public void setDefaultGeometry​(Object geometry)
        Specified by:
        setDefaultGeometry in interface org.opengis.feature.simple.SimpleFeature
        See Also:
        SimpleFeature.setDefaultGeometry(Object)
      • getBounds

        public org.opengis.geometry.BoundingBox getBounds()
        Specified by:
        getBounds in interface org.opengis.feature.Feature
        See Also:
        Feature.getBounds()
      • getDefaultGeometryProperty

        public org.opengis.feature.GeometryAttribute getDefaultGeometryProperty()
        Specified by:
        getDefaultGeometryProperty in interface org.opengis.feature.Feature
        See Also:
        Feature.getDefaultGeometryProperty()
      • setDefaultGeometryProperty

        public void setDefaultGeometryProperty​(org.opengis.feature.GeometryAttribute geometryAttribute)
        Specified by:
        setDefaultGeometryProperty in interface org.opengis.feature.Feature
        See Also:
        Feature.setDefaultGeometryProperty(GeometryAttribute)
      • isNillable

        public boolean isNillable()
        Specified by:
        isNillable in interface org.opengis.feature.Property
        See Also:
        Property.isNillable()
      • getName

        public org.opengis.feature.type.Name getName()
        Specified by:
        getName in interface org.opengis.feature.Property
        See Also:
        Property.getName()
      • getDescriptor

        public org.opengis.feature.type.AttributeDescriptor getDescriptor()
        Specified by:
        getDescriptor in interface org.opengis.feature.Attribute
        Specified by:
        getDescriptor in interface org.opengis.feature.Property
        See Also:
        Attribute.getDescriptor()
      • getUserData

        public Map<Object,​Object> getUserData()
        Specified by:
        getUserData in interface org.opengis.feature.Property
        See Also:
        Property.getUserData()
      • getProperties

        public Collection<org.opengis.feature.Property> getProperties()
        Specified by:
        getProperties in interface org.opengis.feature.ComplexAttribute
      • getProperties

        public Collection<org.opengis.feature.Property> getProperties​(org.opengis.feature.type.Name arg0)
        Specified by:
        getProperties in interface org.opengis.feature.ComplexAttribute
      • getProperties

        public Collection<org.opengis.feature.Property> getProperties​(String arg0)
        Specified by:
        getProperties in interface org.opengis.feature.ComplexAttribute
      • getProperty

        public org.opengis.feature.Property getProperty​(org.opengis.feature.type.Name arg0)
        Specified by:
        getProperty in interface org.opengis.feature.ComplexAttribute
      • getProperty

        public org.opengis.feature.Property getProperty​(String arg0)
        Specified by:
        getProperty in interface org.opengis.feature.ComplexAttribute
      • getValue

        public Collection<? extends org.opengis.feature.Property> getValue()
        Specified by:
        getValue in interface org.opengis.feature.ComplexAttribute
        Specified by:
        getValue in interface org.opengis.feature.Property
      • setValue

        public void setValue​(Collection<org.opengis.feature.Property> arg0)
        Specified by:
        setValue in interface org.opengis.feature.ComplexAttribute
      • validate

        public void validate()
                      throws org.opengis.feature.IllegalAttributeException
        Specified by:
        validate in interface org.opengis.feature.Attribute
        Specified by:
        validate in interface org.opengis.feature.ComplexAttribute
        Throws:
        org.opengis.feature.IllegalAttributeException
      • setValue

        public void setValue​(Object arg0)
        Specified by:
        setValue in interface org.opengis.feature.Property
      • setAttributes

        public void setAttributes​(List<Object> arg0)
        Specified by:
        setAttributes in interface org.opengis.feature.simple.SimpleFeature
      • setAttributes

        public void setAttributes​(Object[] arg0)
        Specified by:
        setAttributes in interface org.opengis.feature.simple.SimpleFeature