#include <ndbrshpt.h>
Inheritance diagram for NodeBrushPath:
Public Member Functions | |
NodeBrushPath () | |
This constructor creates a NodeBrushPath linked to no other, with all status flags false and an uninitialised bounding rectangle. | |
~NodeBrushPath () | |
Destructor for NodeBrushPath. | |
NodeBrushPath (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 Node * | SimpleCopy () |
Makes a copy of all the data in the node. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes the nodebrushpath path record to the filter. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
Writes the nodebrushpath path record to the filter. | |
virtual void | RenderEorDrag (RenderRegion *) |
Renders a version of the path for EORed dragging of shapes. | |
virtual void | Render (RenderRegion *pRender) |
If the brush is selected then the path is rendered, otherwise not. | |
virtual void | RenderObjectBlobs (RenderRegion *pRender) |
Draws the actual path, so that it is only seen when selected. | |
virtual void | RenderTinyBlobs (RenderRegion *pRender) |
Draws the actual path, so that it is only seen when selected. | |
virtual DocRect | GetBoundingRect () |
Returns the bounding rectangle of the coordinates of the path. | |
virtual void | Transform (TransformBase &Trans) |
Will Transform all the coords in the path with the transform provided. | |
void | SetPointAtDistance (MILLIPOINT Distance, DocCoord Point) |
Sets the coordinate of a point a certain distance along this path in the cached points map. | |
INT32 | GetNumberOfSteps () |
as above | |
void | SetNumberOfSteps (INT32 Steps) |
sets the number of steps in the nodeblendpath | |
void | IncludePointInBoundingRect (DocCoord Point) |
So that we can generate the bounding rect of the path as it is drawn this function allows us to add a single point to the bounding rectangle. | |
BOOL | GetPointAtDistance (MILLIPOINT Dist, DocCoord *pPoint, double *pTangent, BOOL UseCache=FALSE) |
Gets the coordinate of a point a certain distance along this path Calls the underlying Path class function This is identical to the version in ndbldpth.cpp except that this uses the cached version of path::Getpointatdistance. | |
void | ResetPathProcCache () |
To reset the cache used by the inkpath member, call this if you are going to alter the path in any way. | |
void | StartedBrush () |
informs the nodebrushpath that the brush is being drawn | |
void | StoppedBrush () |
informs the nodebrushpath that the brush has finished being drawn | |
BOOL | InitialisePathProcessor () |
To create a new path processor object. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
Protected Member Functions | |
void | CopyNodeContents (NodeBrushPath *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 | |
ProcessPathDistance * | m_pProcessPath |
INT32 | m_NumSteps |
BOOL | m_bDrawingBrush |
Definition at line 121 of file ndbrshpt.h.
|
This constructor creates a NodeBrushPath linked to no other, with all status flags false and an uninitialised bounding rectangle.
Definition at line 121 of file ndbrshpt.cpp. 00121 : NodeBlendPath() 00122 { 00123 m_pCachedPointsAtDistance = NULL; 00124 // Reuse the "Destroy cache" call 00125 DestroyCachedInformation(); 00126 m_bDrawingBrush = FALSE; 00127 m_pProcessPath = NULL; 00128 00129 }
|
|
Destructor for NodeBrushPath.
Definition at line 201 of file ndbrshpt.cpp. 00202 { 00203 // Reuse the "Destroy cache" call 00204 DestroyCachedInformation(); 00205 00206 if (m_pProcessPath != NULL) 00207 { 00208 delete m_pProcessPath; 00209 m_pProcessPath = NULL; 00210 } 00211 }
|
|
This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.
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 ?
Definition at line 175 of file ndbrshpt.cpp. 00181 :NodeBlendPath(ContextNode, Direction, Locked, Mangled, Marked, Selected) 00182 { 00183 m_pCachedPointsAtDistance = NULL; 00184 // Reuse the "Destroy cache" call 00185 DestroyCachedInformation(); 00186 m_bDrawingBrush = FALSE; 00187 m_pProcessPath = NULL; 00188 00189 }
|
|
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.
Definition at line 249 of file ndbrshpt.cpp. 00250 { 00251 NodePath::CopyNodeContents( NodeCopy ); 00252 //Copy contents specific to derived class here 00253 }
|
|
Returns the bounding rectangle of the coordinates of the path.
Definition at line 475 of file ndbrshpt.cpp. 00476 { 00477 //TRACEUSER( "Diccon", _T("Getting BRect, currently %d\n"), IsBoundingRectValid); 00478 return NodePath::GetBoundingRect(); 00479 }
|
|
as above
Definition at line 391 of file ndbrshpt.cpp. 00392 { 00393 return m_NumSteps; 00394 }
|
|
Gets the coordinate of a point a certain distance along this path Calls the underlying Path class function This is identical to the version in ndbldpth.cpp except that this uses the cached version of path::Getpointatdistance.
Definition at line 638 of file ndbrshpt.cpp. 00640 { 00641 ERROR2IF(pPoint == NULL,FALSE,"NULL pPoint param"); 00642 00643 BOOL Found = FALSE; 00644 00645 00646 CPathPointInfo PointInfo; 00647 00648 if (m_pCachedPointsAtDistance == NULL) 00649 { 00650 m_pCachedPointsAtDistance = new CMap<MILLIPOINT,MILLIPOINT&,CPathPointInfo,CPathPointInfo&>; 00651 // if (m_pCachedPointsAtDistance != NULL) 00652 // m_pCachedPointsAtDistance->InitHashTable(1277); // Init hash table size to a suitably large prime number 00653 } 00654 00655 if (m_pCachedPointsAtDistance != NULL) 00656 { 00657 00658 Found = m_pCachedPointsAtDistance->Lookup(Distance,PointInfo); 00659 //if (Found) 00660 // TRACEUSER( "Diccon", _T("Point %d, %d found in cache\n"), PointInfo.m_Point.x, PointInfo.m_Point.y); 00661 } 00662 00663 if (!Found) 00664 { 00665 00666 // if we are drawing the brush then use the cached path processor, otherwise 00667 // use the normal one 00668 if (UseCache) 00669 { 00670 00671 BOOL PointFound = FALSE; 00672 INT32 NumCoords; 00673 NumCoords = m_pProcessPath->GetCoordAndTangentWithCache( &PointInfo.m_Point, &PointInfo.m_Tangent, 00674 &PointFound, Distance ,&InkPath); 00675 if ((NumCoords != -1) && PointFound) 00676 { 00677 00678 if (m_pCachedPointsAtDistance != NULL) 00679 m_pCachedPointsAtDistance->SetAt(Distance,PointInfo); 00680 Found = TRUE; 00681 } 00682 } 00683 else 00684 { 00685 if (InkPath.GetPointAtDistance(Distance,&PointInfo.m_Point,&PointInfo.m_Tangent)) 00686 { 00687 if (m_pCachedPointsAtDistance != NULL) 00688 m_pCachedPointsAtDistance->SetAt(Distance,PointInfo); 00689 // TRACEUSER( "Diccon", _T("Point %d, %d found from line\n"), PointInfo.m_Point.x, PointInfo.m_Point.y); 00690 Found = TRUE; 00691 } 00692 } 00693 } 00694 00695 if (Found) 00696 { 00697 *pPoint = PointInfo.m_Point; 00698 if (pTangent) 00699 *pTangent = PointInfo.m_Tangent; 00700 } 00701 00702 00703 // if (Found == FALSE) 00704 // TRACEUSER( "Diccon", _T("Not found at distance %d\n"), Distance); 00705 return Found; 00706 }
|
|
So that we can generate the bounding rect of the path as it is drawn this function allows us to add a single point to the bounding rectangle.
Definition at line 495 of file ndbrshpt.cpp. 00496 { 00497 BoundingRectangle.IncludePoint(Point); 00498 }
|
|
To create a new path processor object.
Definition at line 741 of file ndbrshpt.cpp. 00742 { 00743 if (m_pProcessPath != NULL) 00744 { 00745 delete m_pProcessPath; 00746 m_pProcessPath = NULL; 00747 } 00748 00749 //m_pProcessPath = new ProcessPathDistance(64); 00750 00751 //ERROR2IF(m_pProcessPath == NULL, FALSE, "Unable to allocate ProcessPathDistance object"); 00752 00753 return TRUE; 00754 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeBlendPath. Definition at line 269 of file ndbrshpt.cpp. 00270 { 00271 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00272 ENSURE(IS_A(pNodeCopy, NodeBrushPath), "PolyCopyNodeContents given wrong dest node type"); 00273 00274 if (IS_A(pNodeCopy, NodeBrushPath)) 00275 CopyNodeContents((NodeBrushPath*)pNodeCopy); 00276 }
|
|
If the brush is selected then the path is rendered, otherwise not.
Reimplemented from NodeBlendPath. Definition at line 512 of file ndbrshpt.cpp. 00513 { 00514 pRender -> DrawPath( &InkPath ); 00515 }
|
|
Renders a version of the path for EORed dragging of shapes.
Reimplemented from NodeBlendPath. Definition at line 564 of file ndbrshpt.cpp. 00565 { 00566 pRender -> DrawPath( &InkPath ); 00567 }
|
|
Draws the actual path, so that it is only seen when selected.
Reimplemented from NodeBlendPath. Definition at line 529 of file ndbrshpt.cpp. 00530 { 00531 pRender -> DrawPath( &InkPath ); 00532 }
|
|
Draws the actual path, so that it is only seen when selected.
Reimplemented from NodePath. Definition at line 546 of file ndbrshpt.cpp.
|
|
To reset the cache used by the inkpath member, call this if you are going to alter the path in any way.
Definition at line 722 of file ndbrshpt.cpp.
|
|
sets the number of steps in the nodeblendpath
Definition at line 410 of file ndbrshpt.cpp. 00411 { 00412 m_NumSteps = Steps; 00413 }
|
|
Sets the coordinate of a point a certain distance along this path in the cached points map.
Definition at line 358 of file ndbrshpt.cpp. 00359 { 00360 CPathPointInfo PointInfo; 00361 00362 if (m_pCachedPointsAtDistance == NULL) 00363 { 00364 m_pCachedPointsAtDistance = new CMap<MILLIPOINT,MILLIPOINT&,CPathPointInfo,CPathPointInfo&>; 00365 // if (m_pCachedPointsAtDistance != NULL) 00366 // m_pCachedPointsAtDistance->InitHashTable(1277); // Init hash table size to a suitably large prime number 00367 } 00368 00369 00370 PointInfo.m_Point = Point; 00371 00372 if (m_pCachedPointsAtDistance != NULL) 00373 m_pCachedPointsAtDistance->SetAt(Distance,PointInfo); 00374 00375 }
|
|
Makes a copy of all the data in the node.
Reimplemented from NodeBlendPath. Definition at line 225 of file ndbrshpt.cpp. 00226 { 00227 NodeBrushPath* NodeCopy = new NodeBrushPath(); 00228 if (NodeCopy) 00229 CopyNodeContents(NodeCopy); 00230 00231 return NodeCopy; 00232 }
|
|
informs the nodebrushpath that the brush is being drawn
Definition at line 428 of file ndbrshpt.cpp. 00429 { 00430 // ResetPathProcCache(); 00431 m_bDrawingBrush = TRUE; 00432 }
|
|
informs the nodebrushpath that the brush has finished being drawn
Definition at line 448 of file ndbrshpt.cpp. 00449 { 00450 m_bDrawingBrush = FALSE; 00451 ResetPathProcCache(); 00452 if (m_pProcessPath != NULL) 00453 { 00454 delete m_pProcessPath; 00455 m_pProcessPath = NULL; 00456 } 00457 }
|
|
Will Transform all the coords in the path with the transform provided.
Reimplemented from NodePath. Definition at line 585 of file ndbrshpt.cpp. 00586 { 00587 // Change all the coords 00588 Trans.Transform( (DocCoord*)InkPath.GetCoordArray(), InkPath.GetNumCoords() ); 00589 00590 // and keep the bounding rectangle up to date. 00591 InvalidateBoundingRect(); 00592 00593 // Transform all the children... 00594 TransformChildren(Trans); 00595 00596 // clear out the cache 00597 DestroyCachedInformation(); 00598 00599 // as we are going to need to recalculate all the points try 00600 // to get the path processor back in action, don't worry if it fails though 00601 if (InitialisePathProcessor()) 00602 { 00603 // we got it, so tell the NBM to ask for the cache 00604 Node* pParent = this->FindParent(); 00605 if (pParent != NULL) 00606 { 00607 NodeBrushMaker* pMaker = (NodeBrushMaker*)pParent->FindFirstChild(CC_RUNTIME_CLASS(NodeBrushMaker)); 00608 if (pMaker != NULL) 00609 pMaker->SetUsePathCache(FALSE); 00610 } 00611 else 00612 { 00613 delete m_pProcessPath; 00614 m_pProcessPath = NULL; 00615 } 00616 } 00617 }
|
|
Writes the nodebrushpath path record to the filter. > virtual BOOL NodeBrushPath::WritePreChildrenNative(BaseCamelotFilter* pFilter)
Reimplemented from NodeBlendPath. Definition at line 339 of file ndbrshpt.cpp. 00340 { 00341 return WritePreChildrenWeb(pFilter); 00342 }
|
|
Writes the nodebrushpath path record to the filter. > virtual BOOL NodeBrushPath::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
Reimplemented from NodeBlendPath. Definition at line 293 of file ndbrshpt.cpp. 00294 { 00295 ERROR2IF(pFilter == NULL,FALSE,"NULL filter param"); 00296 00297 BOOL ok = TRUE; 00298 /* 00299 INT32 NumCoords = InkPath.GetNumCoords(); 00300 INT32 RecordSize = sizeof(INT32)+(sizeof(PathVerb)*NumCoords)+(sizeof(DocCoord)*NumCoords); 00301 00302 CamelotFileRecord Rec(pFilter,TAG_BLEND_PATH,RecordSize); 00303 00304 BOOL ok = Rec.Init(); 00305 00306 if (ok) ok = Rec.WritePath(&InkPath); 00307 if (ok) ok = pFilter->Write(&Rec); 00308 if (ok) 00309 { 00310 CamelotFileRecord FilledRec(pFilter, TAG_NODEBLENDPATH_FILLED, sizeof(INT32)); 00311 00312 ok = FilledRec.Init(); 00313 if (ok) 00314 { 00315 INT32 Filled = InkPath.IsFilled; 00316 ok = FilledRec.WriteINT32(Filled); 00317 if (ok) ok = pFilter->Write(&FilledRec); 00318 } 00319 } 00320 if (!ok) 00321 pFilter->GotError(_R(IDE_FILE_WRITE_ERROR)); 00322 */ 00323 return ok; 00324 }
|
|
Definition at line 173 of file ndbrshpt.h. |
|
Definition at line 172 of file ndbrshpt.h. |
|
Definition at line 171 of file ndbrshpt.h. |