GEOS  3.9.1dev
FacetSequenceTreeBuilder.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2016 Daniel Baston
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: operation/distance/FacetSequenceTreeBuilder.java (f6187ee2 JTS-1.14)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OPERATION_DISTANCE_FACETSEQUENCETREEBUILDER_H
20 #define GEOS_OPERATION_DISTANCE_FACETSEQUENCETREEBUILDER_H
21 
22 #include <geos/index/ItemVisitor.h>
24 #include <geos/geom/Geometry.h>
27 
28 namespace geos {
29 namespace operation {
30 namespace distance {
32 private:
33  // 6 seems to be a good facet sequence size
34  static const int FACET_SEQUENCE_SIZE = 6;
35 
36  // Seems to be better to use a minimum node capacity
37  static const int STR_TREE_NODE_CAPACITY = 4;
38 
39  static void addFacetSequences(const geom::Geometry* geom,
40  const geom::CoordinateSequence* pts,
41  std::vector<FacetSequence> & sections);
42  static std::vector<FacetSequence> computeFacetSequences(const geom::Geometry* g);
43 
45  public:
46  FacetSequenceTree(std::vector<FacetSequence> &&seq) : STRtree(STR_TREE_NODE_CAPACITY), sequences(seq) {
47  for (auto& fs : sequences) {
48  STRtree::insert(fs.getEnvelope(), &fs);
49  }
50  }
51 
52  private:
53  std::vector<FacetSequence> sequences;
54  };
55 
56 public:
63  static std::unique_ptr<geos::index::strtree::STRtree> build(const geom::Geometry* g);
64 };
65 }
66 }
67 }
68 
69 #endif //GEOS_FACETSEQUENCETREEBUILDER_H
#define GEOS_DLL
Definition: export.h:28
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatia...
Definition: STRtree.h:64
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Basic namespace for all GEOS functionalities.
The internal representation of a list of coordinates inside a Geometry.