Class MultiCoverage

java.lang.Object
nz.org.riskscape.defaults.function.MultiCoverage
All Implemented Interfaces:
nz.org.riskscape.engine.coverage.TypedCoverage, nz.org.riskscape.engine.data.SelfDescribingScalarData

public class MultiCoverage extends Object implements nz.org.riskscape.engine.coverage.TypedCoverage
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Functional interface for an object that can set raw values with the result of evaluating a coverage.

    Nested classes/interfaces inherited from interface nz.org.riskscape.engine.coverage.TypedCoverage

    nz.org.riskscape.engine.coverage.TypedCoverage.Empty
  • Field Summary

    Fields inherited from interface nz.org.riskscape.engine.coverage.TypedCoverage

    DEFAULT_CRS
  • Method Summary

    Modifier and Type
    Method
    Description
    create(nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.coverage.TypedCoverage[] coverages, MultiCoverage.RawValueSetter[] valueSetters, nz.org.riskscape.engine.SRIDSet sridSet, BiFunction<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Point,List<org.locationtech.jts.geom.Geometry>> cutFunction)
    Creates a new MultiCoverage that yields the given struct type by sampling all of the coverages and setting those to type.
    evaluate(org.locationtech.jts.geom.Point point)
     
    org.geotools.api.referencing.crs.CoordinateReferenceSystem
     
    Map<String,nz.org.riskscape.engine.coverage.TypedCoverage>
     
    Optional<org.geotools.geometry.jts.ReferencedEnvelope>
     
    Optional<Function<org.locationtech.jts.geom.Geometry,List<nz.org.riskscape.engine.util.Pair<org.locationtech.jts.geom.Geometry,Object>>>>
    This samples each of the coverages the MultiCoverage contains individually, and then returns the combined result.
    nz.org.riskscape.engine.types.Struct
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface nz.org.riskscape.engine.coverage.TypedCoverage

    asRelation, getScalarDataType
  • Method Details

    • create

      public static MultiCoverage create(nz.org.riskscape.engine.types.Struct type, nz.org.riskscape.engine.coverage.TypedCoverage[] coverages, MultiCoverage.RawValueSetter[] valueSetters, nz.org.riskscape.engine.SRIDSet sridSet, BiFunction<org.locationtech.jts.geom.Geometry,org.locationtech.jts.geom.Point,List<org.locationtech.jts.geom.Geometry>> cutFunction)

      Creates a new MultiCoverage that yields the given struct type by sampling all of the coverages and setting those to type. Each member of the type must correspond to a coverage.

      Parameters:
      type - the type to be returned from the coverage
      coverages - the coverages that make up the multi coverage
      valueSetters - to evaluate the coverage and set the results in the appropriate positions of the tuples raw results (as given by #type)
      cutFunction - a function that can cut a given geometry into smaller pieces for sampling the coverages. Used by getEvaluateIntersectionOp().
    • evaluate

      public Object evaluate(org.locationtech.jts.geom.Point point)
      Specified by:
      evaluate in interface nz.org.riskscape.engine.coverage.TypedCoverage
    • getEvaluateIntersectionOp

      public Optional<Function<org.locationtech.jts.geom.Geometry,List<nz.org.riskscape.engine.util.Pair<org.locationtech.jts.geom.Geometry,Object>>>> getEvaluateIntersectionOp()

      This samples each of the coverages the MultiCoverage contains individually, and then returns the combined result. When evaluating intersections, the input geometry is cut into pieces (i.e. grid segments), and the centre of each piece is sampled individually. It is important to note that we only ever use TypedCoverage.evaluate(Point) to sample each individual coverage, even if the coverage is a SpatialRelationTypedCoverage.

      Specified by:
      getEvaluateIntersectionOp in interface nz.org.riskscape.engine.coverage.TypedCoverage
    • getCoordinateReferenceSystem

      public org.geotools.api.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
      Specified by:
      getCoordinateReferenceSystem in interface nz.org.riskscape.engine.coverage.TypedCoverage
    • getEnvelope

      public Optional<org.geotools.geometry.jts.ReferencedEnvelope> getEnvelope()
      Specified by:
      getEnvelope in interface nz.org.riskscape.engine.coverage.TypedCoverage
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getCoveragesAsMap

      public Map<String,nz.org.riskscape.engine.coverage.TypedCoverage> getCoveragesAsMap()
    • getType

      public nz.org.riskscape.engine.types.Struct getType()
      Specified by:
      getType in interface nz.org.riskscape.engine.coverage.TypedCoverage