1212 |
kakl |
1 |
/************************************************************************ |
|
|
2 |
* |
|
|
3 |
* File: utm.h |
|
|
4 |
* RCS: $Header: /cvsroot/stelvio/stelvio/NavStar/Utm.h,v 1.2 2002/04/23 05:02:00 steve_l Exp $ |
|
|
5 |
* Author: Steve Loughran |
|
|
6 |
* Created: 2001 |
|
|
7 |
* Language: C++ |
|
|
8 |
* Package: |
|
|
9 |
* Status: Experimental |
|
|
10 |
* @doc |
|
|
11 |
* |
|
|
12 |
************************************************************************/ |
|
|
13 |
#pragma once |
|
|
14 |
|
|
|
15 |
//======================================================================= |
|
|
16 |
/** |
|
|
17 |
* UTM support goes here |
|
|
18 |
*/ |
|
|
19 |
//======================================================================= |
|
|
20 |
class CUtmPoint |
|
|
21 |
{ |
|
|
22 |
protected: |
|
|
23 |
double m_easting; |
|
|
24 |
double m_northing; |
|
|
25 |
int m_xzone; |
|
|
26 |
char m_yzone; |
|
|
27 |
public: |
|
|
28 |
|
|
|
29 |
//======================================================================= |
|
|
30 |
//======================================================================= |
|
|
31 |
CUtmPoint() |
|
|
32 |
{Clear();} |
|
|
33 |
|
|
|
34 |
//======================================================================= |
|
|
35 |
//======================================================================= |
|
|
36 |
CUtmPoint(const CPosition &p) |
|
|
37 |
{ |
|
|
38 |
FromPosition(p); |
|
|
39 |
} |
|
|
40 |
|
|
|
41 |
//======================================================================= |
|
|
42 |
//======================================================================= |
|
|
43 |
CUtmPoint(const CUtmPoint& that) |
|
|
44 |
{ |
|
|
45 |
m_easting=that.m_easting; |
|
|
46 |
m_northing=that.m_northing; |
|
|
47 |
m_xzone=that.m_xzone; |
|
|
48 |
m_yzone=that.m_yzone; |
|
|
49 |
} |
|
|
50 |
|
|
|
51 |
//======================================================================= |
|
|
52 |
//======================================================================= |
|
|
53 |
void Clear() |
|
|
54 |
{ |
|
|
55 |
m_easting=m_northing=0; |
|
|
56 |
m_xzone=0; |
|
|
57 |
m_yzone=0; |
|
|
58 |
} |
|
|
59 |
|
|
|
60 |
//======================================================================= |
|
|
61 |
/** |
|
|
62 |
@func Build a position string |
|
|
63 |
@parm target. must be 30 characters or longer. |
|
|
64 |
*/ |
|
|
65 |
//======================================================================= |
|
|
66 |
|
|
|
67 |
void GetString(TCHAR *position) const; |
|
|
68 |
|
|
|
69 |
//======================================================================= |
|
|
70 |
/** |
|
|
71 |
@func get the position of a UTM point |
|
|
72 |
@parm point out |
|
|
73 |
*/ |
|
|
74 |
//======================================================================= |
|
|
75 |
|
|
|
76 |
void ToPosition(CPosition &pos) const; |
|
|
77 |
|
|
|
78 |
//======================================================================= |
|
|
79 |
/** |
|
|
80 |
@func turn a position into a UTM point |
|
|
81 |
@parm position |
|
|
82 |
@rdesc true if it was in range |
|
|
83 |
*/ |
|
|
84 |
//======================================================================= |
|
|
85 |
|
|
|
86 |
bool FromPosition(const CPosition &pos); |
|
|
87 |
|
|
|
88 |
//======================================================================= |
|
|
89 |
/** |
|
|
90 |
range test |
|
|
91 |
*/ |
|
|
92 |
//======================================================================= |
|
|
93 |
|
|
|
94 |
static bool IsPositionInUtmSpace(const CPosition &pos) |
|
|
95 |
{ return pos.GetLatitude()<=84 && pos.GetLatitude()>=-80;} |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
}; |
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|