libspatialindex API Reference  (git-trunk)
SpatialIndexImpl.cc
Go to the documentation of this file.
1 /******************************************************************************
2  * Project: libspatialindex - A C++ library for spatial indexing
3  * Author: Marios Hadjieleftheriou, mhadji@gmail.com
4  ******************************************************************************
5  * Copyright (c) 2002, Marios Hadjieleftheriou
6  *
7  * All rights reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25  * DEALINGS IN THE SOFTWARE.
26 ******************************************************************************/
28 
29 #include "../rtree/RTree.h"
30 #include "../mvrtree/MVRTree.h"
31 #include "../tprtree/TPRTree.h"
32 
34 {
35  std::ostringstream s;
36  s << "Unknown page id " << id;
37  m_error = s.str();
38 }
39 
41 {
42  return "InvalidPageException: " + m_error;
43 }
44 
45 std::ostream& SpatialIndex::operator<<(std::ostream& os, const ISpatialIndex& i)
46 {
47  const SpatialIndex::RTree::RTree* pRTree = dynamic_cast<const SpatialIndex::RTree::RTree*>(&i);
48  if (pRTree != nullptr)
49  {
50  os << *pRTree;
51  return os;
52  }
53 
54  const SpatialIndex::MVRTree::MVRTree* pMVRTree = dynamic_cast<const SpatialIndex::MVRTree::MVRTree*>(&i);
55  if (pMVRTree != nullptr)
56  {
57  os << *pMVRTree;
58  return os;
59  }
60 
61  const SpatialIndex::TPRTree::TPRTree* pTPRTree = dynamic_cast<const SpatialIndex::TPRTree::TPRTree*>(&i);
62  if (pTPRTree != nullptr)
63  {
64  os << *pTPRTree;
65  return os;
66  }
67 
68  std::cerr << "ISpatialIndex operator<<: Not implemented yet for this index type." << std::endl;
69  return os;
70 }
71 
72 std::ostream& SpatialIndex::operator<<(std::ostream& os, const IStatistics& s)
73 {
74  const SpatialIndex::RTree::Statistics* pRTreeStats = dynamic_cast<const SpatialIndex::RTree::Statistics*>(&s);
75  if (pRTreeStats != nullptr)
76  {
77  os << *pRTreeStats;
78  return os;
79  }
80 
81  const SpatialIndex::MVRTree::Statistics* pMVRTreeStats = dynamic_cast<const SpatialIndex::MVRTree::Statistics*>(&s);
82  if (pMVRTreeStats != nullptr)
83  {
84  os << * pMVRTreeStats;
85  return os;
86  }
87 
88  const SpatialIndex::TPRTree::Statistics* pTPRTreeStats = dynamic_cast<const SpatialIndex::TPRTree::Statistics*>(&s);
89  if (pTPRTreeStats != nullptr)
90  {
91  os << * pTPRTreeStats;
92  return os;
93  }
94 
95  std::cerr << "IStatistics operator<<: Not implemented yet for this index type." << std::endl;
96  return os;
97 }
98 
SIDX_DLL std::ostream & operator<<(std::ostream &os, const Ball &ball)
Definition: Ball.cc:215
int64_t id_type
Definition: SpatialIndex.h:41