00001 00181 #ifndef INC_MI32_RVCCAD_H 00182 #define INC_MI32_RVCCAD_H 00183 00184 #ifndef INC_RVC_OBJECTNAME_H 00185 #include <rvc/objectname.h> 00186 #endif 00187 00188 #ifndef INC_MI32_RECT_H 00189 #include <mi32/rect.h> 00190 #endif 00191 00192 #ifndef INC_MI32_ELEMSTYL_H 00193 #include <mi32/elemstyl.h> 00194 #endif 00195 00196 00197 /* If structure size changes, geom.dll will need to be changed */ 00198 struct CADBLOCK { 00199 RVC::OBJECTNAME name; 00200 RVC::OBJECTDESC desc; 00201 DPOINT3D BasePt; 00202 DPOINT3D GridPt; 00203 DPOINT3D minval; 00204 DPOINT3D maxval; 00205 DOUBLE xscale; 00206 DOUBLE yscale; 00207 DOUBLE zscale; 00208 DOUBLE xsize; 00209 DOUBLE ysize; 00210 DOUBLE zsize; 00211 COLOR GridColor; 00212 UINT32 NumElem; 00213 INT32 dbrecord; 00214 FLOAT rotate; 00215 UINT32 flags; 00216 UINT16 LinkType; 00217 UINT16 space; 00218 UINT32 LinkOffset; 00219 00220 CADBLOCK ( 00221 ) {Clear();} 00222 00223 void Clear ( 00224 ) {memset(static_cast<void*>(this), 0, sizeof(*this));} 00225 00228 DRECT3D GetExtents ( 00229 ) const { 00230 DRECT3D rect; 00231 rect.xinit = minval.x; 00232 rect.yinit = minval.y; 00233 rect.zinit = minval.z; 00234 rect.xlast = maxval.x; 00235 rect.ylast = maxval.y; 00236 rect.zlast = maxval.z; 00237 return (rect); 00238 } 00239 00240 void SetExtents ( 00241 const DRECT3D& rect 00242 ) { 00243 minval.x = rect.xinit; 00244 minval.y = rect.yinit; 00245 minval.z = rect.zinit; 00246 maxval.x = rect.xlast; 00247 maxval.y = rect.ylast; 00248 maxval.z = rect.zlast; 00249 return; 00250 } 00251 00252 }; 00253 00255 PREVENT_MEMFUNC(CADBLOCK) 00256 00257 #define CADBLOCK_HasGrid (0x00000001) 00258 #define CADBLOCK_DrawGridPts (0x00000002) 00259 #define CADBLOCK_DrawLast (0x00000004) 00260 00261 00262 struct CADELEMHDR { 00263 INT32 ElemSize; 00264 UINT16 ElemType; 00265 UINT8 NumAttrib; 00266 UINT8 NumExtra; 00267 }; 00268 00269 /*--- Defined CAD elements ---*/ 00270 00271 #define CAD_INSERT 0 00272 #define CAD_POINT 1 00273 #define CAD_CIRCLE 2 00274 #define CAD_ARC 3 00275 #define CAD_ARCCHORD 4 00276 #define CAD_TEXT 5 00277 #define CAD_BLOCKTEXT 6 00278 #define CAD_LINE 7 00279 #define CAD_RBOX 8 00280 #define CAD_POLYGON 9 00281 #define CAD_MESH 10 00282 #define CAD_ELLIPSE 11 00283 #define CAD_EARC 12 00284 #define CAD_POLYNOMIAL 13 00285 #define CAD_ARCWEDGE 14 00286 #define CAD_EARCWEDGE 15 00287 #define CAD_EARCCHORD 16 00288 #define CAD_MULTILINE 17 00289 #define CAD_MULTIPOINT 18 00290 #define CAD_MULTIPOLYGON 19 00291 #define CAD_LAST 20 00292 00293 /*#define CAD_PARABOLA 21 not defined yet*/ 00294 /*#define CAD_HYPERBOLA 22 not defined yet*/ 00295 /*#define CAD_VARITEXT 23 not defined yet*/ 00296 00304 struct CADELEMOPT { 00305 COLOR color; 00306 COLOR FillColor; 00307 INT32 dbrecord; 00308 INT32 LinePatt; 00309 INT32 FillPatt; 00310 INT32 Symbol; 00311 FLOAT Angle; 00312 FLOAT width; 00313 FLOAT ywidth; 00314 UINT32 StyleFlags; 00315 DPOINT3D Extrusion; /* 24 X, Y, or Z coordinate used in VPOINT_3D?? coords. 00316 For planar data, this is the normal vector to the plane that the element is placed on. */ 00317 INT32 HyperLink; 00318 UINT16 WidthUnits; 00319 UINT16 Space; 00320 DOUBLE MapScale; 00321 COLOR m_LineDrawColor; 00322 COLOR m_PolyBorderColor; 00323 COLOR m_PolyFillColor; 00324 00325 CADELEMOPT ( 00326 ) { 00327 memset(this, 0, sizeof(CADELEMOPT)); 00328 } 00329 00330 CADELEMOPT& operator= ( 00331 const CADELEMOPT& rhs 00332 ) { 00333 if (this != &rhs) memcpy(this, &rhs, sizeof(CADELEMOPT)); 00334 return (*this); 00335 } 00336 00337 void GetStyle ( 00338 LINESTYLE& line 00339 ) const { 00340 line.StyleFlags = StyleFlags; 00341 line.PatternNum = LinePatt; 00342 line.DrawColor = color; 00343 line.MapScale = MapScale; 00344 line.Scale = width; 00345 return; 00346 } 00347 00348 void GetStyle ( 00349 POINTSTYLE& point 00350 ) const { 00351 point.StyleFlags = StyleFlags; 00352 point.SymbolNum = Symbol; 00353 point.DrawColor = color; 00354 point.Angle = Angle; 00355 point.ScaleX = width; 00356 point.ScaleY = ywidth; 00357 point.MapScale = MapScale; 00358 return; 00359 } 00360 00361 void GetStyle ( 00362 POLYSTYLE& poly 00363 ) const { 00364 poly.StyleFlags = StyleFlags; 00365 poly.FillPatternNum = FillPatt; 00366 poly.BorderPatternNum = LinePatt; 00367 poly.BorderColor = color; 00368 poly.FillColor = FillColor; 00369 poly.MapScale = MapScale; 00370 poly.BorderScale = width; 00371 return; 00372 } 00373 00374 void GetStyle ( 00375 TEXTSTYLE& text 00376 ) const { 00377 text.FGColor = color; 00378 text.BGColor = FillColor; 00379 text.StyleFlags = StyleFlags; 00380 text.StyleFlags &= ~STYLEFLAG_TextUseStyleHeight; 00381 text.MapScale = MapScale; 00382 return; 00383 } 00384 00385 void SetStyle ( 00386 const LINESTYLE& line 00387 ) { 00388 StyleFlags = line.StyleFlags; 00389 LinePatt = line.PatternNum; 00390 color = line.DrawColor; 00391 MapScale = line.MapScale; 00392 width = static_cast<float>(line.Scale); 00393 return; 00394 } 00395 00396 void SetStyle ( 00397 const POINTSTYLE& point 00398 ) { 00399 StyleFlags = point.StyleFlags; 00400 Symbol = point.SymbolNum; 00401 color = point.DrawColor; 00402 Angle = static_cast<float>(point.Angle); 00403 width = static_cast<float>(point.ScaleX); 00404 ywidth = static_cast<float>(point.ScaleY); 00405 MapScale = point.MapScale; 00406 return; 00407 } 00408 00409 void SetStyle ( 00410 const POLYSTYLE& poly 00411 ) { 00412 StyleFlags = poly.StyleFlags; 00413 FillPatt = poly.FillPatternNum; 00414 LinePatt = poly.BorderPatternNum; 00415 color = poly.BorderColor; 00416 FillColor = poly.FillColor; 00417 MapScale = poly.MapScale; 00418 width = static_cast<float>(poly.BorderScale); 00419 return; 00420 } 00421 00422 void SetStyle ( 00423 const TEXTSTYLE& text 00424 ) { 00425 color = text.FGColor; 00426 FillColor = text.BGColor; 00427 StyleFlags = text.StyleFlags; 00428 StyleFlags &= ~STYLEFLAG_TextUseStyleHeight; 00429 MapScale = text.MapScale; 00430 return; 00431 } 00432 00433 }; 00434 00440 /*--- Structure definitions for CAD elements */ 00441 00442 struct CADCIRCLE { /* Size = 32 */ 00443 DPOINT2D_OLD center; 00444 DOUBLE radius; 00445 DOUBLE m_zvalue; 00446 }; 00447 00448 00449 struct CADARC { /* Size = 48 */ 00450 DPOINT2D_OLD center; 00451 DOUBLE radius; 00452 DOUBLE start; 00453 DOUBLE end; 00454 DOUBLE m_zvalue; 00455 }; 00456 00457 00458 struct CADTEXT { /* Size = 128 */ 00459 UINT32 NumPoints; 00460 UINT16 NumChars; 00461 UINT16 CharSize; 00462 FLOAT height; 00463 FLOAT rotate; 00464 FLOAT shear; 00465 FLOAT textrotate; 00466 FLOAT xscale; 00467 INT32 font; 00468 UINT32 FontFlags; 00469 UINT8 m_ShadowRelative; 00470 UINT8 m_BaselineFlags; 00471 UINT8 m_bCartoonBalloonLeaders; 00472 UINT8 m_Predefined; 00473 00475 FLOAT m_LineSpace; 00476 FLOAT m_StrokeWidth; 00477 FLOAT m_EnhanceWidth; 00478 FLOAT m_BoldnessWidth; 00479 FLOAT m_UnderlineWidth; 00480 FLOAT m_UnderlineOffset; 00481 FLOAT m_ShadowOffset; 00482 FLOAT m_ShadowAngle; 00483 FLOAT m_ClipWidth; 00484 00486 FLOAT m_Margin; 00487 FLOAT m_TMargin; 00488 FLOAT m_BMargin; 00489 FLOAT m_LMargin; 00490 FLOAT m_RMargin; 00491 UINT32 m_FrameShape; 00492 UINT32 m_LineStyleFlags; 00493 UINT32 m_PolyStyleFlags; 00494 FLOAT m_LineScale; 00495 FLOAT m_PolyBorderScale; 00496 UINT32 m_Arrow; 00497 00498 UINT32 m_NumLeaderLines; 00499 UINT8 spare2[4]; 00500 // FLOAT m_HatchAngle; //!< Use CADELEMOPT::Angle: Rotation angle for hatch patterns (was spare[8]) 00501 // INT32 PatternNum; //!< Use CADELEMOPT::LinePatt 00502 // INT32 FillPatternNum; //!< Use CADELEMOPT::FillPatt 00503 // INT32 BorderPatternNum; //!< Use CADELEMOPT::Symbol 00504 }; /* Followed by the actual points then the number of characters */ 00505 00506 #define CADBASELINEFLAG_Straight 0x00 00507 #define CADBASELINEFLAG_Exact 0x01 00508 #define CADBASELINEFLAG_Spline 0x02 00509 #define CADBASELINEFLAG_ClipUnder 0x04 00510 00511 struct CADINSERT { /* Size = 72 */ 00512 DPOINT3D_OLD InsertPt; 00513 INT32 BlockNum; 00514 FLOAT rotate; 00515 DOUBLE xscale; 00516 DOUBLE yscale; 00517 DOUBLE zscale; 00518 UINT16 numlins; 00519 UINT16 numcols; 00520 FLOAT linspace; 00521 FLOAT colspace; 00522 UINT32 space; 00523 }; 00524 00525 00526 struct CADRBOX { /* Size = 8 */ 00527 FLOAT rotate; 00528 UINT32 space; 00529 }; 00530 00531 00532 struct CADLINE { /* Size = 8 */ 00533 UINT32 NumPoints; 00534 UINT32 CurveFit; 00535 }; /* Followed by the point data */ 00536 00537 00538 struct CADPOLY { /* Size = 16 */ 00539 UINT32 NumPoints; 00540 UINT32 NumIslands; 00541 UINT32 CurveFit; 00542 UINT32 space; 00543 }; /* 00544 * Followed by the "number of points per island" buffer and the point data for the 00545 * polygon and islands. If NumIslands == 0 then only the polygon is stored. 00546 */ 00547 00548 struct CADMESH { /* Size = 16 */ 00549 UINT32 xverts; 00550 UINT32 yverts; 00551 UINT16 CurveFit; 00552 UINT16 flags; 00553 UINT32 space; 00554 }; /* Followed by the point data in the form of array[xverts][yverts]. */ 00555 00556 00557 struct CADELLIPSE { /* Size = 48 */ 00558 DPOINT2D_OLD center; 00559 DOUBLE xsize; 00560 DOUBLE ysize; 00561 FLOAT rotate; 00562 UINT32 space; 00563 DOUBLE m_zvalue; 00564 }; 00565 00566 00567 struct CADEARC { /* Size = 64 */ 00568 DPOINT2D_OLD center; 00569 DOUBLE start; 00570 DOUBLE end; 00571 DOUBLE xsize; 00572 DOUBLE ysize; 00573 FLOAT rotate; 00574 /* the world X axis*/ 00575 UINT32 space; 00576 DOUBLE m_zvalue; 00577 }; 00578 00579 00580 struct CADMULTIPOINT { 00581 UINT32 NumPoints; 00582 UINT32 space; 00583 }; /* Followed by the point data */ 00584 00585 00586 struct CADMULTILINE { 00587 UINT32 NumLines; 00588 UINT32 CurveFit; 00589 }; /* Followed by the number of points array then followed by the point data */ 00590 00591 00592 struct CADMULTIPOLY { 00593 UINT32 NumPolygons; 00594 UINT32 CurveFit; 00595 }; /* Followed by the array of subregion structures then by the data for each sub-region */ 00596 00597 struct CADSUBPOLY { 00598 UINT32 NumPoints; 00599 UINT32 NumIslands; 00600 }; 00601 00602 00603 struct CADPOLYNOM { /* Size = 40 */ 00604 DPOINT2D_OLD minval; 00605 DPOINT2D_OLD maxval; 00606 UINT32 NumCoeff; 00607 UINT32 space; 00608 }; /* Followed by the coefficients of the polynomial */ 00609 00610 union CADELEMDATA { /* Size = 72 */ 00611 CADINSERT insert; 00612 CADCIRCLE circle; 00613 CADARC arc; 00614 CADTEXT text; 00615 CADLINE line; 00616 CADRBOX rbox; 00617 CADPOLY poly; 00618 CADMESH mesh; 00619 CADELLIPSE ellipse; 00620 CADEARC earc; 00621 CADPOLYNOM polynom; 00622 CADMULTIPOINT mpoint; 00623 CADMULTILINE mline; 00624 CADMULTIPOLY mpoly; 00625 }; 00626 00627 #endif 00628
1.6.1