VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtProjectedGridLinesDrawer Class Reference

vrvGraphics-based implementation of 2D Grid Lines on projected databases \ingroup vrvOsg

Inheritance diagram for makVrv::DtProjectedGridLinesDrawer:
Inheritance graph
[legend]

Classes

struct  GridLine
 

Public Member Functions

 DtProjectedGridLinesDrawer (DtDe &de)
 
virtual ~DtProjectedGridLinesDrawer ()
 
virtual void drawGridLines ()
 
virtual void setMaxGridLines (int maxGridLines)
 
virtual void setWindowDimensions (double startWindowX, double startWindowY, double endWindowX, double endWindowY)
 
virtual void setCenter (const osg::Vec2d &center)
 
virtual void setHeading (double heading)
 
virtual void setScale (double scale)
 
virtual void destroyGridLines ()
 
- Public Member Functions inherited from makVrv::DtGridLinesDrawer
 DtGridLinesDrawer (DtDe &de)
 
 DtGridLinesDrawer (const DtGridLinesDrawer &orig)=delete
 
DtGridLinesDraweroperator= (const DtGridLinesDrawer &rhs)=delete
 
virtual ~DtGridLinesDrawer ()
 
virtual void setChannel (DtOsgChannel *channel)
 
virtual void setChannelDimensions (int startChannelX, int startChannelY, int endChannelX, int endChannelY)
 
virtual void setupOverlay ()
 
virtual void setupFont ()
 
virtual double lookupClosestLatLonSpacing (double minimumSpacingRadians)
 
virtual double lookupClosestCartesianSpacing (double minimumSpacing)
 
virtual double lookupClosestGarsSpacing (double minimumSpacing) const
 
void setPixelRatio (float pixelRatio)
 
- Public Member Functions inherited from makVrv::DtGridLinesParameters
 DtGridLinesParameters ()
 
virtual ~DtGridLinesParameters ()
 
 DtGridLinesParameters (const DtGridLinesParameters &orig)
 
DtGridLinesParametersoperator= (const DtGridLinesParameters &orig)
 
virtual void setGridType (makArchives::DtDisplayUnitsSettingsRecord::CoordSys gridType)
 
virtual void setUnitType (makArchives::DtDisplayUnitsSettingsRecord::DistanceUnits unitType)
 
virtual void setUnitType (makArchives::DtDisplayUnitsSettingsRecord::OrientationUnits unitType)
 
virtual void setMinimalGridlineLabelsEnabled (bool enabled)
 
virtual void setAutoSpacing (bool autoSpacing)
 
virtual void setMinSpacing (int pixels)
 
virtual void setFixedSpacingAmount (double amount)
 
virtual void setGarsFixedSpacing (double degs)
 
virtual void setMgrsMapSheetFixedSpacing (double meters)
 
virtual void setXOffset (double offset)
 
virtual void setYOffset (double offset)
 
virtual void setDecimalPlaces (unsigned decimalPlaces)
 
virtual void setMaxGridLineSegments (int maxGridLineSegments)
 
virtual void setEastWestGridLineColor (float r, float g, float b, float a)
 
virtual void setEastWestLabelColor (float r, float g, float b, float a)
 
virtual void setNorthSouthGridLineColor (float r, float g, float b, float a)
 
virtual void setNorthSouthLabelColor (float r, float g, float b, float a)
 
virtual void setLabelFont (const std::string &fontName)
 
virtual void setLabelPointSize (int pointSize)
 
virtual void setLabelXOffset (int pixels)
 
virtual void setLabelYOffset (int pixels)
 
virtual void setLabelTextWidth (int width)
 
virtual void setLabelTextHeight (int height)
 
virtual void setGridLineWidth (float width)
 
virtual void setLatLonLabelsCenteringCutoff (int altitude)
 
virtual void setMgrsMapSheetCutoff (double altitude)
 
virtual void setGarsPolarLatitudeCutoff (double latitude)
 

Protected Types

enum  LabelPosition {
  Bottom, Left, Top, Right,
  Indeterminate
}
 
