VR-Forces 4.7 Class Documentation
 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 More...

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

Classes

struct  GridLine

Public Member Functions

 DtProjectedGridLinesDrawer (DtDe &de)
 CTOR.
virtual ~DtProjectedGridLinesDrawer ()
 DTOR.
virtual void drawGridLines ()
 Draw the grid lines (and labels)
virtual void setMaxGridLines (int maxGridLines)
 Override base class to allocate memory for lines.
virtual void setWindowDimensions (double startWindowX, double startWindowY, double endWindowX, double endWindowY)
 Set the approximate DB dimensions of the view within the unrotated window.
virtual void setCenter (const osg::Vec2d &center)
 Set the DB location at the center of the window.
virtual void setHeading (double heading)
 Set the current observer heading.
virtual void setScale (double scale)
 Set the current observer scale.
virtual void destroyGridLines ()
 Destroy all grid lines in the current channel.
- Public Member Functions inherited from makVrv::DtGridLinesDrawer
 DtGridLinesDrawer (DtDe &de)
 Default CTOR.
virtual ~DtGridLinesDrawer ()
 Virtual DTOR.
virtual void setChannel (DtOsgChannel *channel)
 Set the channel to draw the grid lines on.
virtual void setChannelDimensions (int startChannelX, int startChannelY, int endChannelX, int endChannelY)
 Set the channel dimensions.
virtual void setupOverlay ()
 Get the overlay to use for our channel.
virtual void setupFont ()
 Get the font to use fron the font manager.
virtual double lookupClosestLatLonSpacing (double minimumSpacingRadians)
 Find the best allowable lat,lon spacing given the minimum requirement.
virtual double lookupClosestCartesianSpacing (double minimumSpacing)
 Find the best allowable cartesian spacing given the minimum requirement.
- Public Member Functions inherited from makVrv::DtGridLinesParameters
 DtGridLinesParameters ()
 CTOR.
virtual ~DtGridLinesParameters ()
 DTOR.
 DtGridLinesParameters (const DtGridLinesParameters &orig)
 Copy constructor.
DtGridLinesParametersoperator= (const DtGridLinesParameters &orig)
 \ brief Assignment operator
virtual void setGridType (makArchives::DtDisplayUnitsSettingsRecord::CoordSys gridType)
 Set the grid type.
virtual void setUnitType (makArchives::DtDisplayUnitsSettingsRecord::DistanceUnits unitType)
 Set the unit type.
virtual void setUnitType (makArchives::DtDisplayUnitsSettingsRecord::OrientationUnits unitType)
 Set the unit type.
virtual void setAutoSpacing (bool autoSpacing)
 Set whether auto spacing is used.
virtual void setMinSpacing (int pixels)
 Set the minimum pixel spacing for auto spacing.
virtual void setFixedSpacingAmount (double amount)
 Set the fixed spacing amount.
virtual void setXOffset (double offset)
 Set the x offset for the origin in current units.
virtual void setYOffset (double offset)
 Set the y offset amount in current units.
virtual void setDecimalPlaces (unsigned decimalPlaces)
 Set the number of decimals or, in the case of MGRS, decimalPlaces.
virtual void setEastWestGridLineColor (float r, float g, float b, float a)
 Set the color of east-west grid lines.
virtual void setEastWestLabelColor (float r, float g, float b, float a)
 Set the color of the labels on east-west grid lines.
virtual void setNorthSouthGridLineColor (float r, float g, float b, float a)
 Set the color of north-south grid lines.
virtual void setNorthSouthLabelColor (float r, float g, float b, float a)
 Set the color of the labels north-south grid lines.
virtual void setLabelFont (const std::string &fontName)
 Set the font used for labels.
virtual void setLabelPointSize (int pointSize)
 Set the point size used for labels.
virtual void setLabelXOffset (int pixels)
 Set the offset of labels from the bottom of the screen.
virtual void setLabelYOffset (int pixels)
 Set the offset of labels from the left side of the screen.
virtual void setLabelTextWidth (int width)
 Set the width of the box used to display text in.
virtual void setLabelTextHeight (int height)
 Set the height of the box used to display text in.
virtual void setGridLineWidth (float width)
 Set the width of grid lines.

Protected Types

enum  LabelPosition {
  Bottom, Left, Top, Right,
  Indeterminate
}
 Represent an screen edge to place a label on. More...
