v0.2.53..v0.2.54 changeset SchemaTranslatedTagCountVisitor.h
Garret Voltz edited this page Mar 31, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/visitors/SchemaTranslatedTagCountVisitor.h b/hoot-core/src/main/cpp/hoot/core/visitors/SchemaTranslatedTagCountVisitor.h
index bb1d607..ff32100 100644
--- a/hoot-core/src/main/cpp/hoot/core/visitors/SchemaTranslatedTagCountVisitor.h
+++ b/hoot-core/src/main/cpp/hoot/core/visitors/SchemaTranslatedTagCountVisitor.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 SCHEMATRANSLATEDTAGCOUNTVISITOR_H
#define SCHEMATRANSLATEDTAGCOUNTVISITOR_H
@@ -31,6 +31,7 @@
#include <hoot/core/elements/ConstOsmMapConsumer.h>
#include <hoot/core/elements/ConstElementVisitor.h>
#include <hoot/core/info/SingleStatistic.h>
+#include <hoot/core/util/StringUtils.h>
namespace hoot
{
@@ -51,15 +52,11 @@ public:
SchemaTranslatedTagCountVisitor(const std::shared_ptr<ScriptSchemaTranslator>& t);
long getPopulatedCount() const { return _populatedCount; }
-
long getDefaultCount() const { return _defaultCount; }
-
long getNullCount() const { return _nullCount; }
-
long getTotalCount() const { return getPopulatedCount() + getDefaultCount() + getNullCount(); }
- double getStat() const { return (double)getPopulatedCount() /
- (double)getTotalCount(); }
+ double getStat() const { return (double)getPopulatedCount() / (double)getTotalCount(); }
virtual void setOsmMap(const OsmMap* map) { _map = map; }
@@ -68,6 +65,17 @@ public:
virtual QString getDescription() const
{ return "Counts the number of tags translated to a schema"; }
+ virtual std::string getClassName() const { return className(); }
+
+ virtual QString getInitStatusMessage() const { return "Counting translated tags..."; }
+
+ virtual QString getCompletedStatusMessage() const
+ {
+ return
+ "Counted " + StringUtils::formatLargeNumber(getTotalCount()) + " translated tags on " +
+ StringUtils::formatLargeNumber(_numAffected) + " features.";
+ }
+
private:
const OsmMap* _map;
@@ -75,6 +83,8 @@ private:
std::shared_ptr<ScriptToOgrSchemaTranslator> _translator;
long _populatedCount, _defaultCount, _nullCount;
+ int _taskStatusUpdateInterval;
+
void _countTags(std::shared_ptr<Feature>& f);
};