fthrattr.h File Reference

(r1785/r1282)

#include "offattr.h"
#include "bshadow.h"

Go to the source code of this file.

Classes

class  FeatherAttrValue
class  AttrFeather
class  FeatherRecordHandler
 Handles the reading of all feather records in the v2 file format. More...

Defines

#define DEFAULT_FEATHERSIZE_PIX   2
#define DEFAULT_FEATHERSIZE_MP   ((MILLIPOINT) (DEFAULT_FEATHERSIZE_PIX * PX_MP_VAL))
#define MAX_FEATHERSIZE_MP   MAX_SHADOW_BLUR * PX_MP_VAL
#define DEFAULT_GAP_TOLERANCE_MP   ((MILLIPOINT) (PX_MP_VAL * 0.75))

Functions

FIXED16 GetCurrentViewScale ()
MILLIPOINT ConvertMeasurementToMillipointsAtCurrentViewScale (INT32 Width, UnitType type)
UINT32 ConvertMillipointsToPixelsAtCurrentViewScale (MILLIPOINT mp)
INT32 PixelsPerMeterAtCurrentViewScale ()
BOOL CheckLineAttrs (CCAttrMap *pAttrMap)
BOOL MakeLineAttributeCompleteForContouring (Node *Context, Node *NodeToModify, CCAttrMap *pAttrMap)


Define Documentation

#define DEFAULT_FEATHERSIZE_MP   ((MILLIPOINT) (DEFAULT_FEATHERSIZE_PIX * PX_MP_VAL))
 

Definition at line 132 of file fthrattr.h.

#define DEFAULT_FEATHERSIZE_PIX   2
 

Definition at line 131 of file fthrattr.h.

#define DEFAULT_GAP_TOLERANCE_MP   ((MILLIPOINT) (PX_MP_VAL * 0.75))
 

Definition at line 135 of file fthrattr.h.

#define MAX_FEATHERSIZE_MP   MAX_SHADOW_BLUR * PX_MP_VAL
 

Definition at line 133 of file fthrattr.h.


Function Documentation

BOOL CheckLineAttrs CCAttrMap pAttrMap  ) 
 

Definition at line 185 of file fthrattr.cpp.

00186 {
00187     void* ptr = NULL;
00188     return (
00189         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrLineWidth),(void *&)ptr) &&
00190         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrStartArrow),(void *&)ptr) &&
00191         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrEndArrow),(void *&)ptr) &&
00192         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrJoinType),(void *&)ptr) &&
00193         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrStartCap),(void *&)ptr) &&
00194         pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrDashPattern),(void *&)ptr)
00195         );
00196 }

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 }

BOOL MakeLineAttributeCompleteForContouring Node Context,
Node NodeToModify,
CCAttrMap pAttrMap
 

Definition at line 198 of file fthrattr.cpp.

00199 {
00200     AttrLineWidth * pAttrLineWidth = NULL;
00201     AttrStartArrow * pAttrStartArrow = NULL;
00202     AttrEndArrow * pAttrEndArrow = NULL;
00203     AttrJoinType * pAttrJoinType = NULL;
00204     AttrStartCap * pAttrStartCap = NULL;
00205     AttrDashPattern * pAttrDashPattern = NULL;
00206     AttrStrokeColour* pAttrStrokeColour = NULL;
00207 
00208     // get all the attributes out of the attribute map
00209     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrLineWidth),(void *&)pAttrLineWidth);
00210     if(pAttrLineWidth)
00211         pAttrLineWidth->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00212         
00213     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrStartArrow),(void *&)pAttrStartArrow);
00214     if (pAttrStartArrow)
00215         pAttrStartArrow->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00216 
00217     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrEndArrow),(void *&)pAttrEndArrow);
00218     if (pAttrEndArrow)
00219         pAttrEndArrow->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00220 
00221     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrJoinType),(void *&)pAttrJoinType);
00222     if(pAttrJoinType)
00223         pAttrJoinType->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00224         
00225     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrStartCap),(void *&)pAttrStartCap);
00226     if(pAttrStartCap)
00227         pAttrStartCap->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00228         
00229     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrDashPattern),(void *&)pAttrDashPattern);
00230     if(pAttrDashPattern)
00231         pAttrDashPattern->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00232 
00233     pAttrMap->Lookup( CC_RUNTIME_CLASS(AttrStrokeColour),(void *&)pAttrStrokeColour);
00234     if(pAttrStrokeColour)
00235         pAttrStrokeColour->AttachNode(Context,FIRSTCHILD,FALSE,FALSE);
00236 
00237     if( pAttrLineWidth && pAttrStartArrow && pAttrEndArrow && pAttrJoinType && 
00238         pAttrStartCap && pAttrDashPattern && pAttrStrokeColour)
00239     {
00240         Node* pLastChild = Context->FindLastChild();
00241         NodeToModify->AttachNode(pLastChild,NEXT,FALSE,FALSE);  // dynamic attrs are copies, so we are free to modify them
00242         return TRUE;
00243     }
00244     else
00245     {
00246         return FALSE;
00247     }
00248 }

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:10 2007 for Camelot by  doxygen 1.4.4