dime  0.9.1
Portable DXF file library
Loading...
Searching...
No Matches
convert.h
1/**************************************************************************\
2 * Copyright (c) Kongsberg Oil & Gas Technologies AS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31\**************************************************************************/
32
33#ifndef _DXF2VRML_CONVERT_H_
34#define _DXF2VRML_CONVERT_H_
35
36#include <stdio.h>
37#include <dime/Basic.h>
38
39class dimeModel;
40class dxfLayerData;
41class dimeState;
42class dimeEntity;
43
44class DIME_DLL_API dxfConverter
45{
46public:
49
50 void setMaxerr(const dxfdouble maxerr) {
51 this->maxerr = maxerr;
52 }
53 void findHeaderVariables(dimeModel &model);
54 bool doConvert(dimeModel &model);
55 bool writeVrml(const char * filename, const bool vrml1 = false,
56 const bool only2d = false);
57 bool writeVrml(FILE *out, const bool vrml1 = false,
58 const bool only2d = false);
59
60 void setNumSub(const int num) {
61 this->numsub = num;
62 }
63 int getNumSub() const {
64 return numsub;
65 }
66 dxfdouble getMaxerr() const {
67 return this->maxerr;
68 }
69
70 void setFillmode(const bool fill) {
71 this->fillmode = fill;
72 }
73 bool getFillmode() const {
74 return this->fillmode;
75 }
76
77 bool getLayercol() const {
78 return this->layercol;
79 }
80
81 void setLayercol(const bool v) {
82 this->layercol = v;
83 }
84
85 dxfLayerData *getLayerData(const int colidx);
86 dxfLayerData *getLayerData(const dimeEntity *entity);
87 dxfLayerData ** getLayerData();
88 int getColorIndex(const dimeEntity *entity);
90 return currentInsertColorIndex;
91 }
92
93private:
94 friend class dime2Profit;
95 friend class dime2So;
96
97 dxfLayerData *layerData[255];
98 int dummy[4];
99 dxfdouble maxerr;
100 int currentInsertColorIndex;
101 dimeEntity *currentPolyline;
102 int numsub;
103 bool fillmode;
104 bool layercol;
105
106 bool private_callback(const dimeState * const state,
107 dimeEntity *entity);
108 static bool dime_callback(const dimeState * const state,
109 dimeEntity *entity, void *);
110
111};
112
113#endif // _DXF2VRML_CONVERT_H_
The dimeEntity class is the superclass of all entity classes.
Definition Entity.h:61
The dimeModel class organizes a model.
Definition Model.h:55
The dimeState class manages various state variables while the model is traversed.
Definition State.h:41
The dxfConverter class offers a simple interface for DXF converting. It makes it possible to extract ...
Definition convert.h:45
void setLayercol(const bool v)
Definition convert.h:81
int getNumSub() const
Definition convert.h:63
void setFillmode(const bool fill)
Definition convert.h:70
bool getLayercol() const
Definition convert.h:77
void setMaxerr(const dxfdouble maxerr)
Definition convert.h:50
void setNumSub(const int num)
Definition convert.h:60
dxfdouble getMaxerr() const
Definition convert.h:66
bool getFillmode() const
Definition convert.h:73
int getCurrentInsertColorIndex() const
Definition convert.h:89
The dxfLayerData class handles all geometry for a given color index. DXF geometry is grouped into dif...
Definition layerdata.h:41