KiCad PCB EDA Suite
DATA Struct Reference

Public Member Functions

 Handle (TDocStd_Document) m_doc
 
 Handle (XCAFDoc_ColorTool) m_color
 
 Handle (XCAFDoc_ShapeTool) m_assy
 
 DATA ()
 
 ~DATA ()
 
bool GetShape (const std::string &id, std::vector< SGNODE * > *&listPtr)
 
SGNODEGetFace (const std::string &id)
 
SGNODEGetColor (Quantity_Color *colorObj)
 

Public Attributes

SGNODEscene
 
SGNODEdefaultColor
 
Quantity_Color refColor
 
NODEMAP shapes
 
COLORMAP colors
 
FACEMAP faces
 
bool renderBoth
 
bool hasSolid
 

Detailed Description

Definition at line 114 of file loadmodel.cpp.

Constructor & Destructor Documentation

◆ DATA()

DATA::DATA ( )
inline

Definition at line 128 of file loadmodel.cpp.

129  {
130  scene = nullptr;
131  defaultColor = nullptr;
132  refColor.SetValues( Quantity_NOC_BLACK );
133  renderBoth = false;
134  hasSolid = false;
135  }
Quantity_Color refColor
Definition: loadmodel.cpp:121
bool hasSolid
Definition: loadmodel.cpp:126
SGNODE * scene
Definition: loadmodel.cpp:119
SGNODE * defaultColor
Definition: loadmodel.cpp:120
bool renderBoth
Definition: loadmodel.cpp:125

References defaultColor, hasSolid, refColor, renderBoth, and scene.

◆ ~DATA()

DATA::~DATA ( )
inline

Definition at line 137 of file loadmodel.cpp.

138  {
139  // destroy any colors with no parent
140  if( !colors.empty() )
141  {
142  COLORMAP::iterator sC = colors.begin();
143  COLORMAP::iterator eC = colors.end();
144 
145  while( sC != eC )
146  {
147  if( nullptr == S3D::GetSGNodeParent( sC->second ) )
148  S3D::DestroyNode( sC->second );
149 
150  ++sC;
151  }
152 
153  colors.clear();
154  }
155 
156  if( defaultColor && nullptr == S3D::GetSGNodeParent( defaultColor ) )
158 
159  // destroy any faces with no parent
160  if( !faces.empty() )
161  {
162  FACEMAP::iterator sF = faces.begin();
163  FACEMAP::iterator eF = faces.end();
164 
165  while( sF != eF )
166  {
167  if( nullptr == S3D::GetSGNodeParent( sF->second ) )
168  S3D::DestroyNode( sF->second );
169 
170  ++sF;
171  }
172 
173  faces.clear();
174  }
175 
176  // destroy any shapes with no parent
177  if( !shapes.empty() )
178  {
179  NODEMAP::iterator sS = shapes.begin();
180  NODEMAP::iterator eS = shapes.end();
181 
182  while( sS != eS )
183  {
184  std::vector< SGNODE* >::iterator sV = sS->second.begin();
185  std::vector< SGNODE* >::iterator eV = sS->second.end();
186 
187  while( sV != eV )
188  {
189  if( nullptr == S3D::GetSGNodeParent( *sV ) )
190  S3D::DestroyNode( *sV );
191 
192  ++sV;
193  }
194 
195  sS->second.clear();
196  ++sS;
197  }
198 
199  shapes.clear();
200  }
201 
202  if( scene )
204  }
FACEMAP faces
Definition: loadmodel.cpp:124
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:494
COLORMAP colors
Definition: loadmodel.cpp:123
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:149
SGNODE * scene
Definition: loadmodel.cpp:119
SGNODE * defaultColor
Definition: loadmodel.cpp:120
NODEMAP shapes
Definition: loadmodel.cpp:122

References colors, defaultColor, S3D::DestroyNode(), faces, S3D::GetSGNodeParent(), scene, and shapes.

Member Function Documentation

◆ GetColor()

SGNODE* DATA::GetColor ( Quantity_Color *  colorObj)
inline

Definition at line 233 of file loadmodel.cpp.

