libspatialindex API Reference  (git-trunk)
Point.h
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) 2004, 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 ******************************************************************************/
27 
28 #pragma once
29 
30 #include "tools/Tools.h"
31 
32 namespace SpatialIndex
33 {
34  class SIDX_DLL Point : public Tools::IObject, public virtual IShape
35  {
36  public:
37  Point();
38  Point(const double* pCoords, uint32_t dimension);
39  Point(const Point& p);
40  ~Point() override;
41 
42  virtual Point& operator=(const Point& p);
43  virtual bool operator==(const Point& p) const;
44 
45  //
46  // IObject interface
47  //
48  Point* clone() override;
49 
50  //
51  // ISerializable interface
52  //
53  uint32_t getByteArraySize() override;
54  void loadFromByteArray(const uint8_t* data) override;
55  void storeToByteArray(uint8_t** data, uint32_t& length) override;
56 
57  //
58  // IShape interface
59  //
60  bool intersectsShape(const IShape& in) const override;
61  bool containsShape(const IShape& in) const override;
62  bool touchesShape(const IShape& in) const override;
63  void getCenter(Point& out) const override;
64  uint32_t getDimension() const override;
65  void getMBR(Region& out) const override;
66  double getArea() const override;
67  double getMinimumDistance(const IShape& in) const override;
68 
69  virtual double getMinimumDistance(const Point& p) const;
70 
71  virtual double getCoordinate(uint32_t index) const;
72 
73  virtual void makeInfinite(uint32_t dimension);
74  virtual void makeDimension(uint32_t dimension);
75 
76  public:
77  uint32_t m_dimension{0};
78  double* m_pCoords{nullptr};
79 
80  friend class Region;
81  friend SIDX_DLL std::ostream& operator<<(std::ostream& os, const Point& pt);
82  }; // Point
83 
85 
86  SIDX_DLL std::ostream& operator<<(std::ostream& os, const Point& pt);
87 }
Tools::PoolPointer< Point > PointPtr
Definition: Point.h:84
SIDX_DLL std::ostream & operator<<(std::ostream &os, const Ball &ball)
Definition: Ball.cc:215
#define SIDX_DLL
Definition: sidx_export.h:41