NodeBlendPath Class Reference

defines the structure of a node blend path object. This object exists only as a child of a blend object More...

#include <ndbldpth.h>

Inheritance diagram for NodeBlendPath:

NodePath NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject NodeBrushPath List of all members.

Public Member Functions

 NodeBlendPath ()
 This constructor creates a NodeBlendPath linked to no other, with all status flags false and an uninitialised bounding rectangle.
 ~NodeBlendPath ()
 Destructor for Node MouldPath. This does nothing at present.
 NodeBlendPath (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.
virtual BOOL ExportRender (RenderRegion *pRender)
 Called after this node and all of its children have been rendered to the export region. This outputs the "end mould" command. Supports ArtWorks EPS and Camelot EPS.
virtual NodeSimpleCopy ()
 Makes a copy of all the data in the node.
virtual void Render (RenderRegion *pRender)
 Overrides inherited function to do nothing.
virtual void RenderEorDrag (RenderRegion *)
 Overrides inherited function to do nothing.
virtual void RenderObjectBlobs (RenderRegion *pRender)
 Draws the paths object blobs into the render region supplied.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 Returns a completely null rectangle.
virtual CopyType GetCopyType ()
 This function returns a type describing how this object is to be copied. The fuction is called from the low level copy operation CopyObjects. There are two options at present, these being SIMPLECOPY and COMPLEXCOPY. SIMPLECOPY indicates that the node can be copied by a call to its virtual function SimpleCopy() followed by a deep copy of all its children. COMPLEXCOPY however indicates that the node needs to do its own thing when copying and must be called via the ComplexCopy() virtual function. This virtual will likely return a tree of copied objects rather than just a copy of itself.
virtual INT32 ComplexCopy (CopyStage Stage, Range &RangeToCopy, Node **pOutput)
 If the copystage is COPYOBJECT, The node has been called to copy itself and do what ever it needs to to make a sensible copy of other items such as attributes. The caller (CopyObjects) will not deep copy this node (as this is a complex copy and it expects the handler to know what its doing). In this case the NodeBlendPath object needs to turn itself into a node path. SeeAlso Node::ComplexCopy(), CopyObjects().
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState, BOOL DoPreTriggerEdit=TRUE)
 To get node paths inside blend objects to reformat themselves correctly when their paths change. Also see: NodeBlendPath::OnEdited().
virtual BOOL OnEdited (ObjChangeParam *pParam)
 Informs the blend path it has been edited.
virtual BOOL DoBecomeA (BecomeA *pBecomeA)
 Actually tries to change the node into a different node type. This responds to BECOMEA_PASSBACK reason by making a duplicate NodeBlendPath and passing it to the pfnPassBack func provided in the pBecomeA class. This responds to BECOMEA_REPLACE by making a duplicate NodePath (not NodeBlendPath) and inserting into the tree.
void RenderBlendBlobs (RenderRegion *pRender)
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes the mould path record to the filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes the path record to the filter.
virtual BOOL IsANodeBlendPath ()
 virtual identifier function
BOOL CopyNodePath (NodePath *pNodePathToCopy)
 Copies the data in the node by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.
NodePathCreateNodePathCopy ()
 Creates a NodePath that contains the exact same definition.
double GetPathLength ()
 Access function to underlying Path function Also allows the NodeBlendPath to do a bit of caching.
BOOL GetPointAtDistance (MILLIPOINT Dist, DocCoord *pPoint, double *pTangent)
 Gets the coordinate of a point a certain distance along this path Calls the underlying Path class function.
void DestroyCachedInformation ()
 Destroys any cached information the node may be storing about the path, such as it's length.
INT32 SetPathIndex ()
 Sets the index of this NBP by finding out how many NBP's already exist in the parent nodeblend.
UINT32 GetPathIndex ()
 To find out which NBP this is.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Protected Member Functions

void CopyNodeContents (NodeBlendPath *NodeCopy)
 Copies the data in the node by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.

Protected Attributes

