Skip to content

v0.2.47..v0.2.48 changeset OsmJsonReader.h

Garret Voltz edited this page Sep 27, 2019 · 1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h b/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h
index 0bde76d..92f83e7 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h
+++ b/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h
@@ -45,6 +45,7 @@
 #include <hoot/core/io/OsmMapReader.h>
 #include <hoot/core/util/Configurable.h>
 #include <hoot/core/util/ConfigOptions.h>
+#include <hoot/core/util/Boundable.h>
 
 namespace hoot
 {
@@ -105,7 +106,7 @@ namespace hoot
  * Be careful if you want to use it with large datasets.
  */
 
-class OsmJsonReader : public OsmMapReader, Configurable
+class OsmJsonReader : public OsmMapReader, public Configurable, public Boundable
 {
 public:
 
@@ -158,7 +159,8 @@ public:
    *        from the data being read, or self-generate unique IDs
    * @param useDataSourceIds true to use source IDs
    */
-  virtual void setUseDataSourceIds(bool useDataSourceIds) override { _useDataSourceIds = useDataSourceIds; }
+  virtual void setUseDataSourceIds(bool useDataSourceIds) override
+  { _useDataSourceIds = useDataSourceIds; }
 
   /**
    * @brief loadFromString - Builds a map from the JSON string. Throws a
@@ -229,6 +231,13 @@ public:
    */
   virtual void setConfiguration(const Settings& conf) override;
 
+  virtual void setBounds(const geos::geom::Envelope& bounds) { _bounds = bounds; }
+
+  void setKeepImmediatelyConnectedWaysOutsideBounds(bool keep)
+  { _keepImmediatelyConnectedWaysOutsideBounds = keep; }
+
+  bool isValidJson(const QString& jsonStr);
+
 protected:
 
   // Items to conform to OsmMapReader ifc
@@ -272,6 +281,19 @@ protected:
   /** Number of threads to process the HTTP requests */
   int _threadCount;
 
+  geos::geom::Envelope _bounds;
+  // only valid is _bounds is not null
+  bool _keepImmediatelyConnectedWaysOutsideBounds;
+
+  /// Maps from old node ids to new node ids.
+  QHash<long, long> _nodeIdMap;
+  QHash<long, long> _relationIdMap;
+  QHash<long, long> _wayIdMap;
+
+  int _missingNodeCount;
+  int _missingWayCount;
+  QString _path;
+
   /**
    * @brief _loadJSON Loads JSON into a boost property tree
    * @param jsonStr String to load
@@ -324,6 +346,10 @@ protected:
    *   list until the queue is empty.
    */
   void _doHttpRequestFunc();
+
+  void _readToMap();
+
+  long _getRelationId(long fileId);
 };
 
 }
Clone this wiki locally