typedef std::vector< GridLineGridLineVector
 
typedef std::vector
< DtTextProxy * > 
GridBoxLabelArray
 
typedef std::vector< float > VertexList
 
typedef boost::unordered_set
< DtUnicode
UsedGridLabels
 

Protected Member Functions

virtual void reloadTextFonts ()
 
virtual void drawNorthSouthGridLinesAndLabels ()
 
virtual void drawEastWestGridLinesAndLabels ()
 
virtual void findSpacing ()
 
virtual void anchorAndOffsetLines ()
 
virtual DtUnicode createLabel (const double &xMeters, const double &yMeters, bool isNorthSouth)
 
virtual bool labelGridBox (double nsValue, double ewValue, int labelIndex)
 
void convertDegreeSpacingToMeters (double gridSpacing, double &xSpacing, double &ySpacing) const
 
virtual DtFont::TextAlignment offsetLabel (double xSrc, double ySrc, double &xOffset, double &yOffset, DtBoundingBox &bbox) const
 
virtual DtFont::TextAlignment offsetGridBoxLabel (double xSrc, double ySrc, double &xOffset, double &yOffset, DtBoundingBox &bbox) const
 
virtual LabelPosition calcLabelPosition (double x, double y) const
 
virtual void calcDesiredLabelPosition ()
 
double degreesLatitudeToMeters (double x, double y) const
 
double convertToMetersOrDegrees (double value) const
 
virtual double degreesLongitudeToMeters () const
 
virtual double fixedSpacingAmount () const
 
virtual double xOffset () const
 
virtual double yOffset () const
 
virtual void clearUnusedLinesAndLabels (int index, GridLineVector &lines)
 
virtual void clearUnusedGridBoxLabels (int index)
 
virtual bool drawGridLineAndLabel (double startX, double startY, double endX, double endY, GridLine &gridLine, float *lineColor, LabelPosition labelPosition, float *labelColor, bool isNorthSouth)
 
virtual void slot_coordinateSystemChanged ()
 
virtual void labelGridBoxes ()
 
- Protected Member Functions inherited from makVrv::DtGridLinesDrawer
virtual bool limitLines (int current, int limit)
 

Static Protected Member Functions

static void rotate (const DtProjectedGridLinesDrawer::VertexList &in, double rad, DtProjectedGridLinesDrawer::VertexList &out)
 
static void translate (const DtProjectedGridLinesDrawer::VertexList &in, const osg::Vec2 &translation, DtProjectedGridLinesDrawer::VertexList &out)
 
static void scale (const DtProjectedGridLinesDrawer::VertexList &in, double s, DtProjectedGridLinesDrawer::VertexList &out)
 
- Static Protected Member Functions inherited from makVrv::DtGridLinesDrawer
static bool clip (double xMin, double xMax, double yMin, double yMax, double x0src, double y0src, double x1src, double y1src, double &x0clip, double &y0clip, double &x1clip, double &y1clip)
 

Protected Attributes

GridLineVector myEastWestLines
 
GridLineVector myNorthSouthLines
 
GridBoxLabelArray myGridBoxLabels
 
UsedGridLabels myUsedGridLabels
 
double myHeading
 
osg::Vec2d myCenter
 
double myStartWindowX
 
double myStartWindowY
 
double myEndWindowX
 
double myEndWindowY
 
double myScale
 
double myAnchoredMinX
 
double myAnchoredMinY
 
double myAnchoredMaxX
 
double myAnchoredMaxY
 
double myXSpacing
 
double myYSpacing
 
LabelPosition myNorthSouthLabelPosition
 
LabelPosition myEastWestLabelPosition
 
DtSignalConnectionManager myConnections
 
DtCoordinateSystemmyCoordinateSystem = nullptr
 
- Protected Attributes inherited from makVrv::DtGridLinesDrawer
DtDemyDe
 
DtOsgChannelmyChannel
 
osg::Matrix myWorldToWindowMatrix
 
int myStartChannelX
 
int myStartChannelY
 
int myEndChannelX
 
