Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
mydxfmtext.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2010-2012,2014 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 
44 #ifndef MY_DXF_MTEXT_HPP
45 #define MY_DXF_MTEXT_HPP 1
46 
47 
48 #include "mydxfentities.hpp"
49 
50 
51 #define ATTACHMENT_POINT_TOP_LEFT 1
52 #define ATTACHMENT_POINT_TOP_CENTER 2
53 #define ATTACHMENT_POINT_TOP_RIGHT 3
54 #define ATTACHMENT_POINT_MIDDLE_LEFT 4
55 #define ATTACHMENT_POINT_MIDDLE_CENTER 5
56 #define ATTACHMENT_POINT_MIDDLE_RIGHT 6
57 #define ATTACHMENT_POINT_BOTTOM_LEFT 7
58 #define ATTACHMENT_POINT_BOTTOM_CENTER 8
59 #define ATTACHMENT_POINT_BOTTOM_RIGHT 9
60 
61 #define DRAWING_DIRECTION_LEFT_TO_RIGHT 1
62 #define DRAWING_DIRECTION_TOP_TO_BOTTOM 3
63 #define DRAWING_DIRECTION_BY_STYLE 5
64 
65 
70 class MyDXFMText : public MyDXFEntity
71 {
72 
73  std::string _text; /* 1, 3, Text string. If the text string is less than 250 characters, all
74  * characters appear in group 1. If the text string is greater than 250
75  * characters, the string is divided into 250-character chunks, which
76  * appear in one or more group 3 codes. If group 3 codes are used, the
77  * last group is a group 1 and has fewer than 250 characters. */
78  Vec3D _p; /* 10, 20, 30, Insertion point. */
79  double _text_height; /* 40, Nominal (initial) text height. */
80  double _rect_width; /* 41, Reference rectangle width. */
81  double _text_width; /* 42, Horizontal width of the characters that make up the mtext entity. This
82  * value will always be equal to or less than the value of group code 41
83  * (read-only, ignored if supplied). */
84  double _vert_height; /* 43, Vertical height of the mtext entity (read-only, ignored if supplied). */
85  double _spacing_fac; /* 44, Mtext line spacing factor (optional):
86  * Percentage of default (3-on-5) line spacing to be applied. Valid values
87  * range from 0.25 to 4.00 */
88  double _rotation; /* 50, Rotation angle in radians. */
89  int16_t _attachment_point; /* 71, Attachment point:
90  * 1 = Top left; 2 = Top center; 3 = Top right
91  * 4 = Middle left; 5 = Middle center; 6 = Middle right
92  * 7 = Bottom left; 8 = Bottom center; 9 = Bottom right */
93  int16_t _drawing_direction; /* 72, Drawing direction:
94  * 1 = Left to right
95  * 3 = Top to bottom
96  * 5 = By style (the flow direction is inherited from the associated text style) */
97  int16_t _line_spacing; /* 73, Mtext line spacing style (optional):
98  * 1 = At least (taller characters will override)
99  * 2 = Exact (taller characters will not override) */
100  std::string _style; /* 7, Text style name (STANDARD if not provided) (optional). */
101  Vec3D _extrusion; /* 210, 220, 230, Extrusion direction (optional; default = 0, 0, 1) */
102  Vec3D _xaxis; /* 11, 21, 31, X-axis direction vector (in WCS).A group code 50 (rotation angle
103  * in radians) passed as DXF input is converted to the equivalent direction
104  * vector (if both a code 50 and codes 11, 21, 31 are passed, the last one wins).
105  * This is provided as a convenience for conversions from text objects */
106 
107 
108 public:
109 
112  MyDXFMText();
113 
116  MyDXFMText( class MyDXFFile *dxf );
117 
120  virtual ~MyDXFMText() {}
121 
124  virtual MyDXFMText *copy( void ) const { return( new MyDXFMText( *this ) ); }
125 
132  virtual void explode( class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t ) const;
133 
136  virtual void write( class MyDXFFile *dxf, std::ofstream &ostr );
137 
140  virtual EntityType get_type( void ) const { return( ENTITY_MTEXT ); }
141 
149  virtual void plot( const class MyDXFFile *dxf, cairo_t *cairo,
150  const Transformation *t, const double range[4] ) const;
151 
154  virtual void get_bbox( Vec3D &min, Vec3D &max,
155  const class MyDXFFile *dxf, const Transformation *t ) const;
156 
159  virtual void scale( class MyDXFFile *dxf, double s );
160 
163  virtual void translate( class MyDXFFile *dxf, const Vec3D &dx );
164 
169  virtual void rotate_z( class MyDXFFile *dxf, double a );
170 
173  virtual void debug_print( std::ostream &os ) const;
174 };
175 
176 
177 
178 #endif
179 
DXF entity database.
Definition: mydxfentities.hpp:286
DXF entity base class.
Definition: mydxfentities.hpp:78
DXF file class.
Definition: mydxffile.hpp:70
DXF text entity class.
Definition: mydxfmtext.hpp:71
virtual MyDXFMText * copy(void) const
Get a new copy of entity.
Definition: mydxfmtext.hpp:124
MyDXFMText()
Default constructor.
Definition: mydxfmtext.cpp:48
virtual void explode(class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t) const
Explode into entities.
Definition: mydxfmtext.cpp:137
virtual void scale(class MyDXFFile *dxf, double s)
Scale entity by factor s.
Definition: mydxfmtext.cpp:323
virtual ~MyDXFMText()
Virtual destructor.
Definition: mydxfmtext.hpp:120
virtual void plot(const class MyDXFFile *dxf, cairo_t *cairo, const Transformation *t, const double range[4]) const
Plot entity with cairo.
Definition: mydxfmtext.cpp:199
virtual EntityType get_type(void) const
Get entity type.
Definition: mydxfmtext.hpp:140
virtual void translate(class MyDXFFile *dxf, const Vec3D &dx)
Translate entity by dx.
Definition: mydxfmtext.cpp:333
virtual void get_bbox(Vec3D &min, Vec3D &max, const class MyDXFFile *dxf, const Transformation *t) const
Return bounding box of entity.
Definition: mydxfmtext.cpp:307
virtual void debug_print(std::ostream &os) const
Print debugging information to stream os.
Definition: mydxfmtext.cpp:350
virtual void rotate_z(class MyDXFFile *dxf, double a)
Rotate entity around origin.
Definition: mydxfmtext.cpp:339
virtual void write(class MyDXFFile *dxf, std::ofstream &ostr)
Write dxf file to stream.
Definition: mydxfmtext.cpp:152
Transformation for homogenous three dimensional space.
Definition: transformation.hpp:70
Three dimensional vector.
Definition: vec3d.hpp:58
DXF Entities.
EntityType
Entity type.
Definition: mydxfentities.hpp:60


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.