VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGeocentricGridLinesDrawer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2019 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
16 #include <vrvUtil/DtUnicode.h>
17 
18 #include <matrix/vlVector.h>
19 #include <matrix/coordTransform.h>
20 #include <matrix/referenceEllipsoid.h>
21 
22 #include <boost/shared_ptr.hpp>
23 #include <boost/unordered_set.hpp>
24 #include <boost/unordered_map.hpp>
25 
26 #include <osg/Vec3>
27 
28 namespace makVrv
29 {
30 
31  class DtDe;
32  class DtOsgChannel;
33  class DtLineSegment;
34  class DtTextProxy;
35  class DtBoundingBox;
36 
37 
43  : public DtGridLinesDrawer
44  {
45  public:
46 
49 
51  virtual ~DtGeocentricGridLinesDrawer();
52 
54  virtual void drawGridLines();
55 
57  virtual void setScale( double scale );
58 
60  virtual void setObserverPosition( const DtVector& position );
61 
63  virtual void setChannelDimensions( int startChannelX, int startChannelY,
64  int endChannelX, int endChannelY );
65 
66  protected:
67 
69  virtual void reloadTextFonts();
70 
72  virtual void reloadLabelFonts(std::vector<DtTextProxy*>& labels);
73 
76  virtual void setupReferenceEllipsoid();
77 
79  virtual void setupTopoGeocTransforms();
80 
83  virtual bool pointVisible( const DtVector& point ) const;
84 
86  virtual void findPolarSpacing();
87 
89  virtual void drawPolarLongitudeLines();
90 
92  virtual void drawPolarLatitudeLines();
93 
96  virtual void findLatLonWindowDimensions();
97 
99  virtual void findSpacing();
100 
103  virtual void anchorAndOffsetLines();
104 
106  virtual void drawLongitudeLines();
107 
109  virtual void drawLatitudeLines();
110 
112  virtual void createLabel( DtTextProxy*& label, double radians, bool isLongitude);
113 
115  virtual void destroyGridLines();
116 
119  virtual bool clip3D( const DtVector& pointA, const DtVector& pointB,
120  DtVector& clippedA, DtVector& clippedB ) const;
121 
122  // A Grid line is a vector of line segments that form the (notionally)
123  // curved line
124 
125  // A Grid Line is an array of line segments
126  typedef std::vector<DtLineSegment*> GridLine;
127 
128  // A Grid Line Vector is an array or Grid Lines
129  typedef std::vector<GridLine> GridLineVector;
130  typedef std::vector<DtTextProxy*> LabelArray;
131 
134  virtual void clearUnusedLinesAndLabels(int index, GridLineVector& lines,
135  LabelArray& labels);
136 
139  virtual void clearUnusedSegments( int index, GridLine& line );
140 
143  virtual void destroyLinesAndLabels( GridLineVector& lines,
144  LabelArray& labels );
145 
149  virtual void resizeLinesAndLabels( GridLineVector& lines, LabelArray& labels,
150  int numLines );
151 
154  virtual bool drawLineSegment( DtLineSegment*& segment, const DtVector& start,
155  const DtVector& end, float* colorArray, bool* pass3D=0);
156 
159  virtual GridLine& getSegmentedLine( GridLineVector& lines, int index, int numSegments );
160 
162 
176 
180  virtual bool drawStandardLongitudeLine(GridLine& lonLine, double resolution, int numSegs, float curLon, int& curSeg);
181 
186  virtual bool drawNorwayMgrsLongitudeLine(GridLine& lonLine, double resolution, int numSegs, int& curSeg);
187 
192  virtual bool drawSvalbardMgrsLongitudeLines(GridLine& lonLine, double resolution, int numSegs, float curLon, int& curSeg);
193 
194 
196  virtual void drawMapSheetLines();
197 
203  virtual void findMapSheetSpacing();
204 
211  virtual bool anchorMapSheetLines();
212 
214  virtual void clearUnusedLines(int index, GridLineVector& lines);
215 
217  virtual void clearUnusedLabels(int index, LabelArray& labels);
218 
220  struct MgrsSegStart
224  {
225  double lat;
226  double lon;
227  };
229  typedef std::vector<MgrsSegStart> SegmentStarts;
231  typedef std::vector<SegmentStarts> SegmentLocator;
233 
235  virtual SegmentStarts& getSegmentedLocator(SegmentLocator& lines, int index, int numSegments);
236 
238  virtual void resizeLocators(SegmentLocator& locator, int numLines);
239 
241  virtual void clearUnusedLocators(int index, SegmentLocator& locator);
242 
249  virtual bool drawUtmLineSegment(GridLine& line, SegmentStarts& lineLocator, int segIndex, int zone, char hemisphere,
250  double startEasting, double startNorthing, double endEasting, double endNorthing, bool constrainEasting=false);
251 
253  virtual void findEastingLimits(double lat, double& minEasting, double& maxEasting);
254 
256 
265  virtual void drawEastWestMapSheetLines();
266 
267  // \brief Draw the portion of an northing (east-west) line that lies in the specified utm zone
275  virtual int drawEastWestMapSheetLineForUtmZone(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int zone,
276  char hemisphere, double northingLine, int zoneMapSheets, int numSegs, int numPartialSegs, double partialExtra);
277 
278  // \brief Draw the interior portion of a northing line that lies in a specified utm zone
282  virtual int drawEastWestZoneInterior(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int utmZone,
283  char hemisphere, double northingLine, int numSegs, int startEasting, int endEasting);
285 
287 
295  virtual void drawNorthSouthMapSheetLines();
296 
302  virtual int drawNorthSouthMapSheetLinesForUtmZone(int zone, double maxZoneWidth, int iLine);
303 
312  virtual bool drawNorthSouthMapSheetLine(int utmZone, double eastingLine, int iLine);
314 
316 
326  virtual bool getGzdAndMapSheet(const DtVector& geocLoc, DtUnicode& gzd, DtUnicode& gzdAndMapSheet);
327 
334  virtual void labelGridZones();
335 
339  virtual bool labelGridZoneDesignator(double lonValue, double latValue, int labelIndex);
340 
345  virtual bool includeMgrsDesignator(double lonValue, double latValue, osg::Vec3& screenPos, DtVector& geocResult);
346 
349  virtual bool includeMgrsDesignator(double lonValue, double latValue, float screenPosX,
350  float screenPosY, DtVector& geocResult);
351 
357  virtual void createGridLineLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY,
358  bool isEasting);
359 
365  virtual void labelMapSheetLines();
366 
371  virtual bool createMapSheetLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY);
372 
375  virtual DtFont::TextAlignement offsetGridBoxLabel(double xSrc, double ySrc, double& xOffset, double& yOffset,
376  DtBoundingBox& bbox) const;
378 
380 
381  private:
382 
385 
388 
389  protected:
390 
393 
396 
397  double myLatSpacing; // In Radians
398  double myLonSpacing;
399  double myScale;
400  unsigned int myMinChannelDimension; // the smaller of the actual channel width and channel height
401  unsigned int myChannelSize;
407 
408  // This is the normal of the plane facing the observer through the
409  // center of the earth. Used for all 3D clipping.
411 
412  double myStartLat;
413  double myEndLat;
414  double myStartLon;
415  double myEndLon;
416  DtCoordTransform myGeocToTopoTransform;
417  DtCoordTransform myTopoToGeocTransform;
418  DtReferenceEllipsoid myReferenceEllipsoid;
424 
425  // MGRS implementation-specific members
426  typedef boost::unordered_set<DtUnicode> UsedGridLabels;
429 
432 
433  // The locator vectors mirror the GridLine Vectors, providing the lat/lon
434  // for the start of each segment (used for labeling)
437 
440 
443 
444  int myMapSheetSpacing; // 100,000, 10,000, 1,000, 100, 10, or 1m (or 0 for none)
453  };
454 }
double myEndLat
Definition: DtGeocentricGridLinesDrawer.h:413
double myAnchoredStartNorthing
Definition: DtGeocentricGridLinesDrawer.h:446
A unicode string.
Definition: DtUnicode.h:33
LabelArray myGzdLabels
Definition: DtGeocentricGridLinesDrawer.h:430
SegmentLocator myNorthSouthSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:436
std::vector< DtLineSegment * > GridLine
Definition: DtGeocentricGridLinesDrawer.h:126
std::vector< GridLine > GridLineVector
Definition: DtGeocentricGridLinesDrawer.h:129
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
double myLonSpacing
Definition: DtGeocentricGridLinesDrawer.h:398
UsedGridLabels myUsedGzdLabels
Definition: DtGeocentricGridLinesDrawer.h:427
double myAnchoredEndEasting
Definition: DtGeocentricGridLinesDrawer.h:447
DtReferenceEllipsoid myReferenceEllipsoid
Definition: DtGeocentricGridLinesDrawer.h:418
double myStartLat
Definition: DtGeocentricGridLinesDrawer.h:412
double myAnchoredEndLat
Definition: DtGeocentricGridLinesDrawer.h:420
double myObserverLongitude
Definition: DtGeocentricGridLinesDrawer.h:404
SegmentLocator myEastWestSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:439
double myAnchoredStartLat
Definition: DtGeocentricGridLinesDrawer.h:419
A class for controlling text owned by the TextRenderer.
Definition: DtTextRenderer.h:90
Draw 2D Grid Lines on geocentric databases.
Definition: DtGeocentricGridLinesDrawer.h:42
LabelArray myEastWestLabels
Definition: DtGeocentricGridLinesDrawer.h:442
LabelArray myNorthSouthLabels
Definition: DtGeocentricGridLinesDrawer.h:441
std::vector< MgrsSegStart > SegmentStarts
The starting location of each mapsheet line segment drawn for one line.
Definition: DtGeocentricGridLinesDrawer.h:229
TextAlignement
Definition: DtFont.h:33
double myScale
Definition: DtGeocentricGridLinesDrawer.h:399
bool myLatCrossesPole
Definition: DtGeocentricGridLinesDrawer.h:423
UsedGridLabels myUsedMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:428
DtVector myClipNormal
Definition: DtGeocentricGridLinesDrawer.h:410
std::vector< DtTextProxy * > LabelArray
Definition: DtGeocentricGridLinesDrawer.h:130
A class which represents a single line segment.
Definition: DtLineSegment.h:21
LabelArray myLatitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:395
LabelArray myMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:431
double myLatSpacing
Definition: DtGeocentricGridLinesDrawer.h:397
double myObserverLatitude
Definition: DtGeocentricGridLinesDrawer.h:403
unsigned int myChannelSize
Definition: DtGeocentricGridLinesDrawer.h:401
double myAnchoredEndNorthing
Definition: DtGeocentricGridLinesDrawer.h:448
int myChannelExpansionX
Definition: DtGeocentricGridLinesDrawer.h:405
double myAnchoredStartLon
Definition: DtGeocentricGridLinesDrawer.h:421
double myEndLon
Definition: DtGeocentricGridLinesDrawer.h:415
GridLineVector myLatitudeLines
Definition: DtGeocentricGridLinesDrawer.h:392
double lon
Definition: DtGeocentricGridLinesDrawer.h:226
double myAnchoredEndLon
Definition: DtGeocentricGridLinesDrawer.h:422
GridLineVector myNorthSouthLines
Definition: DtGeocentricGridLinesDrawer.h:435
Contains the DtGridLinesSettingsRecord class declaration.
double myStartLon
Definition: DtGeocentricGridLinesDrawer.h:414
LabelArray myLongitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:394
DtCoordTransform myGeocToTopoTransform
Definition: DtGeocentricGridLinesDrawer.h:416
int myChannelExpansionY
Definition: DtGeocentricGridLinesDrawer.h:406
boost::unordered_set< DtUnicode > UsedGridLabels
Definition: DtGeocentricGridLinesDrawer.h:426
Base class with common data / methods for drawing grid lines on projected and geocentric databases \i...
Definition: DtGridLinesDrawer.h:32
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
double myAnchoredStartUtmZone
Definition: DtGeocentricGridLinesDrawer.h:449
Structure / typedefs for segment locators.
Definition: DtGeocentricGridLinesDrawer.h:223
double myAnchoredStartEasting
Definition: DtGeocentricGridLinesDrawer.h:445
DtVector myObserverPosition
Definition: DtGeocentricGridLinesDrawer.h:402
GridLineVector myLongitudeLines
Definition: DtGeocentricGridLinesDrawer.h:391
char myAnchoredStartNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:451
double myAnchoredEndUtmZone
Definition: DtGeocentricGridLinesDrawer.h:450
int myMapSheetSpacing
Definition: DtGeocentricGridLinesDrawer.h:444
double lat
Definition: DtGeocentricGridLinesDrawer.h:225
unsigned int myMinChannelDimension
Definition: DtGeocentricGridLinesDrawer.h:400
DtCoordTransform myTopoToGeocTransform
Definition: DtGeocentricGridLinesDrawer.h:417
char myAnchoredEndNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:452
A simple bounding box.
Definition: DtBoundingBox.h:101
std::vector< SegmentStarts > SegmentLocator
A vector of SegmentStarts, one for each line drawn.
Definition: DtGeocentricGridLinesDrawer.h:231
GridLineVector myEastWestLines
Definition: DtGeocentricGridLinesDrawer.h:438

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)