QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
Point.h
Go to the documentation of this file.
1/******************************************************************************
2 * Project: libspatialindex - A C++ library for spatial indexing
3 * Author: Marios Hadjieleftheriou, [email protected]
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
32namespace SpatialIndex
33{
34 class SIDX_DLL Point : public Tools::IObject, public virtual IShape
35 {
36 public:
38 Point(const double* pCoords, uint32_t dimension);
39 Point(const Point& p);
40 virtual ~Point();
41
42 virtual Point& operator=(const Point& p);
43 virtual bool operator==(const Point& p) const;
44
45 //
46 // IObject interface
47 //
48 virtual Point* clone();
49
50 //
51 // ISerializable interface
52 //
53 virtual uint32_t getByteArraySize();
54 virtual void loadFromByteArray(const byte* data);
55 virtual void storeToByteArray(byte** data, uint32_t& length);
56
57 //
58 // IShape interface
59 //
60 virtual bool intersectsShape(const IShape& in) const;
61 virtual bool containsShape(const IShape& in) const;
62 virtual bool touchesShape(const IShape& in) const;
63 virtual void getCenter(Point& out) const;
64 virtual uint32_t getDimension() const;
65 virtual void getMBR(Region& out) const;
66 virtual double getArea() const;
67 virtual double getMinimumDistance(const IShape& in) const;
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;
78 double* m_pCoords;
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}
Definition SpatialIndex.h:68
Definition Point.h:35
virtual Point & operator=(const Point &p)
virtual double getMinimumDistance(const IShape &in) const
double * m_pCoords
Definition Point.h:78
virtual void getMBR(Region &out) const
virtual double getCoordinate(uint32_t index) const
virtual void storeToByteArray(byte **data, uint32_t &length)
Point(const double *pCoords, uint32_t dimension)
virtual void makeInfinite(uint32_t dimension)
virtual uint32_t getDimension() const
uint32_t m_dimension
Definition Point.h:77
friend SIDX_DLL std::ostream & operator<<(std::ostream &os, const Point &pt)
virtual void getCenter(Point &out) const
virtual bool touchesShape(const IShape &in) const
virtual bool operator==(const Point &p) const
virtual bool intersectsShape(const IShape &in) const
virtual bool containsShape(const IShape &in) const
virtual Point * clone()
virtual uint32_t getByteArraySize()
virtual void loadFromByteArray(const byte *data)
Point(const Point &p)
virtual double getMinimumDistance(const Point &p) const
virtual void makeDimension(uint32_t dimension)
virtual double getArea() const
Definition Region.h:33
Definition Tools.h:215
Definition PoolPointer.h:37
Definition CustomStorage.h:34
SIDX_DLL std::ostream & operator<<(std::ostream &os, const LineSegment &pt)
Tools::PoolPointer< Point > PointPtr
Definition Point.h:84
#define SIDX_DLL
Definition sidx_export.h:41