double m_CachedPathLength
CMap< MILLIPOINT, MILLIPOINT &,
CPathPointInfo, CPathPointInfo & > * 
m_pCachedPointsAtDistance
UINT32 m_Index

Private Member Functions

BOOL InsideBlend ()
 Determins whether the immediate parent of this node blend path object is a blend object.
BOOL ExportCAMEPS (RenderRegion *pRegion)
 Export delimiter tokens for this particular object. The format is defined as csmp path description cemp.
BOOL ExportAWEPS (RenderRegion *pRegion)
 Overrides the standard call to Obj->Render so we can render the path as we would like.

Detailed Description

defines the structure of a node blend path object. This object exists only as a child of a blend object

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
See also:
NodeBlend (the parent object)

Definition at line 119 of file ndbldpth.h.


Constructor & Destructor Documentation

NodeBlendPath::NodeBlendPath  ) 
 

This constructor creates a NodeBlendPath linked to no other, with all status flags false and an uninitialised bounding rectangle.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99

Definition at line 153 of file ndbldpth.cpp.

00153                             : NodePath()
00154 {
00155     m_pCachedPointsAtDistance = NULL;
00156     // Reuse the "Initialise cache" call
00157     DestroyCachedInformation();
00158     m_Index = 0;
00159 }

NodeBlendPath::~NodeBlendPath  ) 
 

Destructor for Node MouldPath. This does nothing at present.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99

Definition at line 229 of file ndbldpth.cpp.

00230 {
00231     // Reuse the "Destroy cache" call
00232     DestroyCachedInformation();
00233 }

NodeBlendPath::NodeBlendPath Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS]
Direction:

Specifies the direction in which this node is to be attached to the ContextNode. The values this variable can take are as follows:

PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node

The remaining inputs specify the status of the node:

Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ?

Parameters:
- [OUTPUTS]
Returns:
-

Errors: An assertion error will occur if ContextNode is NULL

Definition at line 205 of file ndbldpth.cpp.

00211                 :NodePath(ContextNode, Direction, Locked, Mangled, Marked, Selected) 
00212 { 
00213     m_pCachedPointsAtDistance = NULL;
00214     // Reuse the "Destroy cache" call
00215     DestroyCachedInformation();
00216     m_Index = 0;
00217 } 


Member Function Documentation

BOOL NodeBlendPath::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

To get node paths inside blend objects to reformat themselves correctly when their paths change. Also see: NodeBlendPath::OnEdited().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 20/01/2000
Date:
29/4/99
Parameters:
pParam - pointer to the change parameter object [INPUTS] SetOpPermissionState - TRUE to set the Nodes permission flags DoPreTriggerEdit - if TRUE then calls NameGallery::PreTriggerEdit. Must* be TRUE if the calling Op may make any nodes change their bounds, eg move, line width, cut. Use TRUE if unsure.
Returns:
TRUE if the operation can proceede, FALSE to stop it

Reimplemented from NodePath.

Definition at line 589 of file ndbldpth.cpp.

00591 {
00592     BOOL ok = TRUE;
00593 
00594     if (SetOpPermissionState)
00595         ok = OnEdited(pParam);
00596 
00597     if (ok) ok = NodePath::AllowOp(pParam,SetOpPermissionState,DoPreTriggerEdit);
00598 
00599     return ok;
00600 }

INT32 NodeBlendPath::ComplexCopy CopyStage  Stage,
Range RangeToCopy,
Node **  pOutput
[virtual]
 

If the copystage is COPYOBJECT, The node has been called to copy itself and do what ever it needs to to make a sensible copy of other items such as attributes. The caller (CopyObjects) will not deep copy this node (as this is a complex copy and it expects the handler to know what its doing). In this case the NodeBlendPath object needs to turn itself into a node path. SeeAlso Node::ComplexCopy(), CopyObjects().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
Stage - COPYOBJECT if we should make a copy [INPUTS]
  • COPYFINISHED once the entire copy operation has completed RangeToCopy - Describes the range which is currently being copied. pOutput - a pointer to a pointer to a node. Set this pointer to point at the tree copy
