You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by mi...@apache.org on 2022/11/18 19:10:38 UTC

[streampipes] branch STREAMPIPES-584 updated (e1395138e -> 3c0a787ab)

This is an automated email from the ASF dual-hosted git repository.

micklich pushed a change to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git


    from e1395138e change image with other icons
     new f483618a3 stylecheck misc. and optimized import
     new 024da2a55 fix license
     new 599d32947 misc style style check fixes and code format
     new d1104ddab handel invalid epsg code due input field
     new e2f07c16d implement checks against the DB if valid and correct version is used
     new 3c0a787ab run style check and add missing license

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../SpNotSupportedGeometryException.java           |  48 ++++++---
 .../geo/jvm/jts/helper/SpReprojectionBuilder.java  | 108 ++++++++++++++++++---
 .../processor/reprojection/ProjTransformation.java |  59 +++++++++--
 .../reprojection/ProjTransformationController.java |   8 +-
 4 files changed, 179 insertions(+), 44 deletions(-)


[streampipes] 03/06: misc style style check fixes and code format

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 599d32947411eada07179d9cb093e9bae5e7e7c4
Author: micklich <mi...@apache.org>
AuthorDate: Fri Nov 18 09:06:56 2022 +0100

    misc style style check fixes and code format
---
 .../SpNotSupportedGeometryException.java           | 30 +++++++++++-----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
index 244e975b0..f06535087 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
@@ -17,25 +17,25 @@
  */
 package org.apache.streampipes.processors.geo.jvm.jts.exceptions;
 
-
 public class SpNotSupportedGeometryException extends Exception {
 
-  public SpNotSupportedGeometryException() {
-  }
+    public SpNotSupportedGeometryException() {
+    }
 
-  public SpNotSupportedGeometryException(String message) {
-    super(message);
-  }
+    public SpNotSupportedGeometryException(String message) {
+        super(message);
+    }
 
-  public SpNotSupportedGeometryException(String message, Throwable cause) {
-    super(message, cause);
-  }
+    public SpNotSupportedGeometryException(String message, Throwable cause) {
+        super(message, cause);
+    }
 
-  public SpNotSupportedGeometryException(Throwable cause) {
-    super(cause);
-  }
+    public SpNotSupportedGeometryException(Throwable cause) {
+        super(cause);
+    }
 
-  public SpNotSupportedGeometryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
-    super(message, cause, enableSuppression, writableStackTrace);
-  }
+    public SpNotSupportedGeometryException(String message, Throwable cause, boolean enableSuppression,
+                                           boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
 }


[streampipes] 04/06: handel invalid epsg code due input field

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit d1104ddabb8c148371bf9960813a1471c3b7e32c
Author: micklich <mi...@apache.org>
AuthorDate: Fri Nov 18 10:24:16 2022 +0100

    handel invalid epsg code due input field
    
    handel invalid epsg code due input field
---
 .../jvm/jts/processor/reprojection/ProjTransformation.java | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
index 2ce685134..b4c309af5 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
@@ -16,6 +16,7 @@
  */
 package org.apache.streampipes.processors.geo.jvm.jts.processor.reprojection;
 
+import org.apache.streampipes.commons.exceptions.SpRuntimeException;
 import org.apache.streampipes.logging.api.Logger;
 import org.apache.streampipes.model.runtime.Event;
 import org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
@@ -26,8 +27,10 @@ import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext;
 import org.apache.streampipes.wrapper.routing.SpOutputCollector;
 import org.apache.streampipes.wrapper.runtime.EventProcessor;
 
+import org.apache.sis.referencing.CRS;
 import org.apache.sis.setup.Configuration;
 import org.locationtech.jts.geom.Geometry;
+import org.opengis.util.FactoryException;
 import org.postgresql.ds.PGSimpleDataSource;
 
 import javax.sql.DataSource;
@@ -46,7 +49,16 @@ public class ProjTransformation implements EventProcessor<ProjTransformationPara
         targetEPSG = params.getTargetEpsg();
 
         //TODO: this has to move to a central place in the streampipes backend
+        // otherwise Connection to SpatialMetadata database is already initialized occur
         Configuration.current().setDatabase(ProjTransformation::createDataSource);
