|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sim.field.geo.GeomField sim.field.geo.GeomVectorField
public class GeomVectorField
A GeomVectorField contains one or more MasonGeometry objects. The field stores the geometries as a quadtree and used the quadtree during various queries. As objects are inserted into the field, the minimum bounding rectangle (MBR) is expanded to include the new object. This allows a determination of the area of the field.
Note that the field assumes the geometries use the same coordinate system.
Field Summary | |
---|---|
com.vividsolutions.jts.geom.Envelope |
clipEnvelope
|
com.vividsolutions.jts.geom.util.AffineTransformation |
jtsTransform
|
java.awt.geom.AffineTransform |
worldToScreen
|
Fields inherited from class sim.field.geo.GeomField |
---|
drawX, drawY, fieldHeight, fieldWidth, MBR |
Constructor Summary | |
---|---|
GeomVectorField()
|
|
GeomVectorField(int w,
int h)
Default constructor, which resets all internal data structures. |
Method Summary | |
---|---|
void |
addGeometry(MasonGeometry g)
Adds the MasonGeometry to the field and also expands the MBR |
void |
clear()
Removes all geometry objects and resets the MBR. |
void |
computeConvexHull()
Computes the convex hull of all the geometries in this field. |
void |
computeUnion()
Compute the union of the field's geometries. |
MasonGeometry |
findGeometry(MasonGeometry g)
Locate a specific geometry inside the quadtree |
sim.util.Bag |
getContainingObjectgs(MasonGeometry mg)
|
sim.util.Bag |
getContainingObjects(com.vividsolutions.jts.geom.Geometry g)
Returns geometries that contain the given object. |
sim.util.Bag |
getCoveredObjects(MasonGeometry g)
Return geometries that are covered by the given geometry. |
sim.util.Bag |
getCoveringObjects(com.vividsolutions.jts.geom.Geometry g)
Returns geometries that cover the given object. |
sim.util.Bag |
getCoveringObjects(MasonGeometry mg)
|
sim.util.Bag |
getGeometries()
Returns all the field's geometry objects. |
MasonGeometry |
getGeometry(java.lang.String name,
java.lang.Object value)
Searches the field for the first object with attribute name that has value value. |
com.vividsolutions.jts.geom.Point |
getGeometryLocation(MasonGeometry g)
Get the centroid of the given Geometry. |
sim.util.Bag |
getObjectsWithinDistance(com.vividsolutions.jts.geom.Geometry g,
double dist)
Returns a bag containing all those objects within distance of the given geometry. |
sim.util.Bag |
getObjectsWithinDistance(MasonGeometry mg,
double dist)
|
sim.util.Bag |
getTouchingObjects(MasonGeometry mg)
Returns geometries that touch the given geometry. |
boolean |
isCovered(com.vividsolutions.jts.geom.Coordinate point)
Returns true if the coordinate is within any geometry in the field. |
boolean |
isCovered(MasonGeometry g)
Returns true if the given Geometry is covered by any geometry in the field. |
boolean |
isInsideConvexHull(com.vividsolutions.jts.geom.Coordinate coord)
Determine if the Coordinate is within the convex hull of the field's geometries. |
boolean |
isInsideUnion(com.vividsolutions.jts.geom.Coordinate point)
Determine if the Coordinate is within the bounding Geometry of the field's geometries. |
sim.util.Bag |
queryField(com.vividsolutions.jts.geom.Envelope e)
|
sim.engine.Steppable |
scheduleSpatialIndexUpdater()
Schedules a repeating Steppable that updates spatial index |
void |
setGeometryLocation(MasonGeometry g,
com.vividsolutions.jts.geom.CoordinateSequenceFilter p)
Moves the centroid of the given geometry to the provided point. |
void |
updateSpatialIndex()
Rebuild the spatial index from the current set of geometry |
void |
updateTransform(sim.portrayal.DrawInfo2D info)
|
void |
updateTree(com.vividsolutions.jts.geom.Geometry g,
com.vividsolutions.jts.geom.util.AffineTransformation at)
|
Methods inherited from class sim.field.geo.GeomField |
---|
getFieldHeight, getFieldWidth, getHeight, getMBR, getWidth, setFieldHeight, setFieldWidth, setMBR |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public com.vividsolutions.jts.geom.Envelope clipEnvelope
public java.awt.geom.AffineTransform worldToScreen
public com.vividsolutions.jts.geom.util.AffineTransformation jtsTransform
Constructor Detail |
---|
public GeomVectorField()
public GeomVectorField(int w, int h)
Method Detail |
---|
public void addGeometry(MasonGeometry g)
public void clear()
clear
in class GeomField
public void computeConvexHull()
public boolean isInsideConvexHull(com.vividsolutions.jts.geom.Coordinate coord)
public void computeUnion()
public boolean isInsideUnion(com.vividsolutions.jts.geom.Coordinate point)
public sim.util.Bag queryField(com.vividsolutions.jts.geom.Envelope e)
public sim.util.Bag getGeometries()
public sim.util.Bag getObjectsWithinDistance(com.vividsolutions.jts.geom.Geometry g, double dist)
public sim.util.Bag getObjectsWithinDistance(MasonGeometry mg, double dist)
public final sim.util.Bag getCoveringObjects(com.vividsolutions.jts.geom.Geometry g)
public final sim.util.Bag getCoveringObjects(MasonGeometry mg)
public final sim.util.Bag getCoveredObjects(MasonGeometry g)
XXX Could be made more efficient by using spatial index to narrow candidates.
public final sim.util.Bag getContainingObjects(com.vividsolutions.jts.geom.Geometry g)
public final sim.util.Bag getContainingObjectgs(MasonGeometry mg)
public final sim.util.Bag getTouchingObjects(MasonGeometry mg)
public boolean isCovered(MasonGeometry g)
public boolean isCovered(com.vividsolutions.jts.geom.Coordinate point)
public com.vividsolutions.jts.geom.Point getGeometryLocation(MasonGeometry g)
public void setGeometryLocation(MasonGeometry g, com.vividsolutions.jts.geom.CoordinateSequenceFilter p)
Note that the spatial index is not notified of the geometry changes. It is strongly recommended that updateSpatialIndex() be invoked after all geometry position changes.
updateSpatialIndex()
public void updateSpatialIndex()
If the objects contained in this field have moved, then the spatial index will have to be updated. This is done by replacing the current spatial index with an entirely new one built from the same stored geometry.
public sim.engine.Steppable scheduleSpatialIndexUpdater()
The spatial index for a GeomVectorField containing moving objects will need to be updated after all such objects have moved. This method returns a Steppable that invokes updateSpatialIndex() that does this.
public MasonGeometry findGeometry(MasonGeometry g)
XXX Is returning what we're looking for when the target geometry is not found the desired behavior?
g
- is geometry for which we're looking
public void updateTree(com.vividsolutions.jts.geom.Geometry g, com.vividsolutions.jts.geom.util.AffineTransformation at)
public MasonGeometry getGeometry(java.lang.String name, java.lang.Object value)
name
- of attributevalue
- of attribute
TODO What if there is more than one such object?
public void updateTransform(sim.portrayal.DrawInfo2D info)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |