Skip to content

v0.2.52..v0.2.53 changeset EuclideanDistanceExtractor.cpp

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/EuclideanDistanceExtractor.cpp b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/EuclideanDistanceExtractor.cpp
index 43d55f8..756c6f5 100644
--- a/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/EuclideanDistanceExtractor.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/algorithms/extractors/EuclideanDistanceExtractor.cpp
@@ -23,7 +23,7 @@
  * copyrights will be updated automatically.
  *
  * @copyright Copyright (C) 2005 VividSolutions (http://www.vividsolutions.com/)
- * @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/)
  */
 #include "EuclideanDistanceExtractor.h"
 
@@ -42,10 +42,22 @@ namespace hoot
 
 HOOT_FACTORY_REGISTER(FeatureExtractor, EuclideanDistanceExtractor)
 
-double EuclideanDistanceExtractor::distance(const OsmMap &map,
-  const std::shared_ptr<const Element>& target, const std::shared_ptr<const Element> &candidate) const
+EuclideanDistanceExtractor::EuclideanDistanceExtractor() :
+_requireAreaForPolygonConversion(true)
+{
+}
+
+void EuclideanDistanceExtractor::setConfiguration(const Settings& conf)
+{
+  _requireAreaForPolygonConversion = ConfigOptions(conf).getConvertRequireAreaForPolygon();
+}
+
+double EuclideanDistanceExtractor::distance(
+  const OsmMap &map, const std::shared_ptr<const Element>& target,
+  const std::shared_ptr<const Element> &candidate) const
 {
   ElementConverter ec(map.shared_from_this());
+  ec.setRequireAreaForPolygonConversion(_requireAreaForPolygonConversion);
   std::shared_ptr<Geometry> g1 = ec.convertToGeometry(target);
   std::shared_ptr<Geometry> g2 = ec.convertToGeometry(candidate);
 
Clone this wiki locally