Returns:
-1 = The routine failed to make a copy. 0 = No copy has been made. +1 = pOutput points to the copy.

Reimplemented from Node.

Definition at line 775 of file ndbldpth.cpp.

00776 {
00777     ERROR2IF(pOutput==NULL,FALSE,"NodeBlendPath::ComplexCopy() called with NULL output pointer!");
00778 
00779     switch (Stage)
00780     {
00781         case COPYOBJECT:
00782         {   
00783             // we've been asked to make a copy of ourselves
00784             NodePath* NodeCopy = CreateNodePathCopy();
00785             if (NodeCopy != NULL)
00786             {
00787                 (*pOutput) = NodeCopy;
00788                 return 1;
00789             }
00790             break;
00791         }
00792 
00793         case COPYFINISHED:
00794             return 0;
00795             break;
00796     }
00797 
00798     return -1;
00799 }

void NodeBlendPath::CopyNodeContents NodeBlendPath NodeCopy  )  [protected]
 

Copies the data in the node by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
NodeCopy - The node to copy [INPUTS]
See also:
NodeRenderableInk::CopyNodeContents

Definition at line 271 of file ndbldpth.cpp.

00272 {
00273     NodePath::CopyNodeContents( NodeCopy );
00274     //Copy contents specific to derived class here
00275 }

BOOL NodeBlendPath::CopyNodePath NodePath pNodePathToCopy  ) 
 

Copies the data in the node by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pNodePathToCopy [INPUTS]
See also:
NodeRenderableInk::CopyNodeContents

Definition at line 291 of file ndbldpth.cpp.

00292 {
00293     ERROR2IF(pNodePathToCopy == NULL,FALSE,"NULL NodePath ptr");
00294 
00295     BOOL    ok = SetUpPath();
00296     if (ok) ok = InkPath.MergeTwoPaths(pNodePathToCopy->InkPath);
00297 
00298     return ok;
00299 }

NodePath * NodeBlendPath::CreateNodePathCopy  ) 
 

Creates a NodePath that contains the exact same definition.

> NodePath* NodeBlendPath::CreateNodePathCopy()

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/99
Parameters:
- [INPUTS]
Returns:
ptr to a NodePath equivalent, or NULL if it fails
See also:
-

Definition at line 814 of file ndbldpth.cpp.

00815 {
00816     // we've been asked to make a copy of ourselves
00817     NodePath* pCopy = new NodePath;
00818     if (pCopy != NULL)
00819         NodePath::CopyNodeContents(pCopy);
00820 
00821     return pCopy;
00822 }

void NodeBlendPath::DestroyCachedInformation  ) 
 

Destroys any cached information the node may be storing about the path, such as it's length.

> void NodeBlendPath::DestroyCachedInformation()

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
- [INPUTS]
Returns:
-
Should be called whenever the node is edited, for example.
See also:
-

Definition at line 893 of file ndbldpth.cpp.

00894 {
00895     m_CachedPathLength = -1.0;
00896 
00897     if (m_pCachedPointsAtDistance != NULL)
00898     {
00899         m_pCachedPointsAtDistance->RemoveAll();
00900         delete m_pCachedPointsAtDistance;
00901         m_pCachedPointsAtDistance = NULL;
00902     }
00903 }

BOOL NodeBlendPath::DoBecomeA BecomeA pBecomeA  )  [virtual]
 

Actually tries to change the node into a different node type. This responds to BECOMEA_PASSBACK reason by making a duplicate NodeBlendPath and passing it to the pfnPassBack func provided in the pBecomeA class. This responds to BECOMEA_REPLACE by making a duplicate NodePath (not NodeBlendPath) and inserting into the tree.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/10/00
Parameters:
pBecomeA = ptr to info class containing everything a node needs to be able [INPUTS] to become something else
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
NodePath::DoBecomeA()

Reimplemented from NodePath.

Definition at line 658 of file ndbldpth.cpp.

