Search in sources :

Example 31 with DependsOnMethod

use of org.apache.sis.test.DependsOnMethod in project sis by apache.

the class DefaultProjectedCRSTest method testWKT2_WithMixedUnits.

/**
 * Tests WKT 2 formatting. Contrarily to the WKT 1 formatting, in this case it does not matter
 * if we mix the units of measurement because the unit is declared for each parameter and axis.
 *
 * @throws FactoryException if the CRS creation failed.
 */
@Test
@DependsOnMethod("testWKT1")
public void testWKT2_WithMixedUnits() throws FactoryException {
    final ProjectedCRS crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
    assertWktEquals(Convention.WKT2, "PROJCRS[“NTF (Paris) / Lambert zone II”,\n" + "  BASEGEODCRS[“NTF (Paris)”,\n" + "    DATUM[“Nouvelle Triangulation Francaise”,\n" + "      ELLIPSOID[“NTF”, 6378249.2, 293.4660212936269, LENGTHUNIT[“metre”, 1]]],\n" + "      PRIMEM[“Paris”, 2.5969213, ANGLEUNIT[“grad”, 0.015707963267948967]]],\n" + "  CONVERSION[“Lambert zone II”,\n" + "    METHOD[“Lambert Conic Conformal (1SP)”, ID[“EPSG”, 9801]],\n" + "    PARAMETER[“Latitude of natural origin”, 52.0, ANGLEUNIT[“grad”, 0.015707963267948967], ID[“EPSG”, 8801]],\n" + "    PARAMETER[“Longitude of natural origin”, 0.0, ANGLEUNIT[“degree”, 0.017453292519943295], ID[“EPSG”, 8802]],\n" + "    PARAMETER[“Scale factor at natural origin”, 0.99987742, SCALEUNIT[“unity”, 1], ID[“EPSG”, 8805]],\n" + "    PARAMETER[“False easting”, 600000.0, LENGTHUNIT[“metre”, 1], ID[“EPSG”, 8806]],\n" + "    PARAMETER[“False northing”, 2200000.0, LENGTHUNIT[“metre”, 1], ID[“EPSG”, 8807]]],\n" + "  CS[Cartesian, 2],\n" + "    AXIS[“Easting (E)”, east, ORDER[1]],\n" + "    AXIS[“Northing (N)”, north, ORDER[2]],\n" + "    LENGTHUNIT[“metre”, 1],\n" + "  ID[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]", crs);
    assertWktEquals(Convention.WKT2_SIMPLIFIED, "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" + "  BaseGeodCRS[“NTF (Paris)”,\n" + "    Datum[“Nouvelle Triangulation Francaise”,\n" + "      Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" + "      PrimeMeridian[“Paris”, 2.5969213, Unit[“grad”, 0.015707963267948967]],\n" + "    Unit[“degree”, 0.017453292519943295]],\n" + "  Conversion[“Lambert zone II”,\n" + "    Method[“Lambert Conic Conformal (1SP)”],\n" + "    Parameter[“Latitude of natural origin”, 52.0, Unit[“grad”, 0.015707963267948967]],\n" + "    Parameter[“Longitude of natural origin”, 0.0],\n" + "    Parameter[“Scale factor at natural origin”, 0.99987742],\n" + "    Parameter[“False easting”, 600000.0],\n" + "    Parameter[“False northing”, 2200000.0]],\n" + "  CS[Cartesian, 2],\n" + "    Axis[“Easting (E)”, east],\n" + "    Axis[“Northing (N)”, north],\n" + "    Unit[“metre”, 1],\n" + "  Id[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]", crs);
}
Also used : ProjectedCRS(org.opengis.referencing.crs.ProjectedCRS) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 32 with DependsOnMethod

use of org.apache.sis.test.DependsOnMethod in project sis by apache.

the class ServicesForMetadataTest method testSetSpatialTemporalBounds.

/**
 * Tests (indirectly) {@link ServicesForMetadata#setBounds(Envelope, DefaultSpatialTemporalExtent)}.
 *
 * @throws TransformException should never happen.
 */
