com.ibm.geolib

Class GeoSpatialService

  • java.lang.Object
    • com.ibm.geolib.GeoSpatialService
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected GeoSpatialService() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      boolean contains(java.util.Collection<? extends Spatial> containers, Spatial contained)
      Check if any of the spatial objects in the collection contains the specified object.
      boolean contains(Spatial container, Spatial contained)
      Check if the given spatial object contains another spatial object
      <T extends Spatial> 
      java.util.Collection<T>
      getContained(Spatial container, java.util.Collection<T> all)
      Find objects contained in the specified spatial object.
      <T extends Spatial> 
      java.util.Collection<T>
      getContainers(Spatial contained, java.util.Collection<T> all)
      Find objects containing the specified spatial object.
      CoordinateReferenceSystemFactory getCoordinateReferenceSystemFactory()
      Get a coordinate reference system factory that is used to get defined coordinate reference system or to create a new one
      double getDistance(Spatial from, Spatial to, LengthUnit units)
      Compute distance between two spatial objects.
      GeometryFactory getGeometryFactory()
      Get a geometry factory that is used to create new geometries
      <T extends Spatial> 
      T
      getNearestNeighbor(Spatial source, java.util.Collection<T> all)
      Find the nearest neighbor of the given spatial object among a specified collection of spatial objects
      static GeoSpatialService getService() 
      <T extends Spatial> 
      java.util.List<T>
      getWithinDistance(Spatial source, java.util.Collection<T> all, double maxDistance, LengthUnit units)
      Find objects located within the specified distance from the source object
      boolean intersects(Spatial object1, Spatial object2)
      Check if two spatial objects intersect
      <T extends Spatial> 
      java.util.List<T>
      sortByProximity(Spatial source, java.util.Collection<T> all)
      Sort a collection of spatial objects based on their proximity to the given source object
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GeoSpatialService

        protected GeoSpatialService()
    • Method Detail

      • getDistance

        public double getDistance(Spatial from,
                         Spatial to,
                         LengthUnit units)
        Description copied from interface: SpatialService
        Compute distance between two spatial objects.
        Specified by:
        getDistance in interface SpatialService
        Parameters:
        from - source object
        to - target object
        units - specifies unit for measuring distance.
        Returns:
        distance between the given objects measured in the specified length units.
      • contains

        public boolean contains(Spatial container,
                       Spatial contained)
        Description copied from interface: SpatialService
        Check if the given spatial object contains another spatial object
        Specified by:
        contains in interface SpatialService
        Returns:
        true - if the contained object is inside the container object, otherwise - false
      • contains

        public boolean contains(java.util.Collection<? extends Spatial> containers,
                       Spatial contained)
        Description copied from interface: SpatialService
        Check if any of the spatial objects in the collection contains the specified object.
        Specified by:
        contains in interface SpatialService
        Returns:
        true of any of the 'containers' objects contains the 'contained' one, otherwise - false
      • intersects

        public boolean intersects(Spatial object1,
                         Spatial object2)
        Description copied from interface: SpatialService
        Check if two spatial objects intersect
        Specified by:
        intersects in interface SpatialService
        Returns:
        true - if object1 intersects with object2, otherwise - false
      • getNearestNeighbor

        public <T extends Spatial> T getNearestNeighbor(Spatial source,
                                               java.util.Collection<T> all)
        Description copied from interface: SpatialService
        Find the nearest neighbor of the given spatial object among a specified collection of spatial objects
        Specified by:
        getNearestNeighbor in interface SpatialService
        Parameters:
        source - object for which the nearest neighbor to be found
        all - - a collection of spatial objects to look for the nearest neighbor
        Returns:
        a spatial object nearest to the source
      • getWithinDistance

        public <T extends Spatial> java.util.List<T> getWithinDistance(Spatial source,
                                                              java.util.Collection<T> all,
                                                              double maxDistance,
                                                              LengthUnit units)
        Description copied from interface: SpatialService
        Find objects located within the specified distance from the source object
        Specified by:
        getWithinDistance in interface SpatialService
        all - a collection of spatial objects to filter based on the proximity to the source
        maxDistance - - maximal distance at which returned object must be to the source
        units - - distance units
        Returns:
        a list of objects from the 'all' collections that are within 'maxDistance' proximity to the source, calculated in 'units' of length
      • sortByProximity

        public <T extends Spatial> java.util.List<T> sortByProximity(Spatial source,
                                                            java.util.Collection<T> all)
        Description copied from interface: SpatialService
        Sort a collection of spatial objects based on their proximity to the given source object
        Specified by:
        sortByProximity in interface SpatialService
        Parameters:
        source - object that should be used to measure distance to from any object of collection
        all - spatial objects to sort
        Returns:
        an ordered list of spatial objects sorted by their distance to the 'source', in ascending order.
      • getContained

        public <T extends Spatial> java.util.Collection<T> getContained(Spatial container,
                                                               java.util.Collection<T> all)
        Description copied from interface: SpatialService
        Find objects contained in the specified spatial object.
        Specified by:
        getContained in interface SpatialService
        Parameters:
        container - the containing object
        all - possible contained objects.
        Returns:
        A collection of spatial objects from 'all' that are contained in the 'container' object.
      • getContainers

        public <T extends Spatial> java.util.Collection<T> getContainers(Spatial contained,
                                                                java.util.Collection<T> all)
        Description copied from interface: SpatialService
        Find objects containing the specified spatial object.
        Specified by:
        getContainers in interface SpatialService
        Parameters:
        contained - a spatial object which containers should be looked up
        all - possible containing objects
        Returns:
        A collection of spatial objects from 'all' that contain the 'contained' object.

© Copyright IBM 2017