00659 {
00660     // Check for a NULL entry param
00661     ERROR2IF_PF(pBecomeA == NULL,FALSE,("pBecomeA is NULL"));
00662 
00663     // This lump checks that the Reason is one that we understand
00664     // It also makes sure that we don't have a NULL UndoOp ptr
00665     BOOL ValidReason = (pBecomeA->GetReason() == BECOMEA_REPLACE || pBecomeA->GetReason() == BECOMEA_PASSBACK);
00666     ERROR2IF_PF(!ValidReason,FALSE,("Unkown BecomeA reason %d",pBecomeA->GetReason()));
00667 
00668     BOOL Success = TRUE;            // Our success flag (Important that this defaults to TRUE)
00669     NodePath* pNewNodePath = NULL;  // Ptr to a new NodePath, if we get to make one.
00670     
00671     if (pBecomeA->BAPath())
00672     {
00673         switch (pBecomeA->GetReason())
00674         {
00675             case BECOMEA_REPLACE:
00676             {
00677                 // we need to be a NodePath ....
00678 
00679                 // Make a copy of the NodePath of this NodeBlendPath
00680                 CALL_WITH_FAIL(((pNewNodePath = (NodePath*)NodePath::SimpleCopy ()) != NULL), pBecomeA->GetUndoOp(), Success);
00681                 
00682                 if (Success)
00683                 {
00684                     // MUST now copy our children since we need to copy any attributes the path has appllied to it
00685                     CopyChildAttrs (pNewNodePath);
00686                     
00687                     UndoableOperation* pUndoOp = pBecomeA->GetUndoOp();
00688                     // NOT sure if its valid to not have one of these (seems to be assumed in other places)
00689                     // so for now this ERROR2 will fire if there isn't one ....
00690 //                  ERROR2IF(pUndoOp == NULL, FALSE, "No op pointer in NodeBlendPath::DoBecomeA");
00691 
00692                     if (pUndoOp)
00693                     {
00694                         // hide the text story
00695                         NodeHidden* pNodeHidden;
00696                         if (pUndoOp->DoHideNode(this,FALSE,&pNodeHidden)==FALSE)
00697                             Success = FALSE;
00698                         // Insert the NodeGroup next to the old hidden TextStory
00699                         if (!pUndoOp->DoInsertNewNode(pNewNodePath,pNodeHidden,NEXT,FALSE,FALSE,FALSE,FALSE))
00700                             Success = FALSE;
00701                     }
00702                     else
00703                     {
00704                         pNewNodePath->AttachNode(this, NEXT);
00705                     }
00706 
00707                     if (Success)
00708                         pBecomeA->PassBack(pNewNodePath,this);
00709 
00710                     if (!pUndoOp)
00711                     {
00712                         CascadeDelete();
00713                         delete this;
00714                     }
00715                 }
00716             }
00717             break;
00718 
00719             case BECOMEA_PASSBACK :
00720             {
00721                 // we need to be a NodePath ....
00722 
00723                 // Make a copy of the NodePath of this NodeBlendPath
00724                 CALL_WITH_FAIL(((pNewNodePath = (NodePath*)SimpleCopy()) != NULL), pBecomeA->GetUndoOp(), Success);
00725 
00726                 // If successful, pass it back with my attribute map
00727                 if (Success) Success = pBecomeA->PassBack(pNewNodePath,this);
00728             }
00729             break;
00730 
00731             default:
00732                 break;
00733         }
00734     }
00735 
00736     if (!Success)
00737     {
00738         if (pNewNodePath != NULL)
00739         {
00740             // Delete all the NodePath's children (if it has any) and unlink it from the tree (if it's linked)
00741             // This is all done by CascadeDelete()
00742             pNewNodePath->CascadeDelete(); 
00743             delete pNewNodePath;
00744             pNewNodePath = NULL;
00745         }
00746     }
00747 
00748     return Success;
00749 }

BOOL NodeBlendPath::ExportAWEPS RenderRegion pRegion  )  [private]
 

Overrides the standard call to Obj->Render so we can render the path as we would like.

BOOL NodeBlendPath::ExportAWEPS(RenderRegion* pRegion)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pRegion = a pointer to a Camelot EPS render region [INPUTS]
Returns:
TRUE if we've rendered the object FALSE if we want the caller to render the object

