VR-Forces 4.0.4 Class Documentation
include/terrainCS/utmCoordSys.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 1996 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: utmCoordSys.h,v $ $Revision: 1.35 $ $State: Exp $
00007 *********************************************************************/
00008 #ifndef utmCoordSys_H_
00009 #define utmCoordSys_H_
00010 
00011 //
00012 // \file utmCoordSys.h Contains the declaration of the UTM coordinate system class.
00013 //
00014 #include "terrainCS/terrainCSDefines.h"
00015 #include "terrainCS/coordSystem.h"
00016 #include <matrix/utmCoord.h>
00017 #include <vl/utmView.h>
00018 #include <matrix/utmRefPt.h>
00019 
00020 // DtUtmCS is the base class for converting between DIS 
00021 // (geocentric) and local (DB) coordinates.  Coordinates are WGS84
00022 // geocentric Cartesian coordinate (GCC) systems.  Rotations are 
00023 // defined as right-handed rotations about Z, then Y, then X and DIS
00024 // body coordinates ate defined as Y front, X right, Z down.  
00025 // Rotations transform between DIS body and DIS world.
00026 //
00027 // All derived classes convert between their own system and the DIS
00028 // system
00029 class DT_DLL_terrainCS DtUtmCS : public Coordinate_System
00030 {
00031 public:
00032 
00033    DtUtmCS(const DtDegMinSec &refLatitude,
00034                          const DtDegMinSec &refLongitude, 
00035                          int standardOffsets,
00036                          long zone = 0,
00037                          bool setUseDynamicSceneOrigin = false,
00038                          double dynamicSceneOriginDeadband = 0.0,
00039                          double scaleFactor = 0.9996);
00040    
00041    DtUtmCS(double refLatitude,  // in Radians
00042                          double refLongitude, // in Radians
00043                          int standardOffsets,
00044                          long zone = 0,
00045                          bool setUseDynamicSceneOrigin = false,
00046                          double dynamicSceneOriginDeadband = 0.0,
00047                          double scaleFactor = 0.9996);
00048 
00049    //
00050    // \note These parameters are available from ModSAF CTDBs. 
00051    DtUtmCS(int zone,
00052                          double northing,
00053                          double easting,
00054                          double scaleFactor = 0.9996);
00055 
00056    DtUtmCS(const DtUtmCS& orig);
00057 
00058    // Destructor
00059    virtual ~DtUtmCS();
00060 
00061    // Assignment operator
00062    DtUtmCS& operator=(const DtUtmCS& orig);
00063 
00064    // Clone operator
00065    virtual Coordinate_System* clone() const;
00066 
00067 
00068    virtual void dis2local(const DtVector& in, DtVector& out) const;
00069 
00070    virtual void dis2local(const DtDcm& in, DtDcm& out) const;
00071 
00072    virtual void dis2local(const DtVector& vIn, const DtDcm& dIn, 
00073                           DtVector& vOut, DtDcm& dOut) const;
00074 
00075    virtual void disBody2localBody(const DtVector& in, DtVector& out) const;
00076 
00077    virtual void disBody2localBody(const DtDcm& in, DtDcm& out) const;
00078 
00079    virtual void local2dis(const DtVector& in, DtVector& out) const;
00080 
00081    virtual void local2dis(const DtDcm& in, DtDcm& out) const;
00082 
00083    virtual void local2dis(const DtVector& vIn, const DtDcm& dIn, 
00084                           DtVector& vOut, DtDcm& dOut) const;
00085 
00086    virtual void localBody2disBody(const DtVector& in, DtVector& out) const;
00087 
00088    virtual void localBody2disBody(const DtDcm& in, DtDcm& out) const;
00089 
00090    // \return The geodetic coordinate for a given local position.
00091    virtual void localToGeodetic(const DtVector& localPosition,
00092       DtGeodeticCoord& geodeticPosition) const;
00093 
00094    // \return The local coordinate for a given geodetic position.
00095    virtual void geodeticToLocal(const DtGeodeticCoord& geodeticPosition,
00096       DtVector& localPosition) const;
00097 
00098    // \return A coordinate transformation object for going between 
00099    // topo and local coordinates, at a given location.  It is up to the
00100    // caller to ensure that topoToLocal and localToTopo are valid pointers.
00101    virtual void topoToLocal(const DtVector& localPosition, 
00102       DtDcm& topoToLocal) const;
00103    virtual void localToTopo(const DtVector& localPosition, 
00104       DtDcm& localToTopo) const;
00105 
00106    // \return Unit vector pointing down (along the direction of gravity) 
00107    // at the specified location.
00108    virtual DtVector down(const DtVector& location) const;
00109 
00110    // Reset the origin of the scene
00111    virtual void updateDynamicSceneOrigin(const DtVector& newOrigin);
00112 
00113    // Given a latitude & longitude, returns the UTM zone number in which
00114    // that coordinates resides.  With the exception of a couple anomalies,
00115    // the world is broken up into 6 degree wide slices.
00116    static DtU16 latlonToUtmZone(double lat_deg, double lon_deg);
00117 
00118    // \return The UTM zone of utmReferencePoint
00119    virtual long zone() const;
00120 
00121    // \return Zone of myZone member.
00122    long userSetZone() const;
00123    void setUserSetZone(long);
00124 
00125    // Reinitializes coordinate system from newly specified zone
00126    virtual void initFromZone(long zone);
00127 
00128    // Call this to reset the lat/lon and zone from new values.  Will only
00129    // set the coordinate system.  Will not reset the coordinates of the
00130    // database
00131    virtual void initFromLatLonZone(double radLat, double radLon, int zone = 0, double scaleFactor = 0.9996);
00132 
00133    int zoneOrigin() const;
00134 
00135    // Returns name of coordinate system
00136    virtual DtString coordinateSystemName() const;
00137 
00138    double projectionScale() const;
00139    virtual void setOrigin(const DtGeodeticCoord& c);
00140 
00141    virtual bool isSameCS(const Coordinate_System* CSystem) const;
00142 
00143    // Returns transform matricies that use grid declination to be able to translate
00144    // between coordiate systems
00145    virtual DtDcm geocToUtmMatrix(const DtVector& geocLoc) const;
00146    virtual DtDcm utmToGeocMatrix(const DtVector& geocLoc) const;
00147    virtual DtDcm utmToTopoMatrix(const DtVector& geocLoc) const;
00148    virtual DtDcm topoToUtmMatrix(const DtVector& geocLoc) const;
00149 
00150    virtual void setStandardFalseEasting(double);
00151    virtual void setStandardFalseNorthing(double);
00152 
00153    virtual double standardFalseEasting() const;
00154    virtual double standardFalseNorthing() const;
00155 
00156    const DtUtmReferencePoint* utmReferencePoint() const;
00157 
00158 private:
00159    // This class only partially overrides these functions, so hide them explicitly.
00160    using Coordinate_System::dis2local;
00161    using Coordinate_System::local2dis;
00162    using Coordinate_System::localToGeodetic;
00163    using Coordinate_System::geodeticToLocal;
00164 
00165 public:
00166    static double UTM_Projection_Scale;
00167 
00168 protected:
00169 
00170    // Used by derived classes
00171    DtUtmCS();
00172 
00173    void initRefLatLon(const DtDegMinSec &refLatitude, const DtDegMinSec &refLongitude,
00174       int standardOffsets, long zone = 0, bool setUseDynamicSceneOrigin = false,
00175       double dynamicSceneOriginDeadband = 0.0, double scaleFactor = 0.9996);
00176 
00177    DtDcm myOriginDis2Utm;
00178    DtDcm myOriginUtm2Dis;
00179 
00180    // These are saved so that we can serialize and un-serialize the CS. 
00181    DtDegMinSec myRefLatitude;
00182    DtDegMinSec myRefLongitude;
00183    long        myZone;
00184    int         myStandardOffsets;
00185    int         myUseDynamicSceneOrigin;
00186    double      myDynamicSceneOriginDeadband;
00187    double      myScaleFactor;
00188    DtUtmReferencePoint myUtmReferencePoint;
00189 };
00190 
00191 inline const DtUtmReferencePoint* DtUtmCS::utmReferencePoint() const
00192 {
00193    return &myUtmReferencePoint;
00194 }
00195 
00196 inline int DtUtmCS::zoneOrigin() const
00197 {
00198    return myUtmReferencePoint.zoneOrigin();
00199 }
00200 
00201 inline double DtUtmCS::projectionScale() const
00202 {
00203    return myScaleFactor;
00204 }
00205 
00206 inline long DtUtmCS::userSetZone() const
00207 {
00208    return myZone;
00209 }
00210 
00211 inline void DtUtmCS::setUserSetZone(long c)
00212 {
00213    myZone = c;
00214 }
00215 
00216 #endif

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)