MouldEnvelope2x2 Class Reference

Another envelope mould. Provides control over a coons patch shape made from 2x2 4 connected 3rd order bezier splines. More...

#include <moldenv.h>

Inheritance diagram for MouldEnvelope2x2:

MouldEnvelopeBase MouldGeometry CCObject SimpleCCObject List of all members.

Public Member Functions

 MouldEnvelope2x2 ()
 Envelope mould constructor.
 ~MouldEnvelope2x2 ()
 Envelope2x2 mould destructor.
virtual BOOL Initialise ()
 Initialise a mould envelope to contain the correct geometry.
virtual BOOL Validate (Path *const pPath, UINT32 &errorID)
 This function checks whether the path given is suitabile for use as an envelope manifold. Valid paths at present are any set of 5 path elements starting with a moveto followed by line or bezier elements.
virtual BOOL Define (Path *const pPath, DocRect *const pRect)
 This function sets the low level envelope state ready for calls to various envelope path generation functions. It serves simply as a way of informing the low level enveloper of the shape of the current envelope.
virtual BOOL MakeValidFrom (Path **Out, Path *In, INT32 *CornersHint=0)
 creates a valid moulding path from an non-invalid path.
virtual MouldSpace Describe ()
virtual void Transform (Path *const pPath, DocRect *const pRect, TransformBase &Trans)
 Make sure the envelope mould data is transformed correctly. Note, all we need do here is redefine the low level envelope by calling Define() again with the current NodePath shape. We are ofcourse assuming that the child node path has already been transformed and so is correct. This is the case for NodeMould.Transform() which calls this function. It ensures all children are transformed first before it calls us passing in the transformed path itself.
virtual ChangeCode RecordContext (UndoableOperation *)
 Record our context on the undo. In this overridden function we simply create an action to perform the undo/redo of our envelope shape.
virtual UINT32 GetByteSize () const
virtual MouldGeometryMakeCopy ()
 Make a copy of this mould envelope object and return it.

Static Public Member Functions

static BOOL WillBeValid (POINT *P)
 Check whether the point array suited for use as a manifold.

Protected Member Functions

BOOL CopyContents (MouldEnvelope2x2 *pGeom)
 Make a copy of this mouldenvelope class private data.

Private Member Functions

 CC_DECLARE_DYNAMIC (MouldEnvelope2x2)

Private Attributes

const INT32 EnvNumCoords

Detailed Description

Another envelope mould. Provides control over a coons patch shape made from 2x2 4 connected 3rd order bezier splines.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95

Definition at line 229 of file moldenv.h.


Constructor & Destructor Documentation

MouldEnvelope2x2::MouldEnvelope2x2  ) 
 

Envelope mould constructor.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/94
Parameters:
[INPUTS] 

Definition at line 1495 of file moldenv.cpp.

01495                                    : EnvNumCoords(ENV_NUMCOORDS2X2)
01496 {
01497 }

MouldEnvelope2x2::~MouldEnvelope2x2  ) 
 

Envelope2x2 mould destructor.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/94
Parameters:
[INPUTS] 

Definition at line 1510 of file moldenv.cpp.

01511 {
01512 }


Member Function Documentation

MouldEnvelope2x2::CC_DECLARE_DYNAMIC MouldEnvelope2x2   )  [private]
 

BOOL MouldEnvelope2x2::CopyContents MouldEnvelope2x2 pCopyEnvelope  )  [protected]
 

Make a copy of this mouldenvelope class private data.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/01/95
Parameters:
pEnvelope = a pointer to a copy of a mould envelope. [INPUTS]
[OUTPUTS] 
Returns:
TRUE if the data has been copied correctly FALSE if failed

Definition at line 1758 of file moldenv.cpp.