Definition at line 559 of file ndbldpth.cpp.

00560 {
00561     // just return false for the moment until we write our
00562     // proper random AWEPS path render function
00563     return FALSE;
00564 }

BOOL NodeBlendPath::ExportCAMEPS RenderRegion pRegion  )  [private]
 

Export delimiter tokens for this particular object. The format is defined as csmp path description cemp.

BOOL NodeBlendPath::ExportCAMEPS(RenderRegion* pRegion)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pRegion = a pointer to a Camelot EPS render region [INPUTS]
Returns:
TRUE if we've rendered the object FALSE if we want the caller to render the object

Definition at line 516 of file ndbldpth.cpp.

00517 {
00518 /*#ifdef DO_EXPORT
00519     EPSExportDC *pDC = (EPSExportDC *) pRegion->GetRenderDC();
00520 
00521     // If we're hanging around in a mould then export the correct tokens
00522     if (!InsideBlend())
00523     {
00524         NodePath::Render(pRegion);
00525     }
00526     else
00527     {
00528         pDC->OutputToken("csmp");           // Camelot "start mould path" token
00529         pDC->OutputNewLine();
00530 
00531         // Call the parent class
00532         NodePath::Render(pRegion);
00533 
00534         pDC->OutputToken("cemp");           // Camelot "start mould path" token
00535         pDC->OutputNewLine();
00536     }
00537 #endif
00538 */
00539     return TRUE;
00540 }

BOOL NodeBlendPath::ExportRender RenderRegion pRegion  )  [virtual]
 

Called after this node and all of its children have been rendered to the export region. This outputs the "end mould" command. Supports ArtWorks EPS and Camelot EPS.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pRegion = ptr to the export render region to export to [INPUTS]
[OUTPUTS] 
Returns:
TRUE if ok, FALSE if something went wrong

Errors:

Reimplemented from NodeRenderableInk.

Definition at line 485 of file ndbldpth.cpp.

00486 {
00487 /*#ifdef DO_EXPORT
00488     if (pRegion->IS_KIND_OF(NativeRenderRegion))
00489         return ExportCAMEPS(pRegion);
00490 
00491     if (pRegion->IS_KIND_OF(ArtWorksEPSRenderRegion))
00492         return ExportAWEPS(pRegion);
00493 #endif  
00494 */
00495     return FALSE;
00496 }

DocRect NodeBlendPath::GetBoundingRect BOOL  DontUseAttrs = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

Returns a completely null rectangle.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
DontUseAttrs - TRUE if you don't want to use the nodes attrs to calculate [INPUTS] the bounding rect (defaults will be used). Defaults to FALSE. HitTest - TRUE if being called during HitTest
Returns:
A null rectangle

Reimplemented from NodePath.

Definition at line 415 of file ndbldpth.cpp.

00416 {
00417     /* Tricky problems:
00418        (1) When importing, the importer translates the imported picture to centre around
00419            the drop point. Unfortunately it calls us to find our bbox. We don't have a
00420            bbox until the moulder nodes are built, which is not until PostImport time so
00421            the importer does a Translate = (Drop - Center) which is X = (0 - C), BAD.
00422            So we must return a bbox if their is no moulder in the mould! Nasty Showstopper fix  */
00423     
00424 /*  if (InsideBlend())
00425     {
00426         // if there is a moulder node to contribute a bbox
00427         if (FindNext(CC_RUNTIME_CLASS(NodeMoulder)))
00428         {
00429             // Then we dont contribute anything!
00430             DocRect Rect;
00431             return Rect;
00432         }
00433     }
00434 */
00435     // Otherwise we do.
00436     return NodePath::GetBoundingRect(DontUseAttrs);
00437 }

virtual CopyType NodeBlendPath::GetCopyType  )  [inline, virtual]
 

