VR-Forces 4.0.4 Class Documentation
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]

List of all members.

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.

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 (double &xMeters, 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.

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

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

CTOR.

DTOR.

Unimplemented copy constructor.


Member Function Documentation

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.

Destroy all grid lines in the current channel.

virtual void makVrv::DtProjectedGridLinesDrawer::findSpacing ( ) [protected, virtual]

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

Modifies myXSpacing and myYSpacing

virtual void makVrv::DtProjectedGridLinesDrawer::anchorAndOffsetLines ( ) [protected, virtual]

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 ( double &  xMeters,
double  yMeters,
bool  isNorthSouth 
) [protected, virtual]

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 
) [protected, virtual]
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 [protected, virtual]

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 [protected, virtual]

Find the offset and alignment for a grid box label.

virtual LabelPosition makVrv::DtProjectedGridLinesDrawer::calcLabelPosition ( double  x,
double  y 
) const [protected, virtual]

Determine which screen edge a label is closest to.

virtual void makVrv::DtProjectedGridLinesDrawer::calcDesiredLabelPosition ( ) [protected, virtual]

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 [protected, virtual]

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

virtual double makVrv::DtProjectedGridLinesDrawer::fixedSpacingAmount ( ) const [protected, virtual]

Return the fixed spacing amount for the current gridType.

Returns the spacing amount in meters or degrees.

virtual double makVrv::DtProjectedGridLinesDrawer::xOffset ( ) const [protected, virtual]

Return the x offset for the current gridType.

Returns the x offset in meters or degrees.

virtual double makVrv::DtProjectedGridLinesDrawer::yOffset ( ) const [protected, virtual]

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 
) [protected, virtual]
virtual void makVrv::DtProjectedGridLinesDrawer::clearUnusedGridBoxLabels ( int  index) [protected, virtual]
virtual bool makVrv::DtProjectedGridLinesDrawer::drawGridLineAndLabel ( double  startX,
double  startY,
double  endX,
double  endY,
GridLine gridLine,
float *  lineColor,
LabelPosition  labelPosition,
float *  labelColor,
bool  isNorthSouth 
) [protected, virtual]
virtual void makVrv::DtProjectedGridLinesDrawer::labelGridBoxes ( ) [protected, virtual]

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.

Utility function to rotate a list of vertices.

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

Utility function to translate a list of vertices.

Utility function to scale a list of vertices.

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

Unimplemented assignment operator.


Member Data Documentation


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)