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/15 23:36:52 UTC

[incubator-streampipes] 04/11: missing code format action

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/incubator-streampipes.git

commit 1b7fd052d865839e4b9670f7f717da5d258202dc
Author: micklich <fl...@mailbox.org>
AuthorDate: Sat Sep 17 20:24:58 2022 +0200

    missing code format action
---
 .../geo/jvm/jts/helper/SpGeometryBuilder.java      | 180 ++++++++++-----------
 1 file changed, 90 insertions(+), 90 deletions(-)

diff --git a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpGeometryBuilder.java b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpGeometryBuilder.java
index b241f9bdb..4edc9e2ad 100644
--- a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpGeometryBuilder.java
+++ b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/helper/SpGeometryBuilder.java
@@ -24,105 +24,105 @@ import org.locationtech.jts.io.WKTReader;
 
 public class SpGeometryBuilder {
 
-  final static double LONGITUDE_MIN = -180.00;
-  final static double LONGITUDE_MAX = 180.00;
-  final static double LATITUDE_MIN = -90;
-  final static double LATITUDE_MAX = 90;
-
-
-  /**
-   * Creates a {@link org.locationtech.jts.geom.Point} from <code>Latitude</code> and <code> Longitude</code> values
-   *
-   * @param lng  Longitude value in the range -180 &lt; Longitude &gt; 180
-   * @param lat  Latitude value in the range -90 &lt; LATITUDE &gt; 90
-   * @param epsg EPSG Code representing coordinate reference system
-   * @return a {@link org.locationtech.jts.geom.Point}. An empty point geometry is created if Latitude or Longitude values are out of range or has null values.
-   */
-  public static Point createSPGeom(Double lng, Double lat, Integer epsg) {
-    Point point;
-    PrecisionModel precisionModel = getPrecisionModel(epsg);
-    GeometryFactory geomFactory = new GeometryFactory(precisionModel, epsg);
-
-    //check if value is not null due missing stream value
-    if ((lng != null) && (lat != null)) {
-      //check if lat lng is in typical range
-      if (isInWGSCoordinateRange(lng, LONGITUDE_MIN, LONGITUDE_MAX) || isInWGSCoordinateRange(lat, LATITUDE_MIN, LATITUDE_MAX)) {
-
-        Coordinate coordinate = new Coordinate(lng, lat);
-        point = geomFactory.createPoint(coordinate);
-      } else {
-        // creates empty point if values are out of Range
-        point = geomFactory.createPoint();
-      }
-    } else {
-      // creates empty point if lng lat are null value
-      point = geomFactory.createPoint();
+    final static double LONGITUDE_MIN = -180.00;
+    final static double LONGITUDE_MAX = 180.00;
+    final static double LATITUDE_MIN = -90;
+    final static double LATITUDE_MAX = 90;
+
+
+    /**
+     * Creates a {@link org.locationtech.jts.geom.Point} from <code>Latitude</code> and <code> Longitude</code> values
+     *
+     * @param lng  Longitude value in the range -180 &lt; Longitude &gt; 180
+     * @param lat  Latitude value in the range -90 &lt; LATITUDE &gt; 90
+     * @param epsg EPSG Code representing coordinate reference system
+     * @return a {@link org.locationtech.jts.geom.Point}. An empty point geometry is created if Latitude or Longitude values are out of range or has null values.
+     */
+    public static Point createSPGeom(Double lng, Double lat, Integer epsg) {
+        Point point;
+        PrecisionModel precisionModel = getPrecisionModel(epsg);
+        GeometryFactory geomFactory = new GeometryFactory(precisionModel, epsg);
+
+        //check if value is not null due missing stream value
+        if ((lng != null) && (lat != null)) {
+            //check if lat lng is in typical range
+            if (isInWGSCoordinateRange(lng, LONGITUDE_MIN, LONGITUDE_MAX) || isInWGSCoordinateRange(lat, LATITUDE_MIN, LATITUDE_MAX)) {
+
+                Coordinate coordinate = new Coordinate(lng, lat);
+                point = geomFactory.createPoint(coordinate);
+            } else {
+                // creates empty point if values are out of Range
+                point = geomFactory.createPoint();
+            }
+        } else {
+            // creates empty point if lng lat are null value
+            point = geomFactory.createPoint();
+        }
+
+        return point;
     }
 
-    return point;
-  }
 
+    /**
+     * creates a Geometry from a wkt_string. string has to be valid and is not be checked. If invalid, an empty point
+     * geom is returned. method calls getPrecision method and creates a jts geometry factory and a WKT-parser object.
+     * from the wktString the
+     *
+     * @param wktString Well-known text representation of the input geometry
+     * @param epsg      EPSG Code representing SRID
+     * @return {@link org.locationtech.jts.geom.Geometry}. An empty point geometry is created if {@link org.locationtech.jts.io.ParseException} due invalid WKT-String
+     */
+    public static Geometry createSPGeom(String wktString, Integer epsg) {
 
-  /**
-   * creates a Geometry from a wkt_string. string has to be valid and is not be checked. If invalid, an empty point
-   * geom is returned. method calls getPrecision method and creates a jts geometry factory and a WKT-parser object.
-   * from the wktString the
-   *
-   * @param wktString Well-known text representation of the input geometry
-   * @param epsg      EPSG Code representing SRID
-   * @return {@link org.locationtech.jts.geom.Geometry}. An empty point geometry is created if {@link org.locationtech.jts.io.ParseException} due invalid WKT-String
-   */
-  public static Geometry createSPGeom(String wktString, Integer epsg) {
+        Geometry geom;
+        PrecisionModel prec = getPrecisionModel(epsg);
 
-    Geometry geom;
-    PrecisionModel prec = getPrecisionModel(epsg);
+        GeometryFactory geomFactory = new GeometryFactory(prec, epsg);
+        WKTReader wktReader = new WKTReader(geomFactory);
 
-    GeometryFactory geomFactory = new GeometryFactory(prec, epsg);
-    WKTReader wktReader = new WKTReader(geomFactory);
+        try {
+            geom = wktReader.read(wktString);
+        } catch (ParseException e) {
+            // if wktString is invalid, an empty point geometry will be created as returnedGeom
+            geom = geomFactory.createPoint();
+        }
 
-    try {
-      geom = wktReader.read(wktString);
-    } catch (ParseException e) {
-      // if wktString is invalid, an empty point geometry will be created as returnedGeom
-      geom = geomFactory.createPoint();
+        return geom;
     }
 
-    return geom;
-  }
-
-
-  /**
-   * Is in wgs coordinate range boolean.
-   *
-   * @param valueToCheck Any Value
-   * @param min          Min value to check
-   * @param max          max value to check
-   * @return true if value is in min max range
-   */
-  public static boolean isInWGSCoordinateRange(double valueToCheck, double min, double max){
-    return valueToCheck > min && valueToCheck < max;
-  }
-
-
-  /**
-   * Creates a {@link org.locationtech.jts.geom.PrecisionModel} with a specific precision.
-   * WGS84/WGS84 will be created a {@link org.locationtech.jts.geom.PrecisionModel#FIXED} with 7 decimal positions (scale 1000000).
-   * Any other epsg code will create a precision with {@link org.locationtech.jts.geom.PrecisionModel#FLOATING}.
-   *
-   * @param epsg EPSG Code representing SRID
-   * @return {@link org.locationtech.jts.geom.PrecisionModel}
-   */
-  protected static PrecisionModel getPrecisionModel(Integer epsg) {
-    PrecisionModel precisionModel;
-
-    if (epsg == 4326) {
-      // use scale precision with 7 decimal positions like default OSM
-      precisionModel = new PrecisionModel(1000000);
-    } else {
-      // use default constructor
-      precisionModel = new PrecisionModel();
+
+    /**
+     * Is in wgs coordinate range boolean.
+     *
+     * @param valueToCheck Any Value
+     * @param min          Min value to check
+     * @param max          max value to check
+     * @return true if value is in min max range
+     */
+    public static boolean isInWGSCoordinateRange(double valueToCheck, double min, double max) {
+        return valueToCheck > min && valueToCheck < max;
     }
 
-    return precisionModel;
-  }
+
+    /**
+     * Creates a {@link org.locationtech.jts.geom.PrecisionModel} with a specific precision.
+     * WGS84/WGS84 will be created a {@link org.locationtech.jts.geom.PrecisionModel#FIXED} with 7 decimal positions (scale 1000000).
+     * Any other epsg code will create a precision with {@link org.locationtech.jts.geom.PrecisionModel#FLOATING}.
+     *
+     * @param epsg EPSG Code representing SRID
+     * @return {@link org.locationtech.jts.geom.PrecisionModel}
+     */
+    protected static PrecisionModel getPrecisionModel(Integer epsg) {
+        PrecisionModel precisionModel;
+
+        if (epsg == 4326) {
+            // use scale precision with 7 decimal positions like default OSM
+            precisionModel = new PrecisionModel(1000000);
+        } else {
+            // use default constructor
+            precisionModel = new PrecisionModel();
+        }
+
+        return precisionModel;
+    }
 }