int myEndChannelY
 
DtOverlayRenderermyOverlayRenderer
 
DtFontInterfacemyFont
 
float myPixelRatio
 
std::vector< doublemyLatLonAllowableSpacings
 
std::vector< doublemyCartesianAllowableSpacings
 
std::vector< doublemyGarsAllowableSpacings
 
bool myLineLimitNeedsWarning
 
- Protected Attributes inherited from makVrv::DtGridLinesParameters
makArchives::DtDisplayUnitsSettingsRecord::CoordSys myGridType
 
bool myUnitTypeIsAngular
 
makArchives::DtDisplayUnitsSettingsRecord::DistanceUnits myUnitType
 
makArchives::DtDisplayUnitsSettingsRecord::OrientationUnits myAngularUnitType
 
bool myMinimalGridlineLabelsEnabled
 
bool myAutoSpacing
 
int myMinSpacing
 
double mySpacing
 
double myXOffset
 
double myYOffset
 
unsigned myDecimalPlaces
 
int myMaxGridLines
 
int myMaxGridLineSegments
 
float myEastWestGridLineColor [4]
 
float myEastWestLabelColor [4]
 
float myNorthSouthGridLineColor [4]
 
float myNorthSouthLabelColor [4]
 
std::string myLabelFont
 
int myLabelPointSize
 
int myLabelXOffset
 
int myLabelYOffset
 
int myLabelTextWidth
 
int myLabelTextHeight
 
float myGridLineWidth
 
int myLatLonLabelsCenteringCutoff
 
double myMgrsMapSheetCutoff
 
double myGarsFixedSpacing
 
double myMgrsMapSheetFixedSpacing
 
double myGarsPolarLatitudeCutoff
 

Private Member Functions

 DtProjectedGridLinesDrawer (const DtProjectedGridLinesDrawer &orig)
 
DtProjectedGridLinesDraweroperator= (const DtProjectedGridLinesDrawer &rhs)
 

Member Typedef Documentation

typedef std::vector<float> makVrv::DtProjectedGridLinesDrawer::VertexList
protected

his type can be used to provide a list of vertices to the polygon objects

typedef boost::unordered_set<DtUnicode> makVrv::DtProjectedGridLinesDrawer::UsedGridLabels
protected

Member Enumeration Documentation

Represent an screen edge to place a label on.

Enumerator
Bottom 
Left 
Top 
Right 
Indeterminate 

Constructor & Destructor Documentation

makVrv::DtProjectedGridLinesDrawer::DtProjectedGridLinesDrawer ( DtDe de)

CTOR.

virtual makVrv::DtProjectedGridLinesDrawer::~DtProjectedGridLinesDrawer ( )
virtual

DTOR.

makVrv::DtProjectedGridLinesDrawer::DtProjectedGridLinesDrawer ( const DtProjectedGridLinesDrawer orig)
private

Unimplemented copy constructor.

Member Function Documentation

virtual void makVrv::DtProjectedGridLinesDrawer::drawGridLines ( )
virtual

Draw the grid lines (and labels)

virtual void makVrv::DtProjectedGridLinesDrawer::setMaxGridLines ( int  maxGridLines)
virtual

Override base class to allocate memory for lines.

Reimplemented from makVrv::DtGridLinesParameters.

virtual void makVrv::DtProjectedGridLinesDrawer::setWindowDimensions ( double  startWindowX,
double  startWindowY,
double  endWindowX,
double  endWindowY 
)
virtual

Set the approximate DB dimensions of the view within the unrotated window.

virtual void makVrv::DtProjectedGridLinesDrawer::setCenter ( const osg::Vec2d &  center)
virtual

Set the DB location at the center of the window.

virtual void makVrv::DtProjectedGridLinesDrawer::setHeading ( double  heading)
virtual

Set the current observer heading.

virtual void makVrv::DtProjectedGridLinesDrawer::setScale ( double  scale)
virtual

Set the current observer scale.

virtual void makVrv::DtProjectedGridLinesDrawer::destroyGridLines ( )
virtual

