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:44 UTC

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

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;