Class SpatialTests

java.lang.Object
org.opengis.cite.kml22.BaseFixture
org.opengis.cite.kml22.level1.SpatialTests

public class SpatialTests extends BaseFixture
Contains test methods that apply to spatial items in a KML resource such as geometry and bounding box elements. Geometry objects include the following:
  • Point
  • LineString
  • LinearRing
  • Polygon
  • MultiGeometry
  • Model
See Also:
  • "OGC 07-134r2: OGC KML 2.2 - Abstract Test Suite"
  • Field Summary

    Fields inherited from class org.opengis.cite.kml22.BaseFixture

    NS_MAP, testSubject
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    checkAltitudeModeNotClampToGround(Element geometry, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if the geometry element has a kml:altitudeMode of "clampToGround" (default value) and the kml:extrude value is "true".
    (package private) void
    checkAltMode(Element latLonAltBox, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if any kml:LatLonAltBox element's altitude children are present but the kml:altitudeMode == clampToGround (also the default value).
    (package private) void
    checkAltValues(Element latLonAltBox, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if any kml:LatLonAltBox elements altitude children are invalid; kml:maxAltitude must be greater than or equal to kml:minAltitude.
    (package private) void
    checkInnerBoundaries(Element polygonElem, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if any inner boundary of a polygon is not within the outer boundary.
    (package private) void
    checkLatValues(Element box, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if any box elements having latitude children are invalid; kml:north must be greater than kml:south.
    (package private) void
    checkLonValues(Element box, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    An error is reported if any box elements having longitude children are invalid; kml:east must be greater than kml:west.
    (package private) void
    checkModelResourceMap(Element resourceMap, org.opengis.cite.validation.ValidationErrorHandler errHandler)
    Checks the content of a model resource for the occurrence of the expected source file names given by aliases contained in a kml:ResourceMap.
    void
    [Test] Verify that a kml:coordinates element contains a list of 2D or 3D tuples (separated by white space) that contain comma-separated decimal values (lon,lat[,hgt]).
    void
    [Test] Verifies that if the kml:extrude element has the value "true", then the value of kml:altitudeMode is not "clampToGround".
    void
    [Test] Verifies that if the kml:tessellate element has the value "true", then the value of kml:altitudeMode is "clampToGround" (default value).
    void
    [Test] Verifies that the content of a kml:LatLonAltBox element satisfies all of the following constraints: kml:north > kml:south; kml:east > kml:west; kml:minAltitude <= kml:maxAltitude; if kml:minAltitude and kml:maxAltitude are both present, then kml:altitudeMode does not have the value "clampToGround". The default envelope for a region of interest is the entire surface of the EGM96 geoid.
    void
    [Test] Verifies that the content of a kml:LatLonBox element satisfies all of the following constraints: it contains the kml:north, kml:south, kml:east, and kml:west elements; kml:north > kml:south; kml:east > kml:west. The default envelope for a kml:GroundOverlay is the entire surface of the WGS 84 ellipsoid.
    void
    [Test] Verifies that the kml:coordinates element in a kml:LinearRing geometry contains at least 4 coordinate tuples and that the first and last are identical (i.e. they constitute a closed figure).
    void
    [Test] Verifies that the kml:coordinates element in a kml:LineString geometry contains at least two coordinate tuples.
    void
    Test] Verifies that the content of a kml:Model element satisfies all of the following constraints: it contains the kml:Link and kml:Location elements; if it is not a descendant of kml:Update and the target resource refers to any texture files, then there must be a kml:ResourceMap/kml:Alias for each related texture file.
    void
    [Test] Verifies that if a kml:Orientation element is not a descendant of kml:Update, then it contains at least one of the following KML elements: kml:heading, kml:tilt, or kml:roll.
    void
    [Test] Verifies that the kml:coordinates element in a kml:Point geometry contains exactly one coordinate tuple.
    void
    [Test] Verifies that the boundary of a kml:Polygon element satisfies all of the following constraints.
    void
    [Test] Verifies that a kml:Alias element (that renames texture file paths found within a source COLLADA file) referenced in a kml:Model) satisfies the following constraints: the value of the child kml:targetHref element is a URI that refers to an image (texture) resource; the value of the child kml:sourceHref element corresponds to a file reference appearing within the 3D object resource referenced in the preceding sibling kml:Link element.

    Methods inherited from class org.opengis.cite.kml22.BaseFixture

    obtainTestSubject, setTestSubject, verifyElementNotEmpty

    Methods inherited from class java.lang.Object

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

    • SpatialTests

      public SpatialTests()
  • Method Details

    • verifyGeometryCoordinates

      public void verifyGeometryCoordinates()
      [Test] Verify that a kml:coordinates element contains a list of 2D or 3D tuples (separated by white space) that contain comma-separated decimal values (lon,lat[,hgt]).

      Pass if all kml:coordinates elements contain 2D/3D tuples containing decimal values conforming to the xsd:decimal type; fail otherwise. White space consists of one or more of the following characters: space (U+0020), carriage return (U+000D), line feed (U+000A), or tab (U+0009). The relevant 3D coordinate reference system (CRS) is defined in Annex B of the OGC KML 2.2 specification (its identifier is urn:ogc:def:crs:OGC:LonLat84_5773).

      See Also:
      • "OGC 07-134r2, ATC 3: Geometry coordinates"
    • verifyLatLonAltBox

      public void verifyLatLonAltBox()
      [Test] Verifies that the content of a kml:LatLonAltBox element satisfies all of the following constraints:
      1. kml:north > kml:south;
      2. kml:east > kml:west;
      3. kml:minAltitude <= kml:maxAltitude;
      4. if kml:minAltitude and kml:maxAltitude are both present, then kml:altitudeMode does not have the value "clampToGround".
      The default envelope for a region of interest is the entire surface of the EGM96 geoid. By testing north > south and east > west, we are testing for a non-zero area.
      See Also:
      • "OGC 07-134r2, ATC 8: Region - LatLonAltBox"
    • verifyLatLonBox

      public void verifyLatLonBox()
      [Test] Verifies that the content of a kml:LatLonBox element satisfies all of the following constraints:
      1. it contains the kml:north, kml:south, kml:east, and kml:west elements;
      2. kml:north > kml:south;
      3. kml:east > kml:west.
      The default envelope for a kml:GroundOverlay is the entire surface of the WGS 84 ellipsoid. By testing north > south and east > west, we are testing for a non-zero area.
      See Also:
      • "OGC 07-134r2, ATC 11: LatLonBox"
    • verifyGeometryExtrude

      public void verifyGeometryExtrude()
      [Test] Verifies that if the kml:extrude element has the value "true", then the value of kml:altitudeMode is not "clampToGround". This constraint applies to the following elements: kml:Point, kml:LineString, kml:LinearRing (but NOT if it occurs within a Polygon), and kml:Polygon.
      See Also:
      • "OGC 07-134r2, ATC 12: Geometry - extrude"
    • verifyGeometryTesselate

      public void verifyGeometryTesselate()
      [Test] Verifies that if the kml:tessellate element has the value "true", then the value of kml:altitudeMode is "clampToGround" (default value). This applies to the following elements: kml:LineString, kml:LinearRing (but NOT if it occurs within a Polygon), and kml:Polygon. Any KML feature with no altitude mode specified will default to 'clampToGround'.
      See Also:
      • "OGC 07-134r2, ATC 13: Geometry - tessellate"
    • verifyPointCoordinates

      public void verifyPointCoordinates()
      [Test] Verifies that the kml:coordinates element in a kml:Point geometry contains exactly one coordinate tuple.
      See Also:
      • "OGC 07-134r2, ATC 14: Point"
    • verifyLineStringCoordinates

      public void verifyLineStringCoordinates()
      [Test] Verifies that the kml:coordinates element in a kml:LineString geometry contains at least two coordinate tuples.
      See Also:
      • "OGC 07-134r2, ATC 15: LineString"
    • verifyLinearRingIsClosed

      public void verifyLinearRingIsClosed()
      [Test] Verifies that the kml:coordinates element in a kml:LinearRing geometry contains at least 4 coordinate tuples and that the first and last are identical (i.e. they constitute a closed figure).
      See Also:
      • "OGC 07-134r2, ATC 16: LinearRing - control points"
    • verifyPolygonBoundary

      public void verifyPolygonBoundary()
      [Test] Verifies that the boundary of a kml:Polygon element satisfies all of the following constraints.
      1. if it is not a descendant of kml:Update, then the kml:Polygon has a child kml:outerBoundaryIs element;
      2. each interior boundary defines a hole in the Polygon (that is, each inner ring lies within the exterior boundary).
      This test case reflects the essential definition of a polygon. No particular line orientations are assumed. The relevant polygons can be identified using this XPath expression: //kml:Polygon[not(ancestor::kml:Update)].
      See Also:
      • "OGC 07-134r2, ATC 17: Polygon boundary"
    • verifyTextureFileAliasInModel

      public void verifyTextureFileAliasInModel()
      [Test] Verifies that a kml:Alias element (that renames texture file paths found within a source COLLADA file) referenced in a kml:Model) satisfies the following constraints:
      1. the value of the child kml:targetHref element is a URI that refers to an image (texture) resource;
      2. the value of the child kml:sourceHref element corresponds to a file reference appearing within the 3D object resource referenced in the preceding sibling kml:Link element.
      See Also:
      • "OGC 07-134r2, ATC 29: Alias"
    • verifyModelOrientationNotEmpty

      public void verifyModelOrientationNotEmpty()
      [Test] Verifies that if a kml:Orientation element is not a descendant of kml:Update, then it contains at least one of the following KML elements: kml:heading, kml:tilt, or kml:roll.
      See Also:
      • "OGC 07-134r2, ATC 32: Orientation - minimal content"
    • verifyModelContent

      public void verifyModelContent()
      Test] Verifies that the content of a kml:Model element satisfies all of the following constraints:
      1. it contains the kml:Link and kml:Location elements;
      2. if it is not a descendant of kml:Update and the target resource refers to any texture files, then there must be a kml:ResourceMap/kml:Alias for each related texture file.

      Note: This test doesn't first examine the model resource to find all texture file references, since the content type is not known for certain (although a COLLADA file is probably the most common one in use, "model/vnd.collada+xml", *.dae).

      See Also:
      • "OGC 07-134r2, ATC 34: Model"
    • checkModelResourceMap

      void checkModelResourceMap(Element resourceMap, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      Checks the content of a model resource for the occurrence of the expected source file names given by aliases contained in a kml:ResourceMap. The model resource (e.g. a COLLADA file) is referenced by a kml:Model/kml:Link element.
       
       <Model id="model-id">
         <Link>
           <href>...</href>
         </Link>
         <ResourceMap>
           <Alias>
             <targetHref>...</targetHref>
             <sourceHref>...</sourceHref>
           </Alias>
         </ResourceMap>
       </Model>
       
       
      Parameters:
      resourceMap - A kml:ResourceMap element.
      errHandler - The error handler that receives reports of any constraint violations.
    • checkInnerBoundaries

      void checkInnerBoundaries(Element polygonElem, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if any inner boundary of a polygon is not within the outer boundary.
      Parameters:
      polygonElem - A DOM Element representing a kml:Polygon element.
      errHandler - The error handler that receives any errors that were detected.
    • checkAltitudeModeNotClampToGround

      void checkAltitudeModeNotClampToGround(Element geometry, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if the geometry element has a kml:altitudeMode of "clampToGround" (default value) and the kml:extrude value is "true".
      Parameters:
      geometry - A geometry element where kml:extrude is "true".
      errHandler - The error handler that receives any errors that were detected.
    • checkLonValues

      void checkLonValues(Element box, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if any box elements having longitude children are invalid; kml:east must be greater than kml:west.
      Parameters:
      box - A box element (kml:LatLonAltBox, kml:LatLonBox)
      errHandler - The error handler that receives any errors that were detected.
    • checkLatValues

      void checkLatValues(Element box, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if any box elements having latitude children are invalid; kml:north must be greater than kml:south.
      Parameters:
      box - A box element (kml:LatLonAltBox, kml:LatLonBox)
      errHandler - The error handler that receives any errors that were detected.
    • checkAltValues

      void checkAltValues(Element latLonAltBox, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if any kml:LatLonAltBox elements altitude children are invalid; kml:maxAltitude must be greater than or equal to kml:minAltitude.
      Parameters:
      latLonAltBox - A kml:LatLonAltBox element.
      errHandler - The error handler that receives any errors that were detected.
    • checkAltMode

      void checkAltMode(Element latLonAltBox, org.opengis.cite.validation.ValidationErrorHandler errHandler)
      An error is reported if any kml:LatLonAltBox element's altitude children are present but the kml:altitudeMode == clampToGround (also the default value).
      Parameters:
      latLonAltBox - A kml:LatLonAltBox element.
      errHandler - The error handler that receives any errors that were detected.