RePast
v. 2.0

uchicago.src.sim.gis
Class PolygonAdapter

java.lang.Object
  |
  +--uchicago.src.sim.network.DefaultNode
        |
        +--uchicago.src.sim.gis.PolygonAdapter
All Implemented Interfaces:
Node, RepastGisFeature
Direct Known Subclasses:
DrawablePolygon

public class PolygonAdapter
extends DefaultNode
implements RepastGisFeature

This is an adapter between a geotools Polygon, a JTS Polygon and a Repast Node. It contains all of the good bits from each of those.


Nested Class Summary
 
Nested classes inherited from class uchicago.src.sim.network.DefaultNode
DefaultNode.OrderedHashMap
 
Field Summary
protected  Hashtable attributes
           
protected  com.vividsolutions.jts.geom.Geometry geometry
           
protected  String label
           
protected  boolean multi
           
protected  LinePoint[] points
           
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, outEdges, outMap
 
Constructor Summary
PolygonAdapter()
          creates an empty PolygonAdapter.
PolygonAdapter(org.geotools.feature.Feature f)
          creates a PolygonAdapter from a geotools feature.
PolygonAdapter(com.vividsolutions.jts.geom.Geometry geo, Hashtable attr)
          Creates a PolygonAdapter from a geometry and an attributes table.
 
Method Summary
 void addAttribute(String key, Object value)
          add an attribute to this feature.
 boolean crosses(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 boolean disjoint(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 Object getAttribute(String key)
          retrieve an attribute from this feature.
 String[] getAttributeNames()
          get a list of the Attribute names.
 Hashtable getAttributes()
          get the attributes table.
 com.vividsolutions.jts.geom.Geometry getGeometry()
          return the jts geometry from this feature.
 boolean intersects(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 boolean isMulti()
          Returns true if the feature is a "multi" type.
 boolean overlaps(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 void setAttributes(Hashtable attr)
          set the attributes table.
 void setFeature(org.geotools.feature.Feature f)
          set the feature.
 void setGeometry(com.vividsolutions.jts.geom.Geometry geo)
          set the jts geometry from this feature
 boolean touches(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 boolean within(RepastGisFeature g)
          Returns true if the feature is a "multi" type.
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getId, getInDegree, getInEdges, getInNodes, getNode, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge, setNodeLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

attributes

protected Hashtable attributes

geometry

protected com.vividsolutions.jts.geom.Geometry geometry

points

protected LinePoint[] points

label

protected String label

multi

protected boolean multi
Constructor Detail

PolygonAdapter

public PolygonAdapter()
creates an empty PolygonAdapter. Not that useful.


PolygonAdapter

public PolygonAdapter(org.geotools.feature.Feature f)
creates a PolygonAdapter from a geotools feature. This will be the most common way of building.

Parameters:
f -

PolygonAdapter

public PolygonAdapter(com.vividsolutions.jts.geom.Geometry geo,
                      Hashtable attr)
Creates a PolygonAdapter from a geometry and an attributes table.

Parameters:
geo -
attr -
Method Detail

setFeature

public void setFeature(org.geotools.feature.Feature f)
                throws IllegalArgumentException,
                       org.geotools.feature.IllegalFeatureException
set the feature. Add both the attributes and the geometry.

Specified by:
setFeature in interface RepastGisFeature
Parameters:
f -
Throws:
IllegalArgumentException - IllegalFeatureException
org.geotools.feature.IllegalFeatureException

getAttributeNames

public String[] getAttributeNames()
get a list of the Attribute names.

Specified by:
getAttributeNames in interface RepastGisFeature
Returns:

addAttribute

public void addAttribute(String key,
                         Object value)
add an attribute to this feature.

Specified by:
addAttribute in interface RepastGisFeature
Parameters:
key -
value -

getAttribute

public Object getAttribute(String key)
retrieve an attribute from this feature.

Specified by:
getAttribute in interface RepastGisFeature
Parameters:
key -
Returns:

getGeometry

public com.vividsolutions.jts.geom.Geometry getGeometry()
return the jts geometry from this feature.

Specified by:
getGeometry in interface RepastGisFeature
Returns:

setGeometry

public void setGeometry(com.vividsolutions.jts.geom.Geometry geo)
                 throws IllegalArgumentException
set the jts geometry from this feature

Specified by:
setGeometry in interface RepastGisFeature
Parameters:
geo -
Throws:
IllegalArgumentException - If geo not a polygon.

setAttributes

public void setAttributes(Hashtable attr)
set the attributes table.

Specified by:
setAttributes in interface RepastGisFeature
Parameters:
attr -

getAttributes

public Hashtable getAttributes()
get the attributes table.

Returns:

isMulti

public boolean isMulti()
Returns true if the feature is a "multi" type.

Specified by:
isMulti in interface RepastGisFeature
Returns:
multi

intersects

public boolean intersects(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
intersects in interface RepastGisFeature
Parameters:
g -
Returns:
multi

touches

public boolean touches(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
touches in interface RepastGisFeature
Parameters:
g -
Returns:
multi

within

public boolean within(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
within in interface RepastGisFeature
Parameters:
g -
Returns:
multi

crosses

public boolean crosses(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
crosses in interface RepastGisFeature
Parameters:
g -
Returns:
multi

overlaps

public boolean overlaps(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
overlaps in interface RepastGisFeature
Parameters:
g -
Returns:
multi

disjoint

public boolean disjoint(RepastGisFeature g)
Returns true if the feature is a "multi" type.

Specified by:
disjoint in interface RepastGisFeature
Parameters:
g -
Returns:
multi

RePast
v. 2.0

Bug reports and feature requests to RePast