01759 {
01760     ERROR3IF(pCopyEnvelope==NULL, "MouldEnvelope::CopyContents() passed a null pointer");
01761     // ask the base class to copy its bits first
01762     if (!MouldGeometry::CopyContents(pCopyEnvelope))
01763         return FALSE;
01764 
01765     // now lets copy data about ourselves
01766     POINT* TempArray = new POINT[EnvNumCoords];
01767     if (TempArray==NULL)
01768         return FALSE;
01769 
01770     RECT TempRect = pEnvelope->GetSourceBBox();
01771     DocRect Rect = ConvRectToDocRect(TempRect);
01772     pEnvelope->CopyShape(TempArray);
01773 
01774     // define this shape with the details
01775     BOOL ok = (pCopyEnvelope->BuildShape(TempArray, &Rect));
01776 
01777     delete [] TempArray;
01778     return ok;
01779 }

BOOL MouldEnvelope2x2::Define Path *const   pPath,
DocRect *const   pOrigBBox
[virtual]
 

This function sets the low level envelope state ready for calls to various envelope path generation functions. It serves simply as a way of informing the low level enveloper of the shape of the current envelope.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/94
Parameters:
pPath = the path to use for enveloping [INPUTS] pOrigBBox = a pointer to the bounding box of the objects to be enveloped = NULL then the old bounding box will be assumed. returns: TRUE - then SetUp has succeded FALSE - then setup has failed to initialise itself

Reimplemented from MouldGeometry.

Definition at line 1643 of file moldenv.cpp.

01644 {
01645     ERROR2IF(pPath==NULL,FALSE,"MouldEnvelope2x2::Define() called with NULL path");
01646     return MouldEnvelopeBase::Define(pPath,pOrigBBox,EnvNumCoords);
01647 }

virtual MouldSpace MouldEnvelope2x2::Describe  )  [inline, virtual]
 

Reimplemented from MouldGeometry.

Definition at line 242 of file moldenv.h.

00242 {return MOULDSPACE_ENVELOPE2X2;}

virtual UINT32 MouldEnvelope2x2::GetByteSize  )  const [inline, virtual]
 

Reimplemented from MouldGeometry.

Definition at line 246 of file moldenv.h.

00246 { return sizeof(MouldEnvelope2x2); };

BOOL MouldEnvelope2x2::Initialise  )  [virtual]
 

Initialise a mould envelope to contain the correct geometry.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/94
Parameters:
[INPUTS] 

Definition at line 1526 of file moldenv.cpp.

01527 {
01528     ERROR3IF(MouldEnvelopeBase::pEnvelope!=NULL, "MouldEnvelope2x2::Initialise() - pEnvelope not NULL!");
01529     GEnvelope2x2* pGEnvelope = new GEnvelope2x2;
01530     if (pGEnvelope==NULL)
01531         return FALSE;
01532     MouldEnvelopeBase::pEnvelope = pGEnvelope;
01533     return TRUE;
01534 }

MouldGeometry * MouldEnvelope2x2::MakeCopy  )  [virtual]
 

Make a copy of this mould envelope object and return it.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/01/95
Parameters:
- [INPUTS]
a pointer to a new mould envelope object. [OUTPUTS] NULL if unable to create the object.

Reimplemented from MouldGeometry.

Definition at line 1721 of file moldenv.cpp.

01722 {
01723     // create a new Geometry
01724     MouldEnvelope2x2* pGeometry = new MouldEnvelope2x2;
01725     if (pGeometry == NULL)
01726         return NULL;
01727 
01728     if (!pGeometry->Initialise())
01729     {
01730         delete pGeometry;
01731         return NULL;
01732     }
01733 
01734     if (!CopyContents(pGeometry))
01735     {
01736         delete pGeometry;
01737         return NULL;
01738     }
01739 
01740     return ((MouldGeometry*)pGeometry);
01741 }

BOOL MouldEnvelope2x2::MakeValidFrom Path **  Out,
Path In,
INT32 *  CornersHint = 0
[virtual]
 

creates a valid moulding path from an non-invalid path.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/05/95
Parameters:
Out = variable to output the new Path in. In = path to create a valid one from. [INPUTS]
Returns:
whether it managed to create one or not

Reimplemented from MouldGeometry.

Definition at line 1620 of file moldenv.cpp.

01621 {
01622     return FALSE;
01623 }

ChangeCode MouldEnvelope2x2::RecordContext UndoableOperation pOp  )  [virtual]
 