Destroy all grid lines in the current channel.

virtual void makVrv::DtProjectedGridLinesDrawer::reloadTextFonts ( )
protectedvirtual

Reloads text label fonts on runtime font size change.

Implements makVrv::DtGridLinesDrawer.

virtual void makVrv::DtProjectedGridLinesDrawer::drawNorthSouthGridLinesAndLabels ( )
protectedvirtual
virtual void makVrv::DtProjectedGridLinesDrawer::drawEastWestGridLinesAndLabels ( )
protectedvirtual
virtual void makVrv::DtProjectedGridLinesDrawer::findSpacing ( )
protectedvirtual

Determine, based on autoSpacing setting or fixed spacing value, what the grid spacing should be. Modifies myXSpacing and myYSpacing.

virtual void makVrv::DtProjectedGridLinesDrawer::anchorAndOffsetLines ( )
protectedvirtual

Find the range of x's and y's to attempt to draw grid lines for (in database coordinates). It takes the grid type into account, and attempts to use a logical origin (like the zone origin in UTM).

virtual DtUnicode makVrv::DtProjectedGridLinesDrawer::createLabel ( const double xMeters,
const double yMeters,
bool  isNorthSouth 
)
protectedvirtual

Given x and y in database coordinates, create a label string for the grid line in the coordinate system appropriate for the current grid type. This method may change xMeters if mecessary to get a migrid Label into the current UTM zone.

virtual bool makVrv::DtProjectedGridLinesDrawer::labelGridBox ( double  nsValue,
double  ewValue,
int  labelIndex 
)
protectedvirtual
void makVrv::DtProjectedGridLinesDrawer::convertDegreeSpacingToMeters ( double  gridSpacing,
double xSpacing,
double ySpacing 
) const
protected

Convert degree spacing to meters, used to actually draw the lines Note that the spacing may be different for x and y when the units are degrees.

virtual DtFont::TextAlignment makVrv::DtProjectedGridLinesDrawer::offsetLabel ( double  xSrc,
double  ySrc,
double xOffset,
double yOffset,
DtBoundingBox bbox 
) const
protectedvirtual

Find the offset and alignment for a label.

virtual DtFont::TextAlignment makVrv::DtProjectedGridLinesDrawer::offsetGridBoxLabel ( double  xSrc,
double  ySrc,
double xOffset,
double yOffset,
DtBoundingBox bbox 
) const
protectedvirtual

Find the offset and alignment for a grid box label.

virtual LabelPosition makVrv::DtProjectedGridLinesDrawer::calcLabelPosition ( double  x,
double  y 
) const
protectedvirtual

Determine which screen edge a label is closest to.

virtual void makVrv::DtProjectedGridLinesDrawer::calcDesiredLabelPosition ( )
protectedvirtual

Determine which screen edge a label type is supposed to be on.

double makVrv::DtProjectedGridLinesDrawer::degreesLatitudeToMeters ( double  x,
double  y 
) const
protected

Convert one degree of latitude (on the current flat-earth projected db) into meters.

double makVrv::DtProjectedGridLinesDrawer::convertToMetersOrDegrees ( double  value) const
protected
virtual double makVrv::DtProjectedGridLinesDrawer::degreesLongitudeToMeters ( ) const
protectedvirtual

Convert one degree of longitude (on the current flat-earth projected db) into meters.

virtual double makVrv::DtProjectedGridLinesDrawer::fixedSpacingAmount ( ) const
protectedvirtual

Return the fixed spacing amount for the current gridType. Returns the spacing amount in meters or degrees.

virtual double makVrv::DtProjectedGridLinesDrawer::xOffset ( ) const
protectedvirtual

Return the x offset for the current gridType. Returns the x offset in meters or degrees.

virtual double makVrv::DtProjectedGridLinesDrawer::yOffset ( ) const
protectedvirtual

Return the y offset for the current gridType. Returns the y offset in meters or degrees.

