1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                     Tool Library                      //
9 //                   Projection_Proj4                    //
10 //                                                       //
11 //-------------------------------------------------------//
12 //                                                       //
13 //                    crs_transform.h                    //
14 //                                                       //
15 //                 Copyright (C) 2010 by                 //
16 //                      Olaf Conrad                      //
17 //                                                       //
18 //-------------------------------------------------------//
19 //                                                       //
20 // This file is part of 'SAGA - System for Automated     //
21 // Geoscientific Analyses'. SAGA is free software; you   //
22 // can redistribute it and/or modify it under the terms  //
23 // of the GNU General Public License as published by the //
24 // Free Software Foundation, either version 2 of the     //
25 // License, or (at your option) any later version.       //
26 //                                                       //
27 // SAGA is distributed in the hope that it will be       //
28 // useful, but WITHOUT ANY WARRANTY; without even the    //
29 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
30 // PARTICULAR PURPOSE. See the GNU General Public        //
31 // License for more details.                             //
32 //                                                       //
33 // You should have received a copy of the GNU General    //
34 // Public License along with this program; if not, see   //
35 // <http://www.gnu.org/licenses/>.                       //
36 //                                                       //
37 //-------------------------------------------------------//
38 //                                                       //
39 //    e-mail:     oconrad@saga-gis.org                   //
40 //                                                       //
41 //    contact:    Olaf Conrad                            //
42 //                Institute of Geography                 //
43 //                University of Hamburg                  //
44 //                Germany                                //
45 //                                                       //
46 ///////////////////////////////////////////////////////////
47 
48 //---------------------------------------------------------
49 #ifndef HEADER_INCLUDED__crs_transform_H
50 #define HEADER_INCLUDED__crs_transform_H
51 
52 
53 ///////////////////////////////////////////////////////////
54 //														 //
55 //														 //
56 //														 //
57 ///////////////////////////////////////////////////////////
58 
59 //---------------------------------------------------------
60 #include <saga_api/saga_api.h>
61 
62 
63 ///////////////////////////////////////////////////////////
64 //														 //
65 //														 //
66 //														 //
67 ///////////////////////////////////////////////////////////
68 
69 //---------------------------------------------------------
70 class CSG_CRSProjector
71 {
72 public:
73 	CSG_CRSProjector(void);
74 	CSG_CRSProjector(const CSG_CRSProjector &Projector);
75 	virtual ~CSG_CRSProjector(void);
76 
77 	bool					Create						(const CSG_CRSProjector &Projector);
78 	bool					Destroy						(void);
79 
80 	bool					Set_Copies					(int nCopies = 0);
81 	CSG_CRSProjector &		operator []					(int iCopy);
82 
83 	static CSG_String		Get_Version					(void);
84 	static CSG_String		Get_Description				(void);
85 
86 	bool					Set_Source					(const CSG_Projection &Projection);
Get_Source(void)87 	const CSG_Projection &	Get_Source					(void)	const		{	return( m_Source );	}
88 
89 	bool					Set_Target					(const CSG_Projection &Projection);
Get_Target(void)90 	const CSG_Projection &	Get_Target					(void)	const		{	return( m_Target );	}
91 
92 	bool					Set_Inverse					(bool bOn = true);
Get_Inverse(void)93 	bool					Get_Inverse					(void)	const		{	return( m_bInverse );	}
94 
95 	bool					Set_Precise_Mode			(bool bOn = true);
Get_Precise_Mode(void)96 	bool					Get_Precise_Mode			(void)	const		{	return( m_pGCS != NULL );	}
97 
98 	bool					Get_Projection				(double &x, double &y)	const;
99 	bool					Get_Projection				(TSG_Point &Point)		const;
100 	bool					Get_Projection				(CSG_Point &Point)		const;
101 
102 	bool					Get_Projection				(double &x, double &y, double &z)	const;
103 	bool					Get_Projection				(TSG_Point_Z &Point)				const;
104 	bool					Get_Projection				(CSG_Point_Z &Point)				const;
105 
106 
107 private:
108 
109 	bool					m_bInverse;
110 
111 	void					*m_pContext, *m_pSource, *m_pTarget, *m_pGCS;
112 
113 	CSG_Projection			m_Source, m_Target;
114 
115 	int						m_nCopies;
116 
117 	CSG_CRSProjector		*m_Copies;
118 
119 
120 	void					_On_Construction			(void);
121 
122 	bool					_Set_Projection				(const CSG_Projection &Projection, void **ppProjection, bool bInverse);
123 
124 };
125 
126 
127 ///////////////////////////////////////////////////////////
128 //														 //
129 //														 //
130 //														 //
131 ///////////////////////////////////////////////////////////
132 
133 //---------------------------------------------------------
134 #endif // #ifndef HEADER_INCLUDED__crs_transform_H
135