typedef std::vector< GridLineGridLineVector
typedef std::vector
< DtTextProxy * > 
GridBoxLabelArray
typedef std::vector< float > VertexList
 his type can be used to provide a list of vertices to the polygon objects
typedef boost::unordered_set
< DtUnicode
UsedGridLabels

Protected Member Functions

virtual void drawNorthSouthGridLinesAndLabels ()
virtual void drawEastWestGridLinesAndLabels ()
virtual void findSpacing ()
 Determine, based on autoSpacing setting or fixed spacing value, what the grid spacing should be.
virtual void anchorAndOffsetLines ()
 Find the range of x's and y's to attempt to draw grid lines for (in database coordinates).
virtual DtUnicode createLabel (const double &xMeters, const double &yMeters, bool isNorthSouth)
 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.
virtual bool labelGridBox (double nsValue, double ewValue, int labelIndex)
void convertDegreeSpacingToMeters (double gridSpacing, double &xSpacing, double &ySpacing) const
 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::TextAlignement offsetLabel (double xSrc, double ySrc, double &xOffset, double &yOffset, DtBoundingBox &bbox) const
 Find the offset and alignment for a label.
virtual DtFont::TextAlignement offsetGridBoxLabel (double xSrc, double ySrc, double &xOffset, double &yOffset, DtBoundingBox &bbox) const
 Find the offset and alignment for a grid box label.
virtual LabelPosition calcLabelPosition (double x, double y) const
 Determine which screen edge a label is closest to.
virtual void calcDesiredLabelPosition ()
 Determine which screen edge a label type is supposed to be on.
double degreesLatitudeToMeters (double x, double y) const
 Convert one degree of latitude (on the current flat-earth projected db) into meters.
double convertToMetersOrDegrees (double value) const
virtual double degreesLongitudeToMeters () const
 Convert one degree of longitude (on the current flat-earth projected db) into meters.
virtual double fixedSpacingAmount () const
 Return the fixed spacing amount for the current gridType.
virtual double xOffset () const
 Return the x offset for the current gridType.
virtual double yOffset () const
 Return the y offset for the current gridType.
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 labelGridBoxes ()
 Iterate through the grid line intersections, considering them as grid boxes, and request labels from the coordinate display object.

Static Protected Member Functions

static void rotate (const DtProjectedGridLinesDrawer::VertexList &in, double rad, DtProjectedGridLinesDrawer::VertexList &out)
 Utility function to rotate a list of vertices.
static void translate (const DtProjectedGridLinesDrawer::VertexList &in, const osg::Vec2 &translation, DtProjectedGridLinesDrawer::VertexList &out)
 Utility function to translate a list of vertices.
static void scale (const DtProjectedGridLinesDrawer::VertexList &in, double s, DtProjectedGridLinesDrawer::VertexList &out)
 Utility function to scale a list of vertices.
- 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)
 2D clipping routine. Implements Liang / Barsky Clipping

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
- Protected Attributes inherited from makVrv::DtGridLinesDrawer
DtDemyDe
DtOsgChannelmyChannel
osg::Matrix myWorldToWindowMatrix
int myStartChannelX
int myStartChannelY
int myEndChannelX
int myEndChannelY
DtOverlayRenderermyOverlayRenderer
DtFontSP myFont
std::vector< doublemyLatLonAllowableSpacings
std::vector< doublemyCartesianAllowableSpacings
- Protected Attributes inherited from makVrv::DtGridLinesParameters
makArchives::DtDisplayUnitsSettingsRecord::CoordSys myGridType
bool myUnitTypeIsAngular
makArchives::DtDisplayUnitsSettingsRecord::DistanceUnits myUnitType
makArchives::DtDisplayUnitsSettingsRecord::OrientationUnits myAngularUnitType
bool myAutoSpacing
int myMinSpacing
double mySpacing
double myXOffset
double myYOffset
unsigned myDecimalPlaces
int myMaxGridLines
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

Private Member Functions

 DtProjectedGridLinesDrawer (const DtProjectedGridLinesDrawer &orig)
 Unimplemented copy constructor.
DtProjectedGridLinesDraweroperator= (const DtProjectedGridLinesDrawer &rhs)
 Unimplemented assignment operator.

Detailed Description

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

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::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::TextAlignement 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::TextAlignement 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::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

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

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)