+
+        // checks invalid input field. SIS got a cache system but if it is in the cache already it is also vallid
+        try {
+            System.out.println(CRS.forCode("EPSG::" + targetEPSG));
+        } catch (FactoryException e) {
+            throw new SpRuntimeException("Your chosen EPSG Code " + targetEPSG + " is not valid. "
+                    + "Check EPSG on https://spatialreference.org");
+        }
     }
 
     @Override
@@ -84,7 +96,7 @@ public class ProjTransformation implements EventProcessor<ProjTransformationPara
     protected static DataSource createDataSource() {
         PGSimpleDataSource ds = new PGSimpleDataSource();
         // HAS TO BE ADJUSTED OR INCLUDED IN THE AUTO_DISCOVERY
-        String[] serverAddresses = {"192.168.1.100"};
+        String[] serverAddresses = {"192.168.178.100"};
         ds.setServerNames(serverAddresses);
         int[] serverPortNumbers = {54320};
         ds.setPortNumbers(serverPortNumbers);


[streampipes] 05/06: implement checks against the DB if valid and correct version is used

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit e2f07c16dc723cae17ae799cd85b982a65416d31
Author: micklich <mi...@apache.org>
AuthorDate: Fri Nov 18 20:05:10 2022 +0100

    implement checks against the DB if valid and correct version is used
---
 .../geo/jvm/jts/helper/SpReprojectionBuilder.java  | 55 ++++++++++++++++++++++
 .../processor/reprojection/ProjTransformation.java | 42 ++++++++++++++---
 2 files changed, 90 insertions(+), 7 deletions(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
index 28ae4bff3..4ebffbdac 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
@@ -5,6 +5,7 @@ import org.locationtech.jts.geom.CoordinateList;
 import org.locationtech.jts.geom.CoordinateSequence;
 import org.locationtech.jts.geom.Geometry;
 import org.locationtech.jts.geom.impl.CoordinateArraySequence;
+
 import org.apache.streampipes.processors.geo.jvm.jts.exceptions.*;
 
 import java.util.List;
@@ -15,12 +16,16 @@ import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.crs.AbstractCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.locationtech.jts.geom.*;
+
+import org.opengis.metadata.citation.Citation;
+import org.opengis.referencing.crs.CRSAuthorityFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.util.FactoryException;
 
+
 public class SpReprojectionBuilder {
 
     public static Geometry reprojectSpGeometry(Geometry geom, Integer targetEPSG) throws SpNotSupportedGeometryException {
@@ -223,4 +228,54 @@ public class SpReprojectionBuilder {
             return unit;
         }
     }
+
+    public static boolean isSisEpsgValid(Integer targetEPSG){
+        boolean check = true;
+
+        try {
+            CRS.forCode("EPSG::" + targetEPSG);
+        } catch (FactoryException ex) {
+            check = false;
+        }
+        return check;
+    }
+
+
+
+    private static CRSAuthorityFactory getFactory() throws FactoryException {
+        CRSAuthorityFactory factory;
+        try {
+            factory = CRS.getAuthorityFactory("EPSG");
+        } catch (FactoryException e) {
+            throw new FactoryException (e);
+        }
+        return factory;
+    }
+
+    public static boolean isSisConfigurationValid() throws FactoryException {
+        boolean check = true;
+        CRSAuthorityFactory factory = SpReprojectionBuilder.getFactory();
+        Citation authority = factory.getAuthority();
+        if (authority == null) {
+            check = false;
+        }
+        return check;
+    }
+
+    public static boolean isSisDbCorrectVersion() throws FactoryException {
+        boolean check = true;
+        CRSAuthorityFactory factory = SpReprojectionBuilder.getFactory();
+        Citation authority = factory.getAuthority();
+        if (!authority.getEdition().toString().equals("9.9.1")){
+            check = false;
+        }
+        return check;
+    }
+
+    public static String getSisDbVersion() throws FactoryException {
+        CRSAuthorityFactory factory = SpReprojectionBuilder.getFactory();
+        Citation authority = factory.getAuthority();
+        String version = authority.getEdition().toString();
+        return version;
+    }
 }
diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
index b4c309af5..daeb60aef 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
@@ -27,7 +27,6 @@ import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext;
 import org.apache.streampipes.wrapper.routing.SpOutputCollector;
 import org.apache.streampipes.wrapper.runtime.EventProcessor;
 
-import org.apache.sis.referencing.CRS;
 import org.apache.sis.setup.Configuration;
 import org.locationtech.jts.geom.Geometry;
 import org.opengis.util.FactoryException;
@@ -50,13 +49,42 @@ public class ProjTransformation implements EventProcessor<ProjTransformationPara
 
         //TODO: this has to move to a central place in the streampipes backend
         // otherwise Connection to SpatialMetadata database is already initialized occur
-        Configuration.current().setDatabase(ProjTransformation::createDataSource);
 
-        // checks invalid input field. SIS got a cache system but if it is in the cache already it is also vallid
         try {
-            System.out.println(CRS.forCode("EPSG::" + targetEPSG));
+            Configuration.current().setDatabase(ProjTransformation::createDataSource);
+        } catch (IllegalStateException e) {
+            logger.info("Setup was already established");
+            // catch the exceptions due connection is already initialized.
+        }
+
+
+        // check if SIS DB is set up with imported data or is null
+        try {
+            if (SpReprojectionBuilder.isSisConfigurationValid()){
+                logger.info("SIS DB Settings successful checked ");
+            } else {
+                logger.warn("The required EPSG database is not imported");
+                //TODO implement fallback option with proj4j
+                throw new SpRuntimeException("Database not set and ready for fallback ");
+            }
+        } catch (FactoryException e) {
+            throw new SpRuntimeException("Something unexpected happened " + e);
+        }
+
+        // check if SIS DB has the supported 9.9.1 Version.
+        try {
+            if (!SpReprojectionBuilder.isSisDbCorrectVersion()) {
+                logger.warn("Not supported EPSG DB used.");
+                throw new SpRuntimeException("Your current EPSG DB version " + SpReprojectionBuilder.getSisDbVersion()
+                        + " is not the supported 9.9.1 version. ");
+            }
         } catch (FactoryException e) {
-            throw new SpRuntimeException("Your chosen EPSG Code " + targetEPSG + " is not valid. "
+            throw new SpRuntimeException("Something unexpected happened " + e);
+        }
+
+        // checks if Input EPSG in valid and exists in EPSG DB
+        if (!SpReprojectionBuilder.isSisEpsgValid(targetEPSG)) {
+            throw new SpRuntimeException("Your chosen EPSG Code " + targetEPSG + " is not valid or supported. "
                     + "Check EPSG on https://spatialreference.org");
         }
     }
@@ -81,8 +109,8 @@ public class ProjTransformation implements EventProcessor<ProjTransformationPara
 
             out.collect(in);
         } else {
-            logger.warn("An empty point geometry is created in " + ProjTransformationController.EPA_NAME + " "
-                    + "due invalid input values. Check used epsg Code:" + epsgCode);
+            logger.warn("An empty point geometry is created in " + ProjTransformationController.EPA_NAME + " " +
+                    "due invalid input values. Check used epsg Code:" + epsgCode);
         }
     }
 


