dime  0.9.1
Portable DXF file library
Loading...
Searching...
No Matches
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
39class DIME_DLL_API dimeText : public dimeExtrusionEntity
40{
41public:
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
79protected:
80 virtual bool handleRecord(const int groupcode,
81 const dimeParam &param,
82 dimeMemHandler * const memhandler);
83
84private:
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
103inline void
104dimeText::setOrigin(const dimeVec3f &o)
105{
106 this->origin = o;
107}
108
109inline void
110dimeText::getOrigin(dimeVec3f &o) const
111{
112 o = this->origin;
113}
114
115inline void
116dimeText::setSecond(const dimeVec3f &s)
117{
118 this->second = s;
119}
120
121inline bool
122dimeText::getSecond(dimeVec3f &s) const
123{
124 if( haveSecond ) {
125 s = this->second;
126 return true;
127 }
128 else {
129 return false;
130 }
131}
132
133inline void
134dimeText::setHeight(const dxfdouble h)
135{
136 this->height = h;
137}
138
139inline dxfdouble
140dimeText::getHeight() const
141{
142 return this->height;
143}
144
145inline void
146dimeText::setWidth(const dxfdouble w)
147{
148 this->width = w;
149}
150
151inline dxfdouble
152dimeText::getWidth() const
153{
154 return this->width;
155}
156
157inline void
158dimeText::setRotation(const dxfdouble a)
159{
160 this->rotation = a;
161}
162
163inline dxfdouble
164dimeText::getRotation() const
165{
166 return this->rotation;
167}
168
169inline void
170dimeText::setHJust(const int32 h)
171{
172 this->hJust = h;
173}
174
175inline int32
176dimeText::getHJust() const
177{
178 return this->hJust;
179}
180
181inline void
182dimeText::setVJust(const int32 v)
183{
184 this->vJust = v;
185}
186
187inline int32
188dimeText::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
199inline char*
200dimeText::getTextString() const
201{
202 return this->text;
203}
204
205#endif // ! DIME_TEXT_H
206
The dimeEntity class is the superclass of all entity classes.
Definition Entity.h:61
virtual bool write(dimeOutput *const out)
Definition Entity.cpp:271
virtual const char * getEntityName() const =0
virtual GeometryType extractGeometry(dimeArray< dimeVec3f > &verts, dimeArray< int > &indices, dimeVec3f &extrusionDir, dxfdouble &thickness)
Definition Entity.cpp:583
virtual dimeEntity * copy(dimeModel *const model) const =0
The dimeExtrusionEntity class is the superclass of all entity classes with extrusion data.
Definition ExtrusionEntity.h:39
virtual bool handleRecord(const int groupcode, const dimeParam &param, dimeMemHandler *const memhandler)
Definition ExtrusionEntity.cpp:135
virtual int typeId() const
Definition ExtrusionEntity.cpp:96
virtual int countRecords() const
Definition ExtrusionEntity.cpp:113
virtual bool getRecord(const int groupcode, dimeParam &param, const int index=0) const
Definition ExtrusionEntity.cpp:155
The dimeMemHandler class is a special-purpose memory manager.
Definition MemHandler.h:39
The dimeModel class organizes a model.
Definition Model.h:55
The dimeOutput class handles writing of DXF and DXB files.
Definition Output.h:42
The dimeText class handles a Text entity.
Definition Text.h:40
The dimeVec3f class is for containing and operating on a 3D vector / coordinate.
Definition Linear.h:62
The dimeParam class is a union of the different parameter types.
Definition Basic.h:102