KiCad PCB EDA Suite
|
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <map>
#include <vector>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <wx/utils.h>
#include <wx/wfstream.h>
#include <wx/zipstrm.h>
#include <advanced_config.h>
#include <decompress.hpp>
#include <TDocStd_Document.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <Quantity_Color.hxx>
#include <XCAFApp_Application.hxx>
#include <AIS_Shape.hxx>
#include <IGESControl_Reader.hxx>
#include <IGESCAFControl_Reader.hxx>
#include <Interface_Static.hxx>
#include <STEPControl_Reader.hxx>
#include <STEPCAFControl_Reader.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ColorTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <BRep_Tool.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp_Explorer.hxx>
#include <Poly_Triangulation.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Precision.hxx>
#include <TDF_LabelSequence.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Tool.hxx>
#include <TDataStd_Name.hxx>
#include <Standard_Version.hxx>
#include "plugins/3dapi/ifsg_all.h"
Go to the source code of this file.
Classes | |
struct | DATA |
Macros | |
#define | MASK_OCE wxT( "PLUGIN_OCE" ) |
#define | MASK_OCE_EXTRA wxT( "PLUGIN_OCE_EXTRA" ) |
#define | OCC_COLOR_SPACE Quantity_TOC_RGB |
Typedefs | |
typedef std::map< std::size_t, SGNODE * > | COLORMAP |
typedef std::map< std::string, SGNODE * > | FACEMAP |
typedef std::map< std::string, std::vector< SGNODE * > > | NODEMAP |
typedef std::pair< std::string, std::vector< SGNODE * > > | NODEITEM |
Enumerations | |
enum | FormatType { FMT_NONE = 0 , FMT_STEP , FMT_STPZ , FMT_IGES } |
Functions | |
bool | processLabel (const TDF_Label &aLabel, DATA &aData, SGNODE *aParent, std::vector< SGNODE * > *aItems) |
bool | processFace (const TopoDS_Face &face, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items, Quantity_ColorRGBA *color) |
FormatType | fileType (const char *aFileName) |
void | getTag (const TDF_Label &aLabel, std::string &aTag) |
Gets the absolute tag string for a given label in the form of ##:##:##:##. | |
static wxString | getLabelName (const TDF_Label &aLabel) |
std::string | getShapeName (TopAbs_ShapeEnum aShape) |
Gets a string for a given TopAbs_ShapeEnum element. | |
static int | colorFloatToDecimal (float aVal) |
static std::ostream & | operator<< (std::ostream &aOStream, const Quantity_ColorRGBA &aColor) |
static void | printLabel (TDF_Label aLabel, Handle(XCAFDoc_ShapeTool) aShapeTool, Handle(XCAFDoc_ColorTool) aColorTool, const char *aPreMsg=nullptr) |
Gets a string for a given TopAbs_ShapeEnum element. | |
static void | dumpLabels (TDF_Label aLabel, Handle(XCAFDoc_ShapeTool) aShapeTool, Handle(XCAFDoc_ColorTool) aColorTool, int aDepth=0) |
Dumps a label and the entire tree underneath it. | |
bool | getColor (DATA &data, TDF_Label label, Quantity_ColorRGBA &color) |
void | addItems (SGNODE *parent, std::vector< SGNODE * > *lp) |
bool | readIGES (Handle(TDocStd_Document) &m_doc, const char *fname) |
bool | readSTEP (Handle(TDocStd_Document)&m_doc, const char *fname) |
bool | readSTEPZ (Handle(TDocStd_Document)&m_doc, const char *aFileName) |
SCENEGRAPH * | LoadModel (char const *filename) |
bool | processShell (const TopoDS_Shape &shape, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items, Quantity_ColorRGBA *color) |
bool | processSolidOrShell (const TopoDS_Shape &shape, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items) |
#define MASK_OCE wxT( "PLUGIN_OCE" ) |
Definition at line 89 of file loadmodel.cpp.
Referenced by getTag(), LoadModel(), printLabel(), processLabel(), processShell(), processSolidOrShell(), and readSTEP().
#define MASK_OCE_EXTRA wxT( "PLUGIN_OCE_EXTRA" ) |
Definition at line 90 of file loadmodel.cpp.
#define OCC_COLOR_SPACE Quantity_TOC_RGB |
Definition at line 109 of file loadmodel.cpp.
Referenced by DATA::GetColor().
Definition at line 92 of file loadmodel.cpp.
Definition at line 93 of file loadmodel.cpp.
Definition at line 95 of file loadmodel.cpp.
Definition at line 94 of file loadmodel.cpp.
enum FormatType |
Enumerator | |
---|---|
FMT_NONE | |
FMT_STEP | |
FMT_STPZ | |
FMT_IGES |
Definition at line 275 of file loadmodel.cpp.
Definition at line 523 of file loadmodel.cpp.
References S3D::AddSGNodeChild(), S3D::AddSGNodeRef(), and S3D::GetSGNodeParent().
Referenced by processSolidOrShell().
|
static |
Definition at line 412 of file loadmodel.cpp.
Referenced by operator<<().
|
static |
Dumps a label and the entire tree underneath it.
aLabel | Label to convert |
aShapeTool | Handle to shape tool being used |
aColorTool | Handle to color tool being used |
aDepth | Indentation level to offset labels (used recursively by dumpLabels) |
Definition at line 491 of file loadmodel.cpp.
References dumpLabels(), and printLabel().
Referenced by dumpLabels(), and LoadModel().
FormatType fileType | ( | const char * | aFileName | ) |
Definition at line 284 of file loadmodel.cpp.
References FMT_IGES, FMT_NONE, FMT_STEP, and FMT_STPZ.
Referenced by LoadModel().
bool getColor | ( | DATA & | data, |
TDF_Label | label, | ||
Quantity_ColorRGBA & | color ) |
Definition at line 502 of file loadmodel.cpp.
References color, and DATA::GetColor().
Referenced by processSolidOrShell().
|
static |
Definition at line 371 of file loadmodel.cpp.
References Handle(), and name.
Referenced by printLabel().
std::string getShapeName | ( | TopAbs_ShapeEnum | aShape | ) |
Gets a string for a given TopAbs_ShapeEnum element.
aShape | enum value to convert |
Definition at line 394 of file loadmodel.cpp.
Referenced by printLabel().
void getTag | ( | const TDF_Label & | aLabel, |
std::string & | aTag ) |
Gets the absolute tag string for a given label in the form of ##:##:##:##.
aLabel | is the label to get the string for |
aTag | is the resulting tag string based by reference |
Definition at line 347 of file loadmodel.cpp.
References MASK_OCE.
Referenced by processFace(), processLabel(), and processSolidOrShell().
SCENEGRAPH * LoadModel | ( | char const * | filename | ) |
Definition at line 699 of file loadmodel.cpp.
References dumpLabels(), fileType(), FMT_IGES, FMT_STEP, FMT_STPZ, IFSG_NODE::GetRawPtr(), Handle(), MASK_OCE, processLabel(), readIGES(), readSTEP(), readSTEPZ(), DATA::renderBoth, DATA::scene, and S3D::WriteVRML().
Referenced by Load().
|
inlinestatic |
Definition at line 418 of file loadmodel.cpp.
References colorFloatToDecimal().
|
static |
Gets a string for a given TopAbs_ShapeEnum element.
aLabel | Label to convert |
aShapeTool | Handle to shape tool being used |
aColorTool | Handle to color tool being used |
aPregMsg | Any prefixed message to insert (used for indentation in dump) |
Definition at line 438 of file loadmodel.cpp.
References getLabelName(), getShapeName(), and MASK_OCE.
Referenced by dumpLabels().
bool processFace | ( | const TopoDS_Face & | face, |
DATA & | data, | ||
SGNODE * | parent, | ||
std::vector< SGNODE * > * | items, | ||
Quantity_ColorRGBA * | color ) |
Definition at line 1095 of file loadmodel.cpp.
References S3D::AddSGNodeChild(), S3D::AddSGNodeRef(), IFSG_FACESET::CalcNormals(), color, DATA::faces, ADVANCED_CFG::GetCfg(), DATA::GetColor(), DATA::GetFace(), IFSG_NODE::GetRawPtr(), S3D::GetSGNodeParent(), getTag(), Handle(), DATA::hasSolid, ADVANCED_CFG::m_OcePluginLinearDeflection, DATA::renderBoth, IFSG_COORDS::SetCoordsList(), IFSG_INDEX::SetIndices(), and IFSG_NODE::SetParent().
Referenced by processLabel(), and processShell().
bool processLabel | ( | const TDF_Label & | aLabel, |
DATA & | aData, | ||
SGNODE * | aParent, | ||
std::vector< SGNODE * > * | aItems ) |
Definition at line 950 of file loadmodel.cpp.
References IFSG_NODE::GetRawPtr(), DATA::GetShape(), getTag(), DATA::hasSolid, MASK_OCE, processFace(), processLabel(), processSolidOrShell(), IFSG_TRANSFORM::SetRotation(), IFSG_TRANSFORM::SetTranslation(), and T.
Referenced by LoadModel(), and processLabel().
bool processShell | ( | const TopoDS_Shape & | shape, |
DATA & | data, | ||
SGNODE * | parent, | ||
std::vector< SGNODE * > * | items, | ||
Quantity_ColorRGBA * | color ) |
Definition at line 806 of file loadmodel.cpp.
References color, MASK_OCE, and processFace().
Referenced by processSolidOrShell().
bool processSolidOrShell | ( | const TopoDS_Shape & | shape, |
DATA & | data, | ||
SGNODE * | parent, | ||
std::vector< SGNODE * > * | items ) |
Definition at line 825 of file loadmodel.cpp.
References addItems(), IFSG_NODE::Destroy(), getColor(), getColor(), IFSG_NODE::GetRawPtr(), DATA::GetShape(), getTag(), DATA::hasSolid, MASK_OCE, and processShell().
Referenced by processLabel().
bool readIGES | ( | Handle(TDocStd_Document) & | m_doc, |
const char * | fname ) |
Definition at line 546 of file loadmodel.cpp.
Referenced by LoadModel().
bool readSTEP | ( | Handle(TDocStd_Document)& | m_doc, |
const char * | fname ) |
Definition at line 585 of file loadmodel.cpp.
References ADVANCED_CFG::GetCfg(), and MASK_OCE.
Referenced by LoadModel(), and readSTEPZ().
bool readSTEPZ | ( | Handle(TDocStd_Document)& | m_doc, |
const char * | aFileName ) |