00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 #include "camtypes.h"
00111
00112
00113
00114 #include "nodershp.h"
00115 #include "cxftags.h"
00116
00117
00118 #include "cxfile.h"
00119
00120 #include "cxfrgshp.h"
00121 #include "cxfrect.h"
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152 BOOL CXaraFileRectangle::WriteRectangle(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00153 {
00154 BOOL ok;
00155
00156
00157
00158
00159
00160 const INT32 REFORMED = 0x1;
00161 const INT32 STELLATED = 0x2;
00162 const INT32 ROUNDED = 0x4;
00163 const INT32 COMPLEX = 0x8;
00164
00165 INT32 RectangleType = 0;
00166
00167 if (IsReformed(pShape)) RectangleType |= REFORMED;
00168 if (IsStellated(pShape)) RectangleType |= STELLATED;
00169 if (IsRounded(pShape)) RectangleType |= ROUNDED;
00170 if (IsComplex(pShape)) RectangleType |= COMPLEX;
00171
00172 switch (RectangleType)
00173 {
00174 case 0 : ok = WriteRectangleSimple(pFilter, pShape); break;
00175 case REFORMED : ok = WriteRectangleSimpleReformed(pFilter, pShape); break;
00176 case STELLATED : ok = WriteRectangleSimpleStellated(pFilter, pShape); break;
00177 case STELLATED|REFORMED : ok = WriteRectangleSimpleStellatedReformed(pFilter, pShape); break;
00178 case ROUNDED : ok = WriteRectangleSimpleRounded(pFilter, pShape); break;
00179 case ROUNDED|REFORMED : ok = WriteRectangleSimpleRoundedReformed(pFilter, pShape); break;
00180 case ROUNDED|STELLATED : ok = WriteRectangleSimpleRoundedStellated(pFilter, pShape); break;
00181 case ROUNDED|STELLATED|REFORMED : ok = WriteRectangleSimpleRoundedStellatedReformed(pFilter, pShape); break;
00182 case COMPLEX : ok = WriteRectangleComplex(pFilter, pShape); break;
00183 case COMPLEX|REFORMED : ok = WriteRectangleComplexReformed(pFilter, pShape); break;
00184 case COMPLEX|STELLATED : ok = WriteRectangleComplexStellated(pFilter, pShape); break;
00185 case COMPLEX|STELLATED|REFORMED : ok = WriteRectangleComplexStellatedReformed(pFilter, pShape); break;
00186 case COMPLEX|ROUNDED : ok = WriteRectangleComplexRounded(pFilter, pShape); break;
00187 case COMPLEX|ROUNDED|REFORMED : ok = WriteRectangleComplexRoundedReformed(pFilter, pShape); break;
00188 case COMPLEX|ROUNDED|STELLATED : ok = WriteRectangleComplexRoundedStellated(pFilter, pShape); break;
00189 case COMPLEX|ROUNDED|STELLATED|REFORMED : ok = WriteRectangleComplexRoundedStellatedReformed(pFilter, pShape); break;
00190 default : ok = WriteShapeInvalid(pFilter, pShape); break;
00191 }
00192
00193 return ok;
00194 }
00195
00196 BOOL CXaraFileRectangle::WriteRectangleSimple(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00197 {
00198 BOOL ok;
00199
00200 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE, TAG_RECTANGLE_SIMPLE_SIZE);
00201
00202 ok = Rec.Init();
00203 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00204 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00205 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00206 if (ok) ok = pFilter->Write(&Rec);
00207
00208 return ok;
00209 }
00210
00211 BOOL CXaraFileRectangle::WriteRectangleSimpleReformed(BaseCamelotFilter *pFilter, NodeRegularShape *pShape)
00212 {
00213 BOOL ok;
00214
00215 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_REFORMED, TAG_RECTANGLE_SIMPLE_REFORMED_SIZE);
00216
00217 ok = Rec.Init();
00218 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00219 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00220 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00221 if (ok) ok = Rec.WritePath(GetEdgePath(pShape));
00222 if (ok) ok = pFilter->Write(&Rec);
00223
00224 return ok;
00225 }
00226
00227 BOOL CXaraFileRectangle::WriteRectangleSimpleStellated(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00228 {
00229 BOOL ok;
00230
00231 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_STELLATED, TAG_RECTANGLE_SIMPLE_STELLATED_SIZE);
00232
00233 ok = Rec.Init();
00234 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00235 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00236 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00237 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00238 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00239 if (ok) ok = pFilter->Write(&Rec);
00240
00241 return ok;
00242 }
00243
00244 BOOL CXaraFileRectangle::WriteRectangleSimpleStellatedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00245 {
00246 BOOL ok;
00247
00248 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_STELLATED_REFORMED, TAG_RECTANGLE_SIMPLE_STELLATED_REFORMED_SIZE);
00249
00250 ok = Rec.Init();
00251 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00252 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00253 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00254 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00255 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00256 if (ok) ok = Rec.WritePath(GetPrimaryEdgePath(pShape));
00257 if (ok) ok = Rec.WritePath(GetSecondaryEdgePath(pShape));
00258 if (ok) ok = pFilter->Write(&Rec);
00259
00260 return ok;
00261 }
00262
00263 BOOL CXaraFileRectangle::WriteRectangleSimpleRounded(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00264 {
00265 BOOL ok;
00266
00267 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_ROUNDED, TAG_RECTANGLE_SIMPLE_ROUNDED_SIZE);
00268
00269 ok = Rec.Init();
00270 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00271 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00272 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00273 if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape));
00274 if (ok) ok = pFilter->Write(&Rec);
00275
00276 return ok;
00277 }
00278
00279 BOOL CXaraFileRectangle::WriteRectangleSimpleRoundedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00280 {
00281 BOOL ok;
00282
00283 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_ROUNDED_REFORMED, TAG_RECTANGLE_SIMPLE_ROUNDED_REFORMED_SIZE);
00284
00285 ok = Rec.Init();
00286 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00287 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00288 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00289 if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape));
00290 if (ok) ok = Rec.WritePath(GetEdgePath(pShape));
00291 if (ok) ok = pFilter->Write(&Rec);
00292
00293 return ok;
00294 }
00295
00296 BOOL CXaraFileRectangle::WriteRectangleSimpleRoundedStellated(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00297 {
00298 BOOL ok;
00299
00300 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_ROUNDED_STELLATED, TAG_RECTANGLE_SIMPLE_ROUNDED_STELLATED_SIZE);
00301
00302 ok = Rec.Init();
00303 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00304 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00305 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00306 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00307 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00308 if (ok) ok = Rec.WriteDOUBLE(GetPrimaryCurvature(pShape));
00309 if (ok) ok = Rec.WriteDOUBLE(GetSecondaryCurvature(pShape));
00310 if (ok) ok = pFilter->Write(&Rec);
00311
00312 return ok;
00313 }
00314
00315 BOOL CXaraFileRectangle::WriteRectangleSimpleRoundedStellatedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00316 {
00317 BOOL ok;
00318
00319 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_SIMPLE_ROUNDED_STELLATED_REFORMED, TAG_RECTANGLE_SIMPLE_ROUNDED_STELLATED_REFORMED_SIZE);
00320
00321 ok = Rec.Init();
00322 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00323 if (ok) ok = Rec.WriteINT32(GetWidth(pShape));
00324 if (ok) ok = Rec.WriteINT32(GetHeight(pShape));
00325 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00326 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00327 if (ok) ok = Rec.WriteDOUBLE(GetPrimaryCurvature(pShape));
00328 if (ok) ok = Rec.WriteDOUBLE(GetSecondaryCurvature(pShape));
00329 if (ok) ok = Rec.WritePath(GetPrimaryEdgePath(pShape));
00330 if (ok) ok = Rec.WritePath(GetSecondaryEdgePath(pShape));
00331 if (ok) ok = pFilter->Write(&Rec);
00332
00333 return ok;
00334 }
00335
00336 BOOL CXaraFileRectangle::WriteRectangleComplex(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00337 {
00338 BOOL ok;
00339
00340 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX, TAG_RECTANGLE_COMPLEX_SIZE);
00341
00342 ok = Rec.Init();
00343 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00344 if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0);
00345 if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0);
00346 if (ok) ok = pFilter->Write(&Rec);
00347
00348 return ok;
00349 }
00350
00351 BOOL CXaraFileRectangle::WriteRectangleComplexReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00352 {
00353 BOOL ok;
00354
00355 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_REFORMED, TAG_RECTANGLE_COMPLEX_REFORMED_SIZE);
00356
00357 ok = Rec.Init();
00358 if (ok) ok = Rec.WriteCoordTrans(GetUTMajorAxis(pShape),0,0);
00359 if (ok) ok = Rec.WriteCoordTrans(GetUTMinorAxis(pShape),0,0);
00360 if (ok) ok = Rec.WriteMatrix(GetTransformMatrix(pShape));
00361 if (ok) ok = Rec.WritePath(GetEdgePath(pShape));
00362 if (ok) ok = pFilter->Write(&Rec);
00363
00364 return ok;
00365 }
00366
00367 BOOL CXaraFileRectangle::WriteRectangleComplexStellated(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00368 {
00369 BOOL ok;
00370
00371 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_STELLATED, TAG_RECTANGLE_COMPLEX_STELLATED_SIZE);
00372
00373 ok = Rec.Init();
00374 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00375 if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0);
00376 if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0);
00377 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00378 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00379 if (ok) ok = pFilter->Write(&Rec);
00380
00381 return ok;
00382 }
00383
00384 BOOL CXaraFileRectangle::WriteRectangleComplexStellatedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00385 {
00386 BOOL ok;
00387
00388 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_STELLATED_REFORMED, TAG_RECTANGLE_COMPLEX_STELLATED_REFORMED_SIZE);
00389
00390 ok = Rec.Init();
00391 if (ok) ok = Rec.WriteCoordTrans(GetUTMajorAxis(pShape),0,0);
00392 if (ok) ok = Rec.WriteCoordTrans(GetUTMinorAxis(pShape),0,0);
00393 if (ok) ok = Rec.WriteMatrix(GetTransformMatrix(pShape));
00394 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00395 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00396 if (ok) ok = Rec.WritePath(GetPrimaryEdgePath(pShape));
00397 if (ok) ok = Rec.WritePath(GetSecondaryEdgePath(pShape));
00398 if (ok) ok = pFilter->Write(&Rec);
00399
00400 return ok;
00401 }
00402
00403 BOOL CXaraFileRectangle::WriteRectangleComplexRounded(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00404 {
00405 BOOL ok;
00406
00407 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED, TAG_RECTANGLE_COMPLEX_ROUNDED_SIZE);
00408
00409 ok = Rec.Init();
00410 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00411 if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0);
00412 if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0);
00413 if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape));
00414 if (ok) ok = pFilter->Write(&Rec);
00415
00416 return ok;
00417 }
00418
00419 BOOL CXaraFileRectangle::WriteRectangleComplexRoundedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00420 {
00421 BOOL ok;
00422
00423 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED_REFORMED, TAG_RECTANGLE_COMPLEX_ROUNDED_REFORMED_SIZE);
00424
00425 ok = Rec.Init();
00426 if (ok) ok = Rec.WriteCoordTrans(GetUTMajorAxis(pShape),0,0);
00427 if (ok) ok = Rec.WriteCoordTrans(GetUTMinorAxis(pShape),0,0);
00428 if (ok) ok = Rec.WriteMatrix(GetTransformMatrix(pShape));
00429 if (ok) ok = Rec.WriteDOUBLE(GetCurvature(pShape));
00430 if (ok) ok = Rec.WritePath(GetEdgePath(pShape));
00431 if (ok) ok = pFilter->Write(&Rec);
00432
00433 return ok;
00434 }
00435
00436 BOOL CXaraFileRectangle::WriteRectangleComplexRoundedStellated(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00437 {
00438 BOOL ok;
00439
00440 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED_STELLATED, TAG_RECTANGLE_COMPLEX_ROUNDED_STELLATED_SIZE);
00441
00442 ok = Rec.Init();
00443 if (ok) ok = Rec.WriteCoord(GetCentrePoint(pShape));
00444 if (ok) ok = Rec.WriteCoordTrans(GetMajorAxis(pShape),0,0);
00445 if (ok) ok = Rec.WriteCoordTrans(GetMinorAxis(pShape),0,0);
00446 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00447 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00448 if (ok) ok = Rec.WriteDOUBLE(GetPrimaryCurvature(pShape));
00449 if (ok) ok = Rec.WriteDOUBLE(GetSecondaryCurvature(pShape));
00450 if (ok) ok = pFilter->Write(&Rec);
00451
00452 return ok;
00453 }
00454
00455 BOOL CXaraFileRectangle::WriteRectangleComplexRoundedStellatedReformed(BaseCamelotFilter * pFilter, NodeRegularShape * pShape)
00456 {
00457 BOOL ok;
00458
00459 CamelotFileRecord Rec(pFilter,TAG_RECTANGLE_COMPLEX_ROUNDED_STELLATED_REFORMED, TAG_RECTANGLE_COMPLEX_ROUNDED_STELLATED_REFORMED_SIZE);
00460
00461 ok = Rec.Init();
00462 if (ok) ok = Rec.WriteCoordTrans(GetUTMajorAxis(pShape),0,0);
00463 if (ok) ok = Rec.WriteCoordTrans(GetUTMinorAxis(pShape),0,0);
00464 if (ok) ok = Rec.WriteMatrix(GetTransformMatrix(pShape));
00465 if (ok) ok = Rec.WriteDOUBLE(GetStellationRadius(pShape));
00466 if (ok) ok = Rec.WriteDOUBLE(GetStellationOffset(pShape));
00467 if (ok) ok = Rec.WriteDOUBLE(GetPrimaryCurvature(pShape));
00468 if (ok) ok = Rec.WriteDOUBLE(GetSecondaryCurvature(pShape));
00469 if (ok) ok = Rec.WritePath(GetPrimaryEdgePath(pShape));
00470 if (ok) ok = Rec.WritePath(GetSecondaryEdgePath(pShape));
00471 if (ok) ok = pFilter->Write(&Rec);
00472
00473 return ok;
00474 }
00475