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
mydxfblocks.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2010,2012 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 #ifndef MY_DXF_BLOCKS_HPP
44 #define MY_DXF_BLOCKS_HPP 1
45 
46 
47 #include <stdint.h>
48 #include <vector>
49 #include <string>
50 #include "vec3d.hpp"
51 #include "mydxffile.hpp"
52 #include "mydxfentities.hpp"
53 #include "transformation.hpp"
54 
55 
59 {
60 
61  std::string _block_handle;
62  std::string _block_layer;
63 
64  std::string _endblk_handle;
65  std::string _endblk_layer;
66 
67  std::string _path;
68  std::string _owner_handle;
69  std::string _name; // Name reference used by INSERT
70 
71  int16_t _type;
72  Vec3D _p; // Base point
73 
74  class MyDXFEntities *_entities;
75 
76 public:
77 
78  MyDXFBlock( class MyDXFFile *dxf );
79  ~MyDXFBlock();
80 
83  void write( class MyDXFFile *dxf, std::ofstream &ostr );
84 
87  const std::string &name( void ) { return( _name ); }
88 
91  class MyDXFEntities *get_entities( void ) { return( _entities ); }
92 
95  const class MyDXFEntities *get_entities( void ) const { return( _entities ); }
96 
102  void explode( class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t ) const;
103 
111  void plot( const class MyDXFFile *dxf, cairo_t *cairo,
112  const Transformation *t, const double range[4] ) const;
113 
116  void get_bbox( Vec3D &min, Vec3D &max,
117  const class MyDXFFile *dxf, const Transformation *t ) const;
118 
121  void scale( class MyDXFFile *dxf, double s );
122 
125  void translate( class MyDXFFile *dxf, const Vec3D &dx );
126 
129  void debug_print( std::ostream &os ) const;
130 
133  friend std::ostream &operator<<( std::ostream &os, const MyDXFBlock &blk );
134 };
135 
136 
137 
143 {
144 
145  std::vector<MyDXFBlock *> _blocks;
146 
147 public:
148 
149  MyDXFBlocks( class MyDXFFile *dxf );
150  ~MyDXFBlocks();
151 
154  void write( class MyDXFFile *dxf, std::ofstream &ostr );
155 
156  uint32_t size( void ) const { return( _blocks.size() ); }
157 
158  MyDXFBlock *get_by_name( const std::string &name );
159  const MyDXFBlock *get_by_name( const std::string &name ) const;
160 
161  MyDXFBlock *operator()( int a ) { return( _blocks[a] ); }
162 
163  const MyDXFBlock *operator()( int a ) const { return( _blocks[a] ); }
164 
165  void clear( void );
166 
169  void debug_print( std::ostream &os ) const;
170 };
171 
172 
173 
174 
175 
176 #endif
177 
178 
179 
180 
DXF block class.
Definition: mydxfblocks.hpp:59
void write(class MyDXFFile *dxf, std::ofstream &ostr)
Write dxf file to stream.
Definition: mydxfblocks.cpp:115
class MyDXFEntities * get_entities(void)
Get a pointer to the entities of block.
Definition: mydxfblocks.hpp:91
void explode(class MyDXFEntities *ent, MyDXFFile *dxf, const Transformation *t) const
Explode block into entities.
Definition: mydxfblocks.cpp:142
void plot(const class MyDXFFile *dxf, cairo_t *cairo, const Transformation *t, const double range[4]) const
Plot block with cairo.
Definition: mydxfblocks.cpp:153
const std::string & name(void)
Return name of block.
Definition: mydxfblocks.hpp:87
void translate(class MyDXFFile *dxf, const Vec3D &dx)
Translate entity by dx.
Definition: mydxfblocks.cpp:193
void get_bbox(Vec3D &min, Vec3D &max, const class MyDXFFile *dxf, const Transformation *t) const
Return bounding box of entities within the block.
Definition: mydxfblocks.cpp:165
void scale(class MyDXFFile *dxf, double s)
Scale entities within block by factor s.
Definition: mydxfblocks.cpp:184
friend std::ostream & operator<<(std::ostream &os, const MyDXFBlock &blk)
Print debugging information to stream os.
Definition: mydxfblocks.cpp:224
const class MyDXFEntities * get_entities(void) const
Get a const pointer to the entities of block.
Definition: mydxfblocks.hpp:95
void debug_print(std::ostream &os) const
Print debugging information to stream os.
Definition: mydxfblocks.cpp:202
DXF blocks class.
Definition: mydxfblocks.hpp:143
void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: mydxfblocks.cpp:288
void write(class MyDXFFile *dxf, std::ofstream &ostr)
Write dxf file to stream.
Definition: mydxfblocks.cpp:276
DXF entity database.
Definition: mydxfentities.hpp:286
DXF file class.
Definition: mydxffile.hpp:70
Transformation for homogenous three dimensional space.
Definition: transformation.hpp:70
Three dimensional vector.
Definition: vec3d.hpp:58
DXF Entities.
DXF File.
Full transformation for three dimensional homogenous space.
Three dimensional vectors.


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