|
xmsgrid
1.0
|
Implementation of GmPtSearch. Generic class for searching location data. Uses a boost R-tree to query a set of locations. Works for 2D and 3D. More...
Public Member Functions | |
| GmPtSearchImpl (bool a_2dSearch) | |
| Constructor. More... | |
| virtual void | PtsToSearch (BSHP< std::vector< Pt3d >> a_pts) override |
| Adds the point locations to the class. More... | |
| virtual void | VectorThatGrowsToSearch (BSHP< std::vector< Pt3d >> a_) override |
| Adds the point locations to the class. More... | |
| virtual bool | AddPtToVectorIfUnique (const Pt3d &a_, double a_tol, int &a_ptIdx) override |
| Adds the point to the R-tree if the point location is unique based on the passed in tolerance. If a point exists at this location then return false. If the point is added then return true. More... | |
| virtual void | NearestPtsToPt (const Pt3d &a_pt, int a_numPtsToFind, bool a_quad_oct_Search, std::vector< int > &a_nearest) const override |
| Finds the nearest points to the input a_pt with an option to search quadrants/octants. More... | |
| virtual void | NearestPtsToPtInRtree (int a_ptIdx, const Pt3d &a_pt, int a_numPtsToFind, bool a_quad_oct_Search, std::vector< int > &a_nearest) const override |
| Finds the nearest points to the input a_pt with an option to search quadrants/octants. Similar to NearestPtsToPt but this method will always pass the fSatisfies class to the RTree. This method is used to find the nearest points to a point that is included in the RTree. More... | |
| virtual bool | PtInRTree (const Pt3d &a_pt, const double a_tol) override |
| Checks if the point is in the Rtree within tolerance. More... | |
| virtual void | PtsWithinDistanceToPtInRtree (int a_ptIdx, const Pt3d &a_pt, double a_dist, std::vector< int > &a_nearest) const override |
| Finds the nearest points to the input a_pt with an option to search quadrants/octants. Similar to NearestPtsToPt but this method will always pass the fSatisfies class to the RTree. This method is used to find the nearest points to a point that is included in the RTree. More... | |
| virtual void | NearestPtsToPt (const Pt3d &a_pt, int a_numPtsToFind, bool a_quad_oct_Search, std::vector< int > &a_nearest, fSatisfies *a_fsat) const |
| Finds the nearest points to the input a_pt with an option to search quadrants/octants. The difference with this method is the addition of the fSatisfies class. When performing a search in each quadrant/octant it is possible for a point to be exactly on the boundary of a quadrant but we don't want to include that point more than 1 time. The fSatisfies class ensures that a point is only included 1 time. More... | |
| virtual void | SetActivity (DynBitset &a_activity) override |
| Sets activity on the points in the Rtree so that points can be ignored when interpolating. More... | |
| virtual DynBitset | GetActivity () override |
| Returns the point activity. More... | |
| virtual const BSHP< VecPt3d > | GetPointsPtr () const override |
| Returns shared point to the point locations in the RTree. More... | |
| virtual bool | Is2D () const override |
| Returns true if class only searches in 2D. More... | |
| virtual std::string | ToString () const override |
| Write the internals to a string. More... | |
| void | UpdateMinMax (const Pt3d *a_pts, size_t a_npts) |
| Updates the m_min, m_max variables. More... | |
| void | CreateOctants (const Pt3d &a_pt, std::vector< box > &a_boxes) const |
| Creates octants (or quadrants for 2d) to be used in the rtree query. More... | |
Public Attributes | |
| bool | m_2dSearch |
| flag specifying 2d searching only | |
| Pt3d | m_min |
| minimum extents of points | |
| Pt3d | m_max |
| maximum extents of points | |
| DynBitset | m_activity |
| point activity | |
| bgi::rtree< value, qRtree, idx_pt > * | m_rTree |
| spatial index for searching the points | |
| BSHP< VecPt3d > | m_bshpPt3d |
| Vector of point locations. | |
Additional Inherited Members | |
Static Public Member Functions inherited from xms::GmPtSearch | |
| static BSHP< GmPtSearch > | New (bool a_2dSearch) |
| Creates an PtSearch class. More... | |
Implementation of GmPtSearch. Generic class for searching location data. Uses a boost R-tree to query a set of locations. Works for 2D and 3D.
Definition at line 168 of file GmPtSearch.cpp.
| xms::GmPtSearchImpl::GmPtSearchImpl | ( | bool | a_2dSearch | ) |
Constructor.
| [in] | a_2dSearch | Flag to specify that searching is in 2D (x,y) only. |
Definition at line 260 of file GmPtSearch.cpp.
|
overridevirtual |
Adds the point to the R-tree if the point location is unique based on the passed in tolerance. If a point exists at this location then return false. If the point is added then return true.
| a_pt | location to test |
| a_tol | Tolerance used to compare point locations |
| a_ptIdx | New point's index (if unique) or matching point's index. |
Definition at line 349 of file GmPtSearch.cpp.
References m_bshpPt3d, m_max, m_min, m_rTree, PtsWithinDistanceToPtInRtree(), xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by PtSearchUnitTests::testVectorThatGrows().
Creates octants (or quadrants for 2d) to be used in the rtree query.
| a_pt | The location about which to create the quadrants/octants. |
| a_boxes | Vector filled in by this method defining the quadrants/octants. |
Definition at line 591 of file GmPtSearch.cpp.
References m_2dSearch, m_max, m_min, xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by NearestPtsToPt().
|
overridevirtual |
Returns the point activity.
Definition at line 563 of file GmPtSearch.cpp.
References m_activity.
Returns shared point to the point locations in the RTree.
Definition at line 208 of file GmPtSearch.cpp.
References m_bshpPt3d.
|
inlineoverridevirtual |
Returns true if class only searches in 2D.
Definition at line 211 of file GmPtSearch.cpp.
References m_2dSearch.
|
overridevirtual |
Finds the nearest points to the input a_pt with an option to search quadrants/octants.
| a_pt | The location we are interested in. |
| a_numPtsToFind | The number of nearest points to a_pt to find. |
| a_quad_oct_Search | Whether to perform the nearest points search in each quadrant (2d) or octant (3d). |
| a_nearest | Vector that is filled in by this method. |
Definition at line 387 of file GmPtSearch.cpp.
References m_activity, and xms::fSatisfies::m_bits.
Referenced by NearestPtsToPtInRtree().
|
virtual |
Finds the nearest points to the input a_pt with an option to search quadrants/octants. The difference with this method is the addition of the fSatisfies class. When performing a search in each quadrant/octant it is possible for a point to be exactly on the boundary of a quadrant but we don't want to include that point more than 1 time. The fSatisfies class ensures that a point is only included 1 time.
| a_pt | The location we are interested in. |
| a_numPtsToFind | The number of nearest points to a_pt to find. |
| a_quad_oct_Search | Whether to perform the nearest points search in each quadrant (2d) or octant (3d). |
| a_nearest | Vector that is filled in by this method. |
| a_fsat | Class used to ensure a point is include only 1 time in the search results. |
Definition at line 415 of file GmPtSearch.cpp.
References CreateOctants(), xmlog::error, m_bshpPt3d, m_rTree, and XM_LOG.
|
overridevirtual |
Finds the nearest points to the input a_pt with an option to search quadrants/octants. Similar to NearestPtsToPt but this method will always pass the fSatisfies class to the RTree. This method is used to find the nearest points to a point that is included in the RTree.
| a_ptIdx | The index of the point a_pt. a_pt is in the RTree and we don't want it in the results. |
| a_pt | The location we are interested in. |
| a_numPtsToFind | The number of nearest points to a_pt to find. |
| a_quad_oct_Search | Whether to perform the nearest points search in each quadrant (2d) or octant (3d). |
| a_nearest | Vector that is filled in by this method. |
Definition at line 478 of file GmPtSearch.cpp.
References m_activity, xms::fSatisfies::m_bits, m_rTree, and NearestPtsToPt().
|
overridevirtual |
Checks if the point is in the Rtree within tolerance.
| a_pt | The location being searched. |
| a_tol | A distance used to define a box around a_pt to see if any Rtree pts are inside that box. |
Definition at line 497 of file GmPtSearch.cpp.
References PtsWithinDistanceToPtInRtree().
Adds the point locations to the class.
| [in] | a_pts | Array of point locations. |
Definition at line 280 of file GmPtSearch.cpp.
References m_2dSearch, m_bshpPt3d, m_rTree, and UpdateMinMax().
Referenced by PtSearchUnitTests::testPtsWithinDist().
|
overridevirtual |
Finds the nearest points to the input a_pt with an option to search quadrants/octants. Similar to NearestPtsToPt but this method will always pass the fSatisfies class to the RTree. This method is used to find the nearest points to a point that is included in the RTree.
| a_ptIdx | The index of the point a_pt. a_pt is in the RTree and we don't want it in the results. |
| a_pt | The location we are interested in. |
| a_distance | The distance from the point where we want to find additional points |
| a_nearest | Vector that is filled in by this method. |
Definition at line 515 of file GmPtSearch.cpp.
References m_2dSearch, m_activity, xms::fSatisfies::m_bits, m_rTree, and xms::Pt3< T >::z.
Referenced by AddPtToVectorIfUnique(), PtInRTree(), and PtSearchUnitTests::testPtsWithinDist().
|
overridevirtual |
Sets activity on the points in the Rtree so that points can be ignored when interpolating.
| a_activity | Bitset of the point activity. Must be the same size as the number of points. |
Definition at line 551 of file GmPtSearch.cpp.
References m_activity, and m_rTree.
|
overridevirtual |
Write the internals to a string.
Definition at line 573 of file GmPtSearch.cpp.
References m_2dSearch, m_activity, m_bshpPt3d, m_max, m_min, and VecToStream().
| void xms::GmPtSearchImpl::UpdateMinMax | ( | const Pt3d * | a_pts, |
| size_t | a_nPts | ||
| ) |
Updates the m_min, m_max variables.
| a_pts | Array of point locations. |
| a_nPts | Number of values in a_pts array. |
Definition at line 299 of file GmPtSearch.cpp.
References m_2dSearch, m_max, m_min, xms::Pt3< T >::x, xms::Pt3< T >::y, and xms::Pt3< T >::z.
Referenced by PtsToSearch(), and VectorThatGrowsToSearch().
Adds the point locations to the class.
| a_ | Shared pointer to array of point locations. |
Definition at line 326 of file GmPtSearch.cpp.
References m_2dSearch, m_bshpPt3d, m_rTree, and UpdateMinMax().
Referenced by PtSearchUnitTests::testVectorThatGrows().