[streampipes] 01/06: stylecheck misc. and optimized import

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit f483618a30ca43e26bc16c401325274d8b3838b9
Author: micklich <mi...@apache.org>
AuthorDate: Wed Nov 16 09:55:27 2022 +0100

    stylecheck misc. and optimized import
---
 .../jvm/jts/processor/reprojection/ProjTransformation.java    | 11 +++++------
 .../processor/reprojection/ProjTransformationController.java  |  8 ++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
index 58a9d5623..2ce685134 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformation.java
@@ -17,19 +17,18 @@
 package org.apache.streampipes.processors.geo.jvm.jts.processor.reprojection;
 
 import org.apache.streampipes.logging.api.Logger;
-import org.locationtech.jts.geom.Geometry;
-
+import org.apache.streampipes.model.runtime.Event;
+import org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
 import org.apache.streampipes.processors.geo.jvm.jts.helper.SpGeometryBuilder;
 import org.apache.streampipes.processors.geo.jvm.jts.helper.SpReprojectionBuilder;
-import org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
 import org.apache.streampipes.processors.geo.jvm.jts.processor.latLngToGeo.LatLngToGeoParameter;
 import org.apache.streampipes.wrapper.context.EventProcessorRuntimeContext;
-import org.apache.streampipes.wrapper.runtime.EventProcessor;
 import org.apache.streampipes.wrapper.routing.SpOutputCollector;
-import org.apache.streampipes.model.runtime.Event;
+import org.apache.streampipes.wrapper.runtime.EventProcessor;
 
