Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
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 
39 class dimeModel;
40 class dxfLayerData;
41 class dimeState;
42 class dimeEntity;
43 
44 class DIME_DLL_API dxfConverter
45 {
46 public:
47  dxfConverter();
48  ~dxfConverter();
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 
93 private:
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_
bool getLayercol() const
Definition: convert.h:77
void setMaxerr(const dxfdouble maxerr)
Definition: convert.h:50
The dimeState class manages various state variables while the model is traversed. ...
Definition: State.h:40
bool getFillmode() const
Definition: convert.h:73
void setFillmode(const bool fill)
Definition: convert.h:70
The dxfConverter class offers a simple interface for dxf converting. It makes it possible to extract ...
Definition: convert.h:44
The dimeEntity class is the superclass of all entity classes.
Definition: Entity.h:60
void setNumSub(const int num)
Definition: convert.h:60
The dimeModel class organizes a model.
Definition: Model.h:54
void setLayercol(const bool v)
Definition: convert.h:81
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
int getNumSub() const
Definition: convert.h:63
dxfdouble getMaxerr() const
Definition: convert.h:66