| 1 | /**************************************************************************** |
| 2 | ** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved. |
| 3 | ** Copyright (C) 2001 Robert J. Campbell Jr. |
| 4 | ** |
| 5 | ** This file is part of the dxflib project. |
| 6 | ** |
| 7 | ** This file is free software; you can redistribute it and/or modify |
| 8 | ** it under the terms of the GNU General Public License as published by |
| 9 | ** the Free Software Foundation; either version 2 of the License, or |
| 10 | ** (at your option) any later version. |
| 11 | ** |
| 12 | ** Licensees holding valid dxflib Professional Edition licenses may use |
| 13 | ** this file in accordance with the dxflib Commercial License |
| 14 | ** Agreement provided with the Software. |
| 15 | ** |
| 16 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 17 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 18 | ** |
| 19 | ** See http://www.ribbonsoft.com for further details. |
| 20 | ** |
| 21 | ** Contact [email protected] if any conditions of this licensing are |
| 22 | ** not clear to you. |
| 23 | ** |
| 24 | **********************************************************************/ |
| 25 | |
| 26 | #ifndef DL_WRITER_H |
| 27 | #define DL_WRITER_Hcxx . . $ `libs/qCC_io/extern/dxflib/src/dl_writer.h:27:9`! |
| 28 | |
| 29 | #include "dl_global.h"cxx . . $ `<file>/libs/qCC_io/extern/dxflib/src/dl_global.h`/ |
| 30 | |
| 31 | #ifndef _WIN32 |
| 32 | #include <strings.h> |
| 33 | #endif |
| 34 | |
| 35 | #if _MSC_VER > 1000 |
| 36 | #pragma once |
| 37 | #endif // _MSC_VER > 1000 |
| 38 | |
| 39 | #include <iostream> |
| 40 | #include <algorithm> |
| 41 | |
| 42 | #include "dl_attributes.h"cxx . . $ `<file>/libs/qCC_io/extern/dxflib/src/dl_attributes.h`/ |
| 43 | #include "dl_codes.h"cxx . . $ `<file>/libs/qCC_io/extern/dxflib/src/dl_codes.h`/ |
| 44 | |
| 45 | |
| 46 | |
| 47 | /** |
| 48 | * Defines interface for writing low level DXF constructs to |
| 49 | * a file. Implementation is defined in derived classes that write |
| 50 | * to binary or ASCII files. |
| 51 | * |
| 52 | * Implements functions that write higher level constructs in terms of |
| 53 | * the low level ones. |
| 54 | * |
| 55 | * @todo Add error checking for string/entry length. |
| 56 | */ |
| 57 | class DXFLIB_EXPORTcxx . . $ `/build/tmp.dLA5QBHzaL/package/libs/qCC_io/extern/dxflib/src/dl_global.h:12:12`! DL_Writercxx . . $ DL_Writer# { |
| 58 | public: |
| 59 | /** |
| 60 | * @param version DXF version. Defaults to DL_VERSION_2002. |
| 61 | */ |
| 62 | DL_Writercxx . . $ DL_Writer#DL_Writer(680a1977e09fa966).(DL_Codescxx . . $ DL_Codes#::versioncxx . . $ DL_Codes#version# version) : m_handlecxx . . $ DL_Writer#m_handle.(0x30) { |
| 63 | this->versioncxx . . $ DL_Writer#version. = version; |
| 64 | modelSpaceHandlecxx . . $ DL_Writer#modelSpaceHandle. = 0; |
| 65 | paperSpaceHandlecxx . . $ DL_Writer#paperSpaceHandle. = 0; |
| 66 | paperSpace0Handlecxx . . $ DL_Writer#paperSpace0Handle. = 0; |
| 67 | } |
| 68 | |
| 69 | virtual ~cxx . . $ DL_Writer#`~DL_Writer`(49f6e7a06ebc5aa8).DL_Writercxx . . $ DL_Writer#() {} |
| 70 | ; |
| 71 | |
| 72 | /** Generic section for section 'name'. |
| 73 | * |
| 74 | * <pre> |
| 75 | * 0 |
| 76 | * SECTION |
| 77 | * 2 |
| 78 | * name |
| 79 | * </pre> |
| 80 | */ |
| 81 | void sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).(const char* name) const { |
| 82 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "SECTION"); |
| 83 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(2, name); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Section HEADER |
| 88 | * |
| 89 | * <pre> |
| 90 | * 0 |
| 91 | * SECTION |
| 92 | * 2 |
| 93 | * HEADER |
| 94 | * </pre> |
| 95 | */ |
| 96 | void sectionHeadercxx . . $ DL_Writer#sectionHeader(83f5f38750778ac8).() const { |
| 97 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("HEADER"); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Section TABLES |
| 102 | * |
| 103 | * <pre> |
| 104 | * 0 |
| 105 | * SECTION |
| 106 | * 2 |
| 107 | * TABLES |
| 108 | * </pre> |
| 109 | */ |
| 110 | void sectionTablescxx . . $ DL_Writer#sectionTables(83f5f38750778ac8).() const { |
| 111 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("TABLES"); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Section BLOCKS |
| 116 | * |
| 117 | * <pre> |
| 118 | * 0 |
| 119 | * SECTION |
| 120 | * 2 |
| 121 | * BLOCKS |
| 122 | * </pre> |
| 123 | */ |
| 124 | void sectionBlockscxx . . $ DL_Writer#sectionBlocks(83f5f38750778ac8).() const { |
| 125 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("BLOCKS"); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Section ENTITIES |
| 130 | * |
| 131 | * <pre> |
| 132 | * 0 |
| 133 | * SECTION |
| 134 | * 2 |
| 135 | * ENTITIES |
| 136 | * </pre> |
| 137 | */ |
| 138 | void sectionEntitiescxx . . $ DL_Writer#sectionEntities(83f5f38750778ac8).() const { |
| 139 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("ENTITIES"); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Section CLASSES |
| 144 | * |
| 145 | * <pre> |
| 146 | * 0 |
| 147 | * SECTION |
| 148 | * 2 |
| 149 | * CLASSES |
| 150 | * </pre> |
| 151 | */ |
| 152 | void sectionClassescxx . . $ DL_Writer#sectionClasses(83f5f38750778ac8).() const { |
| 153 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("CLASSES"); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Section OBJECTS |
| 158 | * |
| 159 | * <pre> |
| 160 | * 0 |
| 161 | * SECTION |
| 162 | * 2 |
| 163 | * OBJECTS |
| 164 | * </pre> |
| 165 | */ |
| 166 | void sectionObjectscxx . . $ DL_Writer#sectionObjects(83f5f38750778ac8).() const { |
| 167 | sectioncxx . . $ DL_Writer#section(acfedb98bf840c77).("OBJECTS"); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * End of a section. |
| 172 | * |
| 173 | * <pre> |
| 174 | * 0 |
| 175 | * ENDSEC |
| 176 | * </pre> |
| 177 | */ |
| 178 | void sectionEndcxx . . $ DL_Writer#sectionEnd(83f5f38750778ac8).() const { |
| 179 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "ENDSEC"); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Generic table for table 'name' with 'num' entries: |
| 184 | * |
| 185 | * <pre> |
| 186 | * 0 |
| 187 | * TABLE |
| 188 | * 2 |
| 189 | * name |
| 190 | * 70 |
| 191 | * num |
| 192 | * </pre> |
| 193 | */ |
| 194 | void tablecxx . . $ DL_Writer#table(d79d5232a8abe1b).(const char* name, int num, int h=0) const { |
| 195 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "TABLE"); |
| 196 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(2, name); |
| 197 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#AC1015.) { |
| 198 | if (h==0) { |
| 199 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 200 | } |
| 201 | else { |
| 202 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 203 | } |
| 204 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbSymbolTable"); |
| 205 | } |
| 206 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(70, num); |
| 207 | } |
| 208 | |
| 209 | /** Table for layers. |
| 210 | * |
| 211 | * @param num Number of layers in total. |
| 212 | * |
| 213 | * <pre> |
| 214 | * 0 |
| 215 | * TABLE |
| 216 | * 2 |
| 217 | * LAYER |
| 218 | * 70 |
| 219 | * num |
| 220 | * </pre> |
| 221 | */ |
| 222 | void tableLayerscxx . . $ DL_Writer#tableLayers(d76a70202c25db1).(int num) const { |
| 223 | tablecxx . . $ DL_Writer#table(d79d5232a8abe1b).("LAYER", num, 2); |
| 224 | } |
| 225 | |
| 226 | /** Table for line types. |
| 227 | * |
| 228 | * @param num Number of line types in total. |
| 229 | * |
| 230 | * <pre> |
| 231 | * 0 |
| 232 | * TABLE |
| 233 | * 2 |
| 234 | * LTYPE |
| 235 | * 70 |
| 236 | * num |
| 237 | * </pre> |
| 238 | */ |
| 239 | void tableLinetypescxx . . $ DL_Writer#tableLinetypes(d76a70202c25db1).(int num) const { |
| 240 | //linetypeHandle = 5; |
| 241 | tablecxx . . $ DL_Writer#table(d79d5232a8abe1b).("LTYPE", num, 5); |
| 242 | } |
| 243 | |
| 244 | /** Table for application id. |
| 245 | * |
| 246 | * @param num Number of registered applications in total. |
| 247 | * |
| 248 | * <pre> |
| 249 | * 0 |
| 250 | * TABLE |
| 251 | * 2 |
| 252 | * APPID |
| 253 | * 70 |
| 254 | * num |
| 255 | * </pre> |
| 256 | */ |
| 257 | void tableAppidcxx . . $ DL_Writer#tableAppid(d76a70202c25db1).(int num) const { |
| 258 | tablecxx . . $ DL_Writer#table(d79d5232a8abe1b).("APPID", num, 9); |
| 259 | } |
| 260 | |
| 261 | /** Table for text style. |
| 262 | * |
| 263 | * @param num Number of text styles. |
| 264 | * |
| 265 | * <pre> |
| 266 | * 0 |
| 267 | * TABLE |
| 268 | * 2 |
| 269 | * STYLE |
| 270 | * 70 |
| 271 | * num |
| 272 | * </pre> |
| 273 | */ |
| 274 | void tableStylecxx . . $ DL_Writer#tableStyle(d76a70202c25db1).(int num) const { |
| 275 | tablecxx . . $ DL_Writer#table(d79d5232a8abe1b).("STYLE", num, 3); |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * End of a table. |
| 280 | * |
| 281 | * <pre> |
| 282 | * 0 |
| 283 | * ENDTAB |
| 284 | * </pre> |
| 285 | */ |
| 286 | void tableEndcxx . . $ DL_Writer#tableEnd(83f5f38750778ac8).() const { |
| 287 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "ENDTAB"); |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * End of the DXF file. |
| 292 | * |
| 293 | * <pre> |
| 294 | * 0 |
| 295 | * EOF |
| 296 | * </pre> |
| 297 | */ |
| 298 | void dxfEOFcxx . . $ DL_Writer#dxfEOF(83f5f38750778ac8).() const { |
| 299 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "EOF"); |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Comment. |
| 304 | * |
| 305 | * <pre> |
| 306 | * 999 |
| 307 | * text |
| 308 | * </pre> |
| 309 | */ |
| 310 | void commentcxx . . $ DL_Writer#comment(acfedb98bf840c77).(const char* text) const { |
| 311 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(999, text); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Entity. |
| 316 | * |
| 317 | * <pre> |
| 318 | * 0 |
| 319 | * entTypeName |
| 320 | * </pre> |
| 321 | * |
| 322 | * @return Unique handle or 0. |
| 323 | */ |
| 324 | void entitycxx . . $ DL_Writer#entity(acfedb98bf840c77).(const char* entTypeName) const { |
| 325 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, entTypeName); |
| 326 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#AC1015.) { |
| 327 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * Attributes of an entity. |
| 333 | * |
| 334 | * <pre> |
| 335 | * 8 |
| 336 | * layer |
| 337 | * 62 |
| 338 | * color |
| 339 | * 39 |
| 340 | * width |
| 341 | * 6 |
| 342 | * linetype |
| 343 | * </pre> |
| 344 | */ |
| 345 | void entityAttributescxx . . $ DL_Writer#entityAttributes(f43f953b8a4e6765).(const DL_Attributescxx . . $ DL_Attributes#& attrib) const { |
| 346 | |
| 347 | // layer name: |
| 348 | dxfStringcxx . . $ DL_Writer#dxfString(8afd1a062aafdef8).(8, attrib.getLayercxx . . $ DL_Attributes#getLayer(219584694fe2b248).()); |
| 349 | |
| 350 | // R12 doesn't accept BYLAYER values. The value has to be missing |
| 351 | // in that case. |
| 352 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#AC1015. || attrib.getColorcxx . . $ DL_Attributes#getColor(455f465bc33b4cdf).()!=256) { |
| 353 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(62, attrib.getColorcxx . . $ DL_Attributes#getColor(455f465bc33b4cdf).()); |
| 354 | } |
| 355 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#AC1015. && attrib.getColor24cxx . . $ DL_Attributes#getColor24(455f465bc33b4cdf).()!=-1) { |
| 356 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(420, attrib.getColor24cxx . . $ DL_Attributes#getColor24(455f465bc33b4cdf).()); |
| 357 | } |
| 358 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#) { |
| 359 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(370, attrib.getWidthcxx . . $ DL_Attributes#getWidth(455f465bc33b4cdf).()); |
| 360 | } |
| 361 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ `libs/qCC_io/extern/dxflib/src/dl_codes.h:378:9`!) { |
| 362 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(48, attrib.getLinetypeScalecxx . . $ DL_Attributes#getLinetypeScale(21b6c25e127938e2).()); |
| 363 | } |
| 364 | stdcxx . . $ std/::stringcxx . . $ std/string# linetype = attribcxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f)..getLinetypecxx . . $ DL_Attributes#getLinetype(219584694fe2b248).(); |
| 365 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(linetype.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), linetype.endcxx . . $ std/__cxx11/basic_string#end(2d83d3f7098a8e9c).(), linetype.begincxx . . $ std/__cxx11/basic_string#begin(2d83d3f7098a8e9c).(), ::toupper); |
| 366 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ `libs/qCC_io/extern/dxflib/src/dl_codes.h:378:9`! || linetype==cxx . . $ std/`operator==`(4b17aa87c9f300c6)."BYLAYER") { |
| 367 | dxfStringcxx . . $ DL_Writer#dxfString(8afd1a062aafdef8).(6, attrib.getLinetypecxx . . $ DL_Attributes#getLinetype(219584694fe2b248).()); |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Subclass. |
| 373 | */ |
| 374 | void subClasscxx . . $ DL_Writer#subClass(acfedb98bf840c77).(const char* sub) const { |
| 375 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, sub); |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * Layer (must be in the TABLES section LAYER). |
| 380 | * |
| 381 | * <pre> |
| 382 | * 0 |
| 383 | * LAYER |
| 384 | * </pre> |
| 385 | */ |
| 386 | void tableLayerEntrycxx . . $ DL_Writer#tableLayerEntry(cf8bf0a838713cc4).(unsigned long int h=0) const { |
| 387 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "LAYER"); |
| 388 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#) { |
| 389 | if (h==0) { |
| 390 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 391 | } else { |
| 392 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 393 | } |
| 394 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbSymbolTableRecord"); |
| 395 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbLayerTableRecord"); |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Line type (must be in the TABLES section LTYPE). |
| 401 | * |
| 402 | * <pre> |
| 403 | * 0 |
| 404 | * LTYPE |
| 405 | * </pre> |
| 406 | */ |
| 407 | void tableLinetypeEntrycxx . . $ DL_Writer#tableLinetypeEntry(cf8bf0a838713cc4).(unsigned long int h=0) const { |
| 408 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "LTYPE"); |
| 409 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ `libs/qCC_io/extern/dxflib/src/dl_codes.h:378:9`!) { |
| 410 | if (h==0) { |
| 411 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 412 | } else { |
| 413 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 414 | } |
| 415 | //dxfHex(330, 0x5); |
| 416 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbSymbolTableRecord"); |
| 417 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbLinetypeTableRecord"); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Appid (must be in the TABLES section APPID). |
| 423 | * |
| 424 | * <pre> |
| 425 | * 0 |
| 426 | * APPID |
| 427 | * </pre> |
| 428 | */ |
| 429 | void tableAppidEntrycxx . . $ DL_Writer#tableAppidEntry(cf8bf0a838713cc4).(unsigned long int h=0) const { |
| 430 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "APPID"); |
| 431 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#) { |
| 432 | if (h==0) { |
| 433 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 434 | } else { |
| 435 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 436 | } |
| 437 | //dxfHex(330, 0x9); |
| 438 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbSymbolTableRecord"); |
| 439 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbRegAppTableRecord"); |
| 440 | } |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Block (must be in the section BLOCKS). |
| 445 | * |
| 446 | * <pre> |
| 447 | * 0 |
| 448 | * BLOCK |
| 449 | * </pre> |
| 450 | */ |
| 451 | void sectionBlockEntrycxx . . $ DL_Writer#sectionBlockEntry(cf8bf0a838713cc4).(unsigned long int h=0) const { |
| 452 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "BLOCK"); |
| 453 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#) { |
| 454 | if (h==0) { |
| 455 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 456 | } else { |
| 457 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 458 | } |
| 459 | //dxfHex(330, blockHandle); |
| 460 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbEntity"); |
| 461 | if (h==0x1C) { |
| 462 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(67, 1); |
| 463 | } |
| 464 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(8, "0"); // TODO: Layer for block |
| 465 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbBlockBegin"); |
| 466 | } |
| 467 | } |
| 468 | |
| 469 | /** |
| 470 | * End of Block (must be in the section BLOCKS). |
| 471 | * |
| 472 | * <pre> |
| 473 | * 0 |
| 474 | * ENDBLK |
| 475 | * </pre> |
| 476 | */ |
| 477 | void sectionBlockEntryEndcxx . . $ DL_Writer#sectionBlockEntryEnd(cf8bf0a838713cc4).(unsigned long int h=0) const { |
| 478 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(0, "ENDBLK"); |
| 479 | if (versioncxx . . $ DL_Writer#version.>=DL_VERSION_2000cxx . . $ DL_Codes#AC1015.) { |
| 480 | if (h==0) { |
| 481 | handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(); |
| 482 | } else { |
| 483 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(5, h); |
| 484 | } |
| 485 | //dxfHex(330, blockHandle); |
| 486 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbEntity"); |
| 487 | if (h==0x1D) { |
| 488 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(67, 1); |
| 489 | } |
| 490 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(8, "0"); // TODO: Layer for block |
| 491 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(100, "AcDbBlockEnd"); |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | void colorcxx . . $ DL_Writer#color(d76a70202c25db1).(int col=256) const { |
| 496 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(62, col); |
| 497 | } |
| 498 | void linetypecxx . . $ DL_Writer#linetype(acfedb98bf840c77).(const char *lt) const { |
| 499 | dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(6, lt); |
| 500 | } |
| 501 | void linetypeScalecxx . . $ DL_Writer#linetypeScale(1f33e600eefd7a1).(double scale) const { |
| 502 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(48, scale); |
| 503 | } |
| 504 | void lineWeightcxx . . $ DL_Writer#lineWeight(d76a70202c25db1).(int lw) const { |
| 505 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(370, lw); |
| 506 | } |
| 507 | |
| 508 | void coordcxx . . $ DL_Writer#coord(364fed4622c56a73).(int gc, double x, double y, double z=0) const { |
| 509 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc, x); |
| 510 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc+10, y); |
| 511 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc+20, z); |
| 512 | } |
| 513 | |
| 514 | void coordTripletcxx . . $ DL_Writer#coordTriplet(43f1fac29a8429d9).(int gc, const double* value) const { |
| 515 | if (value) { |
| 516 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc, *value++); |
| 517 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc+10, *value++); |
| 518 | dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(gc+20, *value++); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | void resetHandlecxx . . $ DL_Writer#resetHandle(83f5f38750778ac8).() const { |
| 523 | m_handlecxx . . $ DL_Writer#m_handle. = 1; |
| 524 | } |
| 525 | |
| 526 | /** |
| 527 | * Writes a unique handle and returns it. |
| 528 | */ |
| 529 | unsigned long handlecxx . . $ DL_Writer#handle(79dc3568750208f6).(int gc=5) const { |
| 530 | // handle has to be hex |
| 531 | dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(gc, m_handlecxx . . $ DL_Writer#m_handle.); |
| 532 | return m_handlecxx . . $ DL_Writer#m_handle.++; |
| 533 | } |
| 534 | |
| 535 | /** |
| 536 | * @return Next handle that will be written. |
| 537 | */ |
| 538 | unsigned long getNextHandlecxx . . $ DL_Writer#getNextHandle(fe4d2d262d4164a8).() const { |
| 539 | return m_handlecxx . . $ DL_Writer#m_handle.; |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * Increases handle, so that the handle returned remains available. |
| 544 | */ |
| 545 | unsigned long incHandlecxx . . $ DL_Writer#incHandle(fe4d2d262d4164a8).() const { |
| 546 | return m_handlecxx . . $ DL_Writer#m_handle.++; |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * Sets the handle of the model space. Entities refer to |
| 551 | * this handle. |
| 552 | */ |
| 553 | void setModelSpaceHandlecxx . . $ DL_Writer#setModelSpaceHandle(2c44cd906ae4e829).(unsigned long h) { |
| 554 | modelSpaceHandlecxx . . $ DL_Writer#modelSpaceHandle. = h; |
| 555 | } |
| 556 | |
| 557 | unsigned long getModelSpaceHandlecxx . . $ DL_Writer#getModelSpaceHandle(f708dce9a8856c70).() { |
| 558 | return modelSpaceHandlecxx . . $ DL_Writer#modelSpaceHandle.; |
| 559 | } |
| 560 | |
| 561 | /** |
| 562 | * Sets the handle of the paper space. Some special blocks refer to |
| 563 | * this handle. |
| 564 | */ |
| 565 | void setPaperSpaceHandlecxx . . $ DL_Writer#setPaperSpaceHandle(2c44cd906ae4e829).(unsigned long h) { |
| 566 | paperSpaceHandlecxx . . $ DL_Writer#paperSpaceHandle. = h; |
| 567 | } |
| 568 | |
| 569 | unsigned long getPaperSpaceHandlecxx . . $ DL_Writer#getPaperSpaceHandle(f708dce9a8856c70).() { |
| 570 | return paperSpaceHandlecxx . . $ DL_Writer#paperSpaceHandle.; |
| 571 | } |
| 572 | |
| 573 | /** |
| 574 | * Sets the handle of the paper space 0. Some special blocks refer to |
| 575 | * this handle. |
| 576 | */ |
| 577 | void setPaperSpace0Handlecxx . . $ DL_Writer#setPaperSpace0Handle(2c44cd906ae4e829).(unsigned long h) { |
| 578 | paperSpace0Handlecxx . . $ DL_Writer#paperSpace0Handle. = h; |
| 579 | } |
| 580 | |
| 581 | unsigned long getPaperSpace0Handlecxx . . $ DL_Writer#getPaperSpace0Handle(f708dce9a8856c70).() { |
| 582 | return paperSpace0Handlecxx . . $ DL_Writer#paperSpace0Handle.; |
| 583 | } |
| 584 | |
| 585 | /** |
| 586 | * Must be overwritten by the implementing class to write a |
| 587 | * real value to the file. |
| 588 | * |
| 589 | * @param gc Group code. |
| 590 | * @param value The real value. |
| 591 | */ |
| 592 | virtual void dxfRealcxx . . $ DL_Writer#dxfReal(4a50f1d9a5f67043).(int gc, double value) const = 0; |
| 593 | |
| 594 | /** |
| 595 | * Must be overwritten by the implementing class to write an |
| 596 | * int value to the file. |
| 597 | * |
| 598 | * @param gc Group code. |
| 599 | * @param value The int value. |
| 600 | */ |
| 601 | virtual void dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(int gc, int value) const = 0; |
| 602 | |
| 603 | /** |
| 604 | * Can be overwritten by the implementing class to write a |
| 605 | * bool value to the file. |
| 606 | * |
| 607 | * @param gc Group code. |
| 608 | * @param value The bool value. |
| 609 | */ |
| 610 | virtual void dxfBoolcxx . . $ DL_Writer#dxfBool(98eef454720f5b5d).(int gc, bool value) const { |
| 611 | dxfIntcxx . . $ DL_Writer#dxfInt(db7b78144a373e11).(gc, (int)value); |
| 612 | } |
| 613 | |
| 614 | /** |
| 615 | * Must be overwritten by the implementing class to write an |
| 616 | * int value (hex) to the file. |
| 617 | * |
| 618 | * @param gc Group code. |
| 619 | * @param value The int value. |
| 620 | */ |
| 621 | virtual void dxfHexcxx . . $ DL_Writer#dxfHex(db7b78144a373e11).(int gc, int value) const = 0; |
| 622 | |
| 623 | /** |
| 624 | * Must be overwritten by the implementing class to write a |
| 625 | * string to the file. |
| 626 | * |
| 627 | * @param gc Group code. |
| 628 | * @param value The string. |
| 629 | */ |
| 630 | virtual void dxfStringcxx . . $ DL_Writer#dxfString(7bb2515ceb313a32).(int gc, const char* value) const = 0; |
| 631 | |
| 632 | /** |
| 633 | * Must be overwritten by the implementing class to write a |
| 634 | * string to the file. |
| 635 | * |
| 636 | * @param gc Group code. |
| 637 | * @param value The string. |
| 638 | */ |
| 639 | virtual void dxfStringcxx . . $ DL_Writer#dxfString(8afd1a062aafdef8).(int gc, const stdcxx . . $ std/::stringcxx . . $ std/string#& value) const = 0; |
| 640 | |
| 641 | protected: |
| 642 | mutable unsigned long m_handlecxx . . $ DL_Writer#m_handle.; |
| 643 | mutable unsigned long modelSpaceHandlecxx . . $ DL_Writer#modelSpaceHandle.; |
| 644 | mutable unsigned long paperSpaceHandlecxx . . $ DL_Writer#paperSpaceHandle.; |
| 645 | mutable unsigned long paperSpace0Handlecxx . . $ DL_Writer#paperSpace0Handle.; |
| 646 | |
| 647 | /** |
| 648 | * DXF version to be created. |
| 649 | */ |
| 650 | DL_Codescxx . . $ DL_Codes#::versioncxx . . $ DL_Codes#version# versioncxx . . $ DL_Writer#version.; |
| 651 | private: |
| 652 | }; |
| 653 | |
| 654 | #endif |