ContourDragBecomeA Class Reference

This is used to turn all nodes which are to be contoured into a single path for dragging. More...

#include <cntrtool.h>

Inheritance diagram for ContourDragBecomeA:

BecomeA List of all members.

Public Member Functions

 ContourDragBecomeA (BecomeAReason Reason, CCRuntimeClass *pClass, UndoableOperation *pOp, BOOL Sel, Path *pPathList, UINT32 NumPaths, BOOL IncludeLineWidths=FALSE)
virtual BOOL PassBack (NodeRenderableInk *pNewNode, NodeRenderableInk *pCreatedByNode, CCAttrMap *pAttrMap)
 Passback function used to sum all paths together.

Private Attributes

Pathm_pPathList
UINT32 m_NumPaths
BOOL m_IncludeLineWidths

Detailed Description

This is used to turn all nodes which are to be contoured into a single path for dragging.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
Date:
2/12/99

Definition at line 477 of file cntrtool.h.


Constructor & Destructor Documentation

ContourDragBecomeA::ContourDragBecomeA BecomeAReason  Reason,
CCRuntimeClass pClass,
UndoableOperation pOp,
BOOL  Sel,
Path pPathList,
UINT32  NumPaths,
BOOL  IncludeLineWidths = FALSE
[inline]
 

Definition at line 481 of file cntrtool.h.

00487                                                     : BecomeA(Reason, pClass, pOp, Sel)
00488     {
00489         m_pPathList = pPathList;
00490         m_NumPaths = NumPaths;
00491         m_Count = 0;
00492         m_IncludeLineWidths = IncludeLineWidths;
00493 
00494         // we're only interested in the silhouette.
00495         fSilhouette = TRUE;
00496     }


Member Function Documentation

BOOL ContourDragBecomeA::PassBack NodeRenderableInk pNewNode,
NodeRenderableInk pCreatedByNode,
CCAttrMap pAttrMap
[virtual]
 

Passback function used to sum all paths together.

Author:
David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/99
Parameters:
See base class [INPUTS]
TRUE for success [OUTPUTS]
Returns:

Errors: -

See also:
-

Reimplemented from BecomeA.

Definition at line 4486 of file cntrtool.cpp.

04489 {
04490     if (m_Count >= m_NumPaths)
04491     {
04492         ERROR3("Number of paths doesn't match");
04493         return FALSE;
04494     }
04495     
04496     if (!pNewNode || !pNewNode->IsNodePath() || ((NodePath *)pNewNode)->InkPath.GetNumCoords() < 2)
04497         return FALSE;
04498 
04499     if (pCreatedByNode)
04500     {
04501         // only do non-needs parent nodes
04502         if (!pCreatedByNode->NeedsParent(NULL))
04503         {
04504             BOOL PathIsClosed = ((NodePath*)pNewNode)->InkPath.IsClosed();
04505             // check for an open path
04506             if ( !PathIsClosed )
04507             {       
04508                 // make a new node path
04509                 NodePath * pClosedPathNode = 
04510                     ((NodePath *)pNewNode)->MakeNodePathFromAttributes(ContourToolFlatness, pAttrMap, FALSE, m_IncludeLineWidths);
04511 
04512                 m_pPathList[m_Count].ClearPath(FALSE);
04513                 m_pPathList[m_Count].CloneFrom(((NodePath *)pNewNode)->InkPath);
04514 
04515                 // delete the node
04516                 pNewNode->DeleteChildren(pNewNode->FindFirstChild());
04517                 
04518                 delete pNewNode;
04519                 pNewNode = pClosedPathNode;
04520             }
04521 
04522             NodePath* pStrokedPath = pCreatedByNode->GetVariableWidthStrokePath();
04523             BOOL bStroke = FALSE;
04524             
04525             if (pStrokedPath != NULL)
04526             {
04527                 delete pNewNode;
04528                 pNewNode = pStrokedPath;
04529                 pStrokedPath = NULL;
04530                 bStroke = TRUE;
04531             }
04532 
04533             // Karim 30/06/2000
04534             // the path-clipping code cannot cope with a straight line (two handles),
04535             // so we need to explicitly check for this case.
04536             if ( ((NodePath *)pNewNode)->InkPath.GetNumCoords() == 2 )
04537             {
04538                 m_pPathList[m_Count].ClearPath(FALSE);
04539                 m_pPathList[m_Count].CloneFrom(((NodePath *)pNewNode)->InkPath);
04540             }
04541             else
04542             {
04543                 // clip the path to ensure its validity
04544                 if (!bStroke)
04545                 {
04546                     Path BlankPath;
04547                     BlankPath.Initialise();
04548                     BlankPath.ClipPathToPath(((NodePath *)pNewNode)->InkPath, &(m_pPathList[m_Count]), 3);
04549                 }
04550             }
04551 
04552             // has the clipping failed ? if so, just clone.
04553             if (m_pPathList[m_Count].GetNumCoords() < 2)
04554             {
04555                 m_pPathList[m_Count].ClearPath(FALSE);
04556                 m_pPathList[m_Count].CloneFrom(((NodePath *)pNewNode)->InkPath);
04557             }
04558             
04559             // take the path from the node, and add it to my path
04560             m_pPathList[m_Count++].TryToClose();
04561         }
04562     }
04563     
04564     // delete the node
04565     Node *pChild = pNewNode->FindFirstChild();
04566     Node *pNextNode = NULL;
04567 
04568     while (pChild)
04569     {
04570         pNextNode = pChild->FindNext();
04571         pChild->UnlinkNodeFromTree();
04572         
04573         delete pChild;
04574         pChild = pNextNode;
04575     }
04576     
04577     if (pAttrMap)
04578     {
04579         pAttrMap->DeleteAttributes();
04580         delete pAttrMap;
04581     }
04582 
04583     if(pNewNode)
04584         delete pNewNode;
04585     
04586     return TRUE;
04587 }


Member Data Documentation

BOOL ContourDragBecomeA::m_IncludeLineWidths [private]
 

Definition at line 515 of file cntrtool.h.

UINT32 ContourDragBecomeA::m_NumPaths [private]
 

Definition at line 510 of file cntrtool.h.

Path* ContourDragBecomeA::m_pPathList [private]
 

Definition at line 507 of file cntrtool.h.


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