This function returns a type describing how this object is to be copied. The fuction is called from the low level copy operation CopyObjects. There are two options at present, these being SIMPLECOPY and COMPLEXCOPY. SIMPLECOPY indicates that the node can be copied by a call to its virtual function SimpleCopy() followed by a deep copy of all its children. COMPLEXCOPY however indicates that the node needs to do its own thing when copying and must be called via the ComplexCopy() virtual function. This virtual will likely return a tree of copied objects rather than just a copy of itself.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/95
Parameters:
- [INPUTS]
Returns:
A copy type describing how to copy this object

Reimplemented from Node.

Definition at line 143 of file ndbldpth.h.

00143 { return COMPLEXCOPY; };

UINT32 NodeBlendPath::GetPathIndex  ) 
 

To find out which NBP this is.

> UINT32 NodeBlendPath::GetPathIndex()

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/9/99
Parameters:
- [INPUTS]
Returns:
The index number of this nodeblendpath
See also:
-

Definition at line 1014 of file ndbldpth.cpp.

01015 {
01016     return m_Index;
01017 }

double NodeBlendPath::GetPathLength  ) 
 

Access function to underlying Path function Also allows the NodeBlendPath to do a bit of caching.

> double NodeBlendPath::GetPathLength()

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
- [INPUTS]
Returns:
The length of the path stored in this NodeBlendPath
See also:
-

Definition at line 919 of file ndbldpth.cpp.

00920 {
00921     if (m_CachedPathLength < 0)
00922         m_CachedPathLength = InkPath.GetPathLength();
00923     
00924     return m_CachedPathLength;
00925 }

BOOL NodeBlendPath::GetPointAtDistance MILLIPOINT  Distance,
DocCoord pPoint,
double *  pTangent
 

Gets the coordinate of a point a certain distance along this path Calls the underlying Path class function.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/4/99
Parameters:
Distance = a length along the path [INPUTS]
pPoint = the coordinate of the point that distance along the path [OUTPUTS] pTangent = tangent at this point (can be NULL)
Returns:
TRUE/FALSE for success/failure
This wrapper allows us to do any caching, if we get round to it.

Definition at line 942 of file ndbldpth.cpp.

00943 {
00944     ERROR2IF(pPoint == NULL,FALSE,"NULL pPoint param");
00945 
00946     BOOL Found = FALSE;
00947 
00948 #ifdef NBP_CACHEPOINTATDISTANCE
00949     CPathPointInfo  PointInfo;
00950 
00951     if (m_pCachedPointsAtDistance == NULL)
00952     {
00953         m_pCachedPointsAtDistance = new CMap<MILLIPOINT,MILLIPOINT&,CPathPointInfo,CPathPointInfo&>;
00954 //      if (m_pCachedPointsAtDistance != NULL)
00955 //          m_pCachedPointsAtDistance->InitHashTable(1277);     // Init hash table size to a suitably large prime number
00956     }
00957 
00958     if (m_pCachedPointsAtDistance != NULL)
00959     {
00960         Found = m_pCachedPointsAtDistance->Lookup(Distance,PointInfo);
00961         //if (Found)
00962     //  TRACEUSER( "Diccon", _T("Point %d, %d found in cache\n"), PointInfo.m_Point.x, PointInfo.m_Point.y);
00963 
00964     }
00965 
00966     if (!Found)
00967     {
00968         if (InkPath.GetPointAtDistance(Distance,&PointInfo.m_Point,&PointInfo.m_Tangent))
00969         {
00970             if (m_pCachedPointsAtDistance != NULL)
00971                 m_pCachedPointsAtDistance->SetAt(Distance,PointInfo);
00972     //      TRACEUSER( "Diccon", _T("Point %d, %d found from line\n"), PointInfo.m_Point.x, PointInfo.m_Point.y);
00973             Found = TRUE;
00974         }
00975     }
00976 
00977     if (Found)
00978     {
00979         *pPoint = PointInfo.m_Point;
00980         if (pTangent)
00981             *pTangent = PointInfo.m_Tangent;
00982     }
00983 #else
00984     double Tangent = 0.0;
00985     if (InkPath.GetPointAtDistance(Distance,pPoint,&Tangent))
00986     {
00987         if (pTangent)
00988             *pTangent = Tangent;
00989 
00990         Found = TRUE;
00991     }
00992 #endif // NBP_CACHEPOINTATDISTANCE
00993 
00994 //  if (Found == FALSE)
00995     //  TRACEUSER( "Diccon", _T("Not found at distance %d\n"), Distance);
00996     return Found;
00997 }

