ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
dl_codes.h
Go to the documentation of this file.
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 info@ribbonsoft.com if any conditions of this licensing are
22 ** not clear to you.
23 **
24 **********************************************************************/
25 
30 #ifndef DXF_CODES_H
31 #define DXF_CODES_H
32 
33 #include "dl_global.h"
34 
35 #if _MSC_VER > 1000
36 #pragma once
37 #endif // _MSC_VER > 1000
38 
39 #if defined(__OS2__) || defined(__EMX__)
40 #define strcasecmp(s, t) stricmp(s, t)
41 #endif
42 
43 #if defined(_WIN32)
44 #define strcasecmp(s, t) _stricmp(s, t)
45 #endif
46 
47 #ifdef _WIN32
48 #undef M_PI
49 #define M_PI 3.14159265358979323846
50 #pragma warning(disable : 4800)
51 #endif
52 
53 #ifndef M_PI
54 #define M_PI 3.1415926535897932384626433832795
55 #endif
56 
57 #define DL_DXF_MAXLINE 1024
58 #define DL_DXF_MAXGROUPCODE 1100
59 
60 // used to mark invalid vectors:
61 // #define DL_DXF_MAXDOUBLE 1.0E+10
62 
67 public:
71  enum color {
72  black = 250,
73  green = 3,
74  red = 1,
75  brown = 15,
76  yellow = 2,
77  cyan = 4,
78  magenta = 6,
79  gray = 8,
80  blue = 5,
81  l_blue = 163,
82  l_green = 121,
83  l_cyan = 131,
84  l_red = 23,
85  l_magenta = 221,
86  l_gray = 252,
87  white = 7,
88  bylayer = 256,
89  byblock = 0
90  };
91 
95  enum version {
96  AC1009_MIN, // R12, minimalistic
97  AC1009, // R12
100  AC1015 // R2000
101  };
102 };
103 
104 // Extended color palette:
105 // The first entry is only for direct indexing starting with [1]
106 // Color 1 is red (1,0,0)
107 const double dxfColors[][3] = {
108  {0, 0, 0}, // unused
109  {1, 0, 0}, // 1
110  {1, 1, 0},
111  {0, 1, 0},
112  {0, 1, 1},
113  {0, 0, 1},
114  {1, 0, 1},
115  {1, 1, 1}, // black or white
116  {0.5, 0.5, 0.5},
117  {0.75, 0.75, 0.75},
118  {1, 0, 0}, // 10
119  {1, 0.5, 0.5},
120  {0.65, 0, 0},
121  {0.65, 0.325, 0.325},
122  {0.5, 0, 0},
123  {0.5, 0.25, 0.25},
124  {0.3, 0, 0},
125  {0.3, 0.15, 0.15},
126  {0.15, 0, 0},
127  {0.15, 0.075, 0.075},
128  {1, 0.25, 0}, // 20
129  {1, 0.625, 0.5},
130  {0.65, 0.1625, 0},
131  {0.65, 0.4063, 0.325},
132  {0.5, 0.125, 0},
133  {0.5, 0.3125, 0.25},
134  {0.3, 0.075, 0},
135  {0.3, 0.1875, 0.15},
136  {0.15, 0.0375, 0},
137  {0.15, 0.0938, 0.075},
138  {1, 0.5, 0}, // 30
139  {1, 0.75, 0.5},
140  {0.65, 0.325, 0},
141  {0.65, 0.4875, 0.325},
142  {0.5, 0.25, 0},
143  {0.5, 0.375, 0.25},
144  {0.3, 0.15, 0},
145  {0.3, 0.225, 0.15},
146  {0.15, 0.075, 0},
147  {0.15, 0.1125, 0.075},
148  {1, 0.75, 0}, // 40
149  {1, 0.875, 0.5},
150  {0.65, 0.4875, 0},
151  {0.65, 0.5688, 0.325},
152  {0.5, 0.375, 0},
153  {0.5, 0.4375, 0.25},
154  {0.3, 0.225, 0},
155  {0.3, 0.2625, 0.15},
156  {0.15, 0.1125, 0},
157  {0.15, 0.1313, 0.075},
158  {1, 1, 0}, // 50
159  {1, 1, 0.5},
160  {0.65, 0.65, 0},
161  {0.65, 0.65, 0.325},
162  {0.5, 0.5, 0},
163  {0.5, 0.5, 0.25},
164  {0.3, 0.3, 0},
165  {0.3, 0.3, 0.15},
166  {0.15, 0.15, 0},
167  {0.15, 0.15, 0.075},
168  {0.75, 1, 0}, // 60
169  {0.875, 1, 0.5},
170  {0.4875, 0.65, 0},
171  {0.5688, 0.65, 0.325},
172  {0.375, 0.5, 0},
173  {0.4375, 0.5, 0.25},
174  {0.225, 0.3, 0},
175  {0.2625, 0.3, 0.15},
176  {0.1125, 0.15, 0},
177  {0.1313, 0.15, 0.075},
178  {0.5, 1, 0}, // 70
179  {0.75, 1, 0.5},
180  {0.325, 0.65, 0},
181  {0.4875, 0.65, 0.325},
182  {0.25, 0.5, 0},
183  {0.375, 0.5, 0.25},
184  {0.15, 0.3, 0},
185  {0.225, 0.3, 0.15},
186  {0.075, 0.15, 0},
187  {0.1125, 0.15, 0.075},
188  {0.25, 1, 0}, // 80
189  {0.625, 1, 0.5},
190  {0.1625, 0.65, 0},
191  {0.4063, 0.65, 0.325},
192  {0.125, 0.5, 0},
193  {0.3125, 0.5, 0.25},
194  {0.075, 0.3, 0},
195  {0.1875, 0.3, 0.15},
196  {0.0375, 0.15, 0},
197  {0.0938, 0.15, 0.075},
198  {0, 1, 0}, // 90
199  {0.5, 1, 0.5},
200  {0, 0.65, 0},
201  {0.325, 0.65, 0.325},
202  {0, 0.5, 0},
203  {0.25, 0.5, 0.25},
204  {0, 0.3, 0},
205  {0.15, 0.3, 0.15},
206  {0, 0.15, 0},
207  {0.075, 0.15, 0.075},
208  {0, 1, 0.25}, // 100
209  {0.5, 1, 0.625},
210  {0, 0.65, 0.1625},
211  {0.325, 0.65, 0.4063},
212  {0, 0.5, 0.125},
213  {0.25, 0.5, 0.3125},
214  {0, 0.3, 0.075},
215  {0.15, 0.3, 0.1875},
216  {0, 0.15, 0.0375},
217  {0.075, 0.15, 0.0938},
218  {0, 1, 0.5}, // 110
219  {0.5, 1, 0.75},
220  {0, 0.65, 0.325},
221  {0.325, 0.65, 0.4875},
222  {0, 0.5, 0.25},
223  {0.25, 0.5, 0.375},
224  {0, 0.3, 0.15},
225  {0.15, 0.3, 0.225},
226  {0, 0.15, 0.075},
227  {0.075, 0.15, 0.1125},
228  {0, 1, 0.75}, // 120
229  {0.5, 1, 0.875},
230  {0, 0.65, 0.4875},
231  {0.325, 0.65, 0.5688},
232  {0, 0.5, 0.375},
233  {0.25, 0.5, 0.4375},
234  {0, 0.3, 0.225},
235  {0.15, 0.3, 0.2625},
236  {0, 0.15, 0.1125},
237  {0.075, 0.15, 0.1313},
238  {0, 1, 1}, // 130
239  {0.5, 1, 1},
240  {0, 0.65, 0.65},
241  {0.325, 0.65, 0.65},
242  {0, 0.5, 0.5},
243  {0.25, 0.5, 0.5},
244  {0, 0.3, 0.3},
245  {0.15, 0.3, 0.3},
246  {0, 0.15, 0.15},
247  {0.075, 0.15, 0.15},
248  {0, 0.75, 1}, // 140
249  {0.5, 0.875, 1},
250  {0, 0.4875, 0.65},
251  {0.325, 0.5688, 0.65},
252  {0, 0.375, 0.5},
253  {0.25, 0.4375, 0.5},
254  {0, 0.225, 0.3},
255  {0.15, 0.2625, 0.3},
256  {0, 0.1125, 0.15},
257  {0.075, 0.1313, 0.15},
258  {0, 0.5, 1}, // 150
259  {0.5, 0.75, 1},
260  {0, 0.325, 0.65},
261  {0.325, 0.4875, 0.65},
262  {0, 0.25, 0.5},
263  {0.25, 0.375, 0.5},
264  {0, 0.15, 0.3},
265  {0.15, 0.225, 0.3},
266  {0, 0.075, 0.15},
267  {0.075, 0.1125, 0.15},
268  {0, 0.25, 1}, // 160
269  {0.5, 0.625, 1},
270  {0, 0.1625, 0.65},
271  {0.325, 0.4063, 0.65},
272  {0, 0.125, 0.5},
273  {0.25, 0.3125, 0.5},
274  {0, 0.075, 0.3},
275  {0.15, 0.1875, 0.3},
276  {0, 0.0375, 0.15},
277  {0.075, 0.0938, 0.15},
278  {0, 0, 1}, // 170
279  {0.5, 0.5, 1},
280  {0, 0, 0.65},
281  {0.325, 0.325, 0.65},
282  {0, 0, 0.5},
283  {0.25, 0.25, 0.5},
284  {0, 0, 0.3},
285  {0.15, 0.15, 0.3},
286  {0, 0, 0.15},
287  {0.075, 0.075, 0.15},
288  {0.25, 0, 1}, // 180
289  {0.625, 0.5, 1},
290  {0.1625, 0, 0.65},
291  {0.4063, 0.325, 0.65},
292  {0.125, 0, 0.5},
293  {0.3125, 0.25, 0.5},
294  {0.075, 0, 0.3},
295  {0.1875, 0.15, 0.3},
296  {0.0375, 0, 0.15},
297  {0.0938, 0.075, 0.15},
298  {0.5, 0, 1}, // 190
299  {0.75, 0.5, 1},
300  {0.325, 0, 0.65},
301  {0.4875, 0.325, 0.65},
302  {0.25, 0, 0.5},
303  {0.375, 0.25, 0.5},
304  {0.15, 0, 0.3},
305  {0.225, 0.15, 0.3},
306  {0.075, 0, 0.15},
307  {0.1125, 0.075, 0.15},
308  {0.75, 0, 1}, // 200
309  {0.875, 0.5, 1},
310  {0.4875, 0, 0.65},
311  {0.5688, 0.325, 0.65},
312  {0.375, 0, 0.5},
313  {0.4375, 0.25, 0.5},
314  {0.225, 0, 0.3},
315  {0.2625, 0.15, 0.3},
316  {0.1125, 0, 0.15},
317  {0.1313, 0.075, 0.15},
318  {1, 0, 1}, // 210
319  {1, 0.5, 1},
320  {0.65, 0, 0.65},
321  {0.65, 0.325, 0.65},
322  {0.5, 0, 0.5},
323  {0.5, 0.25, 0.5},
324  {0.3, 0, 0.3},
325  {0.3, 0.15, 0.3},
326  {0.15, 0, 0.15},
327  {0.15, 0.075, 0.15},
328  {1, 0, 0.75}, // 220
329  {1, 0.5, 0.875},
330  {0.65, 0, 0.4875},
331  {0.65, 0.325, 0.5688},
332  {0.5, 0, 0.375},
333  {0.5, 0.25, 0.4375},
334  {0.3, 0, 0.225},
335  {0.3, 0.15, 0.2625},
336  {0.15, 0, 0.1125},
337  {0.15, 0.075, 0.1313},
338  {1, 0, 0.5}, // 230
339  {1, 0.5, 0.75},
340  {0.65, 0, 0.325},
341  {0.65, 0.325, 0.4875},
342  {0.5, 0, 0.25},
343  {0.5, 0.25, 0.375},
344  {0.3, 0, 0.15},
345  {0.3, 0.15, 0.225},
346  {0.15, 0, 0.075},
347  {0.15, 0.075, 0.1125},
348  {1, 0, 0.25}, // 240
349  {1, 0.5, 0.625},
350  {0.65, 0, 0.1625},
351  {0.65, 0.325, 0.4063},
352  {0.5, 0, 0.125},
353  {0.5, 0.25, 0.3125},
354  {0.3, 0, 0.075},
355  {0.3, 0.15, 0.1875},
356  {0.15, 0, 0.0375},
357  {0.15, 0.075, 0.0938},
358  {0.33, 0.33, 0.33}, // 250
359  {0.464, 0.464, 0.464},
360  {0.598, 0.598, 0.598},
361  {0.732, 0.732, 0.732},
362  {0.866, 0.866, 0.866},
363  {1, 1, 1} // 255
364 };
365 
366 // AutoCAD VERSION aliases
367 #define DL_VERSION_R12 DL_Codes::AC1009
368 #define DL_VERSION_LT2 DL_Codes::AC1009
369 #define DL_VERSION_R13 DL_Codes::AC1012 // not supported yet
370 #define DL_VERSION_LT95 DL_Codes::AC1012 // not supported yet
371 #define DL_VERSION_R14 DL_Codes::AC1014 // not supported yet
372 #define DL_VERSION_LT97 DL_Codes::AC1014 // not supported yet
373 #define DL_VERSION_LT98 DL_Codes::AC1014 // not supported yet
374 #define DL_VERSION_2000 DL_Codes::AC1015
375 #define DL_VERSION_2002 DL_Codes::AC1015
376 
377 // DXF Group Codes:
378 
379 // Strings
380 #define DL_STRGRP_START 0
381 #define DL_STRGRP_END 9
382 
383 // Coordinates
384 #define DL_CRDGRP_START 10
385 #define DL_CRDGRP_END 19
386 
387 // Real values
388 #define DL_RLGRP_START 38
389 #define DL_RLGRP_END 59
390 
391 // Short integer values
392 #define DL_SHOGRP_START 60
393 #define DL_SHOGRP_END 79
394 
395 // New in Release 13,
396 #define DL_SUBCLASS 100
397 
398 // More coordinates
399 #define DL_CRD2GRP_START 210
400 #define DL_CRD2GRP_END 239
401 
402 // Extended data strings
403 #define DL_ESTRGRP_START 1000
404 #define DL_ESTRGRP_END 1009
405 
406 // Extended data reals
407 #define DL_ERLGRP_START 1010
408 #define DL_ERLGRP_END 1059
409 
410 #define DL_Y8_COORD_CODE 28
411 #define DL_Z0_COORD_CODE 30
412 #define DL_Z8_COORD_CODE 38
413 
414 #define DL_POINT_COORD_CODE 10
415 #define DL_INSERT_COORD_CODE 10
416 
417 #define DL_CRD2GRP_START 210
418 #define DL_CRD2GRP_END 239
419 
420 #define DL_THICKNESS 39
421 #define DL_FIRST_REAL_CODE THICKNESS
422 #define DL_LAST_REAL_CODE 59
423 #define DL_FIRST_INT_CODE 60
424 #define DL_ATTFLAGS_CODE 70
425 #define DL_PLINE_FLAGS_CODE 70
426 #define DL_LAYER_FLAGS_CODE 70
427 #define DL_FLD_LEN_CODE 73 // Inside ATTRIB resbuf
428 #define DL_LAST_INT_CODE 79
429 #define DL_X_EXTRU_CODE 210
430 #define DL_Y_EXTRU_CODE 220
431 #define DL_Z_EXTRU_CODE 230
432 #define DL_COMMENT_CODE 999
433 
434 // Start and endpoints of a line
435 #define DL_LINE_START_CODE 10 // Followed by x coord
436 #define DL_LINE_END_CODE 11 // Followed by x coord
437 
438 // Some codes used by blocks
439 #define DL_BLOCK_FLAGS_CODE 70 // An int containing flags
440 #define DL_BLOCK_BASE_CODE 10 // Origin of block definition
441 #define DL_XREF_DEPENDENT 16 // If a block contains an XREF
442 #define DL_XREF_RESOLVED 32 // If a XREF resolved ok
443 #define DL_REFERENCED 64 // If a block is ref'd in DWG
444 
445 #define DL_XSCALE_CODE 41
446 #define DL_YSCALE_CODE 42
447 #define DL_ANGLE_CODE 50
448 #define DL_INS_POINT_CODE 10 // Followed by x of ins pnt
449 #define DL_NAME2_CODE 3 // Second appearance of name
450 
451 // Some codes used by circle entities
452 #define DL_CENTER_CODE 10 // Followed by x of center
453 #define DL_RADIUS_CODE 40 // Followd by radius of circle
454 
455 #define DL_COND_OP_CODE -4 // Conditional op,ads_ssget
456 
457 // When using ads_buildlist you MUST use RTDXF0 instead of these
458 #define DL_ENTITY_TYPE_CODE 0 // Then there is LINE, 3DFACE..
459 #define DL_SES_CODE 0 // Start End String Code
460 #define DL_FILE_SEP_CODE 0 // File separator
461 #define DL_SOT_CODE 0 // Start Of Table
462 #define DL_TEXTVAL_CODE 1
463 #define DL_NAME_CODE 2
464 #define DL_BLOCK_NAME_CODE 2
465 #define DL_SECTION_NAME_CODE 2
466 #define DL_ENT_HAND_CODE 5 // What follows is hexa string
467 #define DL_TXT_STYLE_CODE 7 // Inside attributes
468 #define DL_LAYER_NAME_CODE 8 // What follows is layer name
469 #define DL_FIRST_XCOORD_CODE 10 // Group code x of 1st coord
470 #define DL_FIRST_YCOORD_CODE 20 // Group code y of 1st coord
471 #define DL_FIRST_ZCOORD_CODE 30 // Group code z of 1st coord
472 #define DL_L_START_CODE 10
473 #define DL_L_END_CODE 11
474 #define DL_TXTHI_CODE 40
475 #define DL_SCALE_X_CODE 41
476 #define DL_SCALE_Y_CODE 42
477 #define DL_SCALE_Z_CODE 43
478 #define DL_BULGE_CODE 42 // Used in PLINE verts for arcs
479 #define DL_ROTATION_CODE 50
480 #define DL_COLOUR_CODE 62 // What follows is a color int
481 #define DL_LTYPE_CODE 6 // What follows is a linetype
482 
483 // Attribute flags
484 #define DL_ATTS_FOLLOW_CODE 66
485 #define DL_ATT_TAG_CODE 2
486 #define DL_ATT_VAL_CODE 1
487 #define DL_ATT_FLAGS_CODE 70 // 4 1 bit flags as follows...
488 #define DL_ATT_INVIS_FLAG 1
489 #define DL_ATT_CONST_FLAG 2
490 #define DL_ATT_VERIFY_FLAG 4 // Prompt and verify
491 #define DL_ATT_PRESET_FLAG 8 // No prompt and no verify
492 
493 // PLINE defines
494 // Flags
495 #define DL_OPEN_PLINE 0x00
496 #define DL_CLOSED_PLINE 0x01
497 #define DL_POLYLINE3D 0x80
498 #define DL_PFACE_MESH 0x40
499 #define DL_PGON_MESH 0x10
500 // Vertices follow entity, required in POLYLINES
501 #define DL_VERTS_FOLLOW_CODE 66 // Value should always be 1
502 #define DL_VERTEX_COORD_CODE 10
503 
504 // LAYER flags
505 #define DL_FROZEN 1
506 #define DL_FROZEN_BY_DEF 2
507 #define DL_LOCKED 4
508 #define DL_OBJECT_USED 64 // Object is ref'd in the dwg
509 
510 #define DL_BLOCK_EN_CODE -2 // Block entity definition
511 #define DL_E_NAME -1 // Entity name
512 
513 // Extended data codes
514 #define DL_EXTD_SENTINEL (-3)
515 #define DL_EXTD_STR 1000
516 #define DL_EXTD_APP_NAME 1001
517 #define DL_EXTD_CTL_STR 1002
518 #define DL_EXTD_LYR_STR 1003
519 #define DL_EXTD_CHUNK 1004
520 #define DL_EXTD_HANDLE 1005
521 #define DL_EXTD_POINT 1010
522 #define DL_EXTD_POS 1011
523 #define DL_EXTD_DISP 1012
524 #define DL_EXTD_DIR 1013
525 #define DL_EXTD_FLOAT 1040
526 #define DL_EXTD_DIST 1041
527 #define DL_EXTD_SCALE 1042
528 #define DL_EXTD_INT16 1070
529 #define DL_EXTD_INT32 1071
530 
531 // UCS codes for use in ads_trans
532 #define DL_WCS_TRANS_CODE 0
533 #define DL_UCS_TRANS_CODE 1
534 #define DL_DCS_TRANS_CODE 2
535 #define DL_PCS_TRANS_CODE 3
536 
537 #endif
@ AC1012
Definition: dl_codes.h:98
@ AC1014
Definition: dl_codes.h:99
@ AC1009_MIN
Definition: dl_codes.h:96
@ AC1009
Definition: dl_codes.h:97
const double dxfColors[][3]
Definition: dl_codes.h:107
#define DXFLIB_EXPORT
Definition: dl_global.h:12
constexpr Rgb cyan(0, MAX, MAX)
constexpr Rgb black(0, 0, 0)
constexpr Rgb magenta(MAX, 0, MAX)
constexpr Rgb white(MAX, MAX, MAX)
constexpr Rgb red(MAX, 0, 0)
constexpr Rgb blue(0, 0, MAX)
constexpr Rgb green(0, MAX, 0)
constexpr Rgb yellow(MAX, MAX, 0)