offattr.h File Reference

(r1785/r1282)

#include "gla.h"

Go to the source code of this file.

Classes

class  OffscreenAttrValue

Functions

FIXED16 GetCurrentViewScale ()
MILLIPOINT ConvertMeasurementToMillipointsAtCurrentViewScale (INT32 Width, UnitType type)
UINT32 ConvertMillipointsToPixelsAtCurrentViewScale (MILLIPOINT mp)
INT32 PixelsPerMeterAtCurrentViewScale ()


Function Documentation

MILLIPOINT ConvertMeasurementToMillipointsAtCurrentViewScale INT32  Width,
UnitType  type
 

Definition at line 140 of file offattr.cpp.

00141 {
00142     const double dpi = (double)GRenderRegion::GetDefaultDPI();
00143     const double MillipointsPerPixel = (dpi <= 0) ? 750.0 : MILLIPOINTS_PER_INCH / dpi;
00144 
00145     double ScaledWidth = 0;
00146 
00147     switch(type)
00148     {
00149         case MILLIPOINTS:
00150             ScaledWidth = Width;
00151             break;
00152 
00153         case PIXELS:
00154             ScaledWidth =   MillipointsPerPixel * Width;
00155             ScaledWidth /=  GetCurrentViewScale().MakeDouble();
00156             break;
00157 
00158          // unsupported unit type.
00159         default:
00160             ScaledWidth = -1;
00161             break;
00162     }
00163 
00164     return (MILLIPOINT)ScaledWidth;
00165 }

UINT32 ConvertMillipointsToPixelsAtCurrentViewScale MILLIPOINT  mp  ) 
 

Definition at line 167 of file offattr.cpp.

00168 {
00169     const double dpi = (double)GRenderRegion::GetDefaultDPI();
00170     const double MillipointsPerPixel = (dpi <= 0) ? 750.0 : MILLIPOINTS_PER_INCH / dpi;
00171 
00172     // NB   this routine rounds to the nearest pixel, so if you convert
00173     //      from mp to pixels and back again, you are highly unlikely
00174     //      to get the value you started off with!
00175     double  Pixels  =   (mp / MillipointsPerPixel);
00176             Pixels  *=  GetCurrentViewScale().MakeDouble();
00177 
00178     return (UINT32)(Pixels + 0.5);
00179 }

FIXED16 GetCurrentViewScale  ) 
 

Definition at line 131 of file offattr.cpp.

00132 {
00133     View* pView = View::GetCurrent();
00134     if (pView == NULL)
00135         return FIXED16(0);
00136 
00137     return pView->GetViewScale();
00138 }

INT32 PixelsPerMeterAtCurrentViewScale  ) 
 

Definition at line 181 of file offattr.cpp.

00182 {
00183     // NB   return value is given to the nearest pixel.
00184     double  ppm =   PIXELS_PER_INCH * INCHES_PER_METRE;
00185             ppm *=  GetCurrentViewScale().MakeDouble();
00186     return (INT32)(ppm + 0.5);
00187 }


Generated on Sat Nov 10 03:49:16 2007 for Camelot by  doxygen 1.4.4