| http://www.coin3d.org/ http://www.kongsberg.com/kogt/

Text.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 DIME_TEXT_H
34 #define DIME_TEXT_H
35
36 #include <dime/Basic.h>
37 #include <dime/entities/ExtrusionEntity.h>
38
39 class DIME_DLL_API dimeText : public dimeExtrusionEntity
40 {
41 public:
42 dimeText();
43 // dimeText(const char* s);
44
45 void setOrigin(const dimeVec3f &o);
46 void getOrigin(dimeVec3f &o) const;
47 void setSecond(const dimeVec3f &s);
48 bool getSecond(dimeVec3f &s) const;
49 void setHeight(const dxfdouble h);
50 dxfdouble getHeight() const;
51 void setWidth(const dxfdouble w);
52 dxfdouble getWidth() const;
53 void setRotation(const dxfdouble a);
54 dxfdouble getRotation() const;
55 void setHJust(const int32 h);
56 int32 getHJust() const;
57 void setVJust(const int32 v);
58 int32 getVJust() const;
59 void setTextString(const char* s);
60 char* getTextString() const;
61
62 virtual bool getRecord(const int groupcode,
63 dimeParam &param,
64 const int index = 0) const;
65 virtual const char *getEntityName() const;
66
67 virtual dimeEntity *copy(dimeModel * const model) const;
68
69 virtual void print() const;
70 virtual bool write(dimeOutput * const out);
71 virtual int typeId() const;
72 virtual int countRecords() const;
73
74 virtual GeometryType extractGeometry(dimeArray <dimeVec3f> &verts,
75 dimeArray <int> &indices,
76 dimeVec3f &extrusionDir,
77 dxfdouble &thickness);
78
79 protected:
80 virtual bool handleRecord(const int groupcode,
81 const dimeParam &param,
82 dimeMemHandler * const memhandler);
83
84 private:
85 dimeVec3f origin;
86 dimeVec3f second;
87 bool haveSecond;
88 dxfdouble height;
89 dxfdouble width;
90 dxfdouble rotation;
91 dxfdouble wScale;
92 int32 hJust;
93 int32 vJust;
94 char* text;
95
96 }; // class dimeText
97
98 //
99 // inline methods
100 //
101
102
103 inline void
104 dimeText::setOrigin(const dimeVec3f &o)
105 {
106 this->origin = o;
107 }
108
109 inline void
110 dimeText::getOrigin(dimeVec3f &o) const
111 {
112 o = this->origin;
113 }
114
115 inline void
116 dimeText::setSecond(const dimeVec3f &s)
117 {
118 this->second = s;
119 }
120
121 inline bool
122 dimeText::getSecond(dimeVec3f &s) const
123 {
124 if( haveSecond ) {
125 s = this->second;
126 return true;
127 }
128 else {
129 return false;
130 }
131 }
132
133 inline void
134 dimeText::setHeight(const dxfdouble h)
135 {
136 this->height = h;
137 }
138
139 inline dxfdouble
140 dimeText::getHeight() const
141 {
142 return this->height;
143 }
144
145 inline void
146 dimeText::setWidth(const dxfdouble w)
147 {
148 this->width = w;
149 }
150
151 inline dxfdouble
152 dimeText::getWidth() const
153 {
154 return this->width;
155 }
156
157 inline void
158 dimeText::setRotation(const dxfdouble a)
159 {
160 this->rotation = a;
161 }
162
163 inline dxfdouble
164 dimeText::getRotation() const
165 {
166 return this->rotation;
167 }
168
169 inline void
170 dimeText::setHJust(const int32 h)
171 {
172 this->hJust = h;
173 }
174
175 inline int32
176 dimeText::getHJust() const
177 {
178 return this->hJust;
179 }
180
181 inline void
182 dimeText::setVJust(const int32 v)
183 {
184 this->vJust = v;
185 }
186
187 inline int32
188 dimeText::getVJust() const
189 {
190 return this->vJust;
191 }
192
193 //inline void
194 //dimeText::setTextString(const char* s)
195 //{
196 //this->text = s;
197 //}
198
199 inline char*
200 dimeText::getTextString() const
201 {
202 return this->text;
203 }
204
205 #endif // ! DIME_TEXT_H
206
dimeText
The dimeText class handles a Text entity.
Definition: Text.h:39
dimeArray< dimeVec3f >
dimeMemHandler
The dimeMemHandler class is a special-purpose memory manager.
Definition: MemHandler.h:38
dimeEntity::copy
virtual dimeEntity * copy(dimeModel *const model) const =0
dimeExtrusionEntity::countRecords
virtual int countRecords() const
Definition: ExtrusionEntity.cpp:113
dimeExtrusionEntity::typeId
virtual int typeId() const
Definition: ExtrusionEntity.cpp:96
dimeEntity
The dimeEntity class is the superclass of all entity classes.
Definition: Entity.h:60
dimeModel
The dimeModel class organizes a model.
Definition: Model.h:54
dimeEntity::getEntityName
virtual const char * getEntityName() const =0
dimeVec3f
The dimeVec3f class is for containing and operating on a 3D vector / coordinate.
Definition: Linear.h:61
dimeParam
The dimeParam class is a union of the different parameter types.
Definition: Basic.h:102
dimeExtrusionEntity
The dimeExtrusionEntity class is the superclass of all entity classes with extrusion data...
Definition: ExtrusionEntity.h:38
dimeEntity::extractGeometry
virtual GeometryType extractGeometry(dimeArray< dimeVec3f > &verts, dimeArray< int > &indices, dimeVec3f &extrusionDir, dxfdouble &thickness)
Definition: Entity.cpp:583
dimeEntity::write
virtual bool write(dimeOutput *const out)
Definition: Entity.cpp:271
dimeExtrusionEntity::getRecord
virtual bool getRecord(const int groupcode, dimeParam &param, const int index=0) const
Definition: ExtrusionEntity.cpp:155
dimeOutput
The dimeOutput class handles writing of DXF and DXB files.
Definition: Output.h:41
dimeExtrusionEntity::handleRecord
virtual bool handleRecord(const int groupcode, const dimeParam &param, dimeMemHandler *const memhandler)
Definition: ExtrusionEntity.cpp:135

Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.