@Test
@DependsOnMethod({ "testSetGeographicBoundsFrom4D", "testSetVerticalBoundsFromGeoid" })
public void testSetSpatialTemporalBounds() throws TransformException {
    final DefaultSpatialTemporalExtent extent = new DefaultSpatialTemporalExtent();
    extent.setBounds(createEnvelope(HardCodedCRS.GEOID_3D));
    verifySpatialExtent((GeographicBoundingBox) getSingleton(extent.getSpatialExtent()));
    verifyVerticalExtent(CommonCRS.Vertical.MEAN_SEA_LEVEL, extent.getVerticalExtent());
}
Also used : DefaultSpatialTemporalExtent(org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 33 with DependsOnMethod

use of org.apache.sis.test.DependsOnMethod in project sis by apache.

the class LongitudeRotationTest method testWKT.

/**
 * Tests WKT formatting. Note that we do not expect a {@code Param_MT[“Longitude rotation”, …]} text
 * since we want to make clear that Apache SIS implements longitude rotation by an affine transform.
 */
@Test
@DependsOnMethod("testCreateMathTransform")
public void testWKT() {
    final LongitudeRotation provider = new LongitudeRotation();
    final ParameterValueGroup p = provider.getParameters().createValue();
    p.parameter("Longitude offset").setValue(2.5969213, Units.GRAD);
    assertWktEquals("PARAM_MT[“Affine parametric transformation”,\n" + "  PARAMETER[“A2”, 2.33722917, ID[“EPSG”, 8625]]]", provider.createMathTransform(null, p));
}
Also used : ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 34 with DependsOnMethod

use of org.apache.sis.test.DependsOnMethod in project sis by apache.

the class ParameterFormatTest method testMultiOccurrence.

/**
 * Tests the formatting of a parameter value group with a cardinality
 * invalid according ISO 19111, but allowed by Apache SIS implementation.
 * ISO 19111 restricts {@link ParameterValue} cardinality to the [0 … 1] range,
 * but SIS can handle arbitrary number of occurrences (2 in this test).
 */
@Test
@DependsOnMethod("testExtendedCardinality")
public void testMultiOccurrence() {
    final ParameterValueGroup group = DefaultParameterDescriptorGroupTest.M1_M1_O1_O2.createValue();
    group.parameter("Mandatory 2").setValue(20);
    final ParameterValue<?> value = group.parameter("Optional 4");
    value.setValue(40);
    /*
         * Adding a second occurrence of the same parameter.
         * Not straightforward because not allowed by ISO 19111.
         */
    final ParameterValue<?> secondOccurrence = value.getDescriptor().createValue();
    group.values().add(secondOccurrence);
    secondOccurrence.setValue(50);
    final ParameterFormat format = new ParameterFormat(null, null);
    format.setContentLevel(ParameterFormat.ContentLevel.BRIEF);
    final String text = format.format(group);
    assertMultilinesEquals("Test group\n" + "┌─────────────┬─────────┬──────────────┬───────┐\n" + "│ Name        │ Type    │ Value domain │ Value │\n" + "├─────────────┼─────────┼──────────────┼───────┤\n" + "│ Mandatory 1 │ Integer │              │    10 │\n" + "│ Mandatory 2 │ Integer │              │    20 │\n" + "│ Optional 4  │ Integer │              │    40 │\n" + "│      ″      │    ″    │      ″       │    50 │\n" + "└─────────────┴─────────┴──────────────┴───────┘\n", text);
}
Also used : ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 35 with DependsOnMethod

use of org.apache.sis.test.DependsOnMethod in project sis by apache.

the class ParameterMarshallingTest method testURIValue.

/**
 * Tests (un)marshalling of a parameter with a URI value.
 *
 * @throws JAXBException if an error occurred during marshalling or unmarshalling.
 * @throws URISyntaxException should never happen.
 */
@Test
@DependsOnMethod("testStringValue")
public void testURIValue() throws JAXBException, URISyntaxException {
    final DefaultParameterValue<URI> parameter = create(URI.class, null);
    parameter.setValue(new URI("http://www.opengis.org"));
    testMarshallAndUnmarshall(parameter, "<gml:ParameterValue xmlns:gml=\"" + Namespaces.GML + "\">\n" + "  <gml:valueFile>http://www.opengis.org</gml:valueFile>\n" + "    <gml:operationParameter>" + "      <gml:OperationParameter>" + "        <gml:name>A parameter of type URI</gml:name>" + "      </gml:OperationParameter>" + "    </gml:operationParameter>" + "</gml:ParameterValue>");
}
Also used : URI(java.net.URI) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Aggregations

DependsOnMethod (org.apache.sis.test.DependsOnMethod)298 Test (org.junit.Test)296 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)27 ProjectedCRS (org.opengis.referencing.crs.ProjectedCRS)23 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)21 CoordinateOperation (org.opengis.referencing.operation.CoordinateOperation)21 Rectangle (java.awt.Rectangle)19 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)19 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)18 GeographicCRS (org.opengis.referencing.crs.GeographicCRS)15 Random (java.util.Random)11 Matrix (org.opengis.referencing.operation.Matrix)11 HashMap (java.util.HashMap)10 IdentifiedObject (org.opengis.referencing.IdentifiedObject)8 ReferenceIdentifier (org.opengis.referencing.ReferenceIdentifier)8 MathTransform (org.opengis.referencing.operation.MathTransform)8 DefaultFeatureType (org.apache.sis.feature.DefaultFeatureType)7 DefaultFeatureTypeTest (org.apache.sis.feature.DefaultFeatureTypeTest)7 DirectPosition2D (org.apache.sis.geometry.DirectPosition2D)7 GeneralParameterDescriptor (org.opengis.parameter.GeneralParameterDescriptor)7