Skip to content

v0.2.48..v0.2.49 changeset OsmJsonReader.h

Garret Voltz edited this page Oct 2, 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 92f83e7..f5aeb68 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h
+++ b/hoot-core/src/main/cpp/hoot/core/io/OsmJsonReader.h
@@ -43,6 +43,7 @@
 // Hoot
 #include <hoot/core/elements/OsmMap.h>
 #include <hoot/core/io/OsmMapReader.h>
+#include <hoot/core/io/ParallelBoundedApiReader.h>
 #include <hoot/core/util/Configurable.h>
 #include <hoot/core/util/ConfigOptions.h>
 #include <hoot/core/util/Boundable.h>
@@ -106,7 +107,7 @@ namespace hoot
  * Be careful if you want to use it with large datasets.
  */
 
-class OsmJsonReader : public OsmMapReader, public Configurable, public Boundable
+class OsmJsonReader : public OsmMapReader, public Configurable, public Boundable, private ParallelBoundedApiReader
 {
 public:
 
@@ -165,10 +166,9 @@ public:
   /**
    * @brief loadFromString - Builds a map from the JSON string. Throws a
    *        HootException with error and line number if JSON parsing fails
-   * @param jsonStr - input string
-   * @return Smart pointer to the OSM map
+   * @param jsonStr - input string, map - The OSM map to load it into
    */
-  virtual OsmMapPtr loadFromString(const QString& jsonStr);
+  virtual void loadFromString(const QString& jsonStr, const OsmMapPtr& map);
 
   /**
    * @brief loadFromPtree - Builds a map from the supplied boost property tree
@@ -266,20 +266,6 @@ protected:
 
   /** List of JSON strings, one for each HTTP response */
   QStringList _results;
-  /** Mutex guarding the results list */
-  std::mutex _resultsMutex;
-  /** Essentially the work queue of bounding boxes that the threads query from */
-  QList<geos::geom::Envelope> _bboxes;
-  /** Mutex guarding the bounding box list */
-  std::mutex _bboxMutex;
-  /** Flag indicating that the _bboxes list is still being loaded, set to false when completely loaded */
-  bool _bboxContinue;
-  /** Flag indicating whether or not the bounding box (if it exists) should be split and run in parallel */
-  bool _runParallel;
-  /** Grid division size (0.25 degrees lat/lon default) */
-  double _coordGridSize;
-  /** Number of threads to process the HTTP requests */
-  int _threadCount;
 
   geos::geom::Envelope _bounds;
   // only valid is _bounds is not null
@@ -341,11 +327,6 @@ protected:
    *   spawns a thread pool to query bounding boxes
    */
   void _readFromHttp();
-  /**
-   * @brief _doHttpRequestFunc Thread processing function that loops processing a bounding box from the
-   *   list until the queue is empty.
-   */
-  void _doHttpRequestFunc();
 
   void _readToMap();
 
Clone this wiki locally