234  {
235  if( nullptr == colorObj )
236  {
237  if( defaultColor )
238  return defaultColor;
239 
240  IFSG_APPEARANCE app( true );
241  app.SetShininess( 0.05f );
242  app.SetSpecular( 0.04f, 0.04f, 0.04f );
243  app.SetAmbient( 0.1f, 0.1f, 0.1f );
244  app.SetDiffuse( 0.6f, 0.6f, 0.6f );
245 
246  defaultColor = app.GetRawPtr();
247  return defaultColor;
248  }
249 
250  Standard_Real id = colorObj->Distance( refColor );
251  std::map< Standard_Real, SGNODE* >::iterator item;
252  item = colors.find( id );
253 
254  if( item != colors.end() )
255  return item->second;
256 
257  IFSG_APPEARANCE app( true );
258  app.SetShininess( 0.1f );
259  app.SetSpecular( 0.12f, 0.12f, 0.12f );
260  app.SetAmbient( 0.1f, 0.1f, 0.1f );
261  app.SetDiffuse( colorObj->Red(), colorObj->Green(), colorObj->Blue() );
262  colors.insert( std::pair< Standard_Real, SGNODE* >( id, app.GetRawPtr() ) );
263 
264  return app.GetRawPtr();
265  }
COLORMAP colors
Definition: loadmodel.cpp:123
Quantity_Color refColor
Definition: loadmodel.cpp:121
bool SetShininess(float aShininess) noexcept
SGNODE * defaultColor
Definition: loadmodel.cpp:120

References colors, defaultColor, IFSG_NODE::GetRawPtr(), refColor, IFSG_APPEARANCE::SetAmbient(), IFSG_APPEARANCE::SetDiffuse(), IFSG_APPEARANCE::SetShininess(), and IFSG_APPEARANCE::SetSpecular().

Referenced by getColor(), and processFace().

◆ GetFace()

SGNODE* DATA::GetFace ( const std::string &  id)
inline

Definition at line 221 of file loadmodel.cpp.

222  {
223  FACEMAP::iterator item;
224  item = faces.find( id );
225 
226  if( item == faces.end() )
227  return nullptr;
228 
229  return item->second;
230  }
FACEMAP faces
Definition: loadmodel.cpp:124

References faces.

Referenced by processFace().

◆ GetShape()

bool DATA::GetShape ( const std::string &  id,
std::vector< SGNODE * > *&  listPtr 
)
inline

Definition at line 207 of file loadmodel.cpp.

208  {
209  listPtr = nullptr;
210  NODEMAP::iterator item;
211  item = shapes.find( id );
212 
213  if( item == shapes.end() )
214  return false;
215 
216  listPtr = &item->second;
217  return true;
218  }
NODEMAP shapes
Definition: loadmodel.cpp:122

References shapes.

Referenced by processLabel(), and processSolid().

◆ Handle() [1/3]

DATA::Handle ( TDocStd_Document  )

◆ Handle() [2/3]

DATA::Handle ( XCAFDoc_ColorTool  )

◆ Handle() [3/3]

DATA::Handle ( XCAFDoc_ShapeTool  )

Member Data Documentation

◆ colors

COLORMAP DATA::colors

Definition at line 123 of file loadmodel.cpp.

Referenced by GetColor(), and ~DATA().

◆ defaultColor

SGNODE* DATA::defaultColor

Definition at line 120 of file loadmodel.cpp.

Referenced by DATA(), GetColor(), and ~DATA().

◆ faces

FACEMAP DATA::faces

Definition at line 124 of file loadmodel.cpp.

Referenced by GetFace(), processFace(), and ~DATA().

◆ hasSolid

bool DATA::hasSolid

Definition at line 126 of file loadmodel.cpp.

Referenced by DATA(), processFace(), processLabel(), and processSolid().

◆ refColor

Quantity_Color DATA::refColor

Definition at line 121 of file loadmodel.cpp.

Referenced by DATA(), and GetColor().

◆ renderBoth

bool DATA::renderBoth

Definition at line 125 of file loadmodel.cpp.

Referenced by DATA(), LoadModel(), and processFace().

◆ scene

SGNODE* DATA::scene

Definition at line 119 of file loadmodel.cpp.

Referenced by DATA(), LoadModel(), and ~DATA().

◆ shapes

NODEMAP DATA::shapes

Definition at line 122 of file loadmodel.cpp.

Referenced by GetShape(), and ~DATA().


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