1 #ifndef OSMSCOUT_UTIL_GEOBOX_H 2 #define OSMSCOUT_UTIL_GEOBOX_H 43 GeoCoord minCoord=GeoCoord(0.0,0.0);
44 GeoCoord maxCoord=GeoCoord(0.0,0.0);
56 GeoBox(
const GeoBox& other) =
default;
62 GeoBox(
const GeoCoord& coordA,
63 const GeoCoord& coordB);
71 minCoord.Set(0.0,0.0);
72 maxCoord.Set(0.0,0.0);
78 void Set(
const GeoCoord& coordA,
79 const GeoCoord& coordB);
84 void Include(
const GeoBox& other);
89 void Include(
const GeoCoord& point);
103 bool openInterval=
true)
const 110 return minCoord.GetLat()<=coord.GetLat() &&
111 maxCoord.GetLat()>coord.GetLat() &&
112 minCoord.GetLon()<=coord.GetLon() &&
113 maxCoord.GetLon()>coord.GetLon();
116 return minCoord.GetLat()<=coord.GetLat() &&
117 maxCoord.GetLat()>=coord.GetLat() &&
118 minCoord.GetLon()<=coord.GetLon() &&
119 maxCoord.GetLon()>=coord.GetLon();
134 bool openInterval=
true)
const 136 if (!valid || !other.valid) {
141 return !(other.GetMaxLon()<minCoord.GetLon() ||
142 other.GetMinLon()>=maxCoord.GetLon() ||
143 other.GetMaxLat()<minCoord.GetLat() ||
144 other.GetMinLat()>=maxCoord.GetLat());
147 return !(other.GetMaxLon()<minCoord.GetLon() ||
148 other.GetMinLon()>maxCoord.GetLon() ||
149 other.GetMaxLat()<minCoord.GetLat() ||
150 other.GetMinLat()>maxCoord.GetLat());
158 GeoBox Intersection(
const GeoBox& other)
const;
186 GeoCoord GetCenter()
const;
193 return minCoord.GetLat();
201 return minCoord.GetLon();
209 return maxCoord.GetLat();
217 return maxCoord.GetLon();
225 return maxCoord.GetLon()-minCoord.GetLon();
233 return maxCoord.GetLat()-minCoord.GetLat();
243 return GetWidth()*GetHeight();
259 return GeoCoord(minCoord.GetLat(),
268 return GeoCoord(maxCoord.GetLat(),
283 std::string GetDisplayText()
const;
288 GeoBox& operator=(
const GeoBox& other) =
default;
294 static GeoBox BoxByCenterAndRadius(
const GeoCoord& center,
const Distance& radius);
GeoCoord GetTopRight() const
Definition: GeoBox.h:275
GeoCoord GetBottomRight() const
Definition: GeoBox.h:257
GeoCoord GetMinCoord() const
Definition: GeoBox.h:173
double GetMinLat() const
Definition: GeoBox.h:191
double GetSize() const
Definition: GeoBox.h:241
double GetMaxLat() const
Definition: GeoBox.h:207
double GetMaxLon() const
Definition: GeoBox.h:215
double GetMinLon() const
Definition: GeoBox.h:199
double GetWidth() const
Definition: GeoBox.h:223
GeoCoord GetMaxCoord() const
Definition: GeoBox.h:181
#define CLASS_FINAL
Definition: Compiler.h:26
bool Intersects(const GeoBox &other, bool openInterval=true) const
Definition: GeoBox.h:133
#define OSMSCOUT_API
Definition: CoreImportExport.h:45
double GetHeight() const
Definition: GeoBox.h:231
bool IsValid() const
Definition: GeoBox.h:165
GeoCoord GetBottomLeft() const
Definition: GeoBox.h:249
bool Includes(const P &coord, bool openInterval=true) const
Definition: GeoBox.h:102
void Invalidate()
Definition: GeoBox.h:68
GeoCoord GetTopLeft() const
Definition: GeoBox.h:266