BOOL NodeBlendPath::InsideBlend  )  [private]
 

Determins whether the immediate parent of this node blend path object is a blend object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
- [INPUTS]
Returns:
TRUE if this blend path is inside a blend object ie its immediate parent is a blend object

Definition at line 454 of file ndbldpth.cpp.

00455 {
00456     Node* p = FindParent();
00457     if (p)
00458     {
00459         if (IS_A(p, NodeBlend))
00460             return TRUE;
00461         if (IS_A(p, NodeHidden))
00462             return TRUE;
00463     }
00464     return FALSE;
00465 }

BOOL NodeBlendPath::IsANodeBlendPath  )  [virtual]
 

virtual identifier function

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/11/99
Parameters:
- [INPUTS]

Reimplemented from NodePath.

Definition at line 1064 of file ndbldpth.cpp.

01065 {
01066     return TRUE;
01067 }

BOOL NodeBlendPath::OnEdited ObjChangeParam pParam  )  [virtual]
 

Informs the blend path it has been edited.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pParam - pointer to the change parameter object [INPUTS]
Returns:
TRUE if ok, FALSE if not
It records an action that destroys the cached information held by this node. Also see: NodeBlendPath::AllowOp()

Definition at line 619 of file ndbldpth.cpp.

00620 {
00621     ERROR2IF(pParam == NULL,FALSE,"Null param ptr");
00622 
00623     BOOL ok = TRUE;
00624 
00625     // Always destroy the cached info whenever anyone's doing something to this node.
00626     // When an undoable operation is being performed, this is done by the InitNodeBlendPathAction class
00627     UndoableOperation* pOp=pParam->GetOpPointer();
00628     if (pOp)
00629         ok = (InitNodeBlendPathAction::Init(pOp,pOp->GetUndoActionList(),this)!=AC_FAIL);
00630     else
00631         DestroyCachedInformation();
00632 
00633     return ok;
00634 }

void NodeBlendPath::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 315 of file ndbldpth.cpp.

00316 {
00317     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00318     ENSURE(IS_A(pNodeCopy, NodeBlendPath), "PolyCopyNodeContents given wrong dest node type");
00319 
00320     if (IS_A(pNodeCopy, NodeBlendPath))
00321         CopyNodeContents((NodeBlendPath*)pNodeCopy);
00322 }

void NodeBlendPath::Render RenderRegion pRender  )  [virtual]
 

Overrides inherited function to do nothing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
Pointer to a render region [INPUTS]

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 338 of file ndbldpth.cpp.

00339 {    
00340     
00341     //if (!InsideBlend())
00342         NodePath::Render(pRender);
00343 
00344 }  

void NodeBlendPath::RenderBlendBlobs RenderRegion pRender  ) 
 

Definition at line 395 of file ndbldpth.cpp.

00396 {
00397     NodePath::RenderObjectBlobs(pRender);
00398 }

void NodeBlendPath::RenderEorDrag RenderRegion pRender  )  [virtual]
 

Overrides inherited function to do nothing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pRender - A Pointer to the current RenderRegion [INPUTS]

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 358 of file ndbldpth.cpp.

00359 {
00360     //if (!InsideBlend())
00361     BlobManager* pBlobMan = GetApplication()->GetBlobManager();
00362     BlobStyle CurrBlobs = pBlobMan->GetCurrentInterest();
00363     if (CurrBlobs.Object)
00364         NodePath::RenderEorDrag(pRender);
00365 }

void NodeBlendPath::RenderObjectBlobs RenderRegion pRender  )  [virtual]
 

Draws the paths object blobs into the render region supplied.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pRender - The region to render the blobs into [INPUTS]

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 379 of file ndbldpth.cpp.

