VR-Forces Developer's Guide
 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) 2022 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  enum class DtGarsPrecision;
37 
43  : public DtGridLinesDrawer
44  {
45  public:
46 
49 
51  virtual ~DtGeocentricGridLinesDrawer();
52 
54  virtual void drawGridLines();
55 
57  virtual void drawPolarGridLines();
58 
60  virtual void drawMidLatitudeGridLines();
61 
62 
64  virtual void setScale( double scale );
65 
67  virtual void setObserverPosition( const DtVector& position );
68 
70  virtual void setChannelDimensions( int startChannelX, int startChannelY,
71  int endChannelX, int endChannelY );
72 
74  virtual void setLatLonLabelsCenteringCutoff(double alt);
75 
77  virtual void setGarsPolarLatitudeCutoff(double lat);
78 
79  protected:
80 
82  virtual void reloadTextFonts();
83 
85  virtual void reloadLabelFonts(std::vector<DtTextProxy*>& labels);
86 
89  virtual void setupReferenceEllipsoid();
90 
92  virtual void setupTopoGeocTransforms();
93 
96  virtual bool pointVisible( const DtVector& point ) const;
97 
99  virtual void findPolarSpacing();
100 
102  virtual void drawPolarLongitudeLines();
103 
105  virtual void drawPolarLatitudeLines();
106 
109  virtual void findLatLonWindowDimensions();
110 
112  virtual void findSpacing();
113 
116  virtual void anchorAndOffsetLines();
117 
119  virtual void drawLongitudeLines();
120 
122  virtual void drawLatitudeLines();
123 
125  virtual void createLabel( DtTextProxy*& label, double radians, bool isLongitude, double* endpoints);
126 
128  virtual void destroyGridLines();
129 
132  virtual bool clip3D( const DtVector& pointA, const DtVector& pointB,
133  DtVector& clippedA, DtVector& clippedB ) const;
134 
135  // A Grid line is a vector of line segments that form the (notionally)
136  // curved line
137 
138  // A Grid Line is an array of line segments
139  typedef std::vector<DtLineSegment*> GridLine;
140 
141  // A Grid Line Vector is an array or Grid Lines
142  typedef std::vector<GridLine> GridLineVector;
143  typedef std::vector<DtTextProxy*> LabelArray;
144 
147  virtual void clearUnusedLinesAndLabels(int index, GridLineVector& lines,
148  LabelArray& labels);
149 
152  virtual void clearUnusedSegments( int index, GridLine& line );
153 
156  virtual void destroyLinesAndLabels( GridLineVector& lines,
157  LabelArray& labels );
158 
162  virtual void resizeLinesAndLabels( GridLineVector& lines, LabelArray& labels,
163  int numLines );
164 
170  virtual bool drawLineSegment( DtLineSegment*& segment, const DtVector& start,
171  const DtVector& end, float* colorArray, double* endpoints=0, bool* pass3D = 0);
172 
175  virtual GridLine& getSegmentedLine( GridLineVector& lines, int index, int numSegments );
176 
178 
192 
196  virtual bool drawStandardLongitudeLine(GridLine& lonLine, double resolution, int numSegs, double curLon, int& curSeg, double*endpoints);
197 
202  virtual bool drawNorwayMgrsLongitudeLine(GridLine& lonLine, double resolution, int numSegs, int& curSeg);
203 
208  virtual bool drawSvalbardMgrsLongitudeLines(GridLine& lonLine, double resolution, int numSegs, double curLon, int& curSeg);
209 
210 
212  virtual void drawMapSheetLines();
213 
219  virtual void findMapSheetSpacing();
220 
227  virtual bool anchorMapSheetLines();
228 
230  virtual void clearUnusedLines(int index, GridLineVector& lines);
231 
233  virtual void clearUnusedLabels(int index, LabelArray& labels);
234 
236  struct MgrsSegStart
240  {
241  double lat;
242  double lon;
243  };
245  typedef std::vector<MgrsSegStart> SegmentStarts;
247  typedef std::vector<SegmentStarts> SegmentLocator;
249 
251  virtual SegmentStarts& getSegmentedLocator(SegmentLocator& lines, int index, int numSegments);
252 
254  virtual void resizeLocators(SegmentLocator& locator, int numLines);
255 
257  virtual void clearUnusedLocators(int index, SegmentLocator& locator);
258 
265  virtual bool drawUtmLineSegment(GridLine& line, SegmentStarts& lineLocator, int segIndex, int zone, char hemisphere,
266  double startEasting, double startNorthing, double endEasting, double endNorthing, bool constrainEasting=false);
267 
269  virtual void findEastingLimits(double lat, double& minEasting, double& maxEasting);
270 
272 
281  virtual void drawEastWestMapSheetLines();
282 
283  // \brief Draw the portion of an northing (east-west) line that lies in the specified utm zone
291  virtual int drawEastWestMapSheetLineForUtmZone(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int zone,
292  char hemisphere, double northingLine, int zoneMapSheets, int numSegs, int numPartialSegs, double partialExtra);
293 
294  // \brief Draw the interior portion of a northing line that lies in a specified utm zone
298  virtual int drawEastWestZoneInterior(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int utmZone,
299  char hemisphere, double northingLine, int numSegs, int startEasting, int endEasting);
301 
303 
311  virtual void drawNorthSouthMapSheetLines();
312 
318  virtual int drawNorthSouthMapSheetLinesForUtmZone(int zone, double maxZoneWidth, int iLine);
319 
328  virtual bool drawNorthSouthMapSheetLine(int utmZone, double eastingLine, int iLine);
330 
332 
342  virtual bool getGzdAndMapSheet(const DtVector& geocLoc, DtUnicode& gzd, DtUnicode& gzdAndMapSheet);
343 
350  virtual void labelGridZones();
351 
353  virtual bool labelGarsGrid(double lonValue, double latValue, DtGarsPrecision precision, int labelIndex);
354 
356  virtual void labelGarsGrids();
357 
361  virtual bool labelGridZoneDesignator(double lonValue, double latValue, int labelIndex);
362 
367  virtual bool includeMgrsDesignator(double lonValue, double latValue, osg::Vec3& screenPos, DtVector& geocResult);
368 
371  virtual bool includeMgrsDesignator(double lonValue, double latValue, float screenPosX,
372  float screenPosY, DtVector& geocResult);
373 
379  virtual void createGridLineLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY,
380  bool isEasting);
381 
387  virtual void labelMapSheetLines();
388 
393  virtual bool createMapSheetLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY);
394 
397  virtual DtFont::TextAlignment offsetGridBoxLabel(double xSrc, double ySrc, double& xOffset, double& yOffset,
398  DtBoundingBox& bbox) const;
400 
402 
403  private:
404 
407 
410 
411  protected:
412 
415 
418 
419  double myLatSpacing; // In Radians
420  double myLonSpacing;
421  double myScale;
422  unsigned int myMinChannelDimension; // the smaller of the actual channel width and channel height
423  unsigned int myChannelSize;
430 
431  // This is the normal of the plane facing the observer through the
432  // center of the earth. Used for all 3D clipping.
434 
435  double myStartLat;
436  double myEndLat;
437  double myStartLon;
438  double myEndLon;
439  DtCoordTransform myGeocToTopoTransform;
440  DtCoordTransform myTopoToGeocTransform;
441  DtReferenceEllipsoid myReferenceEllipsoid;
447 
448  // MGRS implementation-specific members
449  typedef boost::unordered_set<DtUnicode> UsedGridLabels;
452 
456 
457  // The locator vectors mirror the GridLine Vectors, providing the lat/lon
458  // for the start of each segment (used for labeling)
461 
466 
467  int myMapSheetSpacing; // 100,000, 10,000, 1,000, 100, 10, or 1m (or 0 for none)
468 
478  };
479 }
double myEndLat
Definition: DtGeocentricGridLinesDrawer.h:436
double myAnchoredStartNorthing
Definition: DtGeocentricGridLinesDrawer.h:470
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
LabelArray myGzdLabels
Definition: DtGeocentricGridLinesDrawer.h:453
DtGarsPrecision
Definition: DtGarsUtil.h:15
SegmentLocator myNorthSouthSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:460
std::vector< DtLineSegment * > GridLine
Definition: DtGeocentricGridLinesDrawer.h:139
std::vector< GridLine > GridLineVector
Definition: DtGeocentricGridLinesDrawer.h:142
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
TextAlignment
Definition: DtFontInterface.h:26
double myLonSpacing
Definition: DtGeocentricGridLinesDrawer.h:420
UsedGridLabels myUsedGzdLabels
Definition: DtGeocentricGridLinesDrawer.h:450
double myAnchoredEndEasting
Definition: DtGeocentricGridLinesDrawer.h:471
DtReferenceEllipsoid myReferenceEllipsoid
Definition: DtGeocentricGridLinesDrawer.h:441
double myStartLat
Definition: DtGeocentricGridLinesDrawer.h:435
double myAnchoredEndLat
Definition: DtGeocentricGridLinesDrawer.h:443
double myObserverLongitude
Definition: DtGeocentricGridLinesDrawer.h:426
SegmentLocator myEastWestSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:463
double myAnchoredStartLat
Definition: DtGeocentricGridLinesDrawer.h:442
A class for controlling text owned by the TextRenderer.
Definition: DtTextProxy.h:33
Draw 2D Grid Lines on geocentric databases. This class supported two types of grids - basic geodetic ...
Definition: DtGeocentricGridLinesDrawer.h:42
LabelArray myEastWestLabels
Definition: DtGeocentricGridLinesDrawer.h:465
LabelArray myNorthSouthLabels
Definition: DtGeocentricGridLinesDrawer.h:464
std::vector< MgrsSegStart > SegmentStarts
The starting location of each mapsheet line segment drawn for one line.
Definition: DtGeocentricGridLinesDrawer.h:245
double myObserverAltitude
Definition: DtGeocentricGridLinesDrawer.h:427
double myScale
Definition: DtGeocentricGridLinesDrawer.h:421
bool myLatCrossesPole
Definition: DtGeocentricGridLinesDrawer.h:446
UsedGridLabels myUsedMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:451
DtVector myClipNormal
Definition: DtGeocentricGridLinesDrawer.h:433
std::vector< DtTextProxy * > LabelArray
Definition: DtGeocentricGridLinesDrawer.h:143
A class which represents a single line segment.
Definition: DtLineSegment.h:23
LabelArray myLatitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:417
LabelArray myMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:454
double myLatSpacing
Definition: DtGeocentricGridLinesDrawer.h:419
double myObserverLatitude
Definition: DtGeocentricGridLinesDrawer.h:425
unsigned int myChannelSize
Definition: DtGeocentricGridLinesDrawer.h:423
double myAnchoredEndNorthing
Definition: DtGeocentricGridLinesDrawer.h:472
int myChannelExpansionX
Definition: DtGeocentricGridLinesDrawer.h:428
double myAnchoredStartLon
Definition: DtGeocentricGridLinesDrawer.h:444
bool myGarsCanDraw
Definition: DtGeocentricGridLinesDrawer.h:477
double myEndLon
Definition: DtGeocentricGridLinesDrawer.h:438
GridLineVector myLatitudeLines
Definition: DtGeocentricGridLinesDrawer.h:414
double lon
Definition: DtGeocentricGridLinesDrawer.h:242
double myAnchoredEndLon
Definition: DtGeocentricGridLinesDrawer.h:445
GridLineVector myNorthSouthLines
Definition: DtGeocentricGridLinesDrawer.h:459
Contains the DtGridLinesSettingsRecord class declaration.
LabelArray myGarsGridLabels
Definition: DtGeocentricGridLinesDrawer.h:455
double myStartLon
Definition: DtGeocentricGridLinesDrawer.h:437
LabelArray myLongitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:416
DtCoordTransform myGeocToTopoTransform
Definition: DtGeocentricGridLinesDrawer.h:439
int myChannelExpansionY
Definition: DtGeocentricGridLinesDrawer.h:429
boost::unordered_set< DtUnicode > UsedGridLabels
Definition: DtGeocentricGridLinesDrawer.h:449
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. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
double myAnchoredStartUtmZone
Definition: DtGeocentricGridLinesDrawer.h:473
Structure / typedefs for segment locators. We store the latitude and longitude of the start of each m...
Definition: DtGeocentricGridLinesDrawer.h:239
double myAnchoredStartEasting
Definition: DtGeocentricGridLinesDrawer.h:469
DtVector myObserverPosition
Definition: DtGeocentricGridLinesDrawer.h:424
GridLineVector myLongitudeLines
Definition: DtGeocentricGridLinesDrawer.h:413
char myAnchoredStartNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:475
double myAnchoredEndUtmZone
Definition: DtGeocentricGridLinesDrawer.h:474
int myMapSheetSpacing
Definition: DtGeocentricGridLinesDrawer.h:467
double lat
Definition: DtGeocentricGridLinesDrawer.h:241
unsigned int myMinChannelDimension
Definition: DtGeocentricGridLinesDrawer.h:422
DtCoordTransform myTopoToGeocTransform
Definition: DtGeocentricGridLinesDrawer.h:440
char myAnchoredEndNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:476
A simple bounding box.
Definition: DtBoundingBox.h:101
std::vector< SegmentStarts > SegmentLocator
A vector of SegmentStarts, one for each line drawn.
Definition: DtGeocentricGridLinesDrawer.h:247
GridLineVector myEastWestLines
Definition: DtGeocentricGridLinesDrawer.h:462

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)