KiCad PCB EDA Suite
MODEL_VRML Class Reference

Public Member Functions

 MODEL_VRML ()
 
 ~MODEL_VRML ()
 
VRML_COLORGetColor (VRML_COLOR_INDEX aIndex)
 
void SetOffset (double aXoff, double aYoff)
 
double GetLayerZ (LAYER_NUM aLayer)
 
void SetLayerZ (LAYER_NUM aLayer, double aValue)
 
bool SetScale (double aWorldScale)
 

Public Attributes

IFSG_TRANSFORM m_OutputPCB
 
VRML_LAYER m_holes
 
VRML_LAYER m_board
 
VRML_LAYER m_top_copper
 
VRML_LAYER m_bot_copper
 
VRML_LAYER m_top_silk
 
VRML_LAYER m_bot_silk
 
VRML_LAYER m_top_tin
 
VRML_LAYER m_bot_tin
 
VRML_LAYER m_plated_holes
 
std::list< SGNODE * > m_components
 
bool m_plainPCB
 
double m_minLineWidth
 
double m_tx
 
double m_ty
 
double m_brd_thickness
 
LAYER_NUM m_text_layer
 
int m_text_width
 

Private Attributes

double m_layer_z [PCB_LAYER_ID_COUNT]
 
int m_iMaxSeg
 
double m_arcMinLen
 
double m_arcMaxLen
 

Detailed Description

Definition at line 144 of file export_vrml.cpp.

Constructor & Destructor Documentation

MODEL_VRML::MODEL_VRML ( )
inline

Definition at line 178 of file export_vrml.cpp.

References DIM, F_Cu, i, MIN_VRML_LINEWIDTH, VRML_COLOR::VRML_COLOR(), VRML_COLOR_PCB, VRML_COLOR_SILK, VRML_COLOR_TIN, and VRML_COLOR_TRACK.

178  : m_OutputPCB( (SGNODE*) NULL )
179  {
180  for( unsigned i = 0; i < DIM( m_layer_z ); ++i )
181  m_layer_z[i] = 0;
182 
183  m_holes.GetArcParams( m_iMaxSeg, m_arcMinLen, m_arcMaxLen );
184 
185  // this default only makes sense if the output is in mm
186  m_brd_thickness = 1.6;
187 
188  // pcb green
189  colors[ VRML_COLOR_PCB ] = VRML_COLOR( .07, .3, .12, .01, .03, .01,
190  0, 0, 0, 0.8, 0, 0.02 );
191  // track green
192  colors[ VRML_COLOR_TRACK ] = VRML_COLOR( .08, .5, .1, .01, .05, .01,
193  0, 0, 0, 0.8, 0, 0.02 );
194  // silkscreen white
195  colors[ VRML_COLOR_SILK ] = VRML_COLOR( .9, .9, .9, .1, .1, .1,
196  0, 0, 0, 0.9, 0, 0.02 );
197  // pad silver
198  colors[ VRML_COLOR_TIN ] = VRML_COLOR( .749, .756, .761, .749, .756, .761,
199  0, 0, 0, 0.8, 0, 0.8 );
200 
201  m_plainPCB = false;
202  SetOffset( 0.0, 0.0 );
203  m_text_layer = F_Cu;
204  m_text_width = 1;
206  }
#define DIM(x)
of elements in an array
Definition: macros.h:98
VRML_LAYER m_holes
void SetOffset(double aXoff, double aYoff)
Class SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
IFSG_TRANSFORM m_OutputPCB
double m_layer_z[PCB_LAYER_ID_COUNT]
#define MIN_VRML_LINEWIDTH
Definition: export_vrml.cpp:57
LAYER_NUM m_text_layer
double m_arcMinLen
double m_arcMaxLen
size_t i
Definition: json11.cpp:597
double m_brd_thickness
double m_minLineWidth
static VRML_COLOR colors[VRML_COLOR_LAST]
MODEL_VRML::~MODEL_VRML ( )
inline

Definition at line 208 of file export_vrml.cpp.

References IFSG_TRANSFORM::Attach(), IFSG_NODE::Destroy(), S3D::DestroyNode(), S3D::GetSGNodeParent(), i, IFSG_NODE::SetParent(), and VRML_COLOR_LAST.

209  {
210  // destroy any unassociated material appearances
211  for( int j = 0; j < VRML_COLOR_LAST; ++j )
212  {
213  if( sgmaterial[j] && NULL == S3D::GetSGNodeParent( sgmaterial[j] ) )
215 
216  sgmaterial[j] = NULL;
217  }
218 
219  if( !m_components.empty() )
220  {
221  IFSG_TRANSFORM tmp( false );
222 
223  for( auto i : m_components )
224  {
225  tmp.Attach( i );
226  tmp.SetParent( NULL );
227  }
228 
229  m_components.clear();
231  }
232  }
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:636
static SGNODE * sgmaterial[VRML_COLOR_LAST]
IFSG_TRANSFORM m_OutputPCB
std::list< SGNODE * > m_components
Class IFSG_TRANSFORM is the wrapper for the VRML compatible TRANSFORM block class SCENEGRAPH...
size_t i
Definition: json11.cpp:597
SGLIB_API void DestroyNode(SGNODE *aNode)
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:210
void Destroy(void)
Function Destroy deletes the object held by this wrapper.
Definition: ifsg_node.cpp:54

Member Function Documentation

VRML_COLOR& MODEL_VRML::GetColor ( VRML_COLOR_INDEX  aIndex)
inline

Definition at line 234 of file export_vrml.cpp.

