#include <nodeshap.h>
Inheritance diagram for NodeSimpleShape:
Public Member Functions | |
NodeSimpleShape () | |
This constructor creates a NodeSimpleShape linked to no other with all status flags false and an uninitialized bounding rectangle. Note: SetUpPath() must be called before the NodeSimpleShape is in a state in which it can be used. | |
NodeSimpleShape (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE) | |
BOOL | SetUpPath (INT32 RequiredSize=12, INT32 BlockSize=12) |
To initialise the path used by the shape into a state that can be used, by allocating memory, setting up member variables properly. | |
virtual Node * | SimpleCopy () |
Makes a copy of all the data in the node. | |
void | CopyNodeContents (NodeSimpleShape *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. | |
virtual void | PolyCopyNodeContents (NodeRenderable *pNodeCopy) |
Polymorphically copies the contents of this node to another. | |
virtual void | CreateShape (DocRect NewRect) |
Should create a the shape to fit the current parallelogram. This version does nothing as there should always be a derived class version. | |
virtual void | UpdateShape () |
Should update the the shape to the current parallelogram. This version does nothing as there should always be a derived class version. | |
virtual DocRect | GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE) |
if the bounding rect is valid it is returned, if not, it is recalculated and then returned. | |
virtual DocRect | GetBlobBoundingRect () |
This calculates the bounding box of the path and adds in the influence of the selection blobs. It does not consider if the blobs are visible or not, it just gives the bounding box that they would occupy if they were visible. | |
virtual void | Render (RenderRegion *pRender) |
Will render the path contained within the object to the given render region. | |
virtual void | RenderEorDrag (RenderRegion *) |
Renders a version of the path for EORed dragging of shapes. | |
virtual void | RenderObjectBlobs (RenderRegion *pRender) |
Renders the Object blobs for a Node Shape. | |
virtual void | RenderTinyBlobs (RenderRegion *pRender) |
Renders the Tiny blobs for a Node Shape. | |
virtual void | Transform (TransformBase &) |
Transforms the shapes parallelogram and then re-builds the shape to fit it. | |
virtual UINT32 | GetNodeSize () const |
For finding the size of the node. | |
virtual BOOL | CanBecomeA (BecomeA *pBecomeA) |
This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object. | |
virtual BOOL | DoBecomeA (BecomeA *pBecomeA) |
Transforms the object into another type of object. Note: changed 7/10/94 by MarkN to take the pBecomeA param, so that more data could be passed to these functions in the future without causing massive rebuilds due to the editing of node.h. | |
void | GetDebugDetails (StringBase *Str) |
Displays debugging info of the tree For obtaining debug information about the Node. | |
virtual BOOL | OnClick (DocCoord, ClickType, ClickModifiers, Spread *) |
Allows the Node to respond to clicks by selecting its blobs or starting drags etc. This functions should be overridden in the all the NodeRenderableInk classes so that this version never gets called. Eg the NodePath class might claim the click if it happened over one of its unselected blobs. | |
BOOL | IsNearControlHandle (DocCoord Coord, INT32 *CoordNum) |
This function tests to see if the Coord passed in is close to any of the control points in the Ellipse. If it is, the number of the control point is set in CoordNum and TRUE is returned. If not, the value of CoordNum is left unchanged and FALSE is returned. | |
virtual void | HandleBlobDrag (DocCoord &, Spread *, INT32) |
This is the base class version of this function, which does nothing. All the work should be done in the derived classes. These should do as follows. When a drag is started on one of the paths blobs this is called. It tries to fire up an operation that will perform a drag of all the selected points, including all the EORing of the relavent parts of the curve. If it fails it will inform the user and not bother. | |
virtual BOOL | Snap (DocCoord *pDocCoord) |
Snaps to given coord to the nearest point on the path. If it is not appropriate to snap the coord to the path (at the moment this means the coord is too far awawy), then FALSE is returned. | |
virtual BOOL | Snap (DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord) |
Snaps the given rect to the nearest position on the grid, preserving its width and height. The coords of the rect used for the snapping are determined by the PrevCoord and CurCoord coords supplied. This is done to allow the user to control how a selection rectangle is snapped to the grid by the direction of his/her last mouse movement. To force the bottom left hand corner of the rect to be snapped, supply PrevCoord=(0,0) and CurCoord(-1,-1). Scope: public. | |
virtual BOOL | SnapToCoords (DocCoord *pDocCoord) |
This function tries to magnetically snap the supplied coord to the shape. This version of the function tries to snap to coords at the centre of the shape and in the middle of each of the edges. | |
virtual double | GetRotationAngle () |
Returns the current angle of rotation of the simple shape. This is calculated as the angle from the midpoint of the upper paralleogram line to the positive x-axis. | |
virtual BOOL | IsTypeExtendible () const |
virtual DocRect | ValidateExtend (const ExtendParams &ExtParams) |
Tests to see whether this shape's centre-point is positioned so as to make an extend operation irreversible. | |
virtual void | Extend (const ExtendParams &ExtParams) |
Perform an Extend operation on this shape. Behaviour is as follows:. | |
Public Attributes | |
Path | InkPath |
DocCoord | Parallel [4] |
Private Member Functions | |
CC_DECLARE_DYNCREATE (NodeSimpleShape) |
Definition at line 129 of file nodeshap.h.
|
This constructor creates a NodeSimpleShape linked to no other with all status flags false and an uninitialized bounding rectangle. Note: SetUpPath() must be called before the NodeSimpleShape is in a state in which it can be used.
Definition at line 200 of file nodeshap.cpp. 00200 : NodeRenderableInk() 00201 { 00202 }
|
|
|
|
This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.
Also, the entry value of *pNumObjects cannot be assumed to be 0. Reimplemented from Node. Reimplemented in NodeBitmap. Definition at line 828 of file nodeshap.cpp. 00829 { 00830 // The NodeSimpleShape can become a NodePath 00831 if (pBecomeA->BAPath()) 00832 { 00833 pBecomeA->AddCount(1); 00834 00835 return TRUE; 00836 } 00837 00838 return FALSE; 00839 }
|
|
|
|
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 241 of file nodeshap.cpp. 00242 { 00243 NodeRenderableInk::CopyNodeContents(NodeCopy); 00244 00245 //Copy contents specific to derived class here 00246 if (NodeCopy->InkPath.Initialise(InkPath.GetNumCoords(),12)) 00247 { 00248 // Copy the path data 00249 NodeCopy->InkPath.CopyPathDataFrom(&InkPath); 00250 00251 // copy the parralleogram data 00252 NodeCopy->Parallel[0] = Parallel[0]; 00253 NodeCopy->Parallel[1] = Parallel[1]; 00254 NodeCopy->Parallel[2] = Parallel[2]; 00255 NodeCopy->Parallel[3] = Parallel[3]; 00256 } 00257 }
|
|
Should create a the shape to fit the current parallelogram. This version does nothing as there should always be a derived class version.
Reimplemented in NodeEllipse, and NodeRect. Definition at line 425 of file nodeshap.cpp. 00426 { 00427 // You are not supposed to be calling this. You should have called a 00428 // derived classes version of this function 00429 ENSURE(FALSE, "NodeSimpleShape::CreateShape - You called the base class version"); 00430 }
|
|
Transforms the object into another type of object. Note: changed 7/10/94 by MarkN to take the pBecomeA param, so that more data could be passed to these functions in the future without causing massive rebuilds due to the editing of node.h.
Reimplemented from Node. Reimplemented in NodeBitmap. Definition at line 861 of file nodeshap.cpp. 00862 { 00863 // Check for a NULL entry param 00864 ERROR2IF_PF(pBecomeA == NULL,FALSE,("pBecomeA is NULL")); 00865 00866 // This lump checks that the Reason is one that we understand 00867 // It also makes sure that we don't have a NULL UndoOp ptr 00868 BOOL ValidReason = (pBecomeA->GetReason() == BECOMEA_REPLACE || pBecomeA->GetReason() == BECOMEA_PASSBACK); 00869 ERROR2IF_PF(!ValidReason,FALSE,("Unkown BecomeA reason %d",pBecomeA->GetReason())); 00870 00871 // pBecomeA->Reason is one that we understand. 00872 00873 BOOL Success = TRUE; // Our success flag (Important that this defaults to TRUE) 00874 NodePath* pNewNodePath = NULL; // Ptr to a new NodePath, if we get to make one. 00875 00876 if (pBecomeA->BAPath()) 00877 { 00878 // We need to create a new NodePath, no matter what the reason. 00879 00880 // Allocate a new NodePath node 00881 ALLOC_WITH_FAIL(pNewNodePath, (new NodePath), pBecomeA->GetUndoOp()); 00882 Success = (pNewNodePath != NULL); 00883 00884 // Initialise the path 00885 if (Success) CALL_WITH_FAIL(pNewNodePath->InkPath.Initialise(InkPath.GetNumCoords(),12), pBecomeA->GetUndoOp(), Success); 00886 if (Success) CALL_WITH_FAIL(pNewNodePath->InkPath.CopyPathDataFrom(&InkPath), pBecomeA->GetUndoOp(), Success); 00887 00888 // If Success is TRUE, then we now have a new NodePath object that contains this shape's path 00889 00890 if (Success) 00891 { 00892 switch (pBecomeA->GetReason()) 00893 { 00894 case BECOMEA_REPLACE : 00895 { 00896 // It's a BECOMEA_REPLACE, so replace this node with the new NodePath in an undoable way 00897 00898 // Can't do it in an undoable way without an Undo Op 00899 ERROR2IF_PF(pBecomeA->GetUndoOp() == NULL,FALSE,("GetUndoOp() returned NULL")); 00900 00901 // Firstly, hide this node 00902 NodeHidden* pNodeHidden; 00903 Success = pBecomeA->GetUndoOp()->DoHideNode(this, TRUE, &pNodeHidden); 00904 00905 if (Success) 00906 { 00907 // Insert the new NodePath into the tree, next to the hidden node 00908 pNewNodePath->AttachNode(pNodeHidden,NEXT); 00909 00910 // Copy the node's attributes 00911 CALL_WITH_FAIL(CopyChildrenTo(pNewNodePath), pBecomeA->GetUndoOp(), Success); 00912 00913 if (Success) 00914 { 00915 // Set the bounds 00916 pNewNodePath->InvalidateBoundingRect(); 00917 pNewNodePath->SetSelected(IsSelected()); 00918 00919 // Create a hide node action to hide the node when we undo 00920 HideNodeAction* UndoHideNodeAction; 00921 Success = (HideNodeAction::Init(pBecomeA->GetUndoOp(), 00922 pBecomeA->GetUndoOp()->GetUndoActionList(), 00923 pNewNodePath, 00924 TRUE, // Include subtree size 00925 ( Action**)(&UndoHideNodeAction)) 00926 != AC_FAIL); 00927 } 00928 } 00929 00930 if (Success) 00931 pBecomeA->PassBack(pNewNodePath, this); 00932 } 00933 break; 00934 00935 case BECOMEA_PASSBACK : 00936 Success = pBecomeA->PassBack(pNewNodePath,this); 00937 break; 00938 00939 default: 00940 break; 00941 } 00942 } 00943 } 00944 00945 if (!Success) 00946 { 00947 if (pNewNodePath != NULL) 00948 { 00949 // Delete all the NodePath's children (if it has any) and unlink it from the tree (if it's linked) 00950 // This is all done by CascadeDelete() 00951 pNewNodePath->CascadeDelete(); 00952 delete pNewNodePath; 00953 pNewNodePath = NULL; 00954 } 00955 } 00956 00957 return Success; 00958 }
|
|
Perform an Extend operation on this shape. Behaviour is as follows:.
Reimplemented from Node. Definition at line 1179 of file nodeshap.cpp. 01180 { 01181 // do the extension operations on ourself. 01182 TransformStretchObject(ExtParams); 01183 TransformTranslateObject(ExtParams); 01184 01185 // do the base-class implementation to extend our children. 01186 Node::Extend(ExtParams); 01187 }
|
|
This calculates the bounding box of the path and adds in the influence of the selection blobs. It does not consider if the blobs are visible or not, it just gives the bounding box that they would occupy if they were visible.
Reimplemented from NodeRenderable. Reimplemented in NodeEllipse. Definition at line 617 of file nodeshap.cpp. 00618 { 00619 #if !defined(EXCLUDE_FROM_RALPH) 00620 // Find the Shapes bounding rectangle 00621 DocRect Rect = GetBoundingRect(); 00622 00623 // Find the blob manager 00624 BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); 00625 00626 // And if we can find the current view, add on the size of a selection blob 00627 if (pBlobMgr!= NULL) 00628 { 00629 // Wee need to add in each of the blobs. there is a blob on each corner 00630 // of the parallelogram 00631 DocRect BlobSize; 00632 pBlobMgr->GetBlobRect(Parallel[0], &BlobSize); 00633 Rect = Rect.Union(BlobSize); 00634 00635 // Next corner of the parallelogram 00636 pBlobMgr->GetBlobRect(Parallel[1], &BlobSize); 00637 Rect = Rect.Union(BlobSize); 00638 00639 // and the next 00640 pBlobMgr->GetBlobRect(Parallel[2], &BlobSize); 00641 Rect = Rect.Union(BlobSize); 00642 00643 // and the last one 00644 pBlobMgr->GetBlobRect(Parallel[3], &BlobSize); 00645 Rect = Rect.Union(BlobSize); 00646 } 00647 00648 // Make sure we include the Bounds of our children 00649 IncludeChildrensBoundingRects(&Rect); 00650 00651 // return the rectangle with the blobs included 00652 return Rect; 00653 #else 00654 return DocRect(0,0,0,0); 00655 #endif 00656 }
|
|
if the bounding rect is valid it is returned, if not, it is recalculated and then returned.
Reimplemented from NodeRenderableBounded. Definition at line 570 of file nodeshap.cpp. 00571 { 00572 if (!IsBoundingRectValid || DontUseAttrs) 00573 { 00574 // Something to put the new bounding rectangle in 00575 DocRect NewBoundingRect; 00576 00577 // Find out what the paths bounding rect is now 00578 if (!CalculatePathBoundingRect(InkPath, DontUseAttrs, &NewBoundingRect)) 00579 { 00580 // GDraw failed to find out how big the bounding rect 00581 // we will have to make do with the bounding rect of the coords 00582 NewBoundingRect = InkPath.GetBoundingRect(); 00583 } 00584 00585 // we have a new bounding rect - decide what to do with it 00586 if (DontUseAttrs) 00587 { 00588 // but it is not the real bounding rect, so just return it 00589 return NewBoundingRect; 00590 } 00591 00592 // Update the Nodes bounding rectangle 00593 BoundingRectangle = NewBoundingRect; 00594 00595 // Mark the rect as valid 00596 IsBoundingRectValid = TRUE; 00597 } 00598 00599 // return the current state of the bounding rect 00600 return BoundingRectangle; 00601 }
|
|
Displays debugging info of the tree For obtaining debug information about the Node.
Reimplemented from NodeRenderableBounded. Definition at line 315 of file nodeshap.cpp. 00316 { 00317 #ifdef _DEBUG 00318 // Call base class 00319 NodeRenderableInk::GetDebugDetails( Str ); 00320 00321 InkPath.FindStartOfPath(); 00322 String_256 TempStr; 00323 00324 (*Str) += TEXT( "\r\nEllipse Path Data Dump\r\n" ); 00325 00326 TempStr._MakeMsg( TEXT( "Parallelogram :-\r\n\t#1%ld,\t#2%ld\r\n") 00327 TEXT("\t#3%ld,\t#4%ld\r\n") 00328 TEXT("\t#5%ld,\t#6%ld\r\n") 00329 TEXT("\t#7%ld,\t#8%ld\r\n"), 00330 Parallel[0].x, Parallel[0].y, 00331 Parallel[1].x, Parallel[1].y, 00332 Parallel[2].x, Parallel[2].y, 00333 Parallel[3].x, Parallel[3].y ); 00334 (*Str) += TempStr; 00335 00336 DocRect BlobRect = GetBlobBoundingRect(); 00337 TempStr._MakeMsg( TEXT("Blob Bounding Rect :-\r\n\t#1%ld,\t#2%ld\r\n\t#3%ld,\t#4%ld\r\n"), 00338 BlobRect.lo.x, BlobRect.lo.y, BlobRect.hi.x, BlobRect.hi.y ); 00339 (*Str) += TempStr; 00340 00341 if ( InkPath.IsFilled ) 00342 (*Str) += TEXT( "The Path is Filled\r\n" ); 00343 00344 (*Str) += TEXT( "\r\nNum\tType\tX Coord\tY Coord\r\n" ); 00345 PathVerb* Verbs = InkPath.GetVerbArray(); 00346 DocCoord* Coords = InkPath.GetCoordArray(); 00347 // PathFlags* Flags = InkPath.GetFlagArray(); 00348 for (INT32 i=0; i<InkPath.GetNumCoords(); i++) 00349 { 00350 // Add the info to the string 00351 TempStr._MakeMsg( TEXT("#1%d.\t#2%d\t#3%ld,\t#4%ld\r\n"), 00352 i, Verbs[i], Coords[i].x, Coords[i].y ); 00353 (*Str) += TempStr; 00354 } 00355 #endif 00356 }
|
|
For finding the size of the node.
Reimplemented from Node. Reimplemented in NodeAnimatingBitmap, NodeBitmap, NodeEllipse, and NodeRect. Definition at line 673 of file nodeshap.cpp. 00674 { 00675 return (sizeof(NodeSimpleShape)); 00676 }
|
|
Returns the current angle of rotation of the simple shape. This is calculated as the angle from the midpoint of the upper paralleogram line to the positive x-axis.
Reimplemented from NodeRenderableBounded. Definition at line 1104 of file nodeshap.cpp. 01105 { 01106 DocCoord MidPoint((Parallel[0].x + Parallel[1].x)/2, (Parallel[0].y + Parallel[1].y)/2); 01107 01108 DocRect Bounds(Parallel[0],Parallel[0]); 01109 Bounds.IncludePoint(Parallel[1]); 01110 Bounds.IncludePoint(Parallel[2]); 01111 Bounds.IncludePoint(Parallel[3]); 01112 DocCoord Centre((Bounds.LowCorner().x+Bounds.HighCorner().x)/2, 01113 (Bounds.LowCorner().y+Bounds.HighCorner().y)/2); 01114 01115 DocCoord Offset = MidPoint - Centre; 01116 01117 double Angle = atan2((double)Offset.y, (double)Offset.x); 01118 if (Angle == HUGE_VAL) 01119 Angle = 0.0; 01120 01121 return Angle; 01122 }
|
|
This is the base class version of this function, which does nothing. All the work should be done in the derived classes. These should do as follows. When a drag is started on one of the paths blobs this is called. It tries to fire up an operation that will perform a drag of all the selected points, including all the EORing of the relavent parts of the curve. If it fails it will inform the user and not bother.
Reimplemented in NodeEllipse, and NodeRect. Definition at line 798 of file nodeshap.cpp. 00799 { 00800 ENSURE( FALSE, "NodeSimpleShape::HandleBlobDrag() called. Derived class should have been used"); 00801 }
|
|
This function tests to see if the Coord passed in is close to any of the control points in the Ellipse. If it is, the number of the control point is set in CoordNum and TRUE is returned. If not, the value of CoordNum is left unchanged and FALSE is returned.
Definition at line 748 of file nodeshap.cpp. 00749 { 00750 #if !defined(EXCLUDE_FROM_RALPH) 00751 // Find the blob manager 00752 BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); 00753 if (pBlobMgr==NULL) 00754 return FALSE; 00755 00756 // Find out about the size of a blob 00757 DocRect BlobRect; 00758 pBlobMgr->GetBlobRect(Coord, &BlobRect); 00759 00760 // Check to see if it is near any of the blobs 00761 for (INT32 i=0; i<4; i++) 00762 { 00763 // Check for collision with the control points 00764 if (BlobRect.ContainsCoord(Parallel[i])) 00765 { 00766 // Tell them which control point it waas over 00767 *CoordNum = i; 00768 00769 // we have used that click up, so tell the world 00770 return TRUE; 00771 } 00772 } 00773 #endif 00774 // was not over any of the control points 00775 return FALSE; 00776 }
|
|
Reimplemented from Node. Definition at line 205 of file nodeshap.h. 00205 { return TRUE; }
|
|
Allows the Node to respond to clicks by selecting its blobs or starting drags etc. This functions should be overridden in the all the NodeRenderableInk classes so that this version never gets called. Eg the NodePath class might claim the click if it happened over one of its unselected blobs.
Reimplemented from NodeRenderableInk. Reimplemented in NodeBitmap. Definition at line 700 of file nodeshap.cpp. 00702 { 00703 PORTNOTETRACE("other","NodeSimpleShape::OnClick - do nothing"); 00704 00705 #if !defined(EXCLUDE_FROM_RALPH) 00706 // we only handle the click if we can confirm that object blobs are being displayed. 00707 BlobManager* pBlobMgr = GetApplication()->GetBlobManager(); 00708 if (pBlobMgr == NULL) 00709 return FALSE; 00710 if (!pBlobMgr->GetCurrentInterest().Object) 00711 return FALSE; 00712 00713 INT32 ClickCorner; 00714 00715 if (IsNearControlHandle(PointerPos, &ClickCorner)) 00716 { 00717 // The click was over a control point, so start the drag and tell it the opposite corner 00718 if (Click==CLICKTYPE_DRAG) 00719 HandleBlobDrag(Parallel[ClickCorner], pSpread, (ClickCorner+2)%4 ); 00720 00721 // we have used that click up, so tell the world 00722 return TRUE; 00723 } 00724 #endif 00725 // did not use the click 00726 return FALSE; 00727 }
|
|
Polymorphically copies the contents of this node to another.
Reimplemented from NodeRenderableBounded. Reimplemented in NodeAnimatingBitmap, and NodeBitmap. Definition at line 273 of file nodeshap.cpp. 00274 { 00275 ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node"); 00276 ENSURE(IS_A(pNodeCopy, NodeSimpleShape), "PolyCopyNodeContents given wrong dest node type"); 00277 00278 if (IS_A(pNodeCopy, NodeSimpleShape)) 00279 CopyNodeContents((NodeSimpleShape*)pNodeCopy); 00280 }
|
|
Will render the path contained within the object to the given render region.
Reimplemented from Node. Reimplemented in NodeBitmap. Definition at line 465 of file nodeshap.cpp.
|
|
Renders a version of the path for EORed dragging of shapes.
Reimplemented from NodeRenderableInk. Definition at line 485 of file nodeshap.cpp. 00486 { 00487 // Render an EORed version of the shape. For a simple object such 00488 // as this we can render it as normal 00489 pRender->DrawPath(&InkPath); 00490 }
|
|
Renders the Object blobs for a Node Shape.
Reimplemented from NodeRenderable. Definition at line 507 of file nodeshap.cpp. 00508 { 00509 #if !defined(EXCLUDE_FROM_RALPH) 00510 // Set the line colours etc as we need them 00511 pRender->SetLineColour(COLOUR_NONE); 00512 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 00513 00514 // Render the blobs on the path 00515 pRender->DrawBlob(Parallel[0], BT_UNSELECTED); 00516 pRender->DrawBlob(Parallel[1], BT_UNSELECTED); 00517 pRender->DrawBlob(Parallel[2], BT_UNSELECTED); 00518 pRender->DrawBlob(Parallel[3], BT_UNSELECTED); 00519 #endif 00520 }
|
|
Renders the Tiny blobs for a Node Shape.
Reimplemented from NodeRenderable. Definition at line 536 of file nodeshap.cpp. 00537 { 00538 #if !defined(EXCLUDE_FROM_RALPH) 00539 // Set the line colours etc as we need them 00540 pRender->SetLineColour(COLOUR_NONE); 00541 pRender->SetFillColour(COLOUR_UNSELECTEDBLOB); 00542 00543 // Find out about the path that the shape is made from 00544 DocCoord* Coords = InkPath.GetCoordArray(); 00545 00546 // Render the blobs on the path 00547 if (InkPath.GetNumCoords()>0) 00548 pRender->DrawBlob(Coords[0], BT_UNSELECTED); 00549 #endif 00550 }
|
|
To initialise the path used by the shape into a state that can be used, by allocating memory, setting up member variables properly.
Definition at line 376 of file nodeshap.cpp. 00377 { 00378 return (InkPath.Initialise(RequiredSize, BlockSize)); 00379 }
|
|
Makes a copy of all the data in the node.
Reimplemented from NodeRenderableInk. Reimplemented in NodeAnimatingBitmap, NodeBitmap, NodeEllipse, and NodeRect. Definition at line 215 of file nodeshap.cpp. 00216 { 00217 // Make a new NodeSimpleShape and then copy things into it 00218 TRACE( _T("NodeSimpleShape::SimpleCopy() - Should not be called\n")); 00219 NodeSimpleShape* NodeCopy = new NodeSimpleShape(); 00220 if (NodeCopy) 00221 CopyNodeContents(NodeCopy); 00222 00223 return NodeCopy; 00224 }
|
|
Snaps the given rect to the nearest position on the grid, preserving its width and height. The coords of the rect used for the snapping are determined by the PrevCoord and CurCoord coords supplied. This is done to allow the user to control how a selection rectangle is snapped to the grid by the direction of his/her last mouse movement. To force the bottom left hand corner of the rect to be snapped, supply PrevCoord=(0,0) and CurCoord(-1,-1). Scope: public.
Reimplemented from NodeRenderableBounded. Definition at line 1029 of file nodeshap.cpp. 01030 { 01031 #if !defined(EXCLUDE_FROM_RALPH) 01032 TRACEUSER( "MarkN", _T("NodeSimpleShape::Snap(DocRect)\n") ); 01033 #endif 01034 return FALSE; 01035 }
|
|
Snaps to given coord to the nearest point on the path. If it is not appropriate to snap the coord to the path (at the moment this means the coord is too far awawy), then FALSE is returned.
Reimplemented from NodeRenderableBounded. Definition at line 980 of file nodeshap.cpp. 00981 { 00982 #if !defined(EXCLUDE_FROM_RALPH) 00983 BOOL Snapped = FALSE; 00984 00985 MILLIPOINT SnapDist = CSnap::GetSnapDist(); 00986 MILLIPOINT SqrSnapDist = SnapDist*SnapDist; 00987 00988 INT32 NearEl; 00989 double mu; 00990 double SqrDist = InkPath.SqrDistanceToPoint(*pDocCoord,&NearEl,&mu); 00991 00992 if (SqrDist <= SqrSnapDist) 00993 { 00994 *pDocCoord = InkPath.ClosestPointTo(mu,NearEl); 00995 Snapped = TRUE; 00996 } 00997 00998 return (Snapped); 00999 #else 01000 return FALSE; 01001 #endif 01002 }
|
|
This function tries to magnetically snap the supplied coord to the shape. This version of the function tries to snap to coords at the centre of the shape and in the middle of each of the edges.
Reimplemented from NodeRenderableBounded. Reimplemented in NodeRect. Definition at line 1055 of file nodeshap.cpp. 01056 { 01057 #if !defined(EXCLUDE_FROM_RALPH) 01058 // Work out the coords to snap to 01059 DocCoord TestPoint; 01060 01061 // Snap to the Centre of the Shape 01062 TestPoint.x = (Parallel[0].x + Parallel[2].x) / 2; 01063 TestPoint.y = (Parallel[0].y + Parallel[2].y) / 2; 01064 01065 // Test to see if the points are close together, and update pDocCoord if they are 01066 if (IsMagneticallyClose(&TestPoint, pDocCoord)) 01067 return TRUE; 01068 01069 // Try and snap to the middle of each of the edges 01070 for (INT32 i=0; i<4; i++) 01071 { 01072 // Find test coord 01073 INT32 NextPoint = (i+1) % 4; 01074 TestPoint.x = (Parallel[i].x + Parallel[NextPoint].x) / 2; 01075 TestPoint.y = (Parallel[i].y + Parallel[NextPoint].y) / 2; 01076 01077 // Test to see if the points are close together, and update pDocCoord if they are 01078 if (IsMagneticallyClose(&TestPoint, pDocCoord)) 01079 return TRUE; 01080 } 01081 #endif 01082 // Did not snap to anything. 01083 return FALSE; 01084 }
|
|
Transforms the shapes parallelogram and then re-builds the shape to fit it.
Reimplemented from NodeRenderableBounded. Definition at line 395 of file nodeshap.cpp. 00396 { 00397 // Transform the Shape 00398 Trans.Transform((DocCoord*)Parallel, 4); 00399 00400 // re-create the path and update its bounding rectangle 00401 UpdateShape(); 00402 00403 // Mark the bounding rect as invalid 00404 InvalidateBoundingRect(); 00405 00406 // Transform all the children... 00407 TransformChildren(Trans); 00408 }
|
|
Should update the the shape to the current parallelogram. This version does nothing as there should always be a derived class version.
Reimplemented in NodeEllipse, and NodeRect. Definition at line 444 of file nodeshap.cpp. 00445 { 00446 // You are not supposed to be calling this. You should have called a 00447 // derived classes version of this function 00448 ENSURE(FALSE, "NodeSimpleShape::UpdateShape - You called the base class version"); 00449 }
|
|
Tests to see whether this shape's centre-point is positioned so as to make an extend operation irreversible.
Reimplemented from Node. Definition at line 1142 of file nodeshap.cpp. 01143 { 01144 DocCoord doccArray[1] = { FindExtendCentre() }; 01145 DocRect drMinExtend = Extender::ValidateControlPoints(1, doccArray, ExtParams); 01146 01147 // if we didn't invalidate the extension, we must call the base class 01148 // implementation, which will validate our children. 01149 if (drMinExtend.lo.x == INT32_MAX && 01150 drMinExtend.lo.y == INT32_MAX && 01151 drMinExtend.hi.x == INT32_MAX && 01152 drMinExtend.hi.y == INT32_MAX) 01153 drMinExtend = Node::ValidateExtend(ExtParams); 01154 01155 return drMinExtend; 01156 }
|
|
Definition at line 211 of file nodeshap.h. |
|
Definition at line 212 of file nodeshap.h. |