PathRecordHandler Class Reference

Handles the reading of all fill attribute records in the v2 file format. More...

#include <rechpath.h>

Inheritance diagram for PathRecordHandler:

CamelotRecordHandler CXaraFileRecordHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PathRecordHandler ()
 ~PathRecordHandler ()
virtual UINT32GetTagList ()
 Default constructor Informs the handler that the filter's about to start importing Provides the record handler system with a list of records handled by this handler.
virtual BOOL HandleRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the given record.

Private Member Functions

 CC_DECLARE_DYNAMIC (PathRecordHandler)
BOOL HandlePathRecord (CXaraFileRecord *pCXaraFileRecord, BOOL Filled, BOOL Stroked)
 Handles the given record. The record has to be a path record.
BOOL HandlePathRelativeRecord (CXaraFileRecord *pCXaraFileRecord, BOOL Filled, BOOL Stroked)
 Handles the given record. The record has to be a path relative record.
BOOL HandlePathRefRecord (CXaraFileRecord *pCXaraFileRecord)
 Handles the given record. The record has to be a path reference record.

Detailed Description

Handles the reading of all fill attribute records in the v2 file format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
See also:
-

Definition at line 119 of file rechpath.h.


Constructor & Destructor Documentation

PathRecordHandler::PathRecordHandler  )  [inline]
 

Definition at line 125 of file rechpath.h.

00125 {}

PathRecordHandler::~PathRecordHandler  )  [inline]
 

Definition at line 126 of file rechpath.h.

00126 {}


Member Function Documentation

PathRecordHandler::CC_DECLARE_DYNAMIC PathRecordHandler   )  [private]
 

UINT32 * PathRecordHandler::GetTagList  )  [virtual]
 

Default constructor Informs the handler that the filter's about to start importing Provides the record handler system with a list of records handled by this handler.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
- [INPUTS]
Returns:
Ptr to a list of tag values, terminated by CXFRH_TAG_LIST_END
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 3131 of file nodepath.cpp.

03132 {
03133     static UINT32 TagList[] = { TAG_PATH,
03134                                 TAG_PATH_FILLED,
03135                                 TAG_PATH_STROKED,
03136                                 TAG_PATH_FILLED_STROKED,
03137                                 TAG_PATH_RELATIVE,
03138                                 TAG_PATH_RELATIVE_FILLED,
03139                                 TAG_PATH_RELATIVE_STROKED,
03140                                 TAG_PATH_RELATIVE_FILLED_STROKED,
03141 //                              TAG_PATH_FLAGS,
03142                                 TAG_PATHREF_IDENTICAL,
03143                                 TAG_PATHREF_TRANSFORM,
03144                                 CXFRH_TAG_LIST_END};
03145 
03146     return (UINT32*)&TagList;
03147 }

BOOL PathRecordHandler::HandlePathRecord CXaraFileRecord pCXaraFileRecord,
BOOL  Filled,
BOOL  Stroked
[private]
 

Handles the given record. The record has to be a path record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS] Filled = TRUE if the path should be filled Stroked= TRUE if the path should be stroked
Returns:
TRUE if handled successfuly FALSE otherwise
See also:
-

Definition at line 3213 of file nodepath.cpp.

03214 {
03215     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
03216     ERROR3IF(!IsTagInList(pCXaraFileRecord->GetTag()),"I don't handle this tag type");
03217 
03218     BOOL ok = FALSE;
03219 
03220     NodePath* pNodePath = new NodePath;
03221 
03222     if (pNodePath != NULL && pNodePath->SetUpPath())
03223     {
03224         ok = pCXaraFileRecord->ReadPath(&pNodePath->InkPath); 
03225 
03226         if (ok)
03227         {
03228             pNodePath->InkPath.IsFilled = Filled;   // Set the filled flag
03229             pNodePath->InkPath.IsStroked= Stroked;  // Set the stroked flag
03230             pNodePath->InkPath.InitialiseFlags();   // Init the path flags array to something sensible
03231         }
03232     }
03233             
03234     if (ok) ok = InsertNode(pNodePath);
03235     if (ok) SetLastNodePathInserted(pNodePath);
03236 
03237     if (ok) AddPathRecordRefToList(pNodePath,pCXaraFileRecord->GetRecordNumber());
03238 
03239     return ok;
03240 }

BOOL PathRecordHandler::HandlePathRefRecord CXaraFileRecord pCXaraFileRecord  )  [private]
 

Handles the given record. The record has to be a path reference record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/9/96
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS]
Returns:
TRUE if handled successfuly FALSE otherwise
See also:
-

Definition at line 3303 of file nodepath.cpp.

