1 /******************************************************************************* 2 * Project: libopencad 3 * Purpose: OpenSource CAD formats support library 4 * Author: Alexandr Borzykh, mush3d at gmail.com 5 * Author: Dmitry Baryshnikov, bishop.dev@gmail.com 6 * Language: C++ 7 ******************************************************************************* 8 * The MIT License (MIT) 9 * 10 * Copyright (c) 2016 Alexandr Borzykh 11 * Copyright (c) 2016 NextGIS, <info@nextgis.com> 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this software and associated documentation files (the "Software"), to deal 15 * in the Software without restriction, including without limitation the rights 16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 * copies of the Software, and to permit persons to whom the Software is 18 * furnished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in all 21 * copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 * SOFTWARE. 30 *******************************************************************************/ 31 #ifndef CADHEADER_H 32 #define CADHEADER_H 33 34 #include "opencad.h" 35 #include <map> 36 #include <string> 37 #include <vector> 38 #include <ctime> 39 40 class OCAD_EXTERN CADHandle final 41 { 42 public: 43 explicit CADHandle( unsigned char codeIn = 0 ); 44 CADHandle( const CADHandle& other ); 45 CADHandle& operator=( const CADHandle& other ); 46 47 void addOffset( unsigned char val ); 48 bool isNull() const; 49 long getAsLong() const; 50 long getAsLong( const CADHandle& ref_handle ) const; 51 private: 52 static long getAsLong(const std::vector<unsigned char>& handle); 53 protected: 54 unsigned char code; 55 std::vector<unsigned char> handleOrOffset; 56 }; 57 58 class OCAD_EXTERN CADVariant final 59 { 60 public: 61 enum class DataType 62 { 63 INVALID = 0, DECIMAL, REAL, STRING, DATETIME, COORDINATES, HANDLE 64 }; 65 66 public: 67 CADVariant(); 68 // cppcheck-suppress noExplicitConstructor 69 CADVariant( const char * val ); 70 // cppcheck-suppress noExplicitConstructor 71 CADVariant( int val ); 72 // cppcheck-suppress noExplicitConstructor 73 CADVariant( short val ); 74 // cppcheck-suppress noExplicitConstructor 75 CADVariant( double val ); 76 CADVariant( double x, double y, double z = 0 ); 77 // cppcheck-suppress noExplicitConstructor 78 CADVariant( const CADHandle& val ); 79 // cppcheck-suppress noExplicitConstructor 80 CADVariant( const std::string& val ); 81 // cppcheck-suppress noExplicitConstructor 82 CADVariant( long julianday, long milliseconds ); 83 public: 84 long getDecimal() const; 85 double getReal() const; 86 const std::string& getString() const; 87 DataType getType() const; 88 double getX() const; 89 double getY() const; 90 double getZ() const; 91 const CADHandle& getHandle() const; 92 protected: 93 DataType type; 94 long decimalVal; 95 double xVal; 96 double yVal; 97 double zVal; 98 std::string stringVal; 99 CADHandle handleVal; 100 time_t dateTimeVal; 101 }; 102 103 /** 104 * @brief The common CAD header class 105 */ 106 class OCAD_EXTERN CADHeader 107 { 108 public: 109 /** 110 * @brief The CAD нeader сonstants enum get from dxf reference: 111 * http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-A85E8E67-27CD-4C59-BE61-4DC9FADBE74A 112 */ 113 enum CADHeaderConstants 114 { 115 OPENCADVER = 1, /**< enum CADVersions value*/ 116 ACADMAINTVER, /**< Maintenance version number (should be ignored) */ 117 ACADVER, /**< The AutoCAD drawing database version number: 118 AC1006 = R10 119 AC1009 = R11 and R12 120 AC1012 = R13 121 AC1014 = R14 122 AC1015 = AutoCAD 2000 123 AC1018 = AutoCAD 2004 124 AC1021 = AutoCAD 2007 125 AC1024 = AutoCAD 2010 126 AC1027 = AutoCAD 2013 */ 127 ANGBASE, /**< Angle 0 direction */ 128 ANGDIR, /**< 1 (Clockwise angles) or 0 (Counterclockwise angles) */ 129 ATTMODE, /**< Attribute visibility: 0,1,2 */ 130 ATTREQ, /**< todo: */ 131 ATTDIA, /**< todo: */ 132 AUNITS, /**< Units format for angles */ 133 AUPREC, /**< Units precision for angles */ 134 CECOLOR, /**< 0 = BYBLOCK; 256 = BYLAYER */ 135 CELTSCALE, /**< Current entity linetype scale */ 136 CELTYPE, /**< Entity linetype name, or BYBLOCK or BYLAYER */ 137 CELWEIGHT, /**< Lineweight of new objects */ 138 CEPSNID, /**< Plotstyle handle of new objects; 139 if CEPSNTYPE is 3, then this value indicates the 140 handle */ 141 CEPSNTYPE, /**< Plot style type of new objects: 142 0 = Plot style by layer, 143 1 = Plot style by block, 144 2 = Plot style by dictionary default, 145 3 = Plot style by object ID/handle */ 146 CHAMFERA, /**< First chamfer distance */ 147 CHAMFERB, /**< Second chamfer distance */ 148 CHAMFERC, /**< Chamfer length */ 149 CHAMFERD, /**< Chamfer angle */ 150 CLAYER, /**< Current layer name */ 151 CMLJUST, /**< Current multiline justification: 152 0 = Top; 153 1 = Middle; 154 2 = Bottom */ 155 CMLSCALE, /**< Current multiline scale */ 156 CMLSTYLE, /**< Current multiline style name */ 157 CSHADOW, /**< Shadow mode for a 3D object: 158 0 = Casts and receives shadows 159 1 = Casts shadows 160 2 = Receives shadows 161 3 = Ignores shadows */ 162 DIMADEC, /**< Number of precision places displayed in angular 163 dimensions */ 164 DIMALT, /**< Alternate unit dimensioning performed if nonzero */ 165 DIMALTD, /**< Alternate unit decimal places */ 166 DIMALTF, /**< Alternate unit scale factor */ 167 DIMALTRND, /**< Determines rounding of alternate units */ 168 DIMALTTD, /**< Number of decimal places for tolerance values of 169 an alternate units dimension */ 170 DIMALTTZ, /**< Controls suppression of zeros for alternate 171 tolerance values: 172 0 = Suppresses zero feet and precisely zero inches 173 1 = Includes zero feet and precisely zero inches 174 2 = Includes zero feet and suppresses zero inches 175 3 = Includes zero inches and suppresses zero feet */ 176 DIMALTU, /**< Units format for alternate units of all dimension 177 style family members except angular: 178 1 = Scientific 179 2 = Decimal 180 3 = Engineering 181 4 = Architectural (stacked) 182 5 = Fractional (stacked) 183 6 = Architectural 184 7 = Fractional */ 185 DIMALTZ, /**< Controls suppression of zeros for alternate unit 186 dimension, values: 187 0 = Suppresses zero feet and precisely zero inches 188 1 = Includes zero feet and precisely zero inches 189 2 = Includes zero feet and suppresses zero inches 190 3 = Includes zero inches and suppresses zero feet */ 191 DIMAPOST, /**< Alternate dimensioning suffix */ 192 DIMASO, /**< 1 = Create associative dimensioning, 193 0 = Draw individual entities */ 194 DIMASSOC, /**< Controls the associativity of dimension objects: 195 0 = Creates exploded dimensions; there is no 196 association between elements of the dimension, 197 and the lines, arcs, arrowheads, and text of a 198 dimension are drawn as separate objects 199 1 = Creates non-associative dimension objects; 200 the elements of the dimension are formed into 201 a single object, and if the definition point 202 on the object moves, then the dimension value 203 is updated 204 2 = Creates associative dimension objects; the 205 elements of the dimension are formed into a 206 single object and one or more definition 207 points of the dimension are coupled with 208 association points on geometric objects */ 209 DIMASZ, /**< Dimensioning arrow size */ 210 DIMATFIT, /**< Controls dimension text and arrow placement when 211 space is not sufficient to place both within the 212 extension lines: 213 0 = Places both text and arrows outside extension 214 lines 215 1 = Moves arrows first, then text 216 2 = Moves text first, then arrows 217 3 = Moves either text or arrows, whichever fits 218 best AutoCAD adds a leader to moved dimension 219 text when DIMTMOVE is set to 1 */ 220 DIMAUNIT, /**< Angle format for angular dimensions: 221 0 = Decimal degrees 222 1 = Degrees/minutes/seconds 223 2 = Gradians 224 3 = Radians 225 4 = Surveyor's units */ 226 DIMAZIN, /**< Controls suppression of zeros for angular 227 dimensions: 228 0 = Displays all leading and trailing zeros 229 1 = Suppresses leading zeros in decimal dimensions 230 2 = Suppresses trailing zeros in decimal dimensions 231 3 = Suppresses leading and trailing zeros */ 232 DIMBLK, /**< Arrow block name */ 233 DIMBLK1, /**< First arrow block name */ 234 DIMBLK2, /**< Second arrow block name */ 235 DIMCEN, /**< Size of center mark/lines */ 236 DIMCLRD, /**< Dimension line color: 237 range is 0 = BYBLOCK; 256 = BYLAYER */ 238 DIMCLRE, /**< Dimension extension line color: 239 range is 0 = BYBLOCK; 256 = BYLAYER */ 240 DIMCLRT, /**< Dimension text color: 241 range is 0 = BYBLOCK; 256 = BYLAYER */ 242 DIMDEC, /**< Number of decimal places for the tolerance values 243 of a primary units dimension */ 244 DIMDLE, /**< Dimension line extension */ 245 DIMDLI, /**< Dimension line increment */ 246 DIMDSEP, /**< Single-character decimal separator used when 247 creating dimensions whose unit format is decimal */ 248 DIMEXE, /**< Extension line extension */ 249 DIMEXO, /**< Extension line offset */ 250 DIMFAC, /**< Scale factor used to calculate the height of text 251 for dimension fractions and tolerances. AutoCAD 252 multiplies DIMTXT by DIMTFAC to set the fractional 253 or tolerance text height */ 254 DIMGAP, /**< Dimension line gap */ 255 DIMJUST, /**< Horizontal dimension text position: 256 0 = Above dimension line and center-justified 257 between extension lines 258 1 = Above dimension line and next to first 259 extension line 260 2 = Above dimension line and next to second 261 extension line 262 3 = Above and center-justified to first extension 263 line 264 4 = Above and center-justified to second 265 extension line */ 266 DIMLDRBLK, /**< Arrow block name for leaders */ 267 DIMLFAC, /**< Linear measurements scale factor */ 268 DIMLIM, /**< Dimension limits generated if nonzero */ 269 DIMLUNIT, /**< Sets units for all dimension types except Angular: 270 1 = Scientific 271 2 = Decimal 272 3 = Engineering 273 4 = Architectural 274 5 = Fractional 275 6 = Windows desktop */ 276 DIMLWD, /**< Dimension line lineweight: 277 -3 = Standard 278 -2 = ByLayer 279 -1 = ByBlock 280 0-211 = an integer representing 100th of mm */ 281 DIMLWE, /**< Extension line lineweight: 282 -3 = Standard 283 -2 = ByLayer 284 -1 = ByBlock 285 0-211 = an integer representing 100th of mm */ 286 DIMPOST, /**< General dimensioning suffix */ 287 DIMRND, /**< Rounding value for dimension distances */ 288 DIMSAH, /**< Use separate arrow blocks if nonzero */ 289 DIMSCALE, /**< Overall dimensioning scale factor */ 290 DIMSD1, /**< Suppression of first extension line: 291 0 = Not suppressed 292 1 = Suppressed */ 293 DIMSD2, /**< Suppression of second extension line: 294 0 = Not suppressed 295 1 = Suppressed */ 296 DIMSE1, /**< First extension line suppressed if nonzero */ 297 DIMSE2, /**< Second extension line suppressed if nonzero */ 298 DIMSHO, /**< 1 = Recompute dimensions while dragging 299 0 = Drag original image */ 300 DIMSOXD, /**< Suppress outside-extensions dimension lines if 301 nonzero */ 302 DIMSTYLE, /**< Dimension style name */ 303 DIMTAD, /**< Text above dimension line if nonzero */ 304 DIMTDEC, /**< Number of decimal places to display the tolerance 305 values */ 306 DIMTFAC, /**< Dimension tolerance display scale factor */ 307 DIMTIH, /**< Text inside horizontal if nonzero */ 308 DIMTIX, /**< Force text inside extensions if nonzero */ 309 DIMTM, /**< Minus tolerance */ 310 DIMTMOVE, /**< Dimension text movement rules: 311 0 = Moves the dimension line with dimension text 312 1 = Adds a leader when dimension text is moved 313 2 = Allows text to be moved freely without a leader */ 314 DIMTOFL, /**< If text is outside extensions, force line 315 extensions between extensions if nonzero */ 316 DIMTOH, /**< Text outside horizontal if nonzero */ 317 DIMTOL, /**< Dimension tolerances generated if nonzero */ 318 DIMTOLJ, /**< Vertical justification for tolerance values: 319 0 = Top 320 1 = Middle 321 2 = Bottom */ 322 DIMTP, /**< Plus tolerance */ 323 DIMTSZ, /**< Dimensioning tick size: 324 0 = No ticks */ 325 DIMTVP, /**< Text vertical position */ 326 DIMTXSTY, /**< Dimension text style */ 327 DIMTXT, /**< Dimensioning text height */ 328 DIMTZIN, /**< Controls suppression of zeros for tolerance values: 329 0 = Suppresses zero feet and precisely zero inches 330 1 = Includes zero feet and precisely zero inches 331 2 = Includes zero feet and suppresses zero inches 332 3 = Includes zero inches and suppresses zero feet */ 333 DIMUPT, /**< Cursor functionality for user-positioned text: 334 0 = Controls only the dimension line location 335 1 = Controls the text position as well as the 336 dimension line location */ 337 DIMZIN, /**< Controls suppression of zeros for primary unit 338 values: 339 0 = Suppresses zero feet and precisely zero inches 340 1 = Includes zero feet and precisely zero inches 341 2 = Includes zero feet and suppresses zero inches 342 3 = Includes zero inches and suppresses zero feet */ 343 DISPSILH, /**< Controls the display of silhouette curves of body 344 objects in Wireframe mode: 345 0 = Off 346 1 = On */ 347 DRAGVS, /**< Hard-pointer ID to visual style while creating 3D 348 solid primitives. The default value is NULL */ 349 DWGCODEPAGE, /**< Drawing code page; set to the system code page 350 when a new drawing is created, but not otherwise 351 maintained by AutoCAD */ 352 ELEVATION, /**< Current elevation set by ELEV command */ 353 ENDCAPS, /**< Lineweight endcaps setting for new objects: 354 0 = none 355 1 = round 356 2 = angle 357 3 = square */ 358 EXTMAX, /**< X, Y, and Z drawing extents upper-right corner 359 (in WCS) */ 360 EXTMIN, /**< X, Y, and Z drawing extents lower-left corner 361 (in WCS) */ 362 EXTNAMES, /**< Controls symbol table naming: 363 0 = Release 14 compatibility. Limits names to 31 364 characters in length. Names can include the 365 letters A to Z, the numerals 0 to 9, and the 366 special characters dollar sign ($), underscore 367 (_), and hyphen (-). 368 1 = AutoCAD 2000. Names can be up to 255 characters 369 in length, and can include the letters A to Z, 370 the numerals 0 to 9, spaces, and any special 371 characters not used for other purposes by 372 Microsoft Windows and AutoCAD */ 373 FILLETRAD, /**< Fillet radius */ 374 FILLMODE, /**< Fill mode on if nonzero */ 375 FINGERPRINTGUID, /**< Set at creation time, uniquely identifies a 376 particular drawing */ 377 HALOGAP, /**< Specifies a gap to be displayed where an object is 378 hidden by another object; the value is specified 379 as a percent of one unit and is independent of the 380 zoom level. A haloed line is shortened at the 381 point where it is hidden when HIDE or the Hidden 382 option of SHADEMODE is used */ 383 HANDSEED, /**< Next available handle */ 384 HIDETEXT, /**< Specifies HIDETEXT system variable: 385 0 = HIDE ignores text objects when producing the 386 hidden view 387 1 = HIDE does not ignore text objects */ 388 HYPERLINKBASE, /**< Path for all relative hyperlinks in the drawing. 389 If null, the drawing path is used */ 390 INDEXCTL, /**< Controls whether layer and spatial indexes are 391 created and saved in drawing files: 392 0 = No indexes are created 393 1 = Layer index is created 394 2 = Spatial index is created 395 3 = Layer and spatial indexes are created */ 396 INSBASE, /**< Insertion base set by BASE command (in WCS) */ 397 INSUNITS, /**< Default drawing units for AutoCAD DesignCenter 398 blocks: 399 0 = Unitless 400 1 = Inches 401 2 = Feet 402 3 = Miles 403 4 = Millimeters 404 5 = Centimeters 405 6 = Meters 406 7 = Kilometers 407 8 = Microinches 408 9 = Mils 409 10 = Yards 410 11 = Angstroms 411 12 = Nanometers 412 13 = Microns 413 14 = Decimeters 414 15 = Decameters 415 16 = Hectometers 416 17 = Gigameters 417 18 = Astronomical units 418 19 = Light years 419 20 = Parsecs */ 420 INTERFERECOLOR, /**< Represents the ACI color index of the 421 "interference objects" created during the 422 interfere command. Default value is 1 */ 423 INTERFEREOBJVS, /**< Hard-pointer ID to the visual style for 424 interference objects. Default visual style is 425 Conceptual */ 426 INTERFEREVPVS, /**< Hard-pointer ID to the visual style for the 427 viewport during interference checking. Default 428 visual style is 3d Wireframe. */ 429 INTERSECTIONCOLOR, /**< Specifies the entity color of intersection 430 polylines: 431 Values 1-255 designate an AutoCAD color index (ACI) 432 0 = Color BYBLOCK 433 256 = Color BYLAYER 434 257 = Color BYENTITY */ 435 INTERSECTIONDISPLAY, /**< Specifies the display of intersection polylines: 436 0 = Turns off the display of intersection 437 polylines 438 1 = Turns on the display of intersection 439 polylines */ 440 JOINSTYLE, /**< Lineweight joint setting for new objects: 441 0 = none 442 1 = round 443 2 = angle 444 3 = flat */ 445 LIMCHECK, /**< Nonzero if limits checking is on */ 446 LIMMAX, /**< XY drawing limits upper-right corner (in WCS) */ 447 LIMMIN, /**< XY drawing limits lower-left corner (in WCS) */ 448 LTSCALE, /**< Global linetype scale */ 449 LUNITS, /**< Units format for coordinates and distances */ 450 LUPREC, /**< Units precision for coordinates and distances */ 451 LWDISPLAY, /**< Controls the display of lineweights on the Model 452 or Layout tab: 453 0 = Lineweight is not displayed 454 1 = Lineweight is displayed */ 455 MAXACTVP, /**< Sets maximum number of viewports to be regenerated */ 456 MEASUREMENT, /**< Sets drawing units: 457 0 = English 458 1 = Metric */ 459 MENU, /**< Name of menu file */ 460 MIRRTEXT, /**< Mirror text if nonzero */ 461 OBSCOLOR, /**< Specifies the color of obscured lines. An obscured 462 line is a hidden line made visible by changing its 463 color and linetype and is visible only when the 464 HIDE or SHADEMODE command is used. The OBSCUREDCOLOR 465 setting is visible only if the OBSCUREDLTYPE is 466 turned ON by setting it to a value other than 0. 467 0 and 256 = Entity color 468 1-255 = An AutoCAD color index (ACI) */ 469 OBSLTYPE, /**< Specifies the linetype of obscured lines. Obscured 470 linetypes are independent of zoom level, unlike 471 regular AutoCAD linetypes. Value 0 turns off 472 display of obscured lines and is the default. 473 Linetype values are defined as follows: 474 0 = Off 475 1 = Solid 476 2 = Dashed 477 3 = Dotted 478 4 = Short Dash 479 5 = Medium Dash 480 6 = Long Dash 481 7 = Double Short Dash 482 8 = Double Medium Dash 483 9 = Double Long Dash 484 10 = Medium Long Dash 485 11 = Sparse Dot */ 486 ORTHOMODE, /**< Ortho mode on if nonzero */ 487 PDMODE, /**< Point display mode */ 488 PDSIZE, /**< Point display size */ 489 PELEVATION, /**< Current paper space elevation */ 490 PEXTMAX, /**< Maximum X, Y, and Z extents for paper space */ 491 PEXTMIN, /**< Minimum X, Y, and Z extents for paper space */ 492 PINSBASE, /**< Paper space insertion base point */ 493 PLIMCHECK, /**< Limits checking in paper space when nonzero */ 494 PLIMMAX, /**< Maximum X and Y limits in paper space */ 495 PLIMMIN, /**< Minimum X and Y limits in paper space */ 496 PLINEGEN, /**< Governs the generation of linetype patterns around 497 the vertices of a 2D polyline: 498 1 = Linetype is generated in a continuous pattern 499 around vertices of the polyline 500 0 = Each segment of the polyline starts and ends 501 with a dash */ 502 PLINEWID, /**< Default polyline width */ 503 PROJECTNAME, /**< Assigns a project name to the current drawing. 504 Used when an external reference or image is not 505 found on its original path. The project name 506 points to a section in the registry that can 507 contain one or more search paths for each project 508 name defined. Project names and their search 509 directories are created from the Files tab of the 510 Options dialog box */ 511 PROXYGRAPHICS, /**< Controls the saving of proxy object images */ 512 PSLTSCALE, /**< Controls paper space linetype scaling: 513 1 = No special linetype scaling 514 0 = Viewport scaling governs linetype scaling */ 515 PSTYLEMODE, /**< Indicates whether the current drawing is in a 516 Color-Dependent or Named Plot Style mode: 517 0 = Uses named plot style tables in the current 518 drawing 519 1 = Uses color-dependent plot style tables in the 520 current drawing */ 521 PSVPSCALE, /**< View scale factor for new viewports: 522 0 = Scaled to fit 523 >0 = Scale factor (a positive real value) */ 524 PUCSBASE, /**< Name of the UCS that defines the origin and 525 orientation of orthographic UCS settings (paper 526 space only) */ 527 PUCSNAME, /**< Current paper space UCS name */ 528 PUCSORG, /**< Current paper space UCS origin */ 529 PUCSORGBACK, /**< Point which becomes the new UCS origin after 530 changing paper space UCS to BACK when PUCSBASE is 531 set to WORLD */ 532 PUCSORGBOTTOM, /**< Point which becomes the new UCS origin after 533 changing paper space UCS to BOTTOM when PUCSBASE 534 is set to WORLD */ 535 PUCSORGFRONT, /**< Point which becomes the new UCS origin after 536 changing paper space UCS to FRONT when PUCSBASE is 537 set to WORLD */ 538 PUCSORGLEFT, /**< Point which becomes the new UCS origin after 539 changing paper space UCS to LEFT when PUCSBASE is 540 set to WORLD */ 541 PUCSORGRIGHT, /**< Point which becomes the new UCS origin after 542 changing paper space UCS to RIGHT when PUCSBASE is 543 set to WORLD */ 544 PUCSORGTOP, /**< Point which becomes the new UCS origin after 545 changing paper space UCS to TOP when PUCSBASE is 546 set to WORLD */ 547 PUCSORTHOREF, /**< If paper space UCS is orthographic (PUCSORTHOVIEW 548 not equal to 0), this is the name of the UCS that 549 the orthographic UCS is relative to. If blank, UCS 550 is relative to WORLD */ 551 PUCSORTHOVIEW, /**< Orthographic view type of paper space UCS: 552 0 = UCS is not orthographic 553 1 = Top 554 2 = Bottom 555 3 = Front 556 4 = Back 557 5 = Left 558 6 = Right */ 559 PUCSXDIR, /**< Current paper space UCS X axis */ 560 PUCSYDIR, /**< Current paper space UCS Y axis */ 561 QTEXTMODE, /**< Quick Text mode on if nonzero */ 562 REGENMODE, /**< REGENAUTO mode on if nonzero */ 563 SHADEDGE, /**< 0 = Faces shaded, edges not highlighted 564 1 = Faces shaded, edges highlighted in black 565 2 = Faces not filled, edges in entity color 566 3 = Faces in entity color, edges in black */ 567 SHADEDIF, /**< Percent ambient/diffuse light range 1-100 568 default 70 */ 569 SHADOWPLANELOCATION, /**< Location of the ground shadow plane. This is a 570 Z axis ordinate. */ 571 SKETCHINC, /**< Sketch record increment */ 572 SKPOLY, /**< 0 = Sketch lines 573 1 = Sketch polylines */ 574 SORTENTS, /**< Controls the object sorting methods; accessible 575 from the Options dialog box User Preferences tab. 576 SORTENTS uses the following bitcodes: 577 0 = Disables SORTENTS 578 1 = Sorts for object selection 579 2 = Sorts for object snap 580 4 = Sorts for redraws 581 8 = Sorts for MSLIDE command slide creation 582 16 = Sorts for REGEN commands 583 32 = Sorts for plotting 584 64 = Sorts for PostScript output */ 585 SPLINESEGS, /**< Number of line segments per spline patch */ 586 SPLINETYPE, /**< Spline curve type for PEDIT Spline */ 587 SURFTAB1, /**< Number of mesh tabulations in first direction */ 588 SURFTAB2, /**< Number of mesh tabulations in second direction */ 589 SURFTYPE, /**< Surface type for PEDIT Smooth */ 590 SURFU, /**< Surface density (for PEDIT Smooth) in M direction */ 591 SURFV, /**< Surface density (for PEDIT Smooth) in N direction */ 592 TDCREATE, /**< Local date/time of drawing creation (see “Special 593 Handling of Date/Time Variables”) */ 594 TDINDWG, /**< Cumulative editing time for this drawing */ 595 TDUCREATE, /**< Universal date/time the drawing was created */ 596 TDUPDATE, /**< Local date/time of last drawing update */ 597 TDUSRTIMER, /**< User-elapsed timer */ 598 TDUUPDATE, /**< Universal date/time of the last update/save */ 599 TEXTSIZE, /**< Default text height */ 600 TEXTSTYLE, /**< Current text style name */ 601 THICKNESS, /**< Current thickness set by ELEV command */ 602 TILEMODE, /**< 1 for previous release compatibility mode 603 0 otherwise */ 604 TRACEWID, /**< Default trace width */ 605 TREEDEPTH, /**< Specifies the maximum depth of the spatial index */ 606 UCSBASE, /**< Name of the UCS that defines the origin and 607 orientation of orthographic UCS settings */ 608 UCSNAME, /**< Name of current UCS */ 609 UCSORG, /**< Origin of current UCS (in WCS) */ 610 UCSORGBACK, /**< Point which becomes the new UCS origin after 611 changing model space UCS to BACK when UCSBASE is 612 set to WORLD */ 613 UCSORGBOTTOM, /**< Point which becomes the new UCS origin after 614 changing model space UCS to BOTTOM when UCSBASE is 615 set to WORLD */ 616 UCSORGFRONT, /**< Point which becomes the new UCS origin after 617 changing model space UCS to FRONT when UCSBASE is 618 set to WORLD */ 619 UCSORGLEFT, /**< Point which becomes the new UCS origin after 620 changing model space UCS to LEFT when UCSBASE is 621 set to WORLD */ 622 UCSORGRIGHT, /**< Point which becomes the new UCS origin after 623 changing model space UCS to RIGHT when UCSBASE is 624 set to WORLD */ 625 UCSORGTOP, /**< Point which becomes the new UCS origin after 626 changing model space UCS to TOP when UCSBASE is 627 set to WORLD */ 628 UCSORTHOREF, /**< If model space UCS is orthographic (UCSORTHOVIEW 629 not equal to 0), this is the name of the UCS that 630 the orthographic UCS is relative to. If blank, UCS 631 is relative to WORLD */ 632 UCSORTHOVIEW, /**< Orthographic view type of model space UCS: 633 0 = UCS is not orthographic 634 1 = Top 635 2 = Bottom 636 3 = Front 637 4 = Back 638 5 = Left 639 6 = Right */ 640 UCSXDIR, /**< Direction of the current UCS X axis (in WCS) */ 641 UCSYDIR, /**< Direction of the current UCS Y axis (in WCS) */ 642 UNITMODE, /**< Low bit set = Display fractions, feet-and-inches, 643 and surveyor's angles in input format */ 644 USERI1, /**< Five integer variables intended for use by 645 third-party developers */ 646 USERI2, USERI3, USERI4, USERI5, USERR1, /**< Five real variables intended for use by 647 third-party developers */ 648 USERR2, USERR3, USERR4, USERR5, USRTIMER, /**< 0 = Timer off 649 1 = Timer on */ 650 VERSIONGUID, /**< Uniquely identifies a particular version of a 651 drawing. Updated when the drawing is modified */ 652 VISRETAIN, /**< 0 = Don't retain xref-dependent visibility settings 653 1 = Retain xref-dependent visibility settings */ 654 WORLDVIEW, /**< 1 = Set UCS to WCS during DVIEW/VPOINT 655 0 = Don't change UCS */ 656 XCLIPFRAME, /**< Controls the visibility of xref clipping 657 boundaries: 658 0 = Clipping boundary is not visible 659 1 = Clipping boundary is visible */ 660 XEDIT, /**< Controls whether the current drawing can be edited 661 in-place when being referenced by another drawing. 662 0 = Can't use in-place reference editing 663 1 = Can use in-place reference editing */ 664 SPLFRAME, /** ? */ 665 WORDLVIEW, /** ? */ 666 PELLIPSE, /** ? */ 667 ISOLINES, /** ? */ 668 TEXTQLTY, /** ? */ 669 FACETRES, /** ? */ 670 DIMFRAC, /** ? */ 671 OLESTARTUP, /** ? */ 672 STYLESHEET, /** ? */ 673 TSTACKALIGN, /**< default = 1 (not present in DXF) */ 674 TSTACKSIZE, /**< default = 70 (not present in DXF) */ 675 MAX_HEADER_CONSTANT = 1000 /**< max + num for user constants */ 676 677 }; 678 public: 679 CADHeader(); 680 /** 681 * @brief Add new value to the CAD file header 682 * @param code The code from constants enum 683 * @param val Value to add 684 * @return SUCCESS or some value from CADErrorCodes 685 */ 686 int addValue( short code, const CADVariant& val ); 687 int addValue( short code, const char * val ); 688 //int addValue( short code, long val ); 689 int addValue( short code, int val ); 690 int addValue( short code, short val ); 691 int addValue( short code, double val ); 692 int addValue( short code, const std::string& val ); 693 int addValue( short code, bool val ); 694 int addValue( short code, double x, double y, double z = 0 ); 695 int addValue( short code, long julianday, long milliseconds ); 696 static int getGroupCode( short code ); 697 const CADVariant getValue( short code, const CADVariant& val = CADVariant() ) const; 698 static const char * getValueName( short code ); 699 void print() const; 700 size_t getSize() const; 701 short getCode( int index ) const; 702 protected: 703 std::map<short, CADVariant> valuesMap; 704 }; 705 706 #endif // CADHEADER_H 707