sim.util.geo
Class MasonGeometry

java.lang.Object
  extended by sim.util.geo.MasonGeometry
All Implemented Interfaces:
java.io.Serializable, sim.util.Proxiable

public class MasonGeometry
extends java.lang.Object
implements sim.util.Proxiable, java.io.Serializable

A MasonGeometry is a wrapper for a JTS geometry and an associated userData field. The userData field can be any MASON object, or general Java object, which will be included in the inspector by default.

MasonGeometry implements sim.util.Proxiable to allow the hiding of various getXXX and setXXX methods from the inspectors. TODO may have to move new AttributeValue convenience functions to inner proxy class.

See Also:
Serialized Form

Nested Class Summary
 class MasonGeometry.GeomWrapperProxy
          Inner class allows us to prevent certain getXXX and setXXX methods from appearing in the Inspector
 
Field Summary
 com.vividsolutions.jts.geom.Geometry geometry
          Internal JTS geometry object
 boolean isMovable
          Does this MasonGeometry move? i.e., dynamically change location
 com.vividsolutions.jts.geom.prep.PreparedGeometry preparedGeometry
          A cached, optimized version of my Geometry.
 java.awt.geom.GeneralPath shape
          Java2D shape corresponding to this Geometry.
 java.awt.geom.AffineTransform transform
           
 
Constructor Summary
MasonGeometry()
          Default constructors
MasonGeometry(com.vividsolutions.jts.geom.Geometry g)
           
MasonGeometry(com.vividsolutions.jts.geom.Geometry g, java.lang.Object o)
           
 
Method Summary
 void addAttribute(java.lang.String name, java.lang.Object value)
           
 void addAttributes(java.util.Map<java.lang.String,AttributeValue> attributes)
           
 void addDoubleAttribute(java.lang.String name, double value)
           
 void addIntegerAttribute(java.lang.String name, int value)
           
 void addStringAttribute(java.lang.String name, java.lang.String value)
           
 boolean equals(java.lang.Object obj)
           
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Map<java.lang.String,AttributeValue> getAttributes()
           
 java.lang.Double getDoubleAttribute(java.lang.String name)
           
 com.vividsolutions.jts.geom.Geometry getGeometry()
           
 java.lang.Integer getIntegerAttribute(java.lang.String name)
           
 java.lang.String getStringAttribute(java.lang.String name)
           
 java.lang.Object getUserData()
           
 boolean hasAttribute(java.lang.String name)
           
 boolean hasAttributes()
           
 int hashCode()
           
 boolean hasHiddenAttributes()
          XXX This might be deprecated because no longer support hidden attributes
 java.lang.Object propertiesProxy()
           
 void setUserData(java.lang.Object o)
          Set the userData field with an arbitrary object
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

geometry

public com.vividsolutions.jts.geom.Geometry geometry
Internal JTS geometry object


shape

public java.awt.geom.GeneralPath shape
Java2D shape corresponding to this Geometry. Used to speed up drawing.


transform

public java.awt.geom.AffineTransform transform

preparedGeometry

public com.vividsolutions.jts.geom.prep.PreparedGeometry preparedGeometry
A cached, optimized version of my Geometry. Used for fast intersection, union, etc. operations


isMovable

public boolean isMovable
Does this MasonGeometry move? i.e., dynamically change location

Constructor Detail

MasonGeometry

public MasonGeometry()
Default constructors


MasonGeometry

public MasonGeometry(com.vividsolutions.jts.geom.Geometry g)

MasonGeometry

public MasonGeometry(com.vividsolutions.jts.geom.Geometry g,
                     java.lang.Object o)
Method Detail

hasHiddenAttributes

public boolean hasHiddenAttributes()
XXX This might be deprecated because no longer support hidden attributes

Returns:
true iff this.attributes contains any hidden attributes

hasAttributes

public boolean hasAttributes()
Returns:
true iff there are any attributes associated with this geometry

hasAttribute

public boolean hasAttribute(java.lang.String name)
Parameters:
name - of attribute for which we're looking
Returns:
true if this geometry has an attribute of that name

getAttributes

public java.util.Map<java.lang.String,AttributeValue> getAttributes()
Returns:
attributes associated with this geometry

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

addAttributes

public void addAttributes(java.util.Map<java.lang.String,AttributeValue> attributes)

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.Object value)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)

addIntegerAttribute

public void addIntegerAttribute(java.lang.String name,
                                int value)

getIntegerAttribute

public java.lang.Integer getIntegerAttribute(java.lang.String name)

addDoubleAttribute

public void addDoubleAttribute(java.lang.String name,
                               double value)

getDoubleAttribute

public java.lang.Double getDoubleAttribute(java.lang.String name)

addStringAttribute

public void addStringAttribute(java.lang.String name,
                               java.lang.String value)

getStringAttribute

public java.lang.String getStringAttribute(java.lang.String name)

setUserData

public final void setUserData(java.lang.Object o)
Set the userData field with an arbitrary object

Parameters:
o - is user supplied object to attach to this geometry

getUserData

public java.lang.Object getUserData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
geometry type and coordinates

getGeometry

public com.vividsolutions.jts.geom.Geometry getGeometry()
Returns:
the JTS geometry object.

propertiesProxy

public java.lang.Object propertiesProxy()
Specified by:
propertiesProxy in interface sim.util.Proxiable