Referenced by write_layers().

235  {
236  return colors[aIndex];
237  }
static VRML_COLOR colors[VRML_COLOR_LAST]
double MODEL_VRML::GetLayerZ ( LAYER_NUM  aLayer)
inline

Definition at line 255 of file export_vrml.cpp.

References DIM.

Referenced by export_vrml_module(), and write_layers().

256  {
257  if( unsigned( aLayer ) >= DIM( m_layer_z ) )
258  return 0;
259 
260  return m_layer_z[ aLayer ];
261  }
#define DIM(x)
of elements in an array
Definition: macros.h:98
double m_layer_z[PCB_LAYER_ID_COUNT]
void MODEL_VRML::SetLayerZ ( LAYER_NUM  aLayer,
double  aValue 
)
inline

Definition at line 263 of file export_vrml.cpp.

Referenced by compute_layer_Zs().

264  {
265  m_layer_z[aLayer] = aValue;
266  }
double m_layer_z[PCB_LAYER_ID_COUNT]
void MODEL_VRML::SetOffset ( double  aXoff,
double  aYoff 
)
inline

Definition at line 239 of file export_vrml.cpp.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

240  {
241  m_tx = aXoff;
242  m_ty = -aYoff;
243 
244  m_holes.SetVertexOffsets( aXoff, aYoff );
245  m_board.SetVertexOffsets( aXoff, aYoff );
246  m_top_copper.SetVertexOffsets( aXoff, aYoff );
247  m_bot_copper.SetVertexOffsets( aXoff, aYoff );
248  m_top_silk.SetVertexOffsets( aXoff, aYoff );
249  m_bot_silk.SetVertexOffsets( aXoff, aYoff );
250  m_top_tin.SetVertexOffsets( aXoff, aYoff );
251  m_bot_tin.SetVertexOffsets( aXoff, aYoff );
252  m_plated_holes.SetVertexOffsets( aXoff, aYoff );
253  }
VRML_LAYER m_bot_tin
VRML_LAYER m_plated_holes
VRML_LAYER m_holes
VRML_LAYER m_bot_silk
VRML_LAYER m_top_silk
VRML_LAYER m_board
VRML_LAYER m_bot_copper
VRML_LAYER m_top_copper
VRML_LAYER m_top_tin
bool MODEL_VRML::SetScale ( double  aWorldScale)
inline

Definition at line 269 of file export_vrml.cpp.

References IFSG_TRANSFORM::SetScale(), and WORLD_SCALE.

Referenced by PCB_EDIT_FRAME::ExportVRML_File().

270  {
271  if( aWorldScale < 0.001 || aWorldScale > 10.0 )
272  throw( std::runtime_error( "WorldScale out of range (valid range is 0.001 to 10.0)" ) );
273 
274  m_OutputPCB.SetScale( aWorldScale * 2.54 );
275  WORLD_SCALE = aWorldScale * 2.54;
276 
277  return true;
278  }
static double WORLD_SCALE
Definition: export_vrml.cpp:68
bool SetScale(const SGPOINT &aScale)
IFSG_TRANSFORM m_OutputPCB

Member Data Documentation

double MODEL_VRML::m_arcMaxLen
private

Definition at line 150 of file export_vrml.cpp.

double MODEL_VRML::m_arcMinLen
private

Definition at line 150 of file export_vrml.cpp.

VRML_LAYER MODEL_VRML::m_board

Definition at line 155 of file export_vrml.cpp.

Referenced by export_vrml_board(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_copper

Definition at line 157 of file export_vrml.cpp.

Referenced by export_round_padstack(), export_vrml_pad(), GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_silk

Definition at line 159 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_bot_tin

Definition at line 161 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_brd_thickness

Definition at line 173 of file export_vrml.cpp.

Referenced by compute_layer_Zs(), and write_layers().

std::list< SGNODE* > MODEL_VRML::m_components

Definition at line 164 of file export_vrml.cpp.

Referenced by export_vrml_module().

VRML_LAYER MODEL_VRML::m_holes
int MODEL_VRML::m_iMaxSeg
private

Definition at line 149 of file export_vrml.cpp.

double MODEL_VRML::m_layer_z[PCB_LAYER_ID_COUNT]
private

Definition at line 147 of file export_vrml.cpp.

double MODEL_VRML::m_minLineWidth

Definition at line 168 of file export_vrml.cpp.

Referenced by export_vrml_arc(), export_vrml_circle(), and export_vrml_line().

IFSG_TRANSFORM MODEL_VRML::m_OutputPCB

Definition at line 153 of file export_vrml.cpp.

Referenced by export_vrml_module(), and write_layers().

VRML_LAYER MODEL_VRML::m_plated_holes

Definition at line 162 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

LAYER_NUM MODEL_VRML::m_text_layer
int MODEL_VRML::m_text_width
VRML_LAYER MODEL_VRML::m_top_copper

Definition at line 156 of file export_vrml.cpp.

Referenced by export_round_padstack(), export_vrml_pad(), GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_top_silk

Definition at line 158 of file export_vrml.cpp.

Referenced by GetLayer(), and write_layers().

VRML_LAYER MODEL_VRML::m_top_tin

Definition at line 160 of file export_vrml.cpp.

Referenced by export_vrml_pad(), and write_layers().

double MODEL_VRML::m_tx

Definition at line 170 of file export_vrml.cpp.

Referenced by export_vrml_module().

double MODEL_VRML::m_ty

Definition at line 171 of file export_vrml.cpp.

Referenced by export_vrml_module().


The documentation for this class was generated from the following file: