bes  Updated for version 3.17.4
BoundingBox.h
1 /******************************************************************************
2  * $Id: BoundingBox.h 2011-07-19 16:24:00Z $
3  *
4  * Project: The Open Geospatial Consortium (OGC) Web Coverage Service (WCS)
5  * for Earth Observation: Open Source Reference Implementation
6  * Purpose: BoundingBox class definition
7  * Author: Yuanzheng Shao, yshao3@gmu.edu
8  *
9  ******************************************************************************
10  * Copyright (c) 2011, Liping Di <ldi@gmu.edu>, Yuanzheng Shao <yshao3@gmu.edu>
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be included
20  * in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
25  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28  * DEALINGS IN THE SOFTWARE.
29  ****************************************************************************/
30 
31 #ifndef BOUNDINGBOX_H_
32 #define BOUNDINGBOX_H_
33 
34 #include <gdal.h>
35 #include <ogr_spatialref.h>
36 #include <limits>
37 #include <stdlib.h>
38 
39 using namespace std;
40 
41 /************************************************************************/
42 /* ==================================================================== */
43 /* My2DPoint */
44 /* ==================================================================== */
45 /************************************************************************/
46 
53 class My2DPoint
54 {
55 public:
56  double mi_X;
57  double mi_Y;
58 
59  virtual ~My2DPoint();
60 
61  My2DPoint()
62  {
63  mi_X = 0;
64  mi_Y = 0;
65  }
66 
67  My2DPoint(const double& xx, const double& yy) :
68  mi_X(xx), mi_Y(yy)
69  {
70  }
71 
72  My2DPoint(const My2DPoint& p) :
73  mi_X(p.mi_X), mi_Y(p.mi_Y)
74  {
75  }
76 
77  My2DPoint& operator =(const My2DPoint& p)
78  {
79  mi_X = p.mi_X;
80  mi_Y = p.mi_Y;
81  return *this;
82  }
83 };
84 
85 /************************************************************************/
86 /* ==================================================================== */
87 /* BoundingBox */
88 /* ==================================================================== */
89 /************************************************************************/
90 
99 {
100 public:
101  My2DPoint mo_LowerLeftPT;
102  My2DPoint mo_UpperRightPT;
103  OGRSpatialReference mo_CRS;
104 
105  BoundingBox(const My2DPoint& llpt, const My2DPoint& urpt, OGRSpatialReference& crs) :
106  mo_LowerLeftPT(llpt), mo_UpperRightPT(urpt), mo_CRS(crs)
107  {
108 
109  }
110 
111  BoundingBox(OGRSpatialReference& crs) :
112  mo_LowerLeftPT(0,0), mo_UpperRightPT(0,0), mo_CRS(crs)
113  {
114 
115  }
116  BoundingBox& operator =(const BoundingBox& box)
117  {
118  mo_LowerLeftPT = box.mo_LowerLeftPT;
119  mo_UpperRightPT = box.mo_UpperRightPT;
120  mo_CRS = box.mo_CRS;
121  return *this;
122  }
123 
124  BoundingBox();
125  virtual ~BoundingBox();
126 
127  BoundingBox Transform(OGRSpatialReference&, int&);
128  BoundingBox TransformWorkExtend(OGRSpatialReference&, int&);
129  BoundingBox Transform(const double*);
130 };
131 
132 CPLErr CPL_DLL CPL_STDCALL bBox_transFormmate( OGRSpatialReference&,
133  OGRSpatialReference&,
134  My2DPoint& lowLeft,
135  My2DPoint& upRight);
136 
137 #endif /* BOUNDINGBOX_H_ */
STL namespace.