ProcessLength Class Reference

Calculates the length of a path. More...

#include <pathproc.h>

Inheritance diagram for ProcessLength:

ProcessPath CCObject SimpleCCObject List of all members.

Public Member Functions

 ProcessLength (const double flat)
 Constructor for processlength.
BOOL PathLength (Path *Input, double *Length, INT32 Index=-1)
 Returns an approximation to the length of a path, in 72000 of an inch units.
virtual void OpenElement (PathVerb Verb, INT32 index)
 Called from ProcessPath which is about to open a new path element.
virtual BOOL NewPoint (PathVerb Verb, DocCoord *pCoord)
virtual BOOL CloseElement (BOOL ok, PathVerb Verb, INT32 index)
 This function is called after processing all new points on a path element. The path element being a curve or line segment within the path passed to ProcessDistance::PathDistance().

Private Attributes

DocCoord PrevCoord
double ElementLength
double CurrLength
INT32 UserIndex

Detailed Description

Calculates the length of a path.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94

Definition at line 211 of file pathproc.h.


Constructor & Destructor Documentation

ProcessLength::ProcessLength const double  flat  ) 
 

Constructor for processlength.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94

Definition at line 653 of file pathproc.cpp.

00653                                               : ProcessPath(flat)
00654 {
00655 }


Member Function Documentation

BOOL ProcessLength::CloseElement BOOL  done,
PathVerb  Verb,
INT32  index
[virtual]
 

This function is called after processing all new points on a path element. The path element being a curve or line segment within the path passed to ProcessDistance::PathDistance().

BOOL ProcessLength::CloseElement(BOOL done, PathVerb Verb, INT32 index)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94
Parameters:
done = true if the new point function procesed all new points in the [INPUTS] open element correctly, false if it did not. Verb = verb of closing element. index = index of closing element.
[OUTPUTS] 
Returns:
FALSE to continue processing the next element TRUE to stop processing and return done

Reimplemented from ProcessPath.

Definition at line 752 of file pathproc.cpp.

00753 {
00754     if (index>UserIndex)
00755         // terminate scan now
00756         return TRUE;
00757 
00758     // continue summing element lengths
00759     CurrLength+=ElementLength;
00760     return FALSE;
00761 }

BOOL ProcessLength::NewPoint PathVerb  Verb,
DocCoord pCoord
[virtual]
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94

Implements ProcessPath.

Definition at line 718 of file pathproc.cpp.

00719 {
00720     if (!ProcFirstPoint && Verb==PT_LINETO)
00721     {
00722         double p0 = PrevCoord.x - pCoord->x;
00723         double p1 = PrevCoord.y - pCoord->y;
00724         ElementLength += sqrt((p0*p0)+(p1*p1));
00725     }
00726     PrevCoord = *pCoord;
00727     return TRUE;
00728 }

void ProcessLength::OpenElement PathVerb  Verb,
INT32  index
[virtual]
 

Called from ProcessPath which is about to open a new path element.

void ProcessLength::OpenElement(PathVerb Verb, INT32 index)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94
Parameters:
Verb = verb of opening element. [INPUTS] index = index of opening element.

Reimplemented from ProcessPath.

Definition at line 702 of file pathproc.cpp.

00703 {
00704     ElementLength = 0;
00705 }

BOOL ProcessLength::PathLength Path pSource,
double *  Length,
INT32  index = -1
 

Returns an approximation to the length of a path, in 72000 of an inch units.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/10/94
Parameters:
pSource = a pointer to a path [INPUTS] Outputs SqrLength = the squared length of the path

Definition at line 671 of file pathproc.cpp.

00672 {
00673     ERROR2IF(pSource==NULL, FALSE, "NULL path passed to ProcessLength::PathLength()");
00674     if (index<0)
00675         index = (pSource->GetNumCoords())+1;
00676 
00677     CurrLength      = 0;
00678     ElementLength   = 0;
00679     UserIndex       = index;
00680 
00681     ProcessFlags PFlags;
00682     BOOL ok = ProcessPath::Init(pSource);
00683     if (ok) ok = ProcessPath::Process(PFlags);
00684     if (ok) *Length = CurrLength;
00685 
00686     return ok;
00687 }


Member Data Documentation

double ProcessLength::CurrLength [private]
 

Definition at line 223 of file pathproc.h.

double ProcessLength::ElementLength [private]
 

Definition at line 222 of file pathproc.h.

DocCoord ProcessLength::PrevCoord [private]
 

Definition at line 221 of file pathproc.h.

INT32 ProcessLength::UserIndex [private]
 

Definition at line 224 of file pathproc.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:09 2007 for Camelot by  doxygen 1.4.4