![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2011 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 /***************************************************************************** 00006 * $RCSfile: DtGeocentricGridLinesDrawer.h,v $ $Revision: 1.17 $ $State: Exp $ 00007 *****************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvOsg/vrvOsg.h> 00016 00017 #include <makArchives/DtGridLinesSettingsRecord.h> 00018 #include <vrvOsg/DtGridLinesDrawer.h> 00019 00020 #include <matrix/vlVector.h> 00021 #include <matrix/coordTransform.h> 00022 #include <matrix/refEllipsoid.h> 00023 00024 #include <boost/shared_ptr.hpp> 00025 00026 namespace makVrv 00027 { 00028 00029 class DtDe; 00030 class DtOsgChannel; 00031 class DtLineSegment; 00032 class DtTextProxy; 00033 class DtBoundingBox; 00034 00035 00039 class DT_DLL_VRVOSG DtGeocentricGridLinesDrawer 00040 : public DtGridLinesDrawer 00041 { 00042 public: 00043 00045 DtGeocentricGridLinesDrawer( DtDe& de ); 00046 00048 virtual ~DtGeocentricGridLinesDrawer(); 00049 00051 virtual void drawGridLines(); 00052 00054 virtual void setScale( double scale ); 00055 00057 virtual void setObserverPosition( const DtVector& position ); 00058 00060 virtual void setChannelDimensions( int startChannelX, int startChannelY, 00061 int endChannelX, int endChannelY ); 00062 00063 protected: 00064 00067 virtual void setupReferenceEllipsoid(); 00068 00070 virtual void setupTopoGeocTransforms(); 00071 00074 virtual bool pointVisible( const DtVector& point ) const; 00075 00077 virtual void findPolarSpacing(); 00078 00080 virtual void drawPolarLongitudeLines(); 00081 00083 virtual void drawPolarLatitudeLines(); 00084 00087 virtual void findLatLonWindowDimensions(); 00088 00090 virtual void findSpacing(); 00091 00094 virtual void anchorAndOffsetLines(); 00095 00097 virtual void drawLongitudeLines(); 00098 00100 virtual void drawLatitudeLines(); 00101 00103 virtual void createLabel( DtTextProxy*& label, double radians, 00104 bool isLongitude ) const; 00105 00107 virtual void destroyGridLines(); 00108 00111 virtual bool clip3D( const DtVector& pointA, const DtVector& pointB, 00112 DtVector& clippedA, DtVector& clippedB ) const; 00113 00114 // A Grid line is a vector of line segments that form the (notionally) 00115 // curved line 00116 00117 // A Grid Line is an array of line segments 00118 typedef std::vector<DtLineSegment*> GridLine; 00119 00120 // A Grid Line Vector is an array or Grid Lines 00121 typedef std::vector<GridLine> GridLineVector; 00122 typedef std::vector<DtTextProxy*> LabelArray; 00123 00126 virtual void clearUnusedLinesAndLabels( int index, GridLineVector& lines, 00127 LabelArray& labels ); 00128 00131 virtual void clearUnusedSegments( int index, GridLine& line ); 00132 00135 virtual void destroyLinesAndLabels( GridLineVector& lines, 00136 LabelArray& labels ); 00137 00141 virtual void resizeLinesAndLabels( GridLineVector& lines, LabelArray& labels, 00142 int numLines ); 00143 00146 virtual bool drawLineSegment( DtLineSegment*& segment, DtVector start, 00147 DtVector end, float* colorArray, bool* pass3D=0 ); 00148 00151 virtual GridLine& getSegmentedLine( GridLineVector& lines, int index, int numSegments ); 00152 00153 private: 00154 00156 DtGeocentricGridLinesDrawer( 00157 const DtGeocentricGridLinesDrawer& orig ); 00158 00160 DtGeocentricGridLinesDrawer& operator=( 00161 const DtGeocentricGridLinesDrawer& rhs ); 00162 00163 protected: 00164 00165 GridLineVector myLongitudeLines; 00166 GridLineVector myLatitudeLines; 00167 00168 LabelArray myLongitudeLabels; 00169 LabelArray myLatitudeLabels; 00170 00171 double myLatSpacing; // In Radians 00172 double myLonSpacing; 00173 double myScale; 00174 unsigned int myChannelSize; 00175 DtVector myObserverPosition; 00176 double myObserverLatitude; 00177 double myObserverLongitude; 00178 int myChannelExpansionX; 00179 int myChannelExpansionY; 00180 00181 // This is the normal of the plane facing the observer through the 00182 // center of the earth. Used for all 3D clipping. 00183 DtVector myClipNormal; 00184 00185 double myStartLat; 00186 double myEndLat; 00187 double myStartLon; 00188 double myEndLon; 00189 DtCoordTransform myGeocToTopoTransform; 00190 DtCoordTransform myTopoToGeocTransform; 00191 DtReferenceEllipsoid myReferenceEllipsoid; 00192 double myAnchoredStartLat; 00193 double myAnchoredEndLat; 00194 double myAnchoredStartLon; 00195 double myAnchoredEndLon; 00196 bool myLatCrossesPole; 00197 }; 00198 }