Skip to content

v0.2.54..v0.2.55 changeset ElementIdCriterion.cpp

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/criterion/ElementIdCriterion.cpp b/hoot-core/src/main/cpp/hoot/core/criterion/ElementIdCriterion.cpp
index af4ca3c..cc9820b 100644
--- a/hoot-core/src/main/cpp/hoot/core/criterion/ElementIdCriterion.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/criterion/ElementIdCriterion.cpp
@@ -22,14 +22,15 @@
  * This will properly maintain the copyright information. DigitalGlobe
  * copyrights will be updated automatically.
  *
- * @copyright Copyright (C) 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
  */
 
 #include "ElementIdCriterion.h"
 
 // hoot
 #include <hoot/core/util/Factory.h>
-#include <hoot/core/elements/Element.h>
+#include <hoot/core/util/ConfigOptions.h>
+#include <hoot/core/util/Log.h>
 
 namespace hoot
 {
@@ -40,14 +41,39 @@ ElementIdCriterion::ElementIdCriterion()
 {
 }
 
-ElementIdCriterion::ElementIdCriterion(const ElementId& id) :
-_id(id)
+ElementIdCriterion::ElementIdCriterion(const ElementId& id)
 {
+  _ids.insert(id);
+}
+
+ElementIdCriterion::ElementIdCriterion(const std::set<ElementId>& ids) :
+_ids(ids)
+{
+}
+
+ElementIdCriterion::ElementIdCriterion(const ElementType& elementType, const std::set<long>& ids)
+{
+  for (std::set<long>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+  {
+    _ids.insert(ElementId(elementType, *it));
+  }
+}
+
+void ElementIdCriterion::setConfiguration(const Settings& conf)
+{
+  ConfigOptions configOpts(conf);
+  _ids.clear();
+  const QStringList idStrs = configOpts.getElementIdCriterionIds();
+  for (int i = 0; i < idStrs.size(); i++)
+  {
+    _ids.insert(ElementId(idStrs.at(i)));
+  }
 }
 
 bool ElementIdCriterion::isSatisfied(const ConstElementPtr& e) const
 {
-  return e->getElementId() == _id;
+  LOG_VART(e->getElementId());
+  return _ids.find(e->getElementId()) != _ids.end();
 }
 
 }
Clone this wiki locally