libspatialindex API Reference  (git-trunk)
TimeRegion.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) 2003, 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 namespace SpatialIndex
31 {
32  class SIDX_DLL TimeRegion : public Region, public ITimeShape
33  {
34  public:
35  TimeRegion();
36  TimeRegion(const double* pLow, const double* pHigh, const Tools::IInterval& ti, uint32_t dimension);
37  TimeRegion(const double* pLow, const double* pHigh, double tStart, double tEnd, uint32_t dimension);
38  TimeRegion(const Point& low, const Point& high, const Tools::IInterval& ti);
39  TimeRegion(const Point& low, const Point& high, double tStart, double tEnd);
40  TimeRegion(const Region& in, const Tools::IInterval& ti);
41  TimeRegion(const Region& in, double tStart, double tEnd);
42  TimeRegion(const TimePoint& low, const TimePoint& high);
43  TimeRegion(const TimeRegion& in);
44  ~TimeRegion() override;
45 
46  virtual TimeRegion& operator=(const TimeRegion& r);
47  virtual bool operator==(const TimeRegion&) const;
48 
49  virtual bool intersectsRegionInTime(const TimeRegion& in) const;
50  virtual bool containsRegionInTime(const TimeRegion& in) const;
51  virtual bool touchesRegionInTime(const TimeRegion& in) const;
52 
53  virtual bool containsPointInTime(const TimePoint& in) const;
54  virtual bool touchesPointInTime(const TimePoint& in) const;
55 
56  virtual void combineRegionInTime(const TimeRegion& in);
57  virtual void getCombinedRegionInTime(TimeRegion& out, const TimeRegion& in) const;
58 
59  //
60  // IObject interface
61  //
62  TimeRegion* clone() override;
63 
64  //
65  // ISerializable interface
66  //
67  uint32_t getByteArraySize() override;
68  void loadFromByteArray(const uint8_t* data) override;
69  void storeToByteArray(uint8_t** data, uint32_t& len) override;
70 
71  //
72  // ITimeShape interface
73  //
74  bool intersectsShapeInTime(const ITimeShape& in) const override;
75  bool intersectsShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const override;
76  bool containsShapeInTime(const ITimeShape& in) const override;
77  bool containsShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const override;
78  bool touchesShapeInTime(const ITimeShape& in) const override;
79  bool touchesShapeInTime(const Tools::IInterval& ivI, const ITimeShape& in) const override;
80  double getAreaInTime() const override;
81  double getAreaInTime(const Tools::IInterval& ivI) const override;
82  double getIntersectingAreaInTime(const ITimeShape& r) const override;
83  double getIntersectingAreaInTime(const Tools::IInterval& ivI, const ITimeShape& r) const override;
84 
85  //
86  // IInterval interface
87  //
88  virtual Tools::IInterval& operator=(const Tools::IInterval&);
89  double getLowerBound() const override;
90  double getUpperBound() const override;
91  void setBounds(double, double) override;
92  bool intersectsInterval(const Tools::IInterval& ti) const override;
93  bool intersectsInterval(Tools::IntervalType t, const double start, const double end) const override;
94  bool containsInterval(const Tools::IInterval& ti) const override;
95  Tools::IntervalType getIntervalType() const override;
96 
97  void makeInfinite(uint32_t dimension) override;
98  void makeDimension(uint32_t dimension) override;
99 
100  public:
101  double m_startTime;
102  double m_endTime;
103 
104  friend SIDX_DLL std::ostream& operator<<(std::ostream& os, const TimeRegion& r);
105  }; // TimeRegion
106 
108  SIDX_DLL std::ostream& operator<<(std::ostream& os, const TimeRegion& r);
109 }
SIDX_DLL std::ostream & operator<<(std::ostream &os, const Ball &ball)
Definition: Ball.cc:215
#define SIDX_DLL
Definition: sidx_export.h:41
IntervalType
Definition: Tools.h:80
Tools::PoolPointer< TimeRegion > TimeRegionPtr
Definition: TimeRegion.h:107