-import org.postgresql.ds.PGSimpleDataSource;
 import org.apache.sis.setup.Configuration;
+import org.locationtech.jts.geom.Geometry;
+import org.postgresql.ds.PGSimpleDataSource;
 
 import javax.sql.DataSource;
 
diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformationController.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformationController.java
index b40ba5000..55735f29b 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformationController.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/reprojection/ProjTransformationController.java
@@ -23,16 +23,16 @@ import org.apache.streampipes.model.schema.PropertyScope;
 import org.apache.streampipes.sdk.builder.ProcessingElementBuilder;
 import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder;
 import org.apache.streampipes.sdk.extractor.ProcessingElementParameterExtractor;
-//import org.apache.streampipes.sdk.helpers.*;
 import org.apache.streampipes.sdk.helpers.EpRequirements;
 import org.apache.streampipes.sdk.helpers.Labels;
 import org.apache.streampipes.sdk.helpers.Locales;
 import org.apache.streampipes.sdk.helpers.OutputStrategies;
 import org.apache.streampipes.sdk.helpers.SupportedFormats;
 import org.apache.streampipes.sdk.helpers.SupportedProtocols;
+import org.apache.streampipes.sdk.utils.Assets;
 import org.apache.streampipes.wrapper.standalone.ConfiguredEventProcessor;
 import org.apache.streampipes.wrapper.standalone.declarer.StandaloneEventProcessingDeclarer;
