Search in sources :

Example 11 with ProcessDescriptor

use of org.geotoolkit.process.ProcessDescriptor in project geotoolkit by Geomatys.

the class NearestTest method testNearest.

/**
 * Test nearest process
 */
@Test
public void testNearest() throws FactoryException, ProcessException, NoSuchIdentifierException {
    // Inputs
    final FeatureCollection featureList = buildFeatureList();
    final Geometry geom = buildIntersectionGeometry();
    // Process
    ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:nearest");
    ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("feature_in").setValue(featureList);
    in.parameter("geometry_in").setValue(geom);
    org.geotoolkit.process.Process proc = desc.createProcess(in);
    // Features out
    final FeatureSet featureListOut = (FeatureSet) proc.call().parameter("feature_out").getValue();
    // Expected Features out
    final FeatureSet featureListResult = buildResultList();
    compare(featureListResult, featureListOut);
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) ProcessDescriptor(org.geotoolkit.process.ProcessDescriptor) FeatureSet(org.apache.sis.storage.FeatureSet) AbstractProcessTest(org.geotoolkit.processing.vector.AbstractProcessTest) Test(org.junit.Test)

Example 12 with ProcessDescriptor

use of org.geotoolkit.process.ProcessDescriptor in project geotoolkit by Geomatys.

the class RegroupTest method testRegroupGeometrySelected.

@Test
public void testRegroupGeometrySelected() throws ProcessException, NoSuchIdentifierException, FactoryException {
    // Inputs
    final FeatureCollection featureList = buildFeatureList();
    // Process
    ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:regroup");
    ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("feature_in").setValue(featureList);
    in.parameter("regroup_attribute").setValue("type");
    in.parameter("geometry_name").setValue("geom2");
    org.geotoolkit.process.Process proc = desc.createProcess(in);
    // Features out
    final FeatureCollection featureListOut = (FeatureCollection) proc.call().parameter("feature_out").getValue();
    // Expected Features out
    final FeatureCollection featureListResult = buildResultList2();
    compare(featureListResult, featureListOut);
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) ProcessDescriptor(org.geotoolkit.process.ProcessDescriptor) AbstractProcessTest(org.geotoolkit.processing.vector.AbstractProcessTest) Test(org.junit.Test)

Example 13 with ProcessDescriptor

use of org.geotoolkit.process.ProcessDescriptor in project geotoolkit by Geomatys.

the class SpatialJoinTest method testSpacialJoinIntersection.

/**
 * Test SpatialJoin process with Intersection method
 */
@Test
public void testSpacialJoinIntersection() throws ProcessException, NoSuchIdentifierException, FactoryException {
    // Inputs
    final FeatureSet targetFeatures = buildFeatureListInter1();
    final FeatureSet sourceFeatures = buildFeatureListInter2();
    // Process
    ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:spatialjoin");
    ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("feature_in").setValue(sourceFeatures);
    in.parameter("feature_target").setValue(targetFeatures);
    in.parameter("intersect").setValue(true);
    org.geotoolkit.process.Process proc = desc.createProcess(in);
    // Features out
    final FeatureSet featureListOut = (FeatureSet) proc.call().parameter("feature_out").getValue();
    // Expected Features out
    final FeatureSet expectedList = buildResultInter();
    compare(expectedList, featureListOut);
}
Also used : ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) FeatureSet(org.apache.sis.storage.FeatureSet) ProcessDescriptor(org.geotoolkit.process.ProcessDescriptor) AbstractProcessTest(org.geotoolkit.processing.vector.AbstractProcessTest) Test(org.junit.Test)

Example 14 with ProcessDescriptor

use of org.geotoolkit.process.ProcessDescriptor in project geotoolkit by Geomatys.

the class AffineTransformTest method testAffineTransform.

@Test
public void testAffineTransform() throws ProcessException, NoSuchIdentifierException, FactoryException {
    // Inputs
    final FeatureCollection featureList = buildFeatureList();
    final AffineTransform transform = new AffineTransform();
    transform.setToTranslation(100, 100);
    // Process
    final ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:affinetransform");
    final ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("feature_in").setValue(featureList);
    in.parameter("transform_in").setValue(transform);
    final org.geotoolkit.process.Process proc = desc.createProcess(in);
    // Features out
    final FeatureCollection featureListOut = (FeatureCollection) proc.call().parameter("feature_out").getValue();
    // Expected Features out
    final FeatureCollection featureListResult = buildResultList();
    compare(featureListResult, featureListOut);
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) AffineTransform(java.awt.geom.AffineTransform) ProcessDescriptor(org.geotoolkit.process.ProcessDescriptor) AbstractProcessTest(org.geotoolkit.processing.vector.AbstractProcessTest) Test(org.junit.Test)

Example 15 with ProcessDescriptor

use of org.geotoolkit.process.ProcessDescriptor in project geotoolkit by Geomatys.

the class ClipTest method testClip.

@Test
public void testClip() throws ProcessException, NoSuchIdentifierException, FactoryException {
    // Inputs
    final FeatureCollection featureList = buildFeatureList();
    final FeatureCollection featuresClip = buildFeatureClip();
    // Process
    ProcessDescriptor desc = ProcessFinder.getProcessDescriptor(GeotkProcessingRegistry.NAME, "vector:clip");
    ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("feature_in").setValue(featureList);
    in.parameter("feature_clip").setValue(featuresClip);
    org.geotoolkit.process.Process proc = desc.createProcess(in);
    // Features out
    final FeatureCollection featureListOut = (FeatureCollection) proc.call().parameter("feature_out").getValue();
    // Expected Features out
    final FeatureCollection featureListResult = buildResultList();
    compare(featureListResult, featureListOut);
}
Also used : FeatureCollection(org.geotoolkit.storage.feature.FeatureCollection) ParameterValueGroup(org.opengis.parameter.ParameterValueGroup) ProcessDescriptor(org.geotoolkit.process.ProcessDescriptor) AbstractProcessTest(org.geotoolkit.processing.vector.AbstractProcessTest) Test(org.junit.Test)

Aggregations

ProcessDescriptor (org.geotoolkit.process.ProcessDescriptor)136 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)121 Test (org.junit.Test)108 AbstractProcessTest (org.geotoolkit.processing.AbstractProcessTest)62 Geometry (org.locationtech.jts.geom.Geometry)43 GeometryFactory (org.locationtech.jts.geom.GeometryFactory)33 Coordinate (org.locationtech.jts.geom.Coordinate)32 LinearRing (org.locationtech.jts.geom.LinearRing)31 Process (org.geotoolkit.process.Process)30 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)20 AbstractProcessTest (org.geotoolkit.processing.vector.AbstractProcessTest)18 GridCoverage (org.apache.sis.coverage.grid.GridCoverage)17 FeatureCollection (org.geotoolkit.storage.feature.FeatureCollection)15 GridCoverageBuilder (org.apache.sis.coverage.grid.GridCoverageBuilder)14 GridGeometry (org.apache.sis.coverage.grid.GridGeometry)14 FeatureSet (org.apache.sis.storage.FeatureSet)14 BufferedImage (java.awt.image.BufferedImage)13 RenderedImage (java.awt.image.RenderedImage)13 SampleDimension (org.apache.sis.coverage.SampleDimension)13 MathTransform (org.opengis.referencing.operation.MathTransform)13