1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //                     Tool Library                      //
9 //                   Projection_Proj4                    //
10 //                                                       //
11 //-------------------------------------------------------//
12 //                                                       //
13 //                    crs_distance.h                     //
14 //                                                       //
15 //                 Copyright (C) 2015 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_distance_H
50 #define HEADER_INCLUDED__crs_distance_H
51 
52 
53 ///////////////////////////////////////////////////////////
54 //														 //
55 //														 //
56 //														 //
57 ///////////////////////////////////////////////////////////
58 
59 //---------------------------------------------------------
60 #include "crs_base.h"
61 
62 
63 ///////////////////////////////////////////////////////////
64 //														 //
65 //														 //
66 //														 //
67 ///////////////////////////////////////////////////////////
68 
69 //---------------------------------------------------------
70 class CCRS_Distance_Calculator
71 {
72 public:
73 	CCRS_Distance_Calculator(void);
74 	CCRS_Distance_Calculator(const CSG_Projection &Projection, double Epsilon);
75 	virtual ~CCRS_Distance_Calculator(void);
76 
77 	bool					Create					(const CSG_Projection &Projection, double Epsilon);
78 
79 	double					Get_Orthodrome			(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine);
80 	double					Get_Loxodrome			(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine);
81 
82 
83 private:
84 
85 	double					m_Epsilon;
86 
87 	CSG_CRSProjector		m_Projector, m_ProjToGCS;
88 
89 
90 	double					Get_Distance			(TSG_Point A, TSG_Point B);
91 
92 	void					Add_Segment				(const TSG_Point &A, const TSG_Point &B, CSG_Shape *pLine, double *Length = NULL);
93 
94 };
95 
96 
97 ///////////////////////////////////////////////////////////
98 //														 //
99 ///////////////////////////////////////////////////////////
100 
101 //---------------------------------------------------------
102 class CCRS_Distance_Lines : public CSG_Tool
103 {
104 public:
105 	CCRS_Distance_Lines(void);
106 
Get_MenuPath(void)107 	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("Tools") );	}
108 
109 
110 protected:
111 
112 	virtual bool			On_Execute				(void);
113 
114 };
115 
116 
117 ///////////////////////////////////////////////////////////
118 //														 //
119 ///////////////////////////////////////////////////////////
120 
121 //---------------------------------------------------------
122 class CCRS_Distance_Points : public CCRS_Base
123 {
124 public:
125 	CCRS_Distance_Points(void);
126 
Get_MenuPath(void)127 	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("Tools") );	}
128 
129 
130 protected:
131 
132 	virtual bool			On_Execute				(void);
133 
134 };
135 
136 
137 ///////////////////////////////////////////////////////////
138 //														 //
139 ///////////////////////////////////////////////////////////
140 
141 //---------------------------------------------------------
142 class CCRS_Distance_Interactive : public CSG_Tool_Interactive
143 {
144 public:
145 	CCRS_Distance_Interactive(void);
146 
Get_MenuPath(void)147 	virtual CSG_String		Get_MenuPath			(void)	{	return( _TL("Tools") );	}
148 
149 
150 protected:
151 
152 	virtual bool			On_Execute				(void);
153 
154 	virtual bool			On_Execute_Position		(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode);
155 
156 
157 private:
158 
159 	CSG_Point				m_Down;
160 
161 	CSG_Projection			m_Projection;
162 
163 };
164 
165 
166 ///////////////////////////////////////////////////////////
167 //														 //
168 //														 //
169 //														 //
170 ///////////////////////////////////////////////////////////
171 
172 //---------------------------------------------------------
173 #endif // #ifndef HEADER_INCLUDED__crs_distance_H
174