-import org.apache.streampipes.sdk.utils.Assets;
+
 
 public class ProjTransformationController extends StandaloneEventProcessingDeclarer<ProjTransformationParameter> {
 
@@ -61,8 +61,8 @@ public class ProjTransformationController extends StandaloneEventProcessingDecla
 
 
     @Override
-    public ConfiguredEventProcessor<ProjTransformationParameter> onInvocation(DataProcessorInvocation graph,
-                                                                              ProcessingElementParameterExtractor extractor) {
+    public ConfiguredEventProcessor<ProjTransformationParameter> onInvocation(
+            DataProcessorInvocation graph, ProcessingElementParameterExtractor extractor) {
 
         String wktString = extractor.mappingPropertyValue(WKT_KEY);
         String sourceEpsg = extractor.mappingPropertyValue(SOURCE_EPSG_KEY);


[streampipes] 06/06: run style check and add missing license

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 3c0a787ab3bad4e23503c51f27076df86ad60253
Author: micklich <mi...@apache.org>
AuthorDate: Fri Nov 18 20:09:49 2022 +0100

    run style check and add missing license
---
 .../geo/jvm/jts/helper/SpReprojectionBuilder.java  | 65 +++++++++++++++-------
 1 file changed, 44 insertions(+), 21 deletions(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
index 4ebffbdac..82ce4c2ce 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpReprojectionBuilder.java
@@ -1,22 +1,37 @@
-package org.apache.streampipes.processors.geo.jvm.jts.helper;
-
-import org.locationtech.jts.geom.Coordinate;
-import org.locationtech.jts.geom.CoordinateList;
-import org.locationtech.jts.geom.CoordinateSequence;
-import org.locationtech.jts.geom.Geometry;
-import org.locationtech.jts.geom.impl.CoordinateArraySequence;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
-import org.apache.streampipes.processors.geo.jvm.jts.exceptions.*;
+package org.apache.streampipes.processors.geo.jvm.jts.helper;
 
-import java.util.List;
-import java.util.stream.Collectors;
+import org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
 
 import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.crs.AbstractCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
-import org.locationtech.jts.geom.*;
-
+import org.locationtech.jts.geom.Coordinate;
+import org.locationtech.jts.geom.CoordinateList;
+import org.locationtech.jts.geom.CoordinateSequence;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.geom.GeometryFactory;
+import org.locationtech.jts.geom.Point;
+import org.locationtech.jts.geom.PrecisionModel;
+import org.locationtech.jts.geom.impl.CoordinateArraySequence;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.crs.CRSAuthorityFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -25,10 +40,14 @@ import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.TransformException;
 import org.opengis.util.FactoryException;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 
 public class SpReprojectionBuilder {
 
-    public static Geometry reprojectSpGeometry(Geometry geom, Integer targetEPSG) throws SpNotSupportedGeometryException {
+    public static Geometry reprojectSpGeometry(Geometry geom, Integer targetEPSG)
+            throws SpNotSupportedGeometryException {
 
         Geometry output = null;
 
@@ -37,7 +56,9 @@ public class SpReprojectionBuilder {
         CoordinateOperation operator = getOperator(sourcerCRS, targetrCRS);
 
         CoordinateList geomCoordList = new CoordinateList(geom.getCoordinates());
-        List<Coordinate> projectedList = geomCoordList.stream().map(coordinate -> transformCoordinate(coordinate, operator)).collect(Collectors.toList());
+        List<Coordinate> projectedList =
+                geomCoordList.stream().map(coordinate -> transformCoordinate(coordinate, operator))
+                        .collect(Collectors.toList());
 
         CoordinateSequence cs = new CoordinateArraySequence(projectedList.toArray(new Coordinate[]{}));
 
@@ -46,7 +67,8 @@ public class SpReprojectionBuilder {
         return output;
     }
 
-    public static Geometry createSimpleSPGeom(CoordinateSequence cs, String geometryType, Integer targetEPSG) throws SpNotSupportedGeometryException {
+    public static Geometry createSimpleSPGeom(CoordinateSequence cs, String geometryType, Integer targetEPSG)
+            throws SpNotSupportedGeometryException {
         Geometry output = null;
         PrecisionModel prec = SpGeometryBuilder.getPrecisionModel(targetEPSG);
         GeometryFactory geomFactory = new GeometryFactory(prec, targetEPSG);
@@ -114,7 +136,8 @@ public class SpReprojectionBuilder {
         return output;
     }
 
-    protected static CoordinateOperation getOperator(CoordinateReferenceSystem source, CoordinateReferenceSystem target) {
+    protected static CoordinateOperation getOperator(CoordinateReferenceSystem source,
+                                                     CoordinateReferenceSystem target) {
 
         CoordinateOperation op = null;
 
@@ -141,7 +164,8 @@ public class SpReprojectionBuilder {
         return unit;
     }
 
-    public static Geometry unifyEPSG(Geometry geomA, Geometry geomB, boolean useFirstGeomAsBase) throws SpNotSupportedGeometryException {
+    public static Geometry unifyEPSG(Geometry geomA, Geometry geomB, boolean useFirstGeomAsBase)
+            throws SpNotSupportedGeometryException {
 
         Geometry tempGeomA = geomA;
         Geometry tempGeomB = geomB;
@@ -229,7 +253,7 @@ public class SpReprojectionBuilder {
         }
     }
 
-    public static boolean isSisEpsgValid(Integer targetEPSG){
+    public static boolean isSisEpsgValid(Integer targetEPSG) {
         boolean check = true;
 
         try {
@@ -241,13 +265,12 @@ public class SpReprojectionBuilder {
     }
 
 
-
     private static CRSAuthorityFactory getFactory() throws FactoryException {
         CRSAuthorityFactory factory;
         try {
             factory = CRS.getAuthorityFactory("EPSG");
         } catch (FactoryException e) {
-            throw new FactoryException (e);
+            throw new FactoryException(e);
         }
         return factory;
     }
@@ -266,7 +289,7 @@ public class SpReprojectionBuilder {
         boolean check = true;
         CRSAuthorityFactory factory = SpReprojectionBuilder.getFactory();
         Citation authority = factory.getAuthority();
-        if (!authority.getEdition().toString().equals("9.9.1")){
+        if (!authority.getEdition().toString().equals("9.9.1")) {
             check = false;
         }
         return check;


[streampipes] 02/06: fix license

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

micklich pushed a commit to branch STREAMPIPES-584
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 024da2a55a85b67b867d5e46e1d33106bfb09cf1
Author: micklich <mi...@apache.org>
AuthorDate: Fri Nov 18 09:01:50 2022 +0100

    fix license
---
 .../exceptions/SpNotSupportedGeometryException.java  | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
index 459a650c8..244e975b0 100755
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/exceptions/SpNotSupportedGeometryException.java
@@ -1,5 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 package org.apache.streampipes.processors.geo.jvm.jts.exceptions;
 
+
 public class SpNotSupportedGeometryException extends Exception {
 
   public SpNotSupportedGeometryException() {
@@ -20,4 +38,4 @@ public class SpNotSupportedGeometryException extends Exception {
   public SpNotSupportedGeometryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
     super(message, cause, enableSuppression, writableStackTrace);
   }
-}
\ No newline at end of file
+}