Record our context on the undo. In this overridden function we simply create an action to perform the undo/redo of our envelope shape.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/01/95
Parameters:
pOp = pointer to a running undoable operation [INPUTS]
- [OUTPUTS]

Reimplemented from MouldGeometry.

Definition at line 1689 of file moldenv.cpp.

01690 {
01691     if (pOp!=NULL)
01692     {
01693         RecordEnvelopeAction* EnvAction;
01694         ActionCode Act;
01695 
01696         // call the actions static init function to get the action going.
01697         Act = RecordEnvelopeAction::Init(pOp, pOp->GetUndoActionList(), this, (Action**)(&EnvAction));
01698 
01699         if (Act == AC_FAIL)
01700             return CC_FAIL;
01701         if (Act == AC_NORECORD)
01702             return CC_NORECORD;
01703     }
01704     return CC_OK;
01705 }

void MouldEnvelope2x2::Transform Path *const   pPath,
DocRect *const   pRect,
TransformBase Trans
[virtual]
 

Make sure the envelope mould data is transformed correctly. Note, all we need do here is redefine the low level envelope by calling Define() again with the current NodePath shape. We are ofcourse assuming that the child node path has already been transformed and so is correct. This is the case for NodeMould.Transform() which calls this function. It ensures all children are transformed first before it calls us passing in the transformed path itself.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/01/95
Parameters:
pMould = A pointer to the node mould object associated with this envelope [INPUTS] Trans = A transformation object

Reimplemented from MouldGeometry.

Definition at line 1667 of file moldenv.cpp.

01668 {
01669     ERROR3IF(pPath==NULL,"MouldEnvelope2x2::Transform() passed a NULL path shape");
01670     Define(pPath,pRect);    
01671 }

BOOL MouldEnvelope2x2::Validate Path *const   pPath,
UINT32 errorID
[virtual]
 

This function checks whether the path given is suitabile for use as an envelope manifold. Valid paths at present are any set of 5 path elements starting with a moveto followed by line or bezier elements.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/02/95
Parameters:
pPath = the path to use for enveloping [INPUTS]
errorID = an id of an error string reporting the problem when failed. [OUTPUTS]
Returns:
TRUE - then the path can be used as an envelope FALSE - then the path is not suitable for use as an envelope

Reimplemented from MouldGeometry.

Definition at line 1553 of file moldenv.cpp.

01554 {
01555     // check for a reasonable number of coordinates
01556     INT32 numc=pPath->GetNumCoords();
01557     if ((numc<5) || numc>(EnvNumCoords+1)) 
01558     {
01559         errorID = _R(IDE_ENV_NUMCOORDERR);
01560         return FALSE;
01561     }
01562 
01563     if (!ValidMouldingPath(numc, 8, pPath, errorID))
01564         return FALSE;
01565 
01566     // Make sure there's no folds either
01567     POINT* p = (POINT*)pPath->GetCoordArray();
01568     if (!WillBeValid(p))
01569     {
01570         errorID = _R(IDE_ENV_NOWIDTHHEIGHT);
01571         return FALSE;
01572     }
01573 
01574     // Ok, now if necessary do a pseudo conversion
01575     if (numc<(EnvNumCoords+1))
01576     {
01577         if (!ConvertShape(EnvNumCoords,NULL,pPath,numc))
01578         {
01579             errorID = _R(IDE_ENV_NUMCOORDERR);
01580             return FALSE;
01581         }
01582     }
01583 
01584     // All is well
01585     return TRUE;
01586 }

BOOL MouldEnvelope2x2::WillBeValid POINT P  )  [static]
 

Check whether the point array suited for use as a manifold.

static BOOL MouldEnvelope2x2::WillBeValid(POINT* P)

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
P a pointer to a POINT array of coordinates [INPUTS]
Returns:
TRUE if the point set is valid

Definition at line 1602 of file moldenv.cpp.

01603 {
01604     return MouldEnvelopeBase::WillBeValid(ENV_NUMCOORDS2X2, P);
01605 }


Member Data Documentation

const INT32 MouldEnvelope2x2::EnvNumCoords [private]
 

Definition at line 258 of file moldenv.h.


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