Skip to content

v0.2.52..v0.2.53 changeset ElementConverter.h

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/ElementConverter.h b/hoot-core/src/main/cpp/hoot/core/elements/ElementConverter.h
index 672b316..ec58443 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/ElementConverter.h
+++ b/hoot-core/src/main/cpp/hoot/core/elements/ElementConverter.h
@@ -22,7 +22,7 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2016, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #ifndef ELEMENTCONVERTER_H
@@ -98,6 +98,7 @@ public:
   std::shared_ptr<geos::geom::Geometry> convertToGeometry(
     const std::shared_ptr<const Element>& e, bool throwError = true,
     const bool statsFlag = false) const;
+
   std::shared_ptr<geos::geom::Point> convertToGeometry(const ConstNodePtr& n) const;
   std::shared_ptr<geos::geom::Geometry> convertToGeometry(const WayPtr& w) const;
   std::shared_ptr<geos::geom::Geometry> convertToGeometry(const ConstWayPtr& w, bool throwError,
@@ -111,12 +112,21 @@ public:
 
   /**
    * Return the geometry type of the specific element.
+   *
    * @param e
    * @param throwError If true an exception is thrown with an invalid geometry. If false a -1 is
    *  returned on error.
+   * @param statsFlag if true, this geometry type is being retrieved for the purpose of map
+   * statistics
+   * @param requireAreaForPolygonConversion if true, in order for the element being converted to
+   * become a polygon it must be classifiable in the schema as an area
    */
   static geos::geom::GeometryTypeId getGeometryType(const ConstElementPtr& e,
-    bool throwError = true, const bool statsFlag = false);
+    bool throwError = true, const bool statsFlag = false,
+    const bool requireAreaForPolygonConversion = true);
+
+  void setRequireAreaForPolygonConversion(bool require)
+  { _requireAreaForPolygonConversion = require; }
 
   static const int UNKNOWN_GEOMETRY = -1;
 
@@ -124,6 +134,9 @@ protected:
 
   ConstElementProviderPtr                 _constProvider;
   std::shared_ptr<OGRSpatialReference>  _spatialReference;
+  // if true, conversions to polys require that the source element be classifiable in the schema as
+  // an area
+  bool _requireAreaForPolygonConversion;
 };
 
 }
Clone this wiki locally