Class DefaultGeography<T>

    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultGeography​(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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void add​(T object)
      Adds an object to this projection without giving it a location.
      void addCoverage​(String name, org.geotools.coverage.grid.GridCoverage2D coverage)
      Adds the named GridCoverage2D
      boolean 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.
      GISAdder<T> getAdder()
      Gets the current GISAdder that determines how objects are added to the geometry when added to the containing context.
      Iterable<T> getAllObjects()
      Gets all the objects that are in this geography.
      org.geotools.coverage.grid.GridCoverage2D getCoverage​(String name)
      Gets the named coverage layer
      Collection<String> getCoverageNames()  
      org.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.
      Layer getLayer​(Class clazz)
      Gets the layer for the specified type.
      Layer getLayer​(String name)
      Gets the named layer.
      Collection<String> getLayerNames()
      Gets the names of the layers in this geography.
      Iterable<T> 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 move​(T object, org.locationtech.jts.geom.Geometry geom)
      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.
      Iterable<T> 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 remove​(T object)  
      void removeCoverage​(String name)  
      void setAdder​(GISAdder<T> adder)
      Sets the current GISAdder that determines how objects are added to the geometry when added to the containing context.
      void setCRS​(String crsCode)
      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.
    • Field Detail

      • coverageMap

        protected Map<String,​org.geotools.coverage.grid.GridCoverage2D> coverageMap
    • Constructor Detail

      • DefaultGeography

        public DefaultGeography​(String name)
        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

        public DefaultGeography​(String name,
                                String crsCode)
        Creates a DefaultGeography with a specified name and coordindate reference system.
        Parameters:
        name - the name of the geography
        crsCode - the coordinate reference system code (e.g. "EPSG:4326")
    • Method Detail

      • getLayerNames

        public Collection<String> 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 interface Geography<T>
        Returns:
        the names of the layers in this geography.
      • add

        protected void add​(T object)
        Adds an object to this projection without giving it a location.
        Parameters:
        object - the object to add
      • move

        public void move​(T object,
                         org.locationtech.jts.geom.Geometry geom)
        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.
        Specified by:
        move in interface Geography<T>
        Parameters:
        object - the object to move
        geom - the location to move the object to
      • getLayer

        public Layer getLayer​(Class clazz)
        Gets the layer for the specified type.
        Specified by:
        getLayer in interface Geography<T>
        Parameters:
        clazz - the type associated with the desired layer
        Returns:
        the layer for the specified type.
      • getLayer

        public Layer getLayer​(String name)
        Gets the named layer.
        Specified by:
        getLayer in interface Geography<T>
        Parameters:
        name - the layer name
        Returns:
        the named Layer.
      • getGeometry

        public org.locationtech.jts.geom.Geometry getGeometry​(Object object)
        Gets the geometric location of the specified object.
        Specified by:
        getGeometry in interface Geography<T>
        Parameters:
        object - the object
        Returns:
        the geometric location of the specified object.
      • getObjectsWithin

        public Iterable<T> getObjectsWithin​(org.locationtech.jts.geom.Envelope envelope)
        Gets an iterable over all the objects within the specified envelope.
        Specified by:
        getObjectsWithin in interface Geography<T>
        Parameters:
        envelope - the bounding envelope
        Returns:
        an iterable over all the objects within the specified location.
      • queryInexact

        public Iterable<T> queryInexact​(org.locationtech.jts.geom.Envelope envelope)
        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 interface Geography<T>
        Parameters:
        envelope - the envelope to query for
        Returns:
        an iterable over items whose extents MAY intersect the given search envelope.
      • getObjectsWithin

        public <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. Subclasses are excluded.
        Specified by:
        getObjectsWithin in interface Geography<T>
        Parameters:
        envelope - the bounding envelope
        type - the type of objects to return
        Returns:
        an iterable over all the objects within the specified location.
      • queryInexact

        public <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. 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 interface Geography<T>
        Parameters:
        envelope - the envelope to query for
        type - the type of objects to return
        Returns:
        an iterable over items whose extents MAY intersect the given search envelope.
      • getAllObjects

        public Iterable<T> getAllObjects()
        Gets all the objects that are in this geography.
        Specified by:
        getAllObjects in interface Geography<T>
        Returns:
        an iterable over all the objects in this geography.
      • size

        public int size()
        Gets the number of objects in the geography.
        Specified by:
        size in interface Geography<T>
        Returns:
        the number of objects in the geography
      • setCRS

        public void setCRS​(String crsCode)
        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.
        Specified by:
        setCRS in interface Geography<T>
        Parameters:
        crsCode - the coordinate reference system code
      • 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.
        Specified by:
        setCRS in interface Geography<T>
        Parameters:
        crs - the coordinate reference system
      • 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 interface Geography<T>
        Parameters:
        object - the object to move
        distance - the distance to move in meters
        angleInRadians - 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 interface Geography<T>
        Parameters:
        object - the object to move
        distance - the distance to move
        unit - the distance units. This must be convertable to meters
        angleInRadians - 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 interface Geography<T>
        Parameters:
        object - the object to move
        lonShift - the amount to move longitudinaly
        latShift - 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.
        Specified by:
        getCRS in interface Geography<T>
        Returns:
        the current coordinate reference system for this geometry.
      • remove

        protected void remove​(T object)
      • getAdder

        public GISAdder<T> getAdder()
        Gets the current GISAdder that determines how objects are added to the geometry when added to the containing context.
        Specified by:
        getAdder in interface Geography<T>
        Returns:
        the current GISAdder
      • setAdder

        public void setAdder​(GISAdder<T> adder)
        Sets the current GISAdder that determines how objects are added to the geometry when added to the containing context.
        Specified by:
        setAdder in interface Geography<T>
        Parameters:
        adder - the new GISAdder
      • getUnits

        public javax.measure.Unit<?> getUnits​(int axis)
        Gets the coordinate reference system's axis units.
        Specified by:
        getUnits in interface Geography<T>
        Parameters:
        axis - the axis index.
        Returns:
        the coordinate reference system's axis units.
      • evaluate

        public boolean evaluate​(ProjectionPredicate predicate)
        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 interface Projection<T>
        Overrides:
        evaluate in class DefaultProjection<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

        public boolean evaluateWithin​(Within within)
        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

        public org.geotools.coverage.grid.GridCoverage2D getCoverage​(String name)
        Description copied from interface: Geography
        Gets the named coverage layer
        Specified by:
        getCoverage in interface Geography<T>
        Parameters:
        name - the layer name
        Returns:
        the named coverage
      • addCoverage

        public void addCoverage​(String name,
                                org.geotools.coverage.grid.GridCoverage2D coverage)
        Description copied from interface: Geography
        Adds the named GridCoverage2D
        Specified by:
        addCoverage in interface Geography<T>