Package repast.simphony.space.gis
Class DefaultGeography<T>
java.lang.Object
repast.simphony.space.projection.DefaultProjection<T>
repast.simphony.space.gis.DefaultGeography<T>
- All Implemented Interfaces:
Geography<T>
,Projection<T>
- Direct Known Subclasses:
ContextGeography
Default implementation of Geography, a geographic GIS type space.
-
Field Summary
Modifier and TypeFieldDescriptionFields inherited from class repast.simphony.space.projection.DefaultProjection
listeners, name
-
Constructor Summary
ConstructorDescriptionDefaultGeography
(String name) Creates a DefaultGeography with the specified name.DefaultGeography
(String name, String crsCode) Creates a DefaultGeography with a specified name and coordindate reference system. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds an object to this projection without giving it a location.void
addCoverage
(String name, org.geotools.coverage.grid.GridCoverage2D coverage) Adds the named GridCoverage2Dboolean
evaluate
(ProjectionPredicate predicate) Evaluate this Projection against the specified Predicate.boolean
evaluateWithin
(Within within) Evaluates the Geography against this predicate comparing whether two objects are within a specified distance of each other.getAdder()
Gets the current GISAdder that determines how objects are added to the geometry when added to the containing context.Gets all the objects that are in this geography.org.geotools.coverage.grid.GridCoverage2D
getCoverage
(String name) Gets the named coverage layerorg.opengis.referencing.crs.CoordinateReferenceSystem
getCRS()
Gets the current coordinate reference system for this geometry.org.locationtech.jts.geom.Geometry
getGeometry
(Object object) Gets the geometric location of the specified object.Gets the layer for the specified type.Gets the named layer.Gets the names of the layers in this geography.getObjectsWithin
(org.locationtech.jts.geom.Envelope envelope) Gets an iterable over all the objects within the specified envelope.<X> Iterable<X>
getObjectsWithin
(org.locationtech.jts.geom.Envelope envelope, Class<X> type) Gets an iterable over all the objects within the specified envelope that are of the specified type and only the specified type.javax.measure.Unit<?>
getUnits
(int axis) Gets the coordinate reference system's axis units.void
Moves the specified object to the specified location.org.locationtech.jts.geom.Geometry
moveByDisplacement
(T object, double lonShift, double latShift) Displaces the specified object by the specified lon and lat amount.org.locationtech.jts.geom.Geometry
moveByVector
(T object, double distance, double angleInRadians) Moves the specified object the specified distance along the specified angle.org.locationtech.jts.geom.Geometry
moveByVector
(T object, double distance, javax.measure.Unit<javax.measure.quantity.Length> unit, double angleInRadians) Moves the specified object the specified distance along the specified angle.queryInexact
(org.locationtech.jts.geom.Envelope envelope) Queries this geography for objects that MAY intersect the the specified envelope.<X> Iterable<X>
queryInexact
(org.locationtech.jts.geom.Envelope envelope, Class<X> type) Queries this geography for objects that MAY intersect the the specified envelope and are of the specified type and only the specified type.protected void
void
removeCoverage
(String name) void
Sets the current GISAdder that determines how objects are added to the geometry when added to the containing context.void
Sets the coordinate reference system for this Geometry.void
setCRS
(org.opengis.referencing.crs.CoordinateReferenceSystem crs) Sets the coordinate reference system for this Geometry.int
size()
Gets the number of objects in the geography.Methods inherited from class repast.simphony.space.projection.DefaultProjection
addProjectionListener, fireProjectionEvent, getName, getProjectionListeners, removeProjectionListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface repast.simphony.space.projection.Projection
addProjectionListener, getName, getProjectionListeners, removeProjectionListener
-
Field Details
-
coverageMap
-
adder
-
-
Constructor Details
-
DefaultGeography
Creates a DefaultGeography with the specified name. The coordinate reference system defaults to WGS84. That CRS uses (longitude, latitude) coordinates with longitude values increasing East and latitude values increasing North. Angular units are degrees and prime meridian is Greenwich..- Parameters:
name
- the name of the geography
-
DefaultGeography
Creates a DefaultGeography with a specified name and coordindate reference system.- Parameters:
name
- the name of the geographycrsCode
- the coordinate reference system code (e.g. "EPSG:4326")
-
-
Method Details
-
getLayerNames
Gets the names of the layers in this geography. There will be one layer for each type (by Java class) in a geography.- Specified by:
getLayerNames
in interfaceGeography<T>
- Returns:
- the names of the layers in this geography.
-
add
Adds an object to this projection without giving it a location.- Parameters:
object
- the object to add
-
move
Moves the specified object to the specified location. If the location is null then the object remains "in" this projection but without a location. The type of geometry must match the type currently associated with the layer. For example, an object cannot be located at a Point if the layer geometery type is a Polygon. A layer gets its geometry type from the first object that is moved in it. -
getLayer
Gets the layer for the specified type. -
getLayer
Gets the named layer. -
getGeometry
Gets the geometric location of the specified object.- Specified by:
getGeometry
in interfaceGeography<T>
- Parameters:
object
- the object- Returns:
- the geometric location of the specified object.
-
getObjectsWithin
Gets an iterable over all the objects within the specified envelope.- Specified by:
getObjectsWithin
in interfaceGeography<T>
- Parameters:
envelope
- the bounding envelope- Returns:
- an iterable over all the objects within the specified location.
-
queryInexact
Queries this geography for objects that MAY intersect the the specified envelope. This provides a first level filter for range rectangle queries. A second level filter SHOULD be applied to test for exact intersection.- Specified by:
queryInexact
in interfaceGeography<T>
- Parameters:
envelope
- the envelope to query for- Returns:
- an iterable over items whose extents MAY intersect the given search envelope.
-
getObjectsWithin
Gets an iterable over all the objects within the specified envelope that are of the specified type and only the specified type. Subclasses are excluded.- Specified by:
getObjectsWithin
in interfaceGeography<T>
- Parameters:
envelope
- the bounding envelopetype
- the type of objects to return- Returns:
- an iterable over all the objects within the specified location.
-
queryInexact
Queries this geography for objects that MAY intersect the the specified envelope and are of the specified type and only the specified type. Subclasses are excluded.This provides a first level filter for range rectangle queries. A second level filter SHOULD be applied to test for exact intersection.- Specified by:
queryInexact
in interfaceGeography<T>
- Parameters:
envelope
- the envelope to query fortype
- the type of objects to return- Returns:
- an iterable over items whose extents MAY intersect the given search envelope.
-
getAllObjects
Gets all the objects that are in this geography.- Specified by:
getAllObjects
in interfaceGeography<T>
- Returns:
- an iterable over all the objects in this geography.
-
size
public int size()Gets the number of objects in the geography. -
setCRS
Sets the coordinate reference system for this Geometry. For example, "EPSG:4326". All the locations of the objects in this Geometry will be appropriately transformed. -
setCRS
public void setCRS(org.opengis.referencing.crs.CoordinateReferenceSystem crs) Sets the coordinate reference system for this Geometry. All the locations of the objects in this Geometry will be appropriately transformed. -
moveByVector
public org.locationtech.jts.geom.Geometry moveByVector(T object, double distance, double angleInRadians) Moves the specified object the specified distance along the specified angle.- Specified by:
moveByVector
in interfaceGeography<T>
- Parameters:
object
- the object to movedistance
- the distance to move in metersangleInRadians
- the angle along which to move. This USES standard mathematical axes where 90 degrees points "north".- Returns:
- the geometric location the object was moved to
-
moveByVector
public org.locationtech.jts.geom.Geometry moveByVector(T object, double distance, javax.measure.Unit<javax.measure.quantity.Length> unit, double angleInRadians) Moves the specified object the specified distance along the specified angle.- Specified by:
moveByVector
in interfaceGeography<T>
- Parameters:
object
- the object to movedistance
- the distance to moveunit
- the distance units. This must be convertable to metersangleInRadians
- the angle along which to move- Returns:
- the geometric location the object was moved to
-
moveByDisplacement
public org.locationtech.jts.geom.Geometry moveByDisplacement(T object, double lonShift, double latShift) Displaces the specified object by the specified lon and lat amount.- Specified by:
moveByDisplacement
in interfaceGeography<T>
- Parameters:
object
- the object to movelonShift
- the amount to move longitudinalylatShift
- the amount to move latitudinaly- Returns:
- the new geometry of the object
-
getCRS
public org.opengis.referencing.crs.CoordinateReferenceSystem getCRS()Gets the current coordinate reference system for this geometry. -
remove
-
getAdder
Gets the current GISAdder that determines how objects are added to the geometry when added to the containing context. -
setAdder
Sets the current GISAdder that determines how objects are added to the geometry when added to the containing context. -
getUnits
public javax.measure.Unit<?> getUnits(int axis) Gets the coordinate reference system's axis units. -
evaluate
Evaluate this Projection against the specified Predicate. DefaultGeography provides doesn't call predicate.evaluate() but rather checks the predicate type and evaluates appropriately here. This is because the Geography interface is not available to repast.simphony.space.projection.ProjectionPredicate.- Specified by:
evaluate
in interfaceProjection<T>
- Overrides:
evaluate
in classDefaultProjection<T>
- Parameters:
predicate
-- Returns:
- true if the predicate evaluates to true, otherwise false. False can also mean that the predicate is not applicable to this Projection. For example, a linked type predicate evaluated against a grid projection.
-
evaluateWithin
Evaluates the Geography against this predicate comparing whether two objects are within a specified distance of each other. The distance is orthodromic and in meters. Note that for Polygons the distance is measured from the center and not from the nearest point.- Parameters:
geography
- the geography to evaluate against.- Returns:
- true if this predicate is true for the specified projection otherwise false.
-
getCoverage
Description copied from interface:Geography
Gets the named coverage layer- Specified by:
getCoverage
in interfaceGeography<T>
- Parameters:
name
- the layer name- Returns:
- the named coverage
-
addCoverage
Description copied from interface:Geography
Adds the named GridCoverage2D- Specified by:
addCoverage
in interfaceGeography<T>
-
removeCoverage
- Specified by:
removeCoverage
in interfaceGeography<T>
-
getCoverageNames
- Specified by:
getCoverageNames
in interfaceGeography<T>
-