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 107 of file loadmodel.cpp.

Constructor & Destructor Documentation

◆ DATA()

DATA::DATA ( )
inline

Definition at line 121 of file loadmodel.cpp.

122  {
123  scene = NULL;
124  defaultColor = NULL;
125  refColor.SetValues( Quantity_NOC_BLACK );
126  renderBoth = false;
127  hasSolid = false;
128  }
#define NULL
Quantity_Color refColor
Definition: loadmodel.cpp:114
bool hasSolid
Definition: loadmodel.cpp:119
SGNODE * scene
Definition: loadmodel.cpp:112
SGNODE * defaultColor
Definition: loadmodel.cpp:113
bool renderBoth
Definition: loadmodel.cpp:118

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

◆ ~DATA()

DATA::~DATA ( )
inline

Definition at line 130 of file loadmodel.cpp.

131  {
132  // destroy any colors with no parent
133  if( !colors.empty() )
134  {
135  COLORMAP::iterator sC = colors.begin();
136  COLORMAP::iterator eC = colors.end();
137 
138  while( sC != eC )
139  {
140  if( NULL == S3D::GetSGNodeParent( sC->second ) )
141  S3D::DestroyNode( sC->second );
142 
143  ++sC;
144  }
145 
146  colors.clear();
147  }
148 
151 
152  // destroy any faces with no parent
153  if( !faces.empty() )
154  {
155  FACEMAP::iterator sF = faces.begin();
156  FACEMAP::iterator eF = faces.end();
157 
158  while( sF != eF )
159  {
160  if( NULL == S3D::GetSGNodeParent( sF->second ) )
161  S3D::DestroyNode( sF->second );
162 
163  ++sF;
164  }
165 
166  faces.clear();
167  }
168 
169  // destroy any shapes with no parent
170  if( !shapes.empty() )
171  {
172  NODEMAP::iterator sS = shapes.begin();
173  NODEMAP::iterator eS = shapes.end();
174 
175  while( sS != eS )
176  {
177  std::vector< SGNODE* >::iterator sV = sS->second.begin();
178  std::vector< SGNODE* >::iterator eV = sS->second.end();
179 
180  while( sV != eV )
181  {
182  if( NULL == S3D::GetSGNodeParent( *sV ) )
183  S3D::DestroyNode( *sV );
184 
185  ++sV;
186  }
187 
188  sS->second.clear();
189  ++sS;
190  }
191 
192  shapes.clear();
193  }
194 
195  if( scene )
197 
198  return;
199  }
FACEMAP faces
Definition: loadmodel.cpp:117
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
Definition: ifsg_api.cpp:492
COLORMAP colors
Definition: loadmodel.cpp:116
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Function DestroyNode deletes the given SG* class node.
Definition: ifsg_api.cpp:148
#define NULL
SGNODE * scene
Definition: loadmodel.cpp:112
SGNODE * defaultColor
Definition: loadmodel.cpp:113
NODEMAP shapes
Definition: loadmodel.cpp:115

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

Member Function Documentation

◆ GetColor()

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

Definition at line 228 of file loadmodel.cpp.

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

References colors, defaultColor, IFSG_NODE::GetRawPtr(), NULL, 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 216 of file loadmodel.cpp.

217  {
218  FACEMAP::iterator item;
219  item = faces.find( id );
220 
221  if( item == faces.end() )
222  return NULL;
223 
224  return item->second;
225  }
FACEMAP faces
Definition: loadmodel.cpp:117
#define NULL

References faces, and NULL.

Referenced by processFace().

◆ GetShape()

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

Definition at line 202 of file loadmodel.cpp.

203  {
204  listPtr = NULL;
205  NODEMAP::iterator item;
206  item = shapes.find( id );
207 
208  if( item == shapes.end() )
209  return false;
210 
211  listPtr = &item->second;
212  return true;
213  }
#define NULL
NODEMAP shapes
Definition: loadmodel.cpp:115

References NULL, and shapes.

Referenced by LoadModel(), 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 116 of file loadmodel.cpp.

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

◆ defaultColor

SGNODE* DATA::defaultColor

Definition at line 113 of file loadmodel.cpp.

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

◆ faces

FACEMAP DATA::faces

Definition at line 117 of file loadmodel.cpp.

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

◆ hasSolid

bool DATA::hasSolid

Definition at line 119 of file loadmodel.cpp.

Referenced by DATA(), processComp(), processFace(), processNode(), and processSolid().

◆ refColor

Quantity_Color DATA::refColor

Definition at line 114 of file loadmodel.cpp.

Referenced by DATA(), and GetColor().

◆ renderBoth

bool DATA::renderBoth

Definition at line 118 of file loadmodel.cpp.

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

◆ scene

SGNODE* DATA::scene

Definition at line 112 of file loadmodel.cpp.

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

◆ shapes

NODEMAP DATA::shapes

Definition at line 115 of file loadmodel.cpp.

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


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