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) 2024 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/unordered_set.hpp>
23 #include <boost/unordered_map.hpp>
24 
25 #include <osg/Vec3>
26 
27 namespace makVrv
28 {
29 
30  class DtDe;
31  class DtOsgChannel;
32  class DtLineSegment;
33  class DtTextProxy;
34  class DtBoundingBox;
35  enum class DtGarsPrecision;
36 
42  : public DtGridLinesDrawer
43  {
44  public:
45 
48 
50  virtual ~DtGeocentricGridLinesDrawer();
51 
53  virtual void drawGridLines();
54 
56  virtual void drawPolarGridLines();
57 
59  virtual void drawMidLatitudeGridLines();
60 
61 
63  virtual void setScale( double scale );
64 
66  virtual void setObserverPosition( const DtVector& position );
67 
69  virtual void setChannelDimensions( int startChannelX, int startChannelY,
70  int endChannelX, int endChannelY );
71 
73  virtual void setLatLonLabelsCenteringCutoff(double alt);
74 
76  virtual void setMgrsMapSheetCutoff(double altitude);
77 
79  virtual void setGarsPolarLatitudeCutoff(double lat);
80 
81  protected:
82 
84  virtual void reloadTextFonts();
85 
87  virtual void reloadLabelFonts(std::vector<DtTextProxy*>& labels);
88 
91  virtual void setupReferenceEllipsoid();
92 
94  virtual void setupTopoGeocTransforms();
95 
98  virtual bool pointVisible( const DtVector& point ) const;
99 
101  virtual void findPolarSpacing();
102 
104  virtual void drawPolarLongitudeLines();
105 
107  virtual void drawPolarLatitudeLines();
108 
111  virtual void findLatLonWindowDimensions();
112 
114  virtual void findSpacing();
115 
118  virtual void anchorAndOffsetLines();
119 
121  virtual void drawLongitudeLines();
122 
124  virtual void drawLatitudeLines();
125 
127  virtual void createLabel( DtTextProxy*& label, double radians, bool isLongitude, double* endpoints);
128 
130  virtual void destroyGridLines();
131 
134  virtual bool clip3D( const DtVector& pointA, const DtVector& pointB,
135  DtVector& clippedA, DtVector& clippedB ) const;
136 
137  // A Grid line is a vector of line segments that form the (notionally)
138  // curved line
139 
140  // A Grid Line is an array of line segments
141  typedef std::vector<DtLineSegment*> GridLine;
142 
143  // A Grid Line Vector is an array or Grid Lines
144  typedef std::vector<GridLine> GridLineVector;
145  typedef std::vector<DtTextProxy*> LabelArray;
146 
149  virtual void clearUnusedLinesAndLabels(int index, GridLineVector& lines,
150  LabelArray& labels);
151 
154  virtual void clearUnusedSegments( int index, GridLine& line );
155 
158  virtual void destroyLinesAndLabels( GridLineVector& lines,
159  LabelArray& labels );
160 
164  virtual void resizeLinesAndLabels( GridLineVector& lines, LabelArray& labels,
165  int numLines );
166 
172  virtual bool drawLineSegment( DtLineSegment*& segment, const DtVector& start,
173  const DtVector& end, float* colorArray, double* endpoints=0, bool* pass3D = 0);
174 
177  virtual GridLine& getSegmentedLine( GridLineVector& lines, int index, int numSegments );
178 
180 
194 
198  virtual bool drawStandardLongitudeLine(GridLine& lonLine, double resolution, int numSegs, double curLon, int& curSeg, double*endpoints);
199 
204  virtual bool drawNorwayMgrsLongitudeLine(GridLine& lonLine, double resolution, int numSegs, int& curSeg);
205 
210  virtual bool drawSvalbardMgrsLongitudeLines(GridLine& lonLine, double resolution, int numSegs, double curLon, int& curSeg);
211 
212 
214  virtual void drawMapSheetLines();
215 
221  virtual void findMapSheetSpacing();
222 
229  virtual bool anchorMapSheetLines();
230 
232  virtual void clearUnusedLines(int index, GridLineVector& lines);
233 
235  virtual void clearUnusedLabels(int index, LabelArray& labels);
236 
238  struct MgrsSegStart
242  {
243  double lat;
244  double lon;
245  };
247  typedef std::vector<MgrsSegStart> SegmentStarts;
249  typedef std::vector<SegmentStarts> SegmentLocator;
251 
253  virtual SegmentStarts& getSegmentedLocator(SegmentLocator& lines, int index, int numSegments);
254 
256  virtual void resizeLocators(SegmentLocator& locator, int numLines);
257 
259  virtual void clearUnusedLocators(int index, SegmentLocator& locator);
260 
267  virtual bool drawUtmLineSegment(GridLine& line, SegmentStarts& lineLocator, int segIndex, int zone, char hemisphere,
268  double startEasting, double startNorthing, double endEasting, double endNorthing, bool constrainEasting=false);
269 
271  virtual void findEastingLimits(double lat, double& minEasting, double& maxEasting);
272 
274 
283  virtual void drawEastWestMapSheetLines();
284 
285  // \brief Draw the portion of an northing (east-west) line that lies in the specified utm zone
293  virtual int drawEastWestMapSheetLineForUtmZone(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int zone,
294  char hemisphere, double northingLine, int zoneMapSheets, int numSegs, int numPartialSegs, double partialExtra);
295 
296  // \brief Draw the interior portion of a northing line that lies in a specified utm zone
300  virtual int drawEastWestZoneInterior(GridLine& eastWestLine, SegmentStarts& lineLocator, int startSeg, int utmZone,
301  char hemisphere, double northingLine, int numSegs, int startEasting, int endEasting);
303 
305 
313  virtual void drawNorthSouthMapSheetLines();
314 
320  virtual int drawNorthSouthMapSheetLinesForUtmZone(int zone, double maxZoneWidth, int iLine);
321 
330  virtual bool drawNorthSouthMapSheetLine(int utmZone, double eastingLine, int iLine);
332 
334 
344  virtual bool getGzdAndMapSheet(const DtVector& geocLoc, DtUnicode& gzd, DtUnicode& gzdAndMapSheet);
345 
352  virtual void labelGridZones();
353 
355  virtual bool labelGarsGrid(double lonValue, double latValue, DtGarsPrecision precision, int labelIndex);
356 
358  virtual void labelGarsGrids();
359 
363  virtual bool labelGridZoneDesignator(double lonValue, double latValue, int labelIndex);
364 
369  virtual bool includeMgrsDesignator(double lonValue, double latValue, osg::Vec3& screenPos, DtVector& geocResult);
370 
373  virtual bool includeMgrsDesignator(double lonValue, double latValue, float screenPosX,
374  float screenPosY, DtVector& geocResult);
375 
381  virtual void createGridLineLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY,
382  bool isEasting);
383 
389  virtual void labelMapSheetLines();
390 
395  virtual bool createMapSheetLabel(DtTextProxy*& label, double lat, double lon, float screenPosX, float screenPosY);
396 
399  virtual DtFont::TextAlignment offsetGridBoxLabel(double xSrc, double ySrc, double& xOffset, double& yOffset,
400  DtBoundingBox& bbox) const;
402 
404 
405  private:
406 
409 
412 
413  protected:
414 
417 
420 
421  double myLatSpacing; // In Radians
422  double myLonSpacing;
423  double myScale;
424  unsigned int myMinChannelDimension; // the smaller of the actual channel width and channel height
425  unsigned int myChannelSize;
432 
433  // This is the normal of the plane facing the observer through the
434  // center of the earth. Used for all 3D clipping.
435  DtVector myClipNormal;
436 
437  double myStartLat;
438  double myEndLat;
439  double myStartLon;
440  double myEndLon;
441  DtCoordTransform myGeocToTopoTransform;
442  DtCoordTransform myTopoToGeocTransform;
443  DtReferenceEllipsoid myReferenceEllipsoid;
449 
450  // MGRS implementation-specific members
451  typedef boost::unordered_set<DtUnicode> UsedGridLabels;
454 
458 
459  // The locator vectors mirror the GridLine Vectors, providing the lat/lon
460  // for the start of each segment (used for labeling)
463 
468 
469  int myMapSheetSpacing; // 100,000, 10,000, 1,000, 100, 10, or 1m (or 0 for none)
470 
480  };
481 }
double myEndLat
Definition: DtGeocentricGridLinesDrawer.h:438
double myAnchoredStartNorthing
Definition: DtGeocentricGridLinesDrawer.h:472
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:455
DtGarsPrecision
Definition: DtGarsUtil.h:15
SegmentLocator myNorthSouthSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:462
std::vector< DtLineSegment * > GridLine
Definition: DtGeocentricGridLinesDrawer.h:141
std::vector< GridLine > GridLineVector
Definition: DtGeocentricGridLinesDrawer.h:144
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
TextAlignment
Definition: DtFontInterface.h:26
double myLonSpacing
Definition: DtGeocentricGridLinesDrawer.h:422
UsedGridLabels myUsedGzdLabels
Definition: DtGeocentricGridLinesDrawer.h:452
double myAnchoredEndEasting
Definition: DtGeocentricGridLinesDrawer.h:473
DtReferenceEllipsoid myReferenceEllipsoid
Definition: DtGeocentricGridLinesDrawer.h:443
double myStartLat
Definition: DtGeocentricGridLinesDrawer.h:437
double myAnchoredEndLat
Definition: DtGeocentricGridLinesDrawer.h:445
double myObserverLongitude
Definition: DtGeocentricGridLinesDrawer.h:428
SegmentLocator myEastWestSegmentLocator
Definition: DtGeocentricGridLinesDrawer.h:465
double myAnchoredStartLat
Definition: DtGeocentricGridLinesDrawer.h:444
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:41
LabelArray myEastWestLabels
Definition: DtGeocentricGridLinesDrawer.h:467
LabelArray myNorthSouthLabels
Definition: DtGeocentricGridLinesDrawer.h:466
std::vector< MgrsSegStart > SegmentStarts
The starting location of each mapsheet line segment drawn for one line.
Definition: DtGeocentricGridLinesDrawer.h:247
double myObserverAltitude
Definition: DtGeocentricGridLinesDrawer.h:429
double myScale
Definition: DtGeocentricGridLinesDrawer.h:423
bool myLatCrossesPole
Definition: DtGeocentricGridLinesDrawer.h:448
UsedGridLabels myUsedMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:453
DtVector myClipNormal
Definition: DtGeocentricGridLinesDrawer.h:435
std::vector< DtTextProxy * > LabelArray
Definition: DtGeocentricGridLinesDrawer.h:145
A class which represents a single line segment.
Definition: DtLineSegment.h:23
LabelArray myLatitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:419
LabelArray myMapSheetLabels
Definition: DtGeocentricGridLinesDrawer.h:456
double myLatSpacing
Definition: DtGeocentricGridLinesDrawer.h:421
double myObserverLatitude
Definition: DtGeocentricGridLinesDrawer.h:427
unsigned int myChannelSize
Definition: DtGeocentricGridLinesDrawer.h:425
double myAnchoredEndNorthing
Definition: DtGeocentricGridLinesDrawer.h:474
int myChannelExpansionX
Definition: DtGeocentricGridLinesDrawer.h:430
double myAnchoredStartLon
Definition: DtGeocentricGridLinesDrawer.h:446
bool myGarsCanDraw
Definition: DtGeocentricGridLinesDrawer.h:479
double myEndLon
Definition: DtGeocentricGridLinesDrawer.h:440
GridLineVector myLatitudeLines
Definition: DtGeocentricGridLinesDrawer.h:416
double lon
Definition: DtGeocentricGridLinesDrawer.h:244
double myAnchoredEndLon
Definition: DtGeocentricGridLinesDrawer.h:447
GridLineVector myNorthSouthLines
Definition: DtGeocentricGridLinesDrawer.h:461
Contains the DtGridLinesSettingsRecord class declaration.
LabelArray myGarsGridLabels
Definition: DtGeocentricGridLinesDrawer.h:457
double myStartLon
Definition: DtGeocentricGridLinesDrawer.h:439
LabelArray myLongitudeLabels
Definition: DtGeocentricGridLinesDrawer.h:418
DtCoordTransform myGeocToTopoTransform
Definition: DtGeocentricGridLinesDrawer.h:441
int myChannelExpansionY
Definition: DtGeocentricGridLinesDrawer.h:431
boost::unordered_set< DtUnicode > UsedGridLabels
Definition: DtGeocentricGridLinesDrawer.h:451
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:76
double myAnchoredStartUtmZone
Definition: DtGeocentricGridLinesDrawer.h:475
Structure / typedefs for segment locators. We store the latitude and longitude of the start of each m...
Definition: DtGeocentricGridLinesDrawer.h:241
double myAnchoredStartEasting
Definition: DtGeocentricGridLinesDrawer.h:471
DtVector myObserverPosition
Definition: DtGeocentricGridLinesDrawer.h:426
GridLineVector myLongitudeLines
Definition: DtGeocentricGridLinesDrawer.h:415
char myAnchoredStartNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:477
double myAnchoredEndUtmZone
Definition: DtGeocentricGridLinesDrawer.h:476
int myMapSheetSpacing
Definition: DtGeocentricGridLinesDrawer.h:469
double lat
Definition: DtGeocentricGridLinesDrawer.h:243
unsigned int myMinChannelDimension
Definition: DtGeocentricGridLinesDrawer.h:424
DtCoordTransform myTopoToGeocTransform
Definition: DtGeocentricGridLinesDrawer.h:442
char myAnchoredEndNorthingHemisphere
Definition: DtGeocentricGridLinesDrawer.h:478
A simple bounding box.
Definition: DtBoundingBox.h:101
std::vector< SegmentStarts > SegmentLocator
A vector of SegmentStarts, one for each line drawn.
Definition: DtGeocentricGridLinesDrawer.h:249
GridLineVector myEastWestLines
Definition: DtGeocentricGridLinesDrawer.h:464

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)