03304 {
03305     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
03306 
03307     ERROR3IF(pCXaraFileRecord->GetTag() != TAG_PATHREF_TRANSFORM,"I don't handle this tag type");
03308 
03309     BOOL ok = TRUE;
03310 
03311     UINT32  SrcRecNum;
03312     Matrix  Transform;
03313 
03314     if (ok) ok = pCXaraFileRecord->ReadUINT32(&SrcRecNum);
03315     if (ok) ok = pCXaraFileRecord->ReadMatrixTrans(&Transform,0,0);
03316 
03317     if (ok)
03318     {    
03319         ok = FALSE; // Default to fail state
03320 
03321         NodePath* pSrcPath = FindPathRecordRefPath(SrcRecNum);
03322         if (pSrcPath != NULL)
03323         {
03324             NodePath* pNodePath = new NodePath;
03325             if (pNodePath != NULL && pNodePath->SetUpPath())
03326             {
03327                 if (pNodePath->InkPath.MergeTwoPaths(pSrcPath->InkPath))
03328                 {
03329                     pNodePath->InkPath.IsFilled = pSrcPath->InkPath.IsFilled;
03330                     pNodePath->InkPath.IsStroked= pSrcPath->InkPath.IsStroked;
03331 
03332                     // See note in BaseCamelotFilter::FindSimilarPath() for an explaination of why we need 
03333                     // to translate the path before transforming it.
03334 
03335                     // Translate the source path so that it has the same coords as that stored in the file
03336                     DocCoord Origin = GetCoordOrigin();
03337                     {
03338                         Matrix          TranslateMat(-Origin.x,-Origin.y);
03339                         Trans2DMatrix   Translate(TranslateMat);
03340                         pNodePath->Transform(Translate);
03341                     }
03342 
03343                     // Transform the path with the read in matrix
03344                     Trans2DMatrix Trans(Transform);
03345                     pNodePath->Transform(Trans);
03346 
03347                     // Translate the source path back to it's origin position
03348                     {
03349                         Matrix          TranslateMat(Origin.x,Origin.y);
03350                         Trans2DMatrix   Translate(TranslateMat);
03351                         pNodePath->Transform(Translate);
03352                     }
03353 
03354                     ok = InsertNode(pNodePath);
03355                     if (ok) SetLastNodePathInserted(pNodePath);
03356                 }
03357             }
03358         }
03359     }
03360 
03361     return ok;
03362 }

BOOL PathRecordHandler::HandlePathRelativeRecord CXaraFileRecord pCXaraFileRecord,
BOOL  Filled,
BOOL  Stroked
[private]
 

Handles the given record. The record has to be a path relative record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/8/96
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS] Filled = TRUE if the path should be filled Stroked= TRUE if the path should be stroked
Returns:
TRUE if handled successfuly FALSE otherwise
See also:
-

Definition at line 3259 of file nodepath.cpp.

03260 {
03261     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
03262     ERROR3IF(!IsTagInList(pCXaraFileRecord->GetTag()),"I don't handle this tag type");
03263 
03264     BOOL ok = FALSE;
03265 
03266     NodePath* pNodePath = new NodePath;
03267 
03268     if (pNodePath != NULL && pNodePath->SetUpPath())
03269     {
03270         ok = pCXaraFileRecord->ReadPathRelative(&pNodePath->InkPath); 
03271 
03272         if (ok)
03273         {
03274             pNodePath->InkPath.IsFilled = Filled;   // Set the filled flag
03275             pNodePath->InkPath.IsStroked= Stroked;  // Set the stroked flag
03276             pNodePath->InkPath.InitialiseFlags();   // Init the path flags array to something sensible
03277         }
03278     }
03279             
03280     if (ok) ok = InsertNode(pNodePath);
03281     if (ok) SetLastNodePathInserted(pNodePath);
03282 
03283     if (ok) AddPathRecordRefToList(pNodePath,pCXaraFileRecord->GetRecordNumber());
03284 
03285     return ok;
03286 }

BOOL PathRecordHandler::HandleRecord CXaraFileRecord pCXaraFileRecord  )  [virtual]
 

Handles the given record.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
pCXaraFileRecord = ptr to record to handle [INPUTS]
Returns:
TRUE if handled successfuly FALSE otherwise
See also:
-

Implements CXaraFileRecordHandler.

Definition at line 3163 of file nodepath.cpp.

03164 {
03165     ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL");
03166     
03167     BOOL ok = TRUE;
03168 
03169     switch (pCXaraFileRecord->GetTag())
03170     {
03171         case TAG_PATH:                          ok = HandlePathRecord(pCXaraFileRecord,FALSE,FALSE);break;
03172         case TAG_PATH_FILLED:                   ok = HandlePathRecord(pCXaraFileRecord,TRUE,FALSE); break;
03173         case TAG_PATH_STROKED:                  ok = HandlePathRecord(pCXaraFileRecord,FALSE,TRUE); break;
03174         case TAG_PATH_FILLED_STROKED:           ok = HandlePathRecord(pCXaraFileRecord,TRUE,TRUE);  break;
03175 
03176         case TAG_PATH_RELATIVE:                 ok = HandlePathRelativeRecord(pCXaraFileRecord,FALSE,FALSE);break;
03177         case TAG_PATH_RELATIVE_FILLED:          ok = HandlePathRelativeRecord(pCXaraFileRecord,TRUE,FALSE); break;
03178         case TAG_PATH_RELATIVE_STROKED:         ok = HandlePathRelativeRecord(pCXaraFileRecord,FALSE,TRUE); break;
03179         case TAG_PATH_RELATIVE_FILLED_STROKED:  ok = HandlePathRelativeRecord(pCXaraFileRecord,TRUE,TRUE);  break;
03180 
03181 //      case TAG_PATH_FLAGS:                    ok = HandlePathFlagsRecord(pCXaraFileRecord,GetLastInsertedPath()); break;
03182 
03183         case TAG_PATHREF_IDENTICAL:
03184         case TAG_PATHREF_TRANSFORM:             ok = HandlePathRefRecord(pCXaraFileRecord);     break;
03185 
03186         default:
03187             ok = FALSE;
03188             ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag()));
03189             break;
03190     }
03191 
03192     return ok;
03193 }


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