#include <rechrshp.h>
Inheritance diagram for RegularShapeRecordHandler:
Public Member Functions | |
RegularShapeRecordHandler () | |
~RegularShapeRecordHandler () | |
UINT32 * | GetTagList () |
Returns an array of records handled by this class. See Also: <???>. | |
BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Reads a regular shape record from a CXaraFile. | |
Protected Member Functions | |
virtual BOOL | ReadShapeInvalid (CXaraFileRecord *pCXaraFileRecord) |
Called when this class is asked to read a record it doesn't know about. We raise an ERROR3 and return FALSE. | |
BOOL | SetupShape (NodeRegularShape *pShape) |
Functions to set various pieces of information in a regular shape. | |
BOOL | InvalidateCache (NodeRegularShape *pShape) |
BOOL | SetCentrePoint (NodeRegularShape *pShape, const DocCoord &CentrePoint) |
BOOL | SetUTCentrePoint (NodeRegularShape *pShape, const DocCoord &UTCentrePoint) |
BOOL | SetMajorAxis (NodeRegularShape *pShape, const DocCoord &MajorAxis) |
BOOL | SetMinorAxis (NodeRegularShape *pShape, const DocCoord &MinorAxis) |
BOOL | SetHeightAndWidth (NodeRegularShape *pShape, const INT32 &Height, const INT32 &Width) |
BOOL | SetNumberOfSides (NodeRegularShape *pShape, const INT32 &NumSides) |
BOOL | SetCurvature (NodeRegularShape *pShape, const double &Curvature) |
BOOL | SetPrimaryCurvature (NodeRegularShape *pShape, const double &PrimaryCurvature) |
BOOL | SetSecondaryCurvature (NodeRegularShape *pShape, const double &SecondaryCurvature) |
BOOL | SetStellationRadius (NodeRegularShape *pShape, const double &StellationRadius) |
BOOL | SetStellationOffset (NodeRegularShape *pShape, const double &StellationOffset) |
BOOL | SetTransformMatrix (NodeRegularShape *pShape, const Matrix &NewMatrix) |
BOOL | SetIsCircular (NodeRegularShape *pShape, const BOOL &IsCircular) |
BOOL | SetIsStellated (NodeRegularShape *pShape, const BOOL &IsStellated) |
BOOL | SetIsRounded (NodeRegularShape *pShape, const BOOL &Value) |
BOOL | SetFlags (NodeRegularShape *pShape, const BYTE &Value) |
Sets various flags in node regular shapes. | |
Private Member Functions | |
CC_DECLARE_DYNAMIC (RegularShapeRecordHandler) | |
BOOL | ReadShapeGeneralPhase1 (CXaraFileRecord *pCXaraFileRecord) |
<???> | |
BOOL | ReadShapeGeneralPhase2 (CXaraFileRecord *pCXaraFileRecord) |
Definition at line 124 of file rechrshp.h.
|
Definition at line 130 of file rechrshp.h.
|
|
Definition at line 131 of file rechrshp.h.
|
|
|
|
Returns an array of records handled by this class. See Also: <???>.
Implements CXaraFileRecordHandler. Reimplemented in EllipseRecordHandler, PolygonRecordHandler, and RectangleRecordHandler. Definition at line 135 of file rechrshp.cpp. 00136 { 00137 static UINT32 TagList[] = {TAG_REGULAR_SHAPE_PHASE_1, 00138 TAG_REGULAR_SHAPE_PHASE_2, 00139 CXFRH_TAG_LIST_END}; 00140 return &TagList[0]; 00141 }
|
|
Reads a regular shape record from a CXaraFile.
Implements CXaraFileRecordHandler. Reimplemented in EllipseRecordHandler, PolygonRecordHandler, and RectangleRecordHandler. Definition at line 155 of file rechrshp.cpp. 00156 { 00157 BOOL ok; 00158 00159 // see kernel/cxftags.h for a description of the differences between these two tags - ach 00160 switch (pCXaraFileRecord->GetTag()) 00161 { 00162 case TAG_REGULAR_SHAPE_PHASE_1 : ok = ReadShapeGeneralPhase1(pCXaraFileRecord); 00163 break; 00164 case TAG_REGULAR_SHAPE_PHASE_2 : ok = ReadShapeGeneralPhase2(pCXaraFileRecord); 00165 break; 00166 default : ok = ReadShapeInvalid(pCXaraFileRecord); 00167 break; 00168 } 00169 00170 return ok; 00171 }
|
|
Definition at line 366 of file rechrshp.cpp. 00367 { 00368 pShape->InvalidateCache(); 00369 return TRUE; 00370 }
|
|
<???>
Definition at line 186 of file rechrshp.cpp. 00187 { 00188 BOOL ok = TRUE; 00189 00190 NodeRegularShape * pShape; 00191 BYTE Flags; 00192 UINT16 NumberOfSides; 00193 DocCoord UTCentrePoint; 00194 DocCoord MajorAxis; 00195 DocCoord MinorAxis; 00196 Matrix TransformMatrix; 00197 double StellationRadius; 00198 double StellationOffset; 00199 double PrimaryCurvature; 00200 double SecondaryCurvature; 00201 00202 pShape = new NodeRegularShape; 00203 00204 if (ok) ok = SetupShape(pShape); 00205 00206 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags); 00207 if (ok) ok = SetFlags(pShape, Flags); 00208 00209 if (ok) ok = pCXaraFileRecord->ReadUINT16(&NumberOfSides); 00210 if (ok) ok = SetNumberOfSides(pShape, NumberOfSides); 00211 00212 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&UTCentrePoint,0,0); 00213 if (ok) ok = SetUTCentrePoint(pShape, UTCentrePoint); 00214 00215 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); 00216 if (ok) ok = SetMajorAxis(pShape, MajorAxis); 00217 00218 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); 00219 if (ok) ok = SetMinorAxis(pShape, MinorAxis); 00220 00221 if (ok) ok = pCXaraFileRecord->ReadMatrix(&TransformMatrix); 00222 if (ok) ok = SetTransformMatrix(pShape, TransformMatrix); 00223 00224 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationRadius); 00225 if (ok) ok = SetStellationRadius(pShape, StellationRadius); 00226 00227 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationOffset); 00228 if (ok) ok = SetStellationOffset(pShape, StellationOffset); 00229 00230 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PrimaryCurvature); 00231 if (ok) ok = SetPrimaryCurvature(pShape, PrimaryCurvature); 00232 00233 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&SecondaryCurvature); 00234 if (ok) ok = SetSecondaryCurvature(pShape, SecondaryCurvature); 00235 00236 if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath1)); 00237 if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath2)); 00238 00239 if (ok) ok = InvalidateCache(pShape); 00240 if (ok) ok = InsertNode(pShape); 00241 00242 return ok; 00243 }
|
|
Definition at line 245 of file rechrshp.cpp. 00246 { 00247 BOOL ok = TRUE; 00248 00249 NodeRegularShape * pShape; 00250 BYTE Flags; 00251 UINT16 NumberOfSides; 00252 DocCoord MajorAxis; 00253 DocCoord MinorAxis; 00254 Matrix TransformMatrix; 00255 double StellationRadius; 00256 double StellationOffset; 00257 double PrimaryCurvature; 00258 double SecondaryCurvature; 00259 00260 pShape = new NodeRegularShape; 00261 00262 if (ok) ok = SetupShape(pShape); 00263 00264 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags); 00265 if (ok) ok = SetFlags(pShape, Flags); 00266 00267 if (ok) ok = pCXaraFileRecord->ReadUINT16(&NumberOfSides); 00268 if (ok) ok = SetNumberOfSides(pShape, NumberOfSides); 00269 00270 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MajorAxis,0,0); 00271 if (ok) ok = SetMajorAxis(pShape, MajorAxis); 00272 00273 if (ok) ok = pCXaraFileRecord->ReadCoordTrans(&MinorAxis,0,0); 00274 if (ok) ok = SetMinorAxis(pShape, MinorAxis); 00275 00276 if (ok) ok = pCXaraFileRecord->ReadMatrix(&TransformMatrix); 00277 if (ok) ok = SetTransformMatrix(pShape, TransformMatrix); 00278 00279 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationRadius); 00280 if (ok) ok = SetStellationRadius(pShape, StellationRadius); 00281 00282 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&StellationOffset); 00283 if (ok) ok = SetStellationOffset(pShape, StellationOffset); 00284 00285 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PrimaryCurvature); 00286 if (ok) ok = SetPrimaryCurvature(pShape, PrimaryCurvature); 00287 00288 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&SecondaryCurvature); 00289 if (ok) ok = SetSecondaryCurvature(pShape, SecondaryCurvature); 00290 00291 if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath1)); 00292 if (ok) ok = pCXaraFileRecord->ReadPath(&(pShape->EdgePath2)); 00293 00294 if (ok) ok = InvalidateCache(pShape); 00295 if (ok) ok = InsertNode(pShape); 00296 00297 return ok; 00298 }
|
|
Called when this class is asked to read a record it doesn't know about. We raise an ERROR3 and return FALSE.
Definition at line 313 of file rechrshp.cpp.
|
|
Definition at line 376 of file rechrshp.cpp. 00377 { 00378 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00379 00380 Matrix m = Matrix(CentrePoint); 00381 pShape->SetTransformMatrix(&m); 00382 00383 return TRUE; 00384 }
|
|
Definition at line 431 of file rechrshp.cpp. 00432 { 00433 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00434 00435 pShape->SetPrimaryCurveToPrimary(Curvature); 00436 return TRUE; 00437 }
|
|
Sets various flags in node regular shapes.
Definition at line 515 of file rechrshp.cpp. 00516 { 00517 // !!HACK!! constants embedded in code 00518 // !!HACK!! see CXaraFileRegularShape::GetFlags for the other code which needs to 00519 // !!HACK!! understand how the flags are packed into the byte. 00520 if ((Value & 0x1) == 0x1) pShape->SetCircular(TRUE); 00521 if ((Value & 0x2) == 0x2) pShape->SetStellated(TRUE); 00522 if ((Value & 0x4) == 0x4) pShape->SetPrimaryCurvature(TRUE); 00523 if ((Value & 0x8) == 0x8) pShape->SetStellationCurvature(TRUE); 00524 00525 return TRUE; 00526 }
|
|
Definition at line 414 of file rechrshp.cpp. 00415 { 00416 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00417 00418 SetMajorAxis(pShape, DocCoord(0, Height/2)); 00419 SetMinorAxis(pShape, DocCoord(Width/2, 0)); 00420 return TRUE; 00421 }
|
|
Definition at line 477 of file rechrshp.cpp. 00478 { 00479 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00480 00481 pShape->SetCircular(IsCircular); 00482 return TRUE; 00483 }
|
|
Definition at line 493 of file rechrshp.cpp. 00494 { 00495 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00496 00497 pShape->SetPrimaryCurvature(IsRounded); 00498 pShape->SetStellationCurvature(IsRounded); 00499 return TRUE; 00500 }
|
|
Definition at line 485 of file rechrshp.cpp. 00486 { 00487 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00488 00489 pShape->SetStellated(IsStellated); 00490 return TRUE; 00491 }
|
|
Definition at line 395 of file rechrshp.cpp. 00396 { 00397 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00398 00399 pShape->SetMajorAxes(MajorAxis); 00400 return TRUE; 00401 }
|
|
Definition at line 404 of file rechrshp.cpp. 00405 { 00406 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00407 00408 pShape->SetMinorAxes(MinorAxis); 00409 return TRUE; 00410 }
|
|
Definition at line 423 of file rechrshp.cpp. 00424 { 00425 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00426 00427 pShape->SetNumSides(NumberOfSides); 00428 return TRUE; 00429 }
|
|
Definition at line 439 of file rechrshp.cpp. 00440 { 00441 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00442 00443 pShape->SetPrimaryCurveToPrimary(PrimaryCurvature); 00444 return TRUE; 00445 }
|
|
Definition at line 447 of file rechrshp.cpp. 00448 { 00449 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00450 00451 pShape->SetStellCurveToStell(SecondaryCurvature); 00452 return TRUE; 00453 }
|
|
Definition at line 463 of file rechrshp.cpp. 00464 { 00465 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00466 00467 pShape->SetStellationRatio(StellationOffset); 00468 return TRUE; 00469 }
|
|
Definition at line 455 of file rechrshp.cpp. 00456 { 00457 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00458 00459 pShape->SetStellRadiusToPrimary(StellationRadius); 00460 return TRUE; 00461 }
|
|
Definition at line 471 of file rechrshp.cpp. 00472 { 00473 pShape->SetTransformMatrix(&NewMatrix); 00474 return TRUE; 00475 }
|
|
Functions to set various pieces of information in a regular shape. BOOL RegularShapeRecordHandler::SetCentrePoint(NodeRegularShape *pShape, const DocCoord & CentrePoint); BOOL RegularShapeRecordHandler::SetMajorAxis(NodeRegularShape *pShape, const DocCoord & MajorAxis); BOOL RegularShapeRecordHandler::SetMinorAxis(NodeRegularShape *pShape, const DocCoord & MinorAxis); BOOL RegularShapeRecordHandler::SetHeightAndWidth(NodeRegularShape *pShape, const INT32 & Height, const INT32 & Width); BOOL RegularShapeRecordHandler::SetNumberOfSides(NodeRegularShape *pShape, const INT32 & NumSides); BOOL RegularShapeRecordHandler::SetCurvature(NodeRegularShape *pShape, const double & Curvature); BOOL RegularShapeRecordHandler::SetPrimaryCurvature(NodeRegularShape *pShape, const double & PrimaryCurvature); BOOL RegularShapeRecordHandler::SetSecondaryCurvature(NodeRegularShape *pShape, const double & SecondaryCurvature); BOOL RegularShapeRecordHandler::SetStellationRadius(NodeRegularShape *pShape, const double & StellationRadius); BOOL RegularShapeRecordHandler::SetStellationOffset(NodeRegularShape *pShape, const double & StellationOffset); BOOL RegularShapeRecordHandler::SetEdgePath(NodeRegularShape *pShape, const Path & NewPath); BOOL RegularShapeRecordHandler::SetPrimaryEdgePath(NodeRegularShape *pShape, const Path & NewPrimaryPath); BOOL RegularShapeRecordHandler::SetSecondaryEdgePath(NodeRegularShape *pShape, const Path & NewSecondaryPath); BOOL RegularShapeRecordHandler::SetTransformMatrix(NodeRegularShape *pShape, const Matrix & NewMatrix); BOOL RegularShapeRecordHandler::SetCircular(NodeRegularShape *pShape, const BOOL & IsCircular); BOOL RegularShapeRecordHandler::SetStellated(NodeRegularShape *pShape, const BOOL & IsStellated); BOOL RegularShapeRecordHandler::SetPrimaryCurvature(NodeRegularShape *pShape, const BOOL & Value); BOOL RegularShapeRecordHandler::SetStellationCurvature(NodeRegularShape *pShape, const BOOL & Value);
Definition at line 352 of file rechrshp.cpp. 00353 { 00354 DocCoord Origin = DocCoord(0,0); 00355 00356 pShape->SetCentrePoint(Origin); 00357 pShape->SetMinorAxes(Origin); 00358 pShape->SetMajorAxes(Origin); 00359 00360 Matrix m = Matrix(); // Identity transform 00361 pShape->SetTransformMatrix(&m); 00362 00363 return pShape->SetUpShape(); 00364 }
|
|
Definition at line 386 of file rechrshp.cpp. 00387 { 00388 ERROR2IF(pShape==NULL, FALSE, "parameter pShape == NULL"); 00389 00390 pShape->SetCentrePoint(CentrePoint); 00391 return TRUE; 00392 }
|