#include <pathproc.h>
Inheritance diagram for ProcessDistance:
Public Member Functions | |
ProcessDistance (const double flat) | |
Constructor for processdistance. | |
double | PathDistance (const double dist, Path *Input, INT32 *index) |
Returns information about a point, which lies a particular distance along a path. | |
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) |
Called from ProcessPath which has generated a new point on the open element. | |
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(). The function will use the element length calculated by NewPoint and decrement the total path length by this amount. If at some point the working distance goes negative, a parameter is calculated along the element. | |
Private Attributes | |
double | Distance |
INT32 | ElementIndex |
double | ElementLength |
double | ElementParam |
DocCoord | PrevCoord |
Definition at line 242 of file pathproc.h.
|
Constructor for processdistance.
Definition at line 778 of file pathproc.cpp. 00778 : ProcessPath(flat) 00779 { 00780 ElementLength = 0; 00781 ElementParam = 0; 00782 ElementIndex = 0; 00783 00784 00785 }
|
|
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(). The function will use the element length calculated by NewPoint and decrement the total path length by this amount. If at some point the working distance goes negative, a parameter is calculated along the element. BOOL ProcessDistance::CloseElement(BOOL done, PathVerb Verb, INT32 index)
Reimplemented from ProcessPath. Definition at line 899 of file pathproc.cpp. 00900 { 00901 if (done) 00902 { 00903 Distance-=ElementLength; 00904 INT32 nextindex = index; 00905 if ((Distance>0) && ProcSource->FindNextEndPoint(&nextindex)) 00906 return FALSE; 00907 00908 Distance+=ElementLength; 00909 ElementIndex = index; 00910 00911 if (ElementLength>0) 00912 ElementParam = Distance / ElementLength; 00913 else 00914 ElementParam = 0; 00915 00916 return TRUE; 00917 00918 } 00919 return FALSE; 00920 }
|
|
Called from ProcessPath which has generated a new point on the open element. BOOL ProcessDistance::NewPoint(PathVerb Verb, DocCoord* pCoord)
Implements ProcessPath. Definition at line 864 of file pathproc.cpp. 00865 { 00866 if (!ProcFirstPoint) 00867 { 00868 double p0 = PrevCoord.x - pCoord->x; 00869 double p1 = PrevCoord.y - pCoord->y; 00870 ElementLength += sqrt((p0*p0)+(p1*p1)); 00871 } 00872 PrevCoord = *pCoord; 00873 return TRUE; 00874 }
|
|
Called from ProcessPath which is about to open a new path element. void ProcessDistance::OpenElement(PathVerb Verb, INT32 index)
Reimplemented from ProcessPath. Definition at line 845 of file pathproc.cpp. 00846 { 00847 ElementLength = 0; 00848 ElementParam = 0; 00849 ElementIndex = 0; 00850 }
|
|
Returns information about a point, which lies a particular distance along a path.
Definition at line 807 of file pathproc.cpp. 00808 { 00809 ENSURE(dist>=0, "distance along path is negative in ProcessDistance::PathDistance"); 00810 00811 if (dist>0) 00812 Distance = dist; 00813 else 00814 Distance = 0; 00815 00816 // if we have a simple position then return the start 00817 if (Distance == 0) 00818 { 00819 *index = 0; 00820 return 0; 00821 } 00822 00823 // set up the processpath process. 00824 ProcessFlags PFlags; 00825 BOOL ok = ProcessPath::Init(pSource); 00826 if (ok) ok = ProcessPath::Process(PFlags); 00827 if (ok) *index = ElementIndex; 00828 00829 return ElementParam; 00830 }
|
|
Definition at line 252 of file pathproc.h. |
|
Definition at line 253 of file pathproc.h. |
|
Definition at line 254 of file pathproc.h. |
|
Definition at line 255 of file pathproc.h. |
|
Definition at line 256 of file pathproc.h. |