00380 {
00381 //  if (Tool::GetCurrentID() == TOOLID_BEZTOOL)
00382         NodePath::RenderObjectBlobs(pRender);
00383 //  else
00384 //  {
00385         // set our eor colour.
00386 //      pRender->SetLineColour(BLACK);
00387         // render the path
00388 //      pRender->DrawPath(&InkPath);
00389         // call the parent class render function
00390 //      NodePath::RenderObjectBlobs(pRender);
00391 //  }
00392 }

INT32 NodeBlendPath::SetPathIndex  ) 
 

Sets the index of this NBP by finding out how many NBP's already exist in the parent nodeblend.

> INT32 NodeBlendPath::SetPathIndex()

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/9/99
Parameters:
- [INPUTS]
Returns:
The index number of this nodeblendpath, or -1 if it fails
See also:
-

Definition at line 1035 of file ndbldpth.cpp.

01036 {
01037     Node* pParent = ((Node*)this)->FindParent();
01038     if ((pParent == NULL) || (!pParent->IS_KIND_OF(NodeBlend)))
01039     {
01040         ERROR3("Path has no parent, or it is not a nodeblend");
01041         return -1;
01042     }
01043     
01044     UINT32 Index = ((NodeBlend*)pParent)->GetNumNodeBlendPaths();
01045 
01046     m_Index = Index;
01047 
01048     return (INT32)Index;
01049 }

Node * NodeBlendPath::SimpleCopy void   )  [virtual]
 

Makes a copy of all the data in the node.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Returns:
Pointer to a Node

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 247 of file ndbldpth.cpp.

00248 {
00249     NodeBlendPath* NodeCopy = new NodeBlendPath();
00250     if (NodeCopy)
00251         CopyNodeContents(NodeCopy);
00252     
00253     return NodeCopy;
00254 }            

BOOL NodeBlendPath::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes the path record to the filter.

> virtual BOOL NodePath::WritePreChildrenNative(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/96
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 871 of file ndbldpth.cpp.

00872 {
00873     return WritePreChildrenWeb(pFilter);
00874 }

BOOL NodeBlendPath::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes the mould path record to the filter.

> virtual BOOL NodeBlendPath::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/4/99
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from NodePath.

Reimplemented in NodeBrushPath.

Definition at line 837 of file ndbldpth.cpp.

00838 {
00839     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
00840 
00841     INT32 NumCoords = InkPath.GetNumCoords();
00842     INT32 RecordSize = sizeof(INT32)+(sizeof(PathVerb)*NumCoords)+(sizeof(DocCoord)*NumCoords);
00843 
00844     CamelotFileRecord Rec(pFilter,TAG_BLEND_PATH,RecordSize);
00845 
00846     BOOL ok = Rec.Init();
00847 
00848     if (ok) ok = Rec.WritePath(&InkPath);
00849     if (ok) ok = pFilter->Write(&Rec);
00850     if (ok)
00851     {
00852         CamelotFileRecord FilledRec(pFilter, TAG_NODEBLENDPATH_FILLED, sizeof(INT32));
00853         
00854         ok = FilledRec.Init();
00855         if (ok)
00856         {
00857             INT32 Filled = InkPath.IsFilled;
00858             ok = FilledRec.WriteINT32(Filled);
00859             if (ok) ok = pFilter->Write(&FilledRec);
00860         }
00861     }
00862     if (!ok)
00863         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00864 
00865     return ok;
00866 }


Member Data Documentation

double NodeBlendPath::m_CachedPathLength [protected]
 

Definition at line 180 of file ndbldpth.h.

UINT32 NodeBlendPath::m_Index [protected]
 

Definition at line 184 of file ndbldpth.h.

CMap< MILLIPOINT, MILLIPOINT &, CPathPointInfo, CPathPointInfo & >* NodeBlendPath::m_pCachedPointsAtDistance [protected]
 

Definition at line 181 of file ndbldpth.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:43 2007 for Camelot by  doxygen 1.4.4