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

micklich pushed a commit to branch 
1321-geo-create-derived-point-of-input-geometry-processor
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit b52d6c2f57046ca64417b0f7fcdd85183ec839f4
Author: micklich <[email protected]>
AuthorDate: Fri Feb 24 20:08:05 2023 +0100

    [#1321] extend documentary. Add log output to log field
---
 .../point/CreateDerivedPointProcessor.java           |  19 +++++++++++++------
 .../derivedPoint.png                                 | Bin 0 -> 47994 bytes
 .../documentation.md                                 |  13 ++++++++-----
 3 files changed, 21 insertions(+), 11 deletions(-)

diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/derivedgeometry/point/CreateDerivedPointProcessor.java
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/derivedgeometry/point/CreateDerivedPointProcessor.java
index 0113cc08a..28914559a 100644
--- 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/derivedgeometry/point/CreateDerivedPointProcessor.java
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/java/org/apache/streampipes/processors/geo/jvm/jts/processor/derivedgeometry/point/CreateDerivedPointProcessor.java
@@ -19,10 +19,14 @@
 package 
org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point;
 
 import org.apache.streampipes.commons.exceptions.SpRuntimeException;
+import 
org.apache.streampipes.extensions.management.monitoring.SpMonitoringManager;
 import org.apache.streampipes.model.DataProcessorType;
+import org.apache.streampipes.model.StreamPipesErrorMessage;
 import org.apache.streampipes.model.graph.DataProcessorDescription;
+import org.apache.streampipes.model.monitoring.SpLogEntry;
 import org.apache.streampipes.model.runtime.Event;
 import org.apache.streampipes.model.schema.PropertyScope;
+import 
org.apache.streampipes.processors.geo.jvm.jts.exceptions.SpNotSupportedGeometryException;
 import org.apache.streampipes.processors.geo.jvm.jts.helper.SpGeometryBuilder;
 import org.apache.streampipes.sdk.builder.ProcessingElementBuilder;
 import org.apache.streampipes.sdk.builder.StreamRequirementsBuilder;
@@ -54,6 +58,7 @@ public class CreateDerivedPointProcessor extends 
StreamPipesDataProcessor {
   private String geometryMapper;
   private String epsgMapper;
   private String outputType;
+  ProcessorParams params;
   private static final Logger LOG = 
LoggerFactory.getLogger(CreateDerivedPointProcessor.class);
 
   @Override
@@ -61,7 +66,7 @@ public class CreateDerivedPointProcessor extends 
StreamPipesDataProcessor {
     return ProcessingElementBuilder.create(
             
"org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point")
         .category(DataProcessorType.GEO)
-        .withAssets(Assets.DOCUMENTATION, Assets.ICON)
+        .withAssets(Assets.DOCUMENTATION, Assets.ICON, "derivedPoint.png")
         .withLocales(Locales.EN)
         .requiredStream(StreamRequirementsBuilder
             .create()
@@ -97,17 +102,19 @@ public class CreateDerivedPointProcessor extends 
StreamPipesDataProcessor {
     this.geometryMapper = 
parameters.extractor().mappingPropertyValue(GEOM_KEY);
     this.epsgMapper = parameters.extractor().mappingPropertyValue(EPSG_KEY);
     this.outputType = 
parameters.extractor().selectedSingleValue(POINT_OUTPUT_TYPE_KEY, String.class);
-
+    this.params = parameters;
   }
 
   @Override
   public void onEvent(Event event, SpOutputCollector collector) throws 
SpRuntimeException {
     String geom = 
event.getFieldBySelector(geometryMapper).getAsPrimitive().getAsString();
-    Integer sourceEpsg = 
event.getFieldBySelector(epsgMapper).getAsPrimitive().getAsInt();
-    Geometry geometry = SpGeometryBuilder.createSPGeom(geom, sourceEpsg);
+    Integer epsg = 
event.getFieldBySelector(epsgMapper).getAsPrimitive().getAsInt();
+    Geometry geometry = SpGeometryBuilder.createSPGeom(geom, epsg);
     if (geometry instanceof Point) {
-      // TODO remove check after harmonized semantic types and multiple tpes
-      LOG.debug("geom is already a point");
+      
SpMonitoringManager.INSTANCE.addErrorMessage(params.getGraph().getElementId(),
+          SpLogEntry.from(System.currentTimeMillis(),
+              StreamPipesErrorMessage.from(new SpNotSupportedGeometryException(
+                  "Point Geometry is not supported"))));
     } else {
       Point derivedPointOutput = null;
       switch (this.outputType) {
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/derivedPoint.png
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/derivedPoint.png
new file mode 100644
index 000000000..46270393c
Binary files /dev/null and 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/derivedPoint.png
 differ
diff --git 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/documentation.md
 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/documentation.md
index 6f9322a2a..de66b2565 100755
--- 
a/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/documentation.md
+++ 
b/streampipes-extensions/streampipes-processors-geo-jvm/src/main/resources/org.apache.streampipes.processors.geo.jvm.jts.processor.derivedgeometry.point/documentation.md
@@ -25,7 +25,8 @@
 ***
 
 ## Description
-Creates a Point of every other Geometry (not included a Point itself).
+A single point geometry is derived from any geometry (except a
+point itself)
 
 ***
 
@@ -46,12 +47,11 @@ Integer value representing EPSG code
 
 ### Point Output Type
 Chose between 
-* Interior Point
-  *  An interior point is guaranteed to lie in the interior of the Geometry, 
+* **Interior Point:**  An interior point is guaranteed to lie in the interior 
of the Geometry, 
   if it is possible to calculate such a point exactly. Otherwise, the point 
may lie on 
   the boundary of the geometry.
-* Centroid Point
-  * Computes the centroid of a Geometry 
+* **Centroid Point**: A centroid point represents the geometric center of a 
simple geometry. For multi-geometries the
+    center of mass is calculated
 
 ***
 
@@ -61,3 +61,6 @@ A point geometry with EPSG code.
 
 ### Example
 
+<p align="center">
+    <img src="derivedPoint.png" width="500;" class="pe-image-documentation"/>
+</p>
\ No newline at end of file

Reply via email to