VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
utmCS.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: utmCoordSys.h,v $ $Revision: 1.35 $ $State: Exp $
7 *********************************************************************/
8 #ifndef utmCS_H_
9 #define utmCS_H_
10 
11 //
12 // \file utmCoordSys.h Contains the declaration of the UTM coordinate system class.
13 //
15 #include "terrainCS/coordSystem.h"
16 #include <matrix/utmCoord.h>
17 #include <vl/utmView.h>
18 #include <matrix/utmReferencePoint.h>
19 
20 // DtUtmCS is the base class for converting between DIS
21 // (geocentric) and local (DB) coordinates. Coordinates are WGS84
22 // geocentric Cartesian coordinate (GCC) systems. Rotations are
23 // defined as right-handed rotations about Z, then Y, then X and DIS
24 // body coordinates ate defined as Y front, X right, Z down.
25 // Rotations transform between DIS body and DIS world.
26 //
27 // All derived classes convert between their own system and the DIS
28 // system
30 {
31 public:
32 
33  DtUtmCS(const DtDegMinSec &refLatitude,
34  const DtDegMinSec &refLongitude,
35  int standardOffsets,
36  long zone = 0,
37  bool setUseDynamicSceneOrigin = false,
38  double dynamicSceneOriginDeadband = 0.0,
39  double scaleFactor = 0.9996);
40 
41  DtUtmCS(double refLatitude, // in Radians
42  double refLongitude, // in Radians
43  int standardOffsets,
44  long zone = 0,
45  bool setUseDynamicSceneOrigin = false,
46  double dynamicSceneOriginDeadband = 0.0,
47  double scaleFactor = 0.9996);
48 
49  //
50  // \note These parameters are available from ModSAF CTDBs.
51  DtUtmCS(int zone,
52  double northing,
53  double easting,
54  double scaleFactor = 0.9996);
55 
56  DtUtmCS(const DtUtmCS& orig);
57 
58  // Destructor
59  virtual ~DtUtmCS() override;
60 
61  // Assignment operator
62  DtUtmCS& operator=(const DtUtmCS& orig);
63 
64  // Clone operator
65  virtual Coordinate_System *clone() const override;
66 
67 
68  virtual void dis2local(const DtVector &in, DtVector &out) const override;
69 
70  virtual void dis2local(const DtDcm &in, DtDcm &out) const override;
71 
72  virtual void dis2local(const DtVector &vIn, const DtDcm &dIn, DtVector &vOut,
73  DtDcm &dOut) const override;
74 
75  virtual void disBody2localBody(const DtVector &in,
76  DtVector &out) const override;
77 
78  virtual void disBody2localBody(const DtDcm &in, DtDcm &out) const override;
79 
80  virtual void local2dis(const DtVector &in, DtVector &out) const override;
81 
82  virtual void local2dis(const DtDcm &in, DtDcm &out) const override;
83 
84  virtual void local2dis(const DtVector &vIn, const DtDcm &dIn, DtVector &vOut,
85  DtDcm &dOut) const override;
86 
87  virtual void localBody2disBody(const DtVector &in,
88  DtVector &out) const override;
89 
90  virtual void localBody2disBody(const DtDcm &in, DtDcm &out) const override;
91 
92  // \return The geodetic coordinate for a given local position.
93  virtual void localToGeodetic(const DtVector &localPosition,
94  DtGeodeticCoord &geodeticPosition) const override;
95 
96  // \return The local coordinate for a given geodetic position.
97  virtual void geodeticToLocal(const DtGeodeticCoord &geodeticPosition,
98  DtVector &localPosition) const override;
99 
100  // \return A coordinate transformation object for going between
101  // topo and local coordinates, at a given location. It is up to the
102  // caller to ensure that topoToLocal and localToTopo are valid pointers.
103  virtual void topoToLocal(const DtVector &localPosition,
104  DtDcm &topoToLocal) const override;
105  virtual void localToTopo(const DtVector &localPosition,
106  DtDcm &localToTopo) const override;
107 
108  // \return Unit vector pointing down (along the direction of gravity)
109  // at the specified location.
110  virtual DtVector down(const DtVector &location) const override;
111 
112  // Reset the origin of the scene
113  virtual void updateDynamicSceneOrigin(const DtVector &newOrigin) override;
114 
115  // Given a latitude & longitude, returns the UTM zone number in which
116  // that coordinates resides. With the exception of a couple anomalies,
117  // the world is broken up into 6 degree wide slices.
118  static DtU16 latlonToUtmZone(double lat_deg, double lon_deg);
119 
120  // \return The UTM zone of utmReferencePoint
121  virtual long zone() const;
122 
123  // \return Zone of myZone member.
124  long userSetZone() const;
125  void setUserSetZone(long);
126 
127  // Reinitializes coordinate system from newly specified zone
128  virtual void initFromZone(long zone);
129 
130  // Call this to reset the lat/lon and zone from new values. Will only
131  // set the coordinate system. Will not reset the coordinates of the
132  // database
133  virtual void initFromLatLonZone(double radLat, double radLon, int zone = 0, double scaleFactor = 0.9996);
134 
135  int zoneOrigin() const;
136 
137  // Returns name of coordinate system
138  virtual DtString coordinateSystemName() const override;
139 
140  double projectionScale() const;
141  virtual void setOrigin(const DtGeodeticCoord &c) override;
142 
143  virtual bool isSameCS(const Coordinate_System *CSystem) const override;
144 
145  // Returns transform matricies that use grid declination to be able to translate
146  // between coordiate systems
147  virtual DtDcm geocToUtmMatrix(const DtVector& geocLoc) const;
148  virtual DtDcm utmToGeocMatrix(const DtVector& geocLoc) const;
149  virtual DtDcm utmToTopoMatrix(const DtVector& geocLoc) const;
150  virtual DtDcm topoToUtmMatrix(const DtVector& geocLoc) const;
151 
152  virtual void setStandardFalseEasting(double);
153  virtual void setStandardFalseNorthing(double);
154 
155  virtual double standardFalseEasting() const;
156  virtual double standardFalseNorthing() const;
157 
158  const DtUtmReferencePoint* utmReferencePoint() const;
159 
160 private:
161  // This class only partially overrides these functions, so hide them explicitly.
166 
167 public:
168  static double UTM_Projection_Scale;
169 
170 protected:
171 
172  // Used by derived classes
173  DtUtmCS();
174 
175  void initRefLatLon(const DtDegMinSec &refLatitude, const DtDegMinSec &refLongitude,
176  int standardOffsets, long zone = 0, bool setUseDynamicSceneOrigin = false,
177  double dynamicSceneOriginDeadband = 0.0, double scaleFactor = 0.9996);
178 
181 
182  // These are saved so that we can serialize and un-serialize the CS.
183  DtDegMinSec myRefLatitude;
184  DtDegMinSec myRefLongitude;
185  long myZone;
190  DtUtmReferencePoint myUtmReferencePoint;
191 };
192 
193 inline const DtUtmReferencePoint* DtUtmCS::utmReferencePoint() const
194 {
195  return &myUtmReferencePoint;
196 }
197 
198 inline int DtUtmCS::zoneOrigin() const
199 {
200  return myUtmReferencePoint.zoneOrigin();
201 }
202 
203 inline double DtUtmCS::projectionScale() const
204 {
205  return myScaleFactor;
206 }
207 
208 inline long DtUtmCS::userSetZone() const
209 {
210  return myZone;
211 }
212 
213 inline void DtUtmCS::setUserSetZone(long c)
214 {
215  myZone = c;
216 }
217 
218 #endif
virtual void disBody2localBody(const DtVector &in, DtVector &out) const
const DtUtmReferencePoint * utmReferencePoint() const
Definition: utmCS.h:193
int myUseDynamicSceneOrigin
Definition: utmCS.h:187
virtual void updateDynamicSceneOrigin(const DtVector &New_Origin)
void setUserSetZone(long)
Definition: utmCS.h:213
double myScaleFactor
Definition: utmCS.h:189
double myDynamicSceneOriginDeadband
Definition: utmCS.h:188
virtual bool isSameCS(const Coordinate_System *CSystem) const
long userSetZone() const
Definition: utmCS.h:208
DtUtmReferencePoint myUtmReferencePoint
Definition: utmCS.h:190
virtual void setOrigin(const DtGeodeticCoord &)
Definition: utmCS.h:29
DtDcm myOriginUtm2Dis
Definition: utmCS.h:180
virtual void localToTopo(const DtVector &localPosition, DtDcm &localToTopo) const
double projectionScale() const
Definition: utmCS.h:203
Definition: coordSystem.h:54
virtual void local2dis(const DtVector &in, DtVector &out) const
virtual void dis2local(const DtVector &in, DtVector &out) const
virtual void topoToLocal(const DtVector &localPosition, DtDcm &topoToLocal) const
int myStandardOffsets
Definition: utmCS.h:186
Coordinate_System & operator=(const Coordinate_System &orig)
virtual void geodeticToLocal(const DtGeodeticCoord &geodeticPosition, DtVector &localPosition) const
virtual DtVector down(const DtVector &localPosition) const
virtual Coordinate_System * clone() const
DtDegMinSec myRefLongitude
Definition: utmCS.h:184
virtual void localBody2disBody(const DtVector &in, DtVector &out) const
virtual void localToGeodetic(const DtVector &localPosition, DtGeodeticCoord &geodeticPosition) const
long myZone
Definition: utmCS.h:185
DtDcm myOriginDis2Utm
Definition: utmCS.h:179
virtual DtString coordinateSystemName() const
#define DT_DLL_terrainCS
Definition: terrainCSDefines.h:23
static double UTM_Projection_Scale
Definition: utmCS.h:168
DtDegMinSec myRefLatitude
Definition: utmCS.h:183
int zoneOrigin() const
Definition: utmCS.h:198

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)