#include <nodecntr.h>
Inheritance diagram for NodeContour:
Public Member Functions | |
NodeContour () | |
NodeContour (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
Constructor. | |
~NodeContour () | |
Destructor. | |
virtual Node * | SimpleCopy () |
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes. | |
void | CopyNodeContents (NodeContour *pNewNode) |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
virtual DocRect | GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE) |
Get the bounding rect of this node. | |
virtual DocRect | GetBlobBoundingRect () |
Get the blob bounding rect of this node. | |
virtual void | RenderTinyBlobs (RenderRegion *pRegion) |
This function is the base class version of a blob rendering function, so it actually does nothing. Tiny blobs are displayed by each of the objects that is selected when in bounded region selection mode. Typically a Tiny Blob should be a single small blob. | |
virtual void | Render (RenderRegion *pRender) |
Renders this node. | |
virtual BOOL | DoBecomeA (BecomeA *pBecomeA) |
Turns this node into another node of a particular type. | |
virtual BOOL | CanBecomeA (BecomeA *pBecomeA) |
Can this node turn itself into a node of a particular type ? | |
virtual BOOL | NeedsParent (Node *pClassNode) const |
Does this node need its parent ? | |
virtual NodeCompound * | GetParentController () const |
virtual String | Describe (BOOL Plural, BOOL Verbose) |
Gets the string descriptor for this object. | |
virtual BOOL | IsAContour () const |
BOOL | GenerateContour (List *pList=NULL, CCAttrMap *pAttrMap=NULL) |
void | DeleteCache () |
void | Transform (TransformBase &Trans) |
Base class transform function. | |
void | RenderEorDrag (RenderRegion *pRender) |
Each class derived from NodeRenderableInk should write a version of this member function. In most cases it will be the same as the Render() member function but some of the nodes (such as groups) need to perform special actions. The function is for drawing the object while it is being dragged about by the selector tool. It should do this with an effective wysiwyg level of 0 so that the drawing is fast. | |
virtual BOOL | WritePreChildrenWeb (BaseCamelotFilter *pFilter) |
Writes out a record that represents the node. | |
virtual BOOL | WritePreChildrenNative (BaseCamelotFilter *pFilter) |
virtual BOOL | AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE) |
This is the way to ask a node if you can do an op to it. | |
virtual BOOL | IsTypeExtendible () const |
virtual DocRect | ValidateExtend (const ExtendParams &ExtParams) |
Tests the reversibility of an Extend operation applied to this node. | |
virtual void | Extend (const ExtendParams &ExtParams) |
Perform an Extend operation on this Node, and its children if appropriate. Default implementation just calls Extend() on its children. | |
virtual BOOL | OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu) |
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs. | |
virtual INT32 | EstimateNodeComplexity (OpParam *details) |
Static Public Member Functions | |
static BOOL | SmoothPath (Path *pPath) |
static BOOL | GenerateContourPathForNode (Path *pDestPath, Node *pSourceNode, const List *pSourceList, const MILLIPOINT nWidth, const BOOL fOuterContour=TRUE, const JointType jt=RoundJoin, const MILLIPOINT nFlatness=-1, const BOOL fUseLineWidths=TRUE, const BOOL fIncludeShadows=FALSE) |
Generate a contour for the given node or list of paths + attrs.Generates the contour paths in this nodeDeletes all the pathsTransforms me & all my pathsRenders my eor drag stuffWrites the node to a fileWrites the node to a fileWrites the node to a fileSort of backwards copy constructorPolymorphically copies the contents of this node to another Blends all the attributes to this particular position,Does the allow op mechanismRenders the tiny blobs for this objectReturns a type correct pointer to the parent Contour controllerTests the reversibility of an Extend operation applied to this node.Perform an Extend operation on this Node, and its children if appropriate.Allows the shadow to respond to the clickSums all node paths' paths together into one pathThis function estimates a complexity value for the node. The complexity value is based upon the total length of all paths in the node. | |
Protected Member Functions | |
BOOL | BlendAttributes (RenderRegion *pRender, CCAttrMap *pAttrMapStart, CCAttrMap *pEndAttrMap, CCAttrMap *pBlendedAttrMap, double BlendRatio) |
BOOL | CopyAttributes (NodeRenderableInk *pNode, CCAttrMap *pAttrMap) |
Copies all the attributes in the attribute map onto the given node. | |
BOOL | SmoothPaths () |
NodeRenderableInk * | FindNodeToContour (NodeRenderableInk *pInk) |
Does a depth first seach to find a node to take the attribute map from when blending. | |
Protected Attributes | |
Path | m_SourcePath |
Path * | m_pPathList |
INT32 | m_NumPaths |
BOOL | m_FirstRender |
Private Member Functions | |
CC_DECLARE_DYNCREATE (NodeContour) |
Definition at line 121 of file nodecntr.h.
|
|
|
Constructor.
Definition at line 190 of file nodecntr.cpp. 00197 { 00198 m_pPathList = NULL; 00199 m_NumPaths = 0; 00200 m_SourcePath.Initialise(); 00201 IsBoundingRectValid = FALSE; 00202 m_FirstRender = TRUE; 00203 }
|
|
Destructor.
Definition at line 215 of file nodecntr.cpp. 00216 { 00217 if (m_pPathList) 00218 { 00219 delete [] m_pPathList; 00220 m_pPathList = NULL; 00221 } 00222 }
|
|
This is the way to ask a node if you can do an op to it.
For example, the op could change the node's appearence (e.g. attr application, editing a path), replace the node with another node (e.g. because it uses hidden nodes to hide the original and put another node in its place, or "make shapes"), delete the node (e.g. the delete and cut ops), etc. This function gives the node a chance to say NO. It also gives the parents a chance to say no too. E.g. a blend node will allow itself to be deleted, but it will NOT allow a child of itself to be deleted). This call should only be made on selected, or parents of selected, nodes. It makes a decision as a straight node if it is selected. It makes a decision as a parent if it has selected children. E.g. NodeBlend::AllowOp(...op delete...) if the node is selected, then it will return TRUE (parents permitting), i.e. I can be deleted if the node is a parent of selected it will return FALSE (i.e. can't delete children of blends). So when the node is selected, you are asking the node if you can do the op to it. When the node is a parent of a selected node, you are asking if you can do the op to one of its children. If the 'SetOpPermissionState' param is TRUE, the following indented lines applies: The node's op permission state is set according to the result of this function. If TRUE is returned, then the node's op permission state will be left unchanged. AND the parent's op permission state will be set to PERMISSION_ALLOWED if FALSE is returned, then the node's op permission state will be PERMISSION_DENIED, AND all it's parents (up to the layer) will be set to PERMISSION_DENIED Also, all parents of this node are called via their AllowOp() func with the same state as this node. This means that after this call, you can guarantee that all of its parents will have either a PERMISSION_DENIED or PERMISSION_ALLOWED state. Note: Even if this node tries to set all it's parents to have a PERMISSION_DENIED state, if any of its parents have previously been set to PERMISSION_ALLOWED they will remain in that state (see SetOpPermission()). Why? Well, it is possible for a parent node to have one child with a PERMISSION_DENIED and another child with a PERMISSION_ALLOWED. It this state the parent MUST be in state PERMISSION_ALLOWED, because at least one of its children will allow the op to happen to it. So, after this call: The op permission state for this node will be either left unchanged (and therefore remain PERMISSION_UNDEFINED), or PERMISSION_DENIED. The parent's op permission state will be either PERMISSION_ALLOWED, or PERMISSION_DENIED. This is so UndoableOperation::UpdateChangedNodes() will only call OnChildChange() on parent nodes, because it only calls that func for nodes that have an op permission state of PERMISSION_ALLOWED.
Reimplemented from Node. |
|
|
|
Can this node turn itself into a node of a particular type ?
Reimplemented from Node. Definition at line 1071 of file nodecntr.cpp. 01072 { 01073 if (pBecomeA->BAPath()) 01074 { 01075 if (pBecomeA->IsCounting()) 01076 { 01077 NodeContourController * pControl = (NodeContourController *)FindParent(); 01078 01079 if (pControl->GetInsetPathFlag()) 01080 { 01081 pBecomeA->AddCount(1); 01082 } 01083 else 01084 { 01085 pBecomeA->AddCount(pControl->GetNumberOfSteps()); 01086 } 01087 } 01088 01089 return TRUE; 01090 } 01091 01092 return FALSE; 01093 }
|
|
|
|
Copies all the attributes in the attribute map onto the given node.
Definition at line 1020 of file nodecntr.cpp. 01021 { 01022 ERROR2IF(pNode == NULL, FALSE, "Node is null"); 01023 ERROR2IF(pAttrMap == NULL, FALSE, "Attribute map is null"); 01024 01025 CCAttrMap::iterator end = pAttrMap->GetEndPosition(); 01026 CCAttrMap::iterator PosStart = pAttrMap->GetStartPosition(); 01027 01028 while( PosStart != end ) 01029 { 01030 CCRuntimeClass *pTypeStart = NULL; 01031 void *pValStart = NULL; 01032 01033 pAttrMap->GetNextAssoc( PosStart, pTypeStart, pValStart ); 01034 NodeAttribute* pNodeAttr = (NodeAttribute *)pValStart; 01035 01036 // copy the attribute onto the node 01037 if (pNodeAttr) 01038 { 01039 if (pNodeAttr->CanBeAppliedToObject()) 01040 { 01041 if (!pNodeAttr->CopyNode(pNode, FIRSTCHILD)) 01042 { 01043 ERROR3("Copy node failed"); 01044 return FALSE; 01045 } 01046 } 01047 } 01048 } 01049 01050 return TRUE; 01051 }
|
|
|
|
|
|
Gets the string descriptor for this object.
Reimplemented from Node. Definition at line 1126 of file nodecntr.cpp. 01127 { 01128 String Name; 01129 Name.Load(_R(IDS_CONTOUR_NODE_NAME)); 01130 01131 if (Plural) 01132 { 01133 Name += _T("s"); 01134 } 01135 01136 return Name; 01137 }
|
|
Turns this node into another node of a particular type.
Reimplemented from Node. Definition at line 696 of file nodecntr.cpp. 00697 { 00698 // Check for a NULL entry param 00699 ERROR2IF_PF(pBecomeA == NULL,FALSE,("pBecomeA is NULL")); 00700 00701 if (!pBecomeA->BAPath()) 00702 { 00703 return FALSE; 00704 } 00705 00706 BOOL ValidReason = (pBecomeA->GetReason() == BECOMEA_REPLACE || pBecomeA->GetReason() == BECOMEA_PASSBACK); 00707 ERROR2IF_PF(!ValidReason,FALSE,("Unkown BecomeA reason %d",pBecomeA->GetReason())); 00708 00709 UndoableOperation* pOp = pBecomeA->GetUndoOp(); 00710 00711 double StepSize = 0; 00712 double Ratio = 0; 00713 00714 NodeContourController * pController = (NodeContourController *)FindParent(); 00715 00716 if (!pController) 00717 { 00718 ERROR3("No contour controller for become a"); 00719 return FALSE; 00720 } 00721 00722 INT32 Width = pController->GetWidth(); 00723 00724 // Node * pContourBegin = NULL; 00725 00726 BOOL bPassback = FALSE; 00727 00728 if (pBecomeA->GetReason() == BECOMEA_PASSBACK) 00729 bPassback = TRUE; 00730 00731 // CCAttrMap * pTmpMap = NULL; 00732 00733 // turn each path into a node path with the appropriate attributes 00734 if (m_pPathList != NULL && m_NumPaths > 0) 00735 { 00736 // do the blended attributes map 00737 CCAttrMap BlendAttrMap(30); 00738 00739 // build the attribute maps for the start & end nodes 00740 NodeRenderableInk * pEndNode = NULL; 00741 00742 if (pController->GetWidth() > 0) 00743 { 00744 pEndNode = (NodeRenderableInk *)FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk)); 00745 } 00746 else 00747 { 00748 pEndNode = (NodeRenderableInk *)FindNext(CC_RUNTIME_CLASS(NodeRenderableInk)); 00749 } 00750 00751 if (!pEndNode) 00752 { 00753 ERROR3("No node present to contour"); 00754 return FALSE; 00755 } 00756 00757 // CGS: need to check whether pEndNode is compound - and if it is, do some extra stuff 00758 00759 if (pEndNode->IsCompound()) 00760 { 00761 pEndNode = FindNodeToContour(pEndNode); 00762 } 00763 00764 if (pEndNode->IS_KIND_OF(NodeBlend)) 00765 { 00766 pEndNode = (NodeRenderableInk *)pEndNode->FindFirstChild(CC_RUNTIME_CLASS(NodeRenderableInk)); 00767 } 00768 00769 // do the blend of the attributes 00770 CCAttrMap * pAttrMapStart = CCAttrMap::MakeAppliedAttrMap(this); 00771 CCAttrMap * pAttrMapEnd = CCAttrMap::MakeAppliedAttrMap(pEndNode); 00772 00773 ERROR3IF (pAttrMapStart == NULL, "pAttrMapStart is NULL!"); 00774 ERROR3IF (pAttrMapEnd == NULL, "pAttrMapEnd is NULL!"); 00775 00776 StepSize = 1.0 / ((double)(m_NumPaths)); 00777 00778 NodePath* pPath = NULL; 00779 Node* pInsertContext = this; 00780 00781 // For DoBecomeA we must return the paths in the order in which they will be placed 00782 // in the tree and rendered 00783 // For Outer contours that means: end node, steps, original node 00784 // For Inner contours that means: original node, steps, end node 00785 // 00786 if (Width < 0) 00787 { 00788 // outer contour ! 00789 // 00790 // End node first 00791 INT32 i = m_NumPaths-1; 00792 00793 if (pOp) 00794 { 00795 ALLOC_WITH_FAIL(pPath, new NodePath, pOp); 00796 } 00797 else 00798 { 00799 pPath = new NodePath; 00800 00801 ERRORIF(pPath == NULL, _R(IDE_NOMORE_MEMORY), FALSE); 00802 } 00803 00804 pPath->InkPath.Initialise(); 00805 pPath->InkPath.CloneFrom(m_pPathList[i]); 00806 pPath->InkPath.IsFilled = TRUE; 00807 pPath->InkPath.InitialiseFlags(0, pPath->InkPath.GetNumCoords()); 00808 00809 // insert the node 00810 if (!bPassback) 00811 { 00812 pPath->ApplyAttributes(pAttrMapStart, TRUE); 00813 00814 if (pOp) 00815 pOp->DoInsertNewNode(pPath, pInsertContext, NEXT, TRUE, FALSE, TRUE, TRUE); 00816 else 00817 { 00818 pPath->AttachNode(pInsertContext, NEXT, FALSE, FALSE); 00819 pPath->NormaliseAttributes(); 00820 } 00821 pInsertContext = pPath; 00822 pPath->SetSelected(TRUE); 00823 00824 pBecomeA->PassBack(pPath, this, pAttrMapStart->Copy()); 00825 } 00826 else 00827 { 00828 pBecomeA->PassBack(pPath, this, pAttrMapStart->Copy()); 00829 } 00830 00831 // Now all the steps 00832 for (i = m_NumPaths-2; i>=0; i--) 00833 { 00834 // blend the attributes at this point 00835 Ratio = (StepSize * ((double)i)) + StepSize; 00836 00837 // calculate the correct ratio given the profile for attributes 00838 CProfileBiasGain Profile = pController->GetAttrProfile(); 00839 Profile.SetBias(-Profile.GetBias()); 00840 Ratio = (double)Profile.MapZeroToOne((AFp)Ratio); 00841 00842 Ratio = 1.0 - Ratio; 00843 00844 if (!BlendAttributes(NULL, pAttrMapStart, pAttrMapEnd, &BlendAttrMap, 00845 Ratio)) 00846 { 00847 ERROR3("Blend attributes failed"); 00848 return FALSE; 00849 } 00850 00851 if (pOp) 00852 { 00853 ALLOC_WITH_FAIL(pPath, new NodePath, pOp); 00854 } 00855 else 00856 { 00857 pPath = new NodePath; 00858 00859 ERRORIF(pPath == NULL, _R(IDE_NOMORE_MEMORY), FALSE); 00860 } 00861 00862 pPath->InkPath.Initialise(); 00863 pPath->InkPath.CloneFrom(m_pPathList[i]); 00864 00865 pPath->InkPath.IsFilled = TRUE; 00866 pPath->InkPath.InitialiseFlags(0, pPath->InkPath.GetNumCoords()); 00867 00868 // insert the node 00869 if (!bPassback) 00870 { 00871 // copy the blended attributes to the new node 00872 // CopyAttributes(pPath, &BlendAttrMap); 00873 pPath->ApplyAttributes(&BlendAttrMap, TRUE); 00874 00875 if (pOp) 00876 pOp->DoInsertNewNode(pPath, pInsertContext, NEXT, TRUE, FALSE, TRUE, TRUE); 00877 else 00878 { 00879 pPath->AttachNode(pInsertContext, NEXT, FALSE, FALSE); 00880 pPath->NormaliseAttributes(); 00881 } 00882 00883 pInsertContext = pPath; 00884 pPath->SetSelected(TRUE); 00885 00886 pBecomeA->PassBack(pPath, this, BlendAttrMap.Copy()); 00887 } 00888 else 00889 { 00890 pBecomeA->PassBack(pPath, this, BlendAttrMap.Copy()); 00891 } 00892 } 00893 } 00894 else 00895 { 00896 // inner contour ! 00897 INT32 i = 0; 00898 for (i = m_NumPaths-1; i!=0 ; i--) 00899 { 00900 // Check if the path has any points before outputing it 00901 // This stops degenerate paths being added to the document 00902 // which will cause errors in the saving code 00903 Path* pStepPath = &(m_pPathList[(m_NumPaths - 1) - i]); 00904 if (pStepPath && pStepPath->GetNumCoords() > 0) 00905 { 00906 // calculate the correct ratio given the profile for attributes 00907 Ratio = (StepSize * ((double)i)); 00908 00909 // calculate the correct ratio given the profile for attributes 00910 CProfileBiasGain Profile = pController->GetAttrProfile(); 00911 Profile.SetBias(-Profile.GetBias()); 00912 Ratio = (double)Profile.MapZeroToOne((AFp)Ratio); 00913 00914 if (!BlendAttributes(NULL, pAttrMapStart, pAttrMapEnd, &BlendAttrMap, 00915 Ratio)) 00916 { 00917 ERROR3("Blend attributes failed"); 00918 return FALSE; 00919 } 00920 00921 pPath = new NodePath; 00922 00923 pPath->InkPath.Initialise(); 00924 pPath->InkPath.CloneFrom(*pStepPath); 00925 pPath->InkPath.IsFilled = TRUE; 00926 pPath->InkPath.InitialiseFlags(0, pPath->InkPath.GetNumCoords()); 00927 00928 if (!bPassback) 00929 { 00930 pPath->ApplyAttributes(&BlendAttrMap, TRUE); 00931 if (pOp) 00932 pOp->DoInsertNewNode(pPath, pInsertContext, NEXT, TRUE, FALSE, TRUE, TRUE); 00933 else 00934 { 00935 pPath->AttachNode(pInsertContext, NEXT, FALSE, FALSE); 00936 pPath->NormaliseAttributes(); 00937 } 00938 00939 pInsertContext = pPath; 00940 pBecomeA->PassBack(pPath, pPath, BlendAttrMap.Copy()); 00941 } 00942 else 00943 { 00944 pBecomeA->PassBack(pPath, pPath, BlendAttrMap.Copy()); 00945 } 00946 } 00947 } 00948 00949 // Finally, the end node 00950 Path* pStepPath = &(m_pPathList[m_NumPaths - 1]); 00951 if (pStepPath && pStepPath->GetNumCoords() > 0) 00952 { 00953 pPath = new NodePath; 00954 pPath->InkPath.Initialise(); 00955 00956 pPath->InkPath.CloneFrom(*pStepPath); 00957 pPath->InkPath.IsFilled = TRUE; 00958 pPath->InkPath.InitialiseFlags(0, pPath->InkPath.GetNumCoords()); 00959 00960 // insert the node 00961 if (!bPassback) 00962 { 00963 // CopyAttributes(pPath, pAttrMapStart); 00964 pPath->ApplyAttributes(pAttrMapStart, TRUE); 00965 if (pOp) 00966 pOp->DoInsertNewNode(pPath, pInsertContext, NEXT, TRUE, FALSE, TRUE, TRUE); 00967 else 00968 { 00969 pPath->AttachNode(pInsertContext, NEXT, FALSE, FALSE); 00970 pPath->NormaliseAttributes(); 00971 } 00972 00973 pInsertContext = pPath; 00974 00975 pBecomeA->PassBack(pPath, pPath, pAttrMapStart->Copy()); 00976 } 00977 else 00978 { 00979 pBecomeA->PassBack(pPath, pPath, pAttrMapStart->Copy()); 00980 } 00981 } 00982 } 00983 00984 BlendAttrMap.DeleteAttributes(); 00985 00986 delete pAttrMapStart; 00987 delete pAttrMapEnd; 00988 00989 // hide the contour begin node 00990 if (!bPassback) 00991 { 00992 if (pOp) 00993 { 00994 NodeHidden * pHidden = NULL; 00995 pOp->DoHideNode(this, TRUE, &pHidden, TRUE); 00996 } 00997 else 00998 { 00999 CascadeDelete(); 01000 delete this; // Scary! 01001 } 01002 } 01003 01004 return TRUE; 01005 } 01006 01007 return FALSE; 01008 }
|
|
Reimplemented from Node. |
|
Perform an Extend operation on this Node, and its children if appropriate. Default implementation just calls Extend() on its children.
Reimplemented from Node. |
|
Does a depth first seach to find a node to take the attribute map from when blending.
Definition at line 651 of file nodecntr.cpp. 00652 { 00653 if (!pInk->IsCompound()) 00654 return pInk; 00655 00656 Node * pNodeStep = pInk->FindFirstDepthFirst(); 00657 00658 AttrFillGeometry * pFill = NULL; 00659 00660 while (pNodeStep && pNodeStep != pInk) 00661 { 00662 if (pNodeStep->IsAnObject()) 00663 { 00664 if (!pNodeStep->NeedsParent(NULL)) 00665 { 00666 // does this have a fill attribute ? 00667 if (((NodeRenderableInk *)pNodeStep)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFillGeometry), 00668 (NodeAttribute **)(&pFill))) 00669 { 00670 // let's check this to see if there's a colour on the node or not 00671 if (pFill->GetStartColour()) 00672 { 00673 if (!pFill->GetStartColour()->IsTransparent()) 00674 return (NodeRenderableInk *)pNodeStep; 00675 } 00676 } 00677 } 00678 } 00679 00680 pNodeStep = pNodeStep->FindNextDepthFirst(pInk); 00681 } 00682 00683 return pInk; 00684 }
|
|
|
|
Generate a contour for the given node or list of paths + attrs.Generates the contour paths in this nodeDeletes all the pathsTransforms me & all my pathsRenders my eor drag stuffWrites the node to a fileWrites the node to a fileWrites the node to a fileSort of backwards copy constructorPolymorphically copies the contents of this node to another Blends all the attributes to this particular position,Does the allow op mechanismRenders the tiny blobs for this objectReturns a type correct pointer to the parent Contour controllerTests the reversibility of an Extend operation applied to this node.Perform an Extend operation on this Node, and its children if appropriate.Allows the shadow to respond to the clickSums all node paths' paths together into one pathThis function estimates a complexity value for the node. The complexity value is based upon the total length of all paths in the node.
/ return fSuccess; } /*!
< ----------------
Definition at line 1184 of file nodecntr.cpp. |
|
Get the blob bounding rect of this node.
Reimplemented from NodeRenderable. Definition at line 379 of file nodecntr.cpp. 00380 { 00381 DocRect dr = GetBoundingRect(FALSE, FALSE); 00382 00383 BlobManager * pMgr = GetApplication()->GetBlobManager(); 00384 00385 INT32 Size = 0; 00386 00387 if (pMgr) 00388 Size = pMgr->GetBlobSize(); 00389 00390 dr.lo.x -= Size*2; 00391 dr.lo.y -= Size*2; 00392 dr.hi.x += Size*2; 00393 dr.hi.y += Size*2; 00394 00395 IncludeChildrensBoundingRects(&dr); 00396 00397 return dr; 00398 }
|
|
Get the bounding rect of this node.
Reimplemented from NodeRenderableBounded. Definition at line 234 of file nodecntr.cpp. 00235 { 00236 // sum all the bounding rects & then add the width 00237 if (!(!IsBoundingRectValid || DontUseAttrs)) 00238 { 00239 return BoundingRectangle; 00240 } 00241 00242 DocRect dr; 00243 00244 NodeContourController * pController = (NodeContourController *)FindParent(); 00245 00246 if (!pController) 00247 return DocRect(0,0,0,0); 00248 00249 INT32 Width = pController->GetWidth(); 00250 00251 Node * pNode = FindParent(); 00252 00253 if (!pNode) 00254 return BoundingRectangle; 00255 00256 pNode = pNode->FindFirstChild(); 00257 00258 while (pNode) 00259 { 00260 if (pNode->IsAnObject() && pNode!=this) 00261 { 00262 if (!IsBoundingRectValid) 00263 { 00264 ((NodeRenderableInk *)pNode)->InvalidateBoundingRect(); 00265 } 00266 00267 dr = dr.Union(((NodeRenderableInk *)pNode)->GetBoundingRect(TRUE, HitTest)); 00268 } 00269 00270 pNode = pNode->FindNext(); 00271 } 00272 00273 if (Width < 0) 00274 { 00275 dr.lo.x += Width; 00276 dr.lo.y += Width; 00277 dr.hi.x -= Width; 00278 dr.hi.y -= Width; 00279 } 00280 00281 DocRect PathRect; 00282 00283 // include all the paths in the bounding rect 00284 for (INT32 i = 0 ; i < m_NumPaths && m_pPathList; i++) 00285 { 00286 PathRect = m_pPathList[i].GetBoundingRect(); 00287 00288 if (PathRect.IsValid() && !PathRect.IsEmpty()) 00289 { 00290 dr = dr.Union(PathRect); 00291 } 00292 } 00293 00294 // take the bounding rect from the paths, if they're present 00295 if (Width < 0) 00296 { 00297 if (m_NumPaths != 0) 00298 { 00299 dr = (m_pPathList[m_NumPaths-1].GetBoundingRect()); 00300 } 00301 } 00302 else 00303 { 00304 if (m_NumPaths != 0) 00305 { 00306 dr = (m_pPathList[0].GetBoundingRect()); 00307 } 00308 } 00309 00310 if (!dr.IsValid() || dr.IsEmpty()) 00311 { 00312 dr = ((NodeCompound *)FindParent())->GetInsideBoundingRect(); 00313 00314 // find the centre point 00315 DocCoord Centre = dr.Centre(); 00316 00317 dr.lo.x = Centre.x - 5; 00318 dr.hi.x = Centre.x + 5; 00319 dr.lo.y = Centre.y - 5; 00320 dr.hi.y = Centre.y + 5; 00321 } 00322 00323 // find out the line width and adjust the bounding rectangle appropriately 00324 AttrLineWidth * pAttr = NULL; 00325 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrLineWidth), (NodeAttribute **)(&pAttr)); 00326 00327 AttrStrokeTransp * pStrokeAttr = NULL; 00328 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeTransp), (NodeAttribute **)(&pStrokeAttr)); 00329 00330 AttrStrokeColour * pStrokeColour = NULL; 00331 FindAppliedAttribute(CC_RUNTIME_CLASS(AttrStrokeColour), (NodeAttribute **)(&pStrokeColour)); 00332 00333 BOOL bTransparent = FALSE; 00334 00335 if (pStrokeAttr) 00336 { 00337 if (pStrokeAttr->Value.Transp == 255) 00338 { 00339 bTransparent = TRUE; 00340 } 00341 } 00342 00343 if (pStrokeColour) 00344 { 00345 if (pStrokeColour->Value.Colour == DocColour(COLOUR_NONE)) 00346 { 00347 bTransparent = TRUE; 00348 } 00349 } 00350 00351 if (pAttr && !bTransparent) 00352 { 00353 MILLIPOINT LineWidth = pAttr->Value.LineWidth / 2; 00354 00355 dr.lo.x -= LineWidth; 00356 dr.lo.y -= LineWidth; 00357 dr.hi.x += LineWidth; 00358 dr.hi.y += LineWidth; 00359 } 00360 00361 dr.Union(pController->GetInsideBoundingRect()); 00362 00363 IsBoundingRectValid = TRUE; 00364 BoundingRectangle = dr; 00365 00366 return dr; 00367 }
|
|
Reimplemented from Node. |
|
Reimplemented from Node. Definition at line 160 of file nodecntr.h. 00160 { return TRUE;}
|
|
Reimplemented from Node. Definition at line 179 of file nodecntr.h. 00179 { return TRUE; }
|
|
Does this node need its parent ?
Reimplemented from Node. Definition at line 1105 of file nodecntr.cpp. 01106 { 01107 if (!pClassNode) 01108 return TRUE; 01109 01110 if (pClassNode->IsKindOf(CC_RUNTIME_CLASS(NodeContourController))) 01111 return TRUE; 01112 01113 return FALSE; 01114 }
|
|
Allows the Node to respond to popup menu clicks by adding items to the popup menu if required. It also allows the node to prevent the menu appearing at all! This functions should be overridden in the all the NodeRenderableInk classes so that this verion never gets called. Eg the NodePath class might claim the click if it happened over one of its blobs.
Reimplemented from NodeRenderableInk. |
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeRenderableBounded. |
|
Renders this node.
Reimplemented from Node. Definition at line 410 of file nodecntr.cpp. 00411 { 00412 double Ratio = 0; 00413 double StepSize = 0; 00414 00415 NodeContourController * pControl = (NodeContourController *)FindParent(); 00416 00417 // check we have something to render ! 00418 if (pControl) 00419 { 00420 pControl->DisableInsetPathPathProcessor(); 00421 00422 if (pControl->GetInsideBoundingRect().IsEmpty()) 00423 return; 00424 } 00425 else 00426 return; 00427 00428 if(m_FirstRender) 00429 { 00430 GenerateContour(); 00431 m_FirstRender = FALSE; 00432 } 00433 00434 // get the first path processor 00435 ContourNodePathProcessor * pProc = (ContourNodePathProcessor *)pRender->GetFirstPathProcessor(); 00436 00437 if (pProc) 00438 { 00439 if (!((PathProcessor *)pProc)->IS_KIND_OF(ContourNodePathProcessor)) 00440 pProc = NULL; 00441 } 00442 00443 // do we have anything to render ?? 00444 if (m_NumPaths == 0) 00445 return; 00446 00447 pRender->SaveContext(); 00448 00449 // find out the line width 00450 LineWidthAttribute * pLineWidth = (LineWidthAttribute *)pRender->GetCurrentAttribute(ATTR_LINEWIDTH); 00451 00452 TRACEUSER( "DaivdM", _T("Contour node render 1\n")); 00453 00454 MILLIPOINT LineWidth = 0; 00455 00456 if (pLineWidth) 00457 LineWidth = pLineWidth->LineWidth; 00458 00459 if (m_pPathList != NULL && m_NumPaths > 0) 00460 { 00461 // do the blended attributes map 00462 CCAttrMap BlendAttrMap(30); 00463 00464 // build the attribute maps for the start & end nodes 00465 NodeRenderableInk * pEndNode = NULL; 00466 00467 if (pControl->GetWidth() > 0) 00468 pEndNode = (NodeRenderableInk *)FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk)); 00469 else 00470 pEndNode = (NodeRenderableInk *)FindNext(CC_RUNTIME_CLASS(NodeRenderableInk)); 00471 00472 if (!pEndNode) 00473 return; 00474 00475 if (pEndNode->IsCompound()) 00476 pEndNode = FindNodeToContour(pEndNode); 00477 00478 if (pEndNode->IS_KIND_OF(NodeBlend)) 00479 pEndNode = (NodeRenderableInk *)pEndNode->FindFirstChild(CC_RUNTIME_CLASS(NodeRenderableInk)); 00480 00481 // do the blend of the attributes 00482 CCAttrMap * pAttrMapStart = CCAttrMap::MakeAttrMapFromRenderRegion(pRender); 00483 WindingRuleAttribute * pWinding = NULL; 00484 00485 if(!pAttrMapStart) 00486 { 00487 ENSURE(FALSE,"Not enough mem to create start attr map for rendering NodeContour."); 00488 return; 00489 } 00490 CCAttrMap * pAttrMapEnd = CCAttrMap::MakeAppliedAttrMap(pEndNode); 00491 00492 StepSize = 1.0 / m_NumPaths; 00493 00494 for (INT32 i = m_NumPaths - 1; i >= 0; i--) 00495 { 00496 TRACEUSER( "Diccon", _T("Rendering contour path %d\n"), i); 00497 if (pControl->GetWidth() < 0) 00498 { 00499 // outer contour 00500 TRACEUSER( "DaivdM", _T("Contour node render %d\n"), i); 00501 00502 if (i == m_NumPaths - 1) 00503 { 00504 if (pProc) 00505 pProc->SetActive(FALSE); 00506 00507 pRender->DrawPath(&(m_pPathList[i])); 00508 00509 } 00510 else 00511 { 00512 if (pProc) 00513 pProc->SetActive(TRUE); 00514 00515 Ratio = (StepSize * i) + StepSize; 00516 00517 // calculate the correct ratio given the profile for attributes 00518 CProfileBiasGain Profile = pControl->GetAttrProfile(); 00519 Profile.SetBias(-Profile.GetBias()); 00520 Ratio = (double)Profile.MapZeroToOne((AFp)Ratio); 00521 00522 Ratio = 1.0 - Ratio; 00523 00524 if (!BlendAttributes(pRender, pAttrMapStart, pAttrMapEnd, &BlendAttrMap, 00525 Ratio)) 00526 { 00527 ERROR3("Blend attributes failed"); 00528 00529 // pop the path processor first 00530 pRender->PopPathProcessor(); 00531 return; 00532 00533 } 00534 00535 // Ilan 5/5/00 00536 // Call the PostDynCreateInit functions for the attributes which require this 00537 // NB attrs which don't succeed in init'ing will mark themselves so that they don't NeedToRender() 00538 // ie the AttrMap can safely be rendered - the united attrs simply won't do their job 00539 BlendAttrMap.PostBlendInit(&(m_pPathList[i]), GetRuntimeClass()); 00540 00541 pRender->SaveContext(); 00542 BlendAttrMap.Render(pRender); 00543 00544 // Quality Max(Quality::QualityDefault); 00545 // QualityAttribute * pAttr = new QualityAttribute(Max); 00546 // pRender->SetQuality(pAttr, FALSE); 00547 00548 PathProcessor* pPP = pRender->GetFirstPathProcessor(); 00549 if (pPP && pPP->IsAPathProcessorStroke()) 00550 pPP->SetDisabled(TRUE); 00551 00552 pRender->DrawPath(&(m_pPathList[i])); 00553 00554 if (pPP) 00555 pPP->SetDisabled(FALSE); 00556 00557 pRender->RestoreContext(); 00558 00559 // Ilan 5/5/00 00560 // Deinitialise the attrs which allocated memory in the PostBlendInit() fn call 00561 BlendAttrMap.PostBlendDeinit(); 00562 } 00563 } 00564 else 00565 { 00566 if (pProc) 00567 pProc->SetActive(FALSE); 00568 00569 Ratio = StepSize * i; 00570 00571 // calculate the correct ratio given the profile for attributes 00572 CProfileBiasGain Profile = pControl->GetAttrProfile(); 00573 Profile.SetBias(-Profile.GetBias()); 00574 Ratio = (double)Profile.MapZeroToOne((AFp)Ratio); 00575 00576 if (Ratio > 0 && Ratio < 1.0) 00577 { 00578 if (!BlendAttributes(pRender, pAttrMapStart, pAttrMapEnd, &BlendAttrMap, 00579 Ratio)) 00580 { 00581 ERROR3("Blend attributes failed"); 00582 // pop the path processor first 00583 pRender->PopPathProcessor(); 00584 return; 00585 } 00586 pRender->SaveContext(); 00587 // Ilan 5/5/00 00588 // Call the PostDynCreateInit functions for the attributes which require this 00589 // NB attrs which don't succeed in init'ing will mark themselves so that they don't NeedToRender() 00590 // ie the AttrMap can safely be rendered - the united attrs simply won't do their job 00591 BlendAttrMap.PostBlendInit(&(m_pPathList[(m_NumPaths-1) - i]), GetRuntimeClass()); 00592 00593 BlendAttrMap.Render(pRender); 00594 } 00595 else if (Ratio == 0) 00596 { 00597 pRender->SaveContext(); 00598 pAttrMapStart->Render(pRender); 00599 } 00600 else 00601 { 00602 pRender->SaveContext(); 00603 pAttrMapEnd->Render(pRender); 00604 } 00605 00606 // set the winding rule 00607 pWinding = (WindingRuleAttribute *)pRender->GetCurrentAttribute(ATTR_WINDINGRULE); 00608 00609 pWinding->WindingRule = NegativeWinding; 00610 00611 pRender->DrawPath(&(m_pPathList[(m_NumPaths-1) - i])); 00612 pRender->RestoreContext(); 00613 00614 if (Ratio > 0 && Ratio < 1.0) 00615 { 00616 // Ilan 5/5/00 00617 // Deinitialise the attrs which allocated memory in the PostBlendInit() fn call 00618 BlendAttrMap.PostBlendDeinit(); 00619 } 00620 } 00621 } 00622 00623 pAttrMapStart->DeleteAttributes(); 00624 delete pAttrMapStart; 00625 delete pAttrMapEnd; 00626 00627 BlendAttrMap.DeleteAttributes(); 00628 } 00629 00630 pRender->RestoreContext(); 00631 00632 // pop the path processor 00633 if (pProc) 00634 pRender->PopPathProcessor(); 00635 00636 00637 pControl->EnableInsetPathPathProcessor(); 00638 }
|
|
Each class derived from NodeRenderableInk should write a version of this member function. In most cases it will be the same as the Render() member function but some of the nodes (such as groups) need to perform special actions. The function is for drawing the object while it is being dragged about by the selector tool. It should do this with an effective wysiwyg level of 0 so that the drawing is fast.
Reimplemented from NodeRenderableInk. |
|
This function is the base class version of a blob rendering function, so it actually does nothing. Tiny blobs are displayed by each of the objects that is selected when in bounded region selection mode. Typically a Tiny Blob should be a single small blob.
Reimplemented from NodeRenderable. |
|
This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
Reimplemented from NodeRenderableInk. |
|
|
|
|
|
Base class transform function.
Reimplemented from NodeRenderableBounded. |
|
Tests the reversibility of an Extend operation applied to this node.
Also note that if a node is of a non-extending type, it should normally consider itself a 'valid extender', as doing nothing is completely reversible (it should of course still check its children).
Reimplemented from Node. |
|
Reimplemented from Node. |
|
Writes out a record that represents the node. > virtual BOOL Node::WritePreChildrenWeb(BaseCamelotFilter* pFilter)
If the node writes out a record successfully to the file, it should return TRUE. If the node chooses not to write itself to the filter (e.g. because it is not appropriate for this filter), then this function should return FALSE. If an error occurs, the function should call pFilter->GotError(), and return FALSE. If the node does not want its child nodes to be written automatically, you should make sure you override CanWriteChildrenWeb() so it returns FALSE. (e.g. this node may choose to save its sub tree itself, so it can choose which of its child nodes should be saved out)
Reimplemented from Node. |
|
Definition at line 223 of file nodecntr.h. |
|
Definition at line 221 of file nodecntr.h. |
|
Definition at line 220 of file nodecntr.h. |
|
Definition at line 217 of file nodecntr.h. |