virtual void makVrv::DtProjectedGridLinesDrawer::clearUnusedLinesAndLabels ( int  index,
GridLineVector lines 
)
protectedvirtual
virtual void makVrv::DtProjectedGridLinesDrawer::clearUnusedGridBoxLabels ( int  index)
protectedvirtual
virtual bool makVrv::DtProjectedGridLinesDrawer::drawGridLineAndLabel ( double  startX,
double  startY,
double  endX,
double  endY,
GridLine gridLine,
float *  lineColor,
LabelPosition  labelPosition,
float *  labelColor,
bool  isNorthSouth 
)
protectedvirtual
virtual void makVrv::DtProjectedGridLinesDrawer::slot_coordinateSystemChanged ( )
protectedvirtual

slot for when the coordinate system changes

virtual void makVrv::DtProjectedGridLinesDrawer::labelGridBoxes ( )
protectedvirtual

Iterate through the grid line intersections, considering them as grid boxes, and request labels from the coordinate display object. If non-zero length labels are returned, and the label isn't a duplicate, add the label to the grid.

static void makVrv::DtProjectedGridLinesDrawer::rotate ( const DtProjectedGridLinesDrawer::VertexList in,
double  rad,
DtProjectedGridLinesDrawer::VertexList out 
)
staticprotected

Utility function to rotate a list of vertices.

static void makVrv::DtProjectedGridLinesDrawer::translate ( const DtProjectedGridLinesDrawer::VertexList in,
const osg::Vec2 &  translation,
DtProjectedGridLinesDrawer::VertexList out 
)
staticprotected

Utility function to translate a list of vertices.

static void makVrv::DtProjectedGridLinesDrawer::scale ( const DtProjectedGridLinesDrawer::VertexList in,
double  s,
DtProjectedGridLinesDrawer::VertexList out 
)
staticprotected

Utility function to scale a list of vertices.

DtProjectedGridLinesDrawer& makVrv::DtProjectedGridLinesDrawer::operator= ( const DtProjectedGridLinesDrawer rhs)
private

Unimplemented assignment operator.

Member Data Documentation

GridLineVector makVrv::DtProjectedGridLinesDrawer::myEastWestLines
protected
GridLineVector makVrv::DtProjectedGridLinesDrawer::myNorthSouthLines
protected
GridBoxLabelArray makVrv::DtProjectedGridLinesDrawer::myGridBoxLabels
protected
UsedGridLabels makVrv::DtProjectedGridLinesDrawer::myUsedGridLabels
protected
double makVrv::DtProjectedGridLinesDrawer::myHeading
protected
osg::Vec2d makVrv::DtProjectedGridLinesDrawer::myCenter
protected
double makVrv::DtProjectedGridLinesDrawer::myStartWindowX
protected
double makVrv::DtProjectedGridLinesDrawer::myStartWindowY
protected
double makVrv::DtProjectedGridLinesDrawer::myEndWindowX
protected
double makVrv::DtProjectedGridLinesDrawer::myEndWindowY
protected
double makVrv::DtProjectedGridLinesDrawer::myScale
protected
double makVrv::DtProjectedGridLinesDrawer::myAnchoredMinX
protected
double makVrv::DtProjectedGridLinesDrawer::myAnchoredMinY
protected
double makVrv::DtProjectedGridLinesDrawer::myAnchoredMaxX
protected
double makVrv::DtProjectedGridLinesDrawer::myAnchoredMaxY
protected
double makVrv::DtProjectedGridLinesDrawer::myXSpacing
protected
double makVrv::DtProjectedGridLinesDrawer::myYSpacing
protected
LabelPosition makVrv::DtProjectedGridLinesDrawer::myNorthSouthLabelPosition
protected
LabelPosition makVrv::DtProjectedGridLinesDrawer::myEastWestLabelPosition
protected
DtSignalConnectionManager makVrv::DtProjectedGridLinesDrawer::myConnections
protected
DtCoordinateSystem* makVrv::DtProjectedGridLinesDrawer::myCoordinateSystem = nullptr
protected

local clone of the system wide coordinate system. for thread safety.


The documentation for this class was generated from the following file:

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)