diff --git a/hoot-js/src/main/cpp/hoot/js/conflate/matching/ScriptMatchCreator.h b/hoot-js/src/main/cpp/hoot/js/conflate/matching/ScriptMatchCreator.h
index a38598d..b822aa9 100644
--- a/hoot-js/src/main/cpp/hoot/js/conflate/matching/ScriptMatchCreator.h
+++ b/hoot-js/src/main/cpp/hoot/js/conflate/matching/ScriptMatchCreator.h
@@ -22,14 +22,16 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef SCRIPTMATCHCREATOR_H
#define SCRIPTMATCHCREATOR_H
+// Hoot
#include <hoot/core/conflate/SearchRadiusProvider.h>
#include <hoot/core/conflate/matching/MatchCreator.h>
#include <hoot/core/util/NotImplementedException.h>
+#include <hoot/core/criterion/ElementCriterion.h>
#include <hoot/js/PluginContext.h>
@@ -37,9 +39,13 @@ namespace hoot
{
class ScriptMatchVisitor;
+class ScriptMatch;
/**
+ * Match creator for all generic conflation scripts
+ *
* @sa ScriptMatch
+ * @todo This class could use some refactoring after recent changes.
*/
class ScriptMatchCreator : public MatchCreator, public SearchRadiusProvider
{
@@ -47,6 +53,8 @@ public:
static std::string className() { return "hoot::ScriptMatchCreator"; }
+ static const QString POINT_POLYGON_SCRIPT_NAME;
+
ScriptMatchCreator();
virtual ~ScriptMatchCreator();
@@ -54,10 +62,15 @@ public:
/**
* @see SearchRadiusProvider
*/
+ virtual void init(const ConstOsmMapPtr& map) override;
+
+ /**
+ * @see SearchRadiusProvider
+ */
virtual Meters calculateSearchRadius(const ConstOsmMapPtr& map, const ConstElementPtr& e) override;
/**
- * Not implemented.
+ * @see MatchCreator
*/
virtual MatchPtr createMatch(const ConstOsmMapPtr&, ElementId, ElementId) override;
@@ -67,8 +80,14 @@ public:
virtual void createMatches(const ConstOsmMapPtr& map, std::vector<ConstMatchPtr>& matches,
ConstMatchThresholdPtr threshold) override;
+ /**
+ * @see MatchCreator
+ */
virtual std::vector<CreatorDescription> getAllCreators() const override;
+ /**
+ * @see MatchCreator
+ */
virtual void setArguments(QStringList args) override;
/**
@@ -80,18 +99,31 @@ public:
*/
virtual bool isMatchCandidate(ConstElementPtr element, const ConstOsmMapPtr& map) override;
+ /**
+ * @see MatchCreator
+ */
virtual std::shared_ptr<MatchThreshold> getMatchThreshold() override;
+ /**
+ * @see MatchCreator
+ */
+ virtual QString getName() const override;
+
private:
std::shared_ptr<PluginContext> _script;
QString _scriptPath;
- CreatorDescription _getScriptDescription(QString path) const;
-
std::shared_ptr<ScriptMatchVisitor> _cachedScriptVisitor;
std::shared_ptr<MatchThreshold> _matchThreshold;
QMap<QString, Meters> _cachedCustomSearchRadii;
+ QMap<QString, double> _candidateDistanceSigmaCache;
+ QMap<QString, CreatorDescription> _descriptionCache;
+
+ ElementCriterionPtr _pointPolyPolyCrit;
+ ElementCriterionPtr _pointPolyPointCrit;
+
+ CreatorDescription _getScriptDescription(QString path) const;
std::shared_ptr<ScriptMatchVisitor> _getCachedVisitor(const ConstOsmMapPtr& map);
};