35#include <wx/filename.h> 
   37#include <wx/stdpaths.h> 
   40#include <wx/wfstream.h> 
   41#include <wx/zipstrm.h> 
   44#include <decompress.hpp> 
   46#include <TDocStd_Document.hxx> 
   48#include <TopoDS_Shape.hxx> 
   49#include <Quantity_Color.hxx> 
   50#include <XCAFApp_Application.hxx> 
   52#include <AIS_Shape.hxx> 
   54#include <IGESControl_Reader.hxx> 
   55#include <IGESCAFControl_Reader.hxx> 
   56#include <Interface_Static.hxx> 
   58#include <STEPControl_Reader.hxx> 
   59#include <STEPCAFControl_Reader.hxx> 
   61#include <XCAFDoc_DocumentTool.hxx> 
   62#include <XCAFDoc_ColorTool.hxx> 
   63#include <XCAFDoc_ShapeTool.hxx> 
   65#include <BRep_Tool.hxx> 
   66#include <BRepMesh_IncrementalMesh.hxx> 
   69#include <TopoDS_Shape.hxx> 
   70#include <TopoDS_Face.hxx> 
   71#include <TopoDS_Compound.hxx> 
   72#include <TopExp_Explorer.hxx> 
   74#include <Quantity_Color.hxx> 
   75#include <Poly_Triangulation.hxx> 
   76#include <Poly_PolygonOnTriangulation.hxx> 
   77#include <Precision.hxx> 
   79#include <TDF_LabelSequence.hxx> 
   80#include <TDF_ChildIterator.hxx> 
   81#include <TDF_Tool.hxx> 
   82#include <TDataStd_Name.hxx> 
   83#include <Standard_Version.hxx> 
   89#define MASK_OCE wxT( "PLUGIN_OCE" ) 
   90#define MASK_OCE_EXTRA wxT( "PLUGIN_OCE_EXTRA" ) 
   92typedef std::map<std::size_t, SGNODE*>               
COLORMAP;
 
   93typedef std::map<std::string, SGNODE*>               
FACEMAP;
 
   94typedef std::map<std::string, std::vector<SGNODE*>>  
NODEMAP;
 
   95typedef std::pair<std::string, std::vector<SGNODE*>> 
NODEITEM;
 
  100                  std::vector< SGNODE* >* aItems );
 
  104                  std::vector< SGNODE* >* items, Quantity_ColorRGBA* 
color );
 
  106#if OCC_VERSION_HEX >= 0x070500 
  107#define OCC_COLOR_SPACE Quantity_TOC_sRGB 
  109#define OCC_COLOR_SPACE Quantity_TOC_RGB 
  130        refColor.SetValues( Quantity_NOC_BLACK );
 
 
  140            COLORMAP::iterator sC = 
colors.begin();
 
  141            COLORMAP::iterator eC = 
colors.end();
 
  160            FACEMAP::iterator sF = 
faces.begin();
 
  161            FACEMAP::iterator eF = 
faces.end();
 
  177            NODEMAP::iterator sS = 
shapes.begin();
 
  178            NODEMAP::iterator eS = 
shapes.end();
 
  182                std::vector< SGNODE* >::iterator sV = sS->second.begin();
 
  183                std::vector< SGNODE* >::iterator eV = sS->second.end();
 
 
  205    bool GetShape( 
const std::string& 
id, std::vector< SGNODE* >*& listPtr )
 
  208        NODEMAP::iterator item;
 
  211        if( item == 
shapes.end() )
 
  214        listPtr = &item->second;
 
 
  221        FACEMAP::iterator item;
 
  222        item = 
faces.find( 
id );
 
  224        if( item == 
faces.end() )
 
 
  233        if( 
nullptr == colorObj )
 
  248        Quantity_Color colorRgb = colorObj->GetRGB();
 
  250        Standard_Real r, g, b;
 
  253        std::size_t hash = std::hash<double>{}( colorRgb.Distance( 
refColor ) )
 
  254                           ^ ( std::hash<float>{}( colorObj->Alpha() ) << 1 );
 
  256        std::map<std::size_t, SGNODE*>::iterator item;
 
  257        item = 
colors.find( hash );
 
  259        if( item != 
colors.end() )
 
 
 
  286    wxFileName fname( wxString::FromUTF8Unchecked( aFileName ) );
 
  287    wxFFileInputStream ifile( fname.GetFullPath() );
 
  292    if( fname.GetExt().MakeUpper().EndsWith( wxT( 
"STPZ" ) )
 
  293            || fname.GetExt().MakeUpper().EndsWith( wxT( 
"GZ" ) ) )
 
  303    const int max_line_count = 3;
 
  305    for( 
int ii = 0; ii < max_line_count; ii++ )
 
  307        memset( iline, 0, 82 );
 
  308        ifile.Read( iline, 82 );
 
  313        if( !strncmp( iline, 
"ISO-10303-21;", 13 ) )
 
  319        std::string fstr = iline;
 
  323        if( fstr.find( 
"urn:oid:1.0.10303." ) != std::string::npos )
 
  329        if( iline[72] == 
'S' && ( iline[80] == 0 || iline[80] == 13 || iline[80] == 10 ) )
 
  333        if( strncmp( iline, 
"/*", 2 ) != 0 )    
 
 
  347void getTag( 
const TDF_Label& aLabel, std::string& aTag )
 
  349    std::ostringstream ostr;
 
  351    if( aLabel.IsNull() )
 
  353        wxLogTrace( 
MASK_OCE, wxT( 
"Null label passed to getTag" ) );
 
  357    TColStd_ListOfInteger tagList;
 
  358    TDF_Tool::TagList( aLabel, tagList );
 
  360    for( TColStd_ListOfInteger::Iterator it( tagList ); it.More(); it.Next() )
 
 
  375    if( !aLabel.IsNull() && aLabel.FindAttribute( TDataStd_Name::GetID(), 
name ) )
 
  377        TCollection_ExtendedString extstr = 
name->Get();
 
  378        char*                      str = 
new char[extstr.LengthOfCString() + 1];
 
  379        extstr.ToUTF8CString( str );
 
  381        txt = wxString::FromUTF8( str );
 
 
  398    case TopAbs_COMPOUND: 
return "COMPOUND";
 
  399    case TopAbs_COMPSOLID: 
return "COMPSOLID";
 
  400    case TopAbs_SOLID: 
return "SOLID";
 
  401    case TopAbs_SHELL: 
return "SHELL";
 
  402    case TopAbs_FACE: 
return "FACE";
 
  403    case TopAbs_WIRE: 
return "WIRE";
 
  404    case TopAbs_EDGE: 
return "EDGE";
 
  405    case TopAbs_VERTEX: 
return "VERTEX";
 
  406    case TopAbs_SHAPE: 
return "SHAPE";
 
 
  418static inline std::ostream& 
operator<<( std::ostream& aOStream, 
const Quantity_ColorRGBA& aColor )
 
  420    Quantity_Color rgb = aColor.GetRGB();
 
 
  439                        Handle( XCAFDoc_ColorTool ) aColorTool, 
const char* aPreMsg = 
nullptr )
 
  441    if( aLabel.IsNull() )
 
  447    TCollection_AsciiString entry;
 
  448    TDF_Tool::Entry( aLabel, entry );
 
  449    std::ostringstream ss;
 
  450    ss << aPreMsg << entry << 
", " << 
getLabelName( aLabel )
 
  451       << ( aShapeTool->IsShape( aLabel ) ? 
", shape" : 
"" )
 
  452       << ( aShapeTool->IsTopLevel( aLabel ) ? 
", topLevel" : 
"" )
 
  453       << ( aShapeTool->IsFree( aLabel ) ? 
", free" : 
"" )
 
  454       << ( aShapeTool->IsAssembly( aLabel ) ? 
", assembly" : 
"" )
 
  455       << ( aShapeTool->IsSimpleShape( aLabel ) ? 
", simple" : 
"" )
 
  456       << ( aShapeTool->IsCompound( aLabel ) ? 
", compound" : 
"" )
 
  457       << ( aShapeTool->IsReference( aLabel ) ? 
", reference" : 
"" )
 
  458       << ( aShapeTool->IsComponent( aLabel ) ? 
", component" : 
"" )
 
  459       << ( aShapeTool->IsSubShape( aLabel ) ? 
", subshape" : 
"" );
 
  461    if( aShapeTool->IsSubShape( aLabel ) )
 
  463        auto shape = aShapeTool->GetShape( aLabel );
 
  464        if( !shape.IsNull() )
 
  468    if( aShapeTool->IsShape( aLabel ) )
 
  470        Quantity_ColorRGBA c;
 
  471        if( aColorTool->GetColor( aLabel, XCAFDoc_ColorGen, c ) )
 
  473        if( aColorTool->GetColor( aLabel, XCAFDoc_ColorSurf, c ) )
 
  475        if( aColorTool->GetColor( aLabel, XCAFDoc_ColorCurv, c ) )
 
  479    wxLogTrace( 
MASK_OCE, ss.str().c_str() );
 
 
  492                        Handle( XCAFDoc_ColorTool ) aColorTool, 
int aDepth = 0 )
 
  494    std::string indent( aDepth * 2, 
' ' );
 
  495    printLabel( aLabel, aShapeTool, aColorTool, indent.c_str() );
 
  496    TDF_ChildIterator it;
 
  497    for( it.Initialize( aLabel ); it.More(); it.Next() )
 
  498        dumpLabels( it.Value(), aShapeTool, aColorTool, aDepth + 1 );
 
 
  506        if( data.m_color->
GetColor( label, XCAFDoc_ColorSurf, 
color ) )
 
  508        else if( data.m_color->
GetColor( label, XCAFDoc_ColorCurv, 
color ) )
 
  510        else if( data.m_color->
GetColor( label, XCAFDoc_ColorGen, 
color ) )
 
  513        label = label.Father();
 
 
  528    std::vector< SGNODE* >::iterator sL = lp->begin();
 
  529    std::vector< SGNODE* >::iterator eL = lp->end();
 
 
  548    IGESCAFControl_Reader reader;
 
  549    IFSelect_ReturnStatus stat  = reader.ReadFile( fname );
 
  550    reader.PrintCheckLoad( Standard_False, IFSelect_ItemsByEntity );
 
  552    if( stat != IFSelect_RetDone )
 
  556    if( !Interface_Static::SetIVal( 
"read.precision.mode", 0 ) )
 
  560    reader.SetColorMode(
true);  
 
  561    reader.SetNameMode(
false);  
 
  562    reader.SetLayerMode(
false); 
 
  564    if( !reader.Transfer( m_doc ) )
 
  566        if( m_doc->CanClose() == CDM_CCS_OK )
 
  573    if( reader.NbShapes() < 1 )
 
  575        if( m_doc->CanClose() == CDM_CCS_OK )
 
 
  587    wxLogTrace( 
MASK_OCE, wxT( 
"Reading step file %s" ), fname );
 
  589    STEPCAFControl_Reader reader;
 
  590    IFSelect_ReturnStatus stat  = reader.ReadFile( fname );
 
  592    if( stat != IFSelect_RetDone )
 
  596    if( !Interface_Static::SetIVal( 
"read.precision.mode", 1 ) )
 
  600    if( !Interface_Static::SetRVal( 
"read.precision.val", 
ADVANCED_CFG::GetCfg().m_OcePluginLinearDeflection ) )
 
  604    reader.SetColorMode( 
true );  
 
  605    reader.SetNameMode( 
false );  
 
  606    reader.SetLayerMode( 
false ); 
 
  608    if( !reader.Transfer( m_doc ) )
 
  610        if( m_doc->CanClose() == CDM_CCS_OK )
 
  617    if( reader.NbRootsForTransfer() < 1 )
 
  619        if( m_doc->CanClose() == CDM_CCS_OK )
 
 
  631    wxFileName fname( wxString::FromUTF8Unchecked( aFileName ) );
 
  632    wxFFileInputStream ifile( fname.GetFullPath() );
 
  634    wxFileName outFile( fname );
 
  636    outFile.SetPath( wxStandardPaths::Get().GetTempDir() );
 
  637    outFile.SetExt( wxT( 
"STEP" ) );
 
  639    wxFileOffset size = ifile.GetLength();
 
  640    wxBusyCursor busycursor;
 
  642    if( size == wxInvalidOffset )
 
  646        bool success = 
false;
 
  647        wxFFileOutputStream ofile( outFile.GetFullPath() );
 
  652        char *buffer = 
new char[size];
 
  654        ifile.Read( buffer, size);
 
  655        std::string expanded;
 
  659            expanded = gzip::decompress( buffer, size );
 
  665        if( expanded.empty() )
 
  669            wxZipInputStream izipfile( ifile );
 
  670            std::unique_ptr<wxZipEntry> zip_file( izipfile.GetNextEntry() );
 
  672            if( zip_file && !zip_file->IsDir() && izipfile.CanRead() )
 
  674                izipfile.Read( ofile );
 
  680            ofile.Write( expanded.data(), expanded.size() );
 
  690    bool retval = 
readSTEP( m_doc, outFile.GetFullPath().mb_str() );
 
  693    wxRemoveFile( outFile.GetFullPath() );
 
 
  703    Handle(XCAFApp_Application) m_app = XCAFApp_Application::GetApplication();
 
  704    m_app->NewDocument( 
"MDTV-XCAF", data.m_doc );
 
  712        if( !
readIGES( data.m_doc, filename ) )
 
  718        if( !
readSTEP( data.m_doc, filename ) )
 
  731        if( m_app->CanClose( data.m_doc ) == CDM_CCS_OK )
 
  732            m_app->Close( data.m_doc );
 
  738    data.m_assy = XCAFDoc_DocumentTool::ShapeTool( data.m_doc->Main() );
 
  739    data.m_color = XCAFDoc_DocumentTool::ColorTool( data.m_doc->Main() );
 
  742    if( wxLog::IsAllowedTraceMask( 
MASK_OCE ) )
 
  744        dumpLabels( data.m_doc->Main(), data.m_assy, data.m_color );
 
  748    TDF_LabelSequence frshapes;
 
  749    data.m_assy->GetFreeShapes( frshapes );
 
  757    for( Standard_Integer i = 1; i <= frshapes.Length(); i++ )
 
  759        const TDF_Label& label = frshapes.Value( i );
 
  761        if( data.m_color->IsVisible( label ) )
 
  770        if( m_app->CanClose( data.m_doc ) == CDM_CCS_OK )
 
  771            m_app->Close( data.m_doc );
 
  779#if ( defined( DEBUG_OCE ) && DEBUG_OCE > 3 ) 
  782        wxFileName fn( wxString::FromUTF8Unchecked( filename ) );
 
  786            output = wxT( 
"_step-" );
 
  788            output = wxT( 
"_iges-" );
 
  790        output.append( fn.GetName() );
 
  791        output.append( wxT( 
".wrl" ) );
 
  797    data.
scene = 
nullptr;
 
  799    if( m_app->CanClose( data.m_doc ) == CDM_CCS_OK )
 
  800        m_app->Close( data.m_doc );
 
 
  807                   std::vector<SGNODE*>* items, Quantity_ColorRGBA* 
color )
 
  812    wxLogTrace( 
MASK_OCE, wxT( 
"Processing shell" ) );
 
  813    for( it.Initialize( shape, 
false, 
false ); it.More(); it.Next() )
 
  815        const TopoDS_Face& face = TopoDS::Face( it.Value() );
 
 
  826                   std::vector< SGNODE* >* items )
 
  830    Quantity_ColorRGBA col;
 
  831    Quantity_ColorRGBA* lcolor = 
nullptr;
 
  833    data.
hasSolid = shape.ShapeType() == TopAbs_SOLID;
 
  835    wxLogTrace( 
MASK_OCE, wxT( 
"Processing solid" ) );
 
  838    if( !data.m_assy->Search( shape, label ) )
 
  841        std::ostringstream ostr;
 
  842        ostr << 
"KMISC_" << i++;
 
  847        bool found_color = 
false;
 
  858            if( data.m_assy->Search( shape, label, Standard_False, Standard_True, Standard_True ) &&
 
  869            if( data.m_assy->Search( shape, label, Standard_False, Standard_False,
 
  882            if( data.m_assy->Search( shape, label, Standard_False, Standard_False,
 
  900    std::vector< SGNODE* >* component = 
nullptr;
 
  902    if( !partID.empty() )
 
  909        if( 
nullptr != items )
 
  910            items->push_back( pptr );
 
  914    std::vector<SGNODE*> itemList;
 
  916    TopAbs_ShapeEnum stype = shape.ShapeType();
 
  917    if( stype == TopAbs_SHELL )
 
  919        if( 
processShell( shape, data, pptr, &itemList, lcolor ) )
 
  925        for( it.Initialize( shape, 
false, 
false ); it.More(); it.Next() )
 
  927            const TopoDS_Shape& subShape = it.Value();
 
  929            if( subShape.ShapeType() == TopAbs_SHELL )
 
  931                if( 
processShell( subShape, data, pptr, &itemList, lcolor ) )
 
  936                wxLogTrace( 
MASK_OCE, wxT( 
"Unsupported subshape in solid" ) );
 
  943    else if( 
nullptr != items )
 
  944        items->push_back( pptr );
 
 
  951                   std::vector<SGNODE*>* aItems )
 
  953    std::string labelTag;
 
  955    if( wxLog::IsAllowedTraceMask( 
MASK_OCE ) )
 
  958        getTag( aLabel, labelTag );
 
  961    wxLogTrace( 
MASK_OCE, wxT( 
"Processing label %s" ), labelTag );
 
  963    TopoDS_Shape originalShape;
 
  964    TDF_Label shapeLabel = aLabel;
 
  966    if( !aData.m_assy->
GetShape( shapeLabel, originalShape ) )
 
  971    TopoDS_Shape shape = originalShape;
 
  973    if( aData.m_assy->IsReference( aLabel ) )
 
  975        wxLogTrace( 
MASK_OCE, wxT( 
"Label %s is ref, trying to pull up referred label" ),
 
  978        if( !aData.m_assy->GetReferredShape( aLabel, shapeLabel ) )
 
  983        labelTag = 
static_cast<int>( shapeLabel.Tag() );
 
  986        if( !aData.m_assy->
GetShape( shapeLabel, shape ) )
 
  996    const TopLoc_Location& loc = originalShape.Location();
 
  998    if( !loc.IsIdentity() )
 
 1000        wxLogTrace( 
MASK_OCE, wxT( 
"Label %d has location" ), 
static_cast<int>( aLabel.Tag() ) );
 
 1001        gp_Trsf 
T = loc.Transformation();
 
 1002        gp_XYZ  coord = 
T.TranslationPart();
 
 1004        wxLogTrace( 
MASK_OCE, wxT( 
"Translation %f, %f, %f" ), coord.X(), coord.Y(), coord.Z() );
 
 1006        Standard_Real angle;
 
 1008        if( 
T.GetRotation( axis, angle ) )
 
 1011            wxLogTrace( 
MASK_OCE, wxT( 
"Rotation %f, %f, %f, angle %f" ),
 
 1012                        axis.X(), axis.Y(), axis.Z(), angle );
 
 1016    TopAbs_ShapeEnum stype = shape.ShapeType();
 
 1022    case TopAbs_COMPOUND:
 
 1026            if( !aData.m_assy->IsAssembly( shapeLabel ) )
 
 1030                for( xp.Init( shape, TopAbs_SOLID ); xp.More(); xp.Next() )
 
 1037                for( xp.Init( shape, TopAbs_SHELL, TopAbs_SOLID ); xp.More(); xp.Next() )
 
 1044                for( xp.Init( shape, TopAbs_FACE, TopAbs_SHELL ); xp.More(); xp.Next() )
 
 1046                    const TopoDS_Face& face = TopoDS::Face( xp.Current() );
 
 1047                    processFace( face, aData, pptr, aItems, 
nullptr );
 
 1067        if( 
processFace( TopoDS::Face( shape ), aData, pptr, aItems, 
nullptr ) )
 
 1076    if( 
nullptr != aItems )
 
 1077        aItems->push_back( pptr );
 
 1079    if( !aData.m_assy->IsSimpleShape( shapeLabel ) && shapeLabel.HasChild() )
 
 1081        wxLogTrace( 
MASK_OCE, wxT( 
"Label %s has children" ), labelTag );
 
 1082        TDF_ChildIterator it;
 
 1084        for( it.Initialize( shapeLabel ); it.More(); it.Next() )
 
 
 1096                  Quantity_ColorRGBA* 
color )
 
 1098    if( Standard_True == face.IsNull() )
 
 1101    bool reverse = ( face.Orientation() == TopAbs_REVERSED );
 
 1102    SGNODE* ashape = 
nullptr;
 
 1106    bool useBothSides = 
false;
 
 1111        useBothSides = 
true;
 
 1113    if( data.m_assy->FindShape( face, label, Standard_False ) )
 
 1116    if( !partID.empty() )
 
 1117        ashape = data.
GetFace( partID );
 
 1126        if( 
nullptr != items )
 
 1127            items->push_back( ashape );
 
 1131            std::string id2 = partID;
 
 1140            if( 
nullptr != items )
 
 1141                items->push_back( shapeB );
 
 1147    TopLoc_Location loc;
 
 1148    Standard_Boolean isTessellate (Standard_False);
 
 1149    Handle( Poly_Triangulation ) triangulation = BRep_Tool::Triangulation( face, loc );
 
 1152    if( triangulation.IsNull() || triangulation->Deflection() > linDeflection + Precision::Confusion() )
 
 1153        isTessellate = Standard_True;
 
 1157        BRepMesh_IncrementalMesh IM(face, linDeflection, Standard_False,
 
 1159        triangulation = BRep_Tool::Triangulation( face, loc );
 
 1162    if( triangulation.IsNull() == Standard_True )
 
 1165    Quantity_ColorRGBA lcolor;
 
 1168    if( data.m_color->
GetColor( face, XCAFDoc_ColorSurf, lcolor )
 
 1169        || data.m_color->
GetColor( face, XCAFDoc_ColorCurv, lcolor )
 
 1170        || data.m_color->
GetColor( face, XCAFDoc_ColorGen, lcolor ) )
 
 1189    std::vector< SGPOINT > vertices;
 
 1190    std::vector< int > indices;
 
 1191    std::vector< int > indices2;
 
 1194    for( 
int i = 1; i <= triangulation->NbNodes(); i++ )
 
 1196        gp_XYZ v( triangulation->Node(i).Coord() );
 
 1197        vertices.emplace_back( v.X(), v.Y(), v.Z() );
 
 1200    for( 
int i = 1; i <= triangulation->NbTriangles(); i++ )
 
 1203        triangulation->Triangle(i).Get(a, b, c);
 
 1218        indices.push_back( a );
 
 1219        indices.push_back( b );
 
 1220        indices.push_back( c );
 
 1224            indices2.push_back( b );
 
 1225            indices2.push_back( a );
 
 1226            indices2.push_back( c );
 
 1231    coordIdx.
SetIndices( indices.size(), &indices[0] );
 
 1235    if( !partID.empty() )
 
 1242        std::string id2 = partID;
 
 1251        coordIdx2.
SetIndices( indices2.size(), &indices2[0] );
 
 1255        if( !partID.empty() )
 
 
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
 
bool SetDiffuse(float aRVal, float aGVal, float aBVal)
 
bool SetSpecular(float aRVal, float aGVal, float aBVal)
 
bool SetShininess(float aShininess) noexcept
 
bool SetAmbient(float aRVal, float aGVal, float aBVal)
 
bool SetTransparency(float aTransparency) noexcept
 
The wrapper for SGCOORDINDEX.
 
The wrapper for SGCOORDS.
 
bool SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
 
The wrapper for the SGFACESET class.
 
bool CalcNormals(SGNODE **aPtr)
 
bool SetIndices(size_t nIndices, int *aIndexList)
Set the number of indices and creates a copy of the given index data.
 
bool SetParent(SGNODE *aParent)
Set the parent SGNODE of this object.
 
SGNODE * GetRawPtr(void) noexcept
Return the raw internal SGNODE pointer.
 
void Destroy(void)
Delete the object held by this wrapper.
 
The wrapper for the SGSHAPE class.
 
Define the basic data set required to represent a 3D model.
 
The base class of all Scene Graph nodes.
 
double m_OcePluginLinearDeflection
OCE (STEP/IGES) 3D Plugin Tesselation Linear Deflection.
 
collects header files for all SG* wrappers and the API
 
Handle(KICAD3D_INFO) KICAD3D_INFO
 
bool processShell(const TopoDS_Shape &shape, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items, Quantity_ColorRGBA *color)
 
std::map< std::string, std::vector< SGNODE * > > NODEMAP
 
std::map< std::size_t, SGNODE * > COLORMAP
 
bool processFace(const TopoDS_Face &face, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items, Quantity_ColorRGBA *color)
 
std::pair< std::string, std::vector< SGNODE * > > NODEITEM
 
bool getColor(DATA &data, TDF_Label label, Quantity_ColorRGBA &color)
 
static int colorFloatToDecimal(float aVal)
 
void getTag(const TDF_Label &aLabel, std::string &aTag)
Gets the absolute tag string for a given label in the form of ##:##:##:##.
 
void addItems(SGNODE *parent, std::vector< SGNODE * > *lp)
 
std::string getShapeName(TopAbs_ShapeEnum aShape)
Gets a string for a given TopAbs_ShapeEnum element.
 
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.
 
SCENEGRAPH * LoadModel(char const *filename)
 
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.
 
FormatType fileType(const char *aFileName)
 
bool readSTEP(Handle(TDocStd_Document)&m_doc, const char *fname)
 
static std::ostream & operator<<(std::ostream &aOStream, const Quantity_ColorRGBA &aColor)
 
bool processSolidOrShell(const TopoDS_Shape &shape, DATA &data, SGNODE *parent, std::vector< SGNODE * > *items)
 
static wxString getLabelName(const TDF_Label &aLabel)
 
bool processLabel(const TDF_Label &aLabel, DATA &aData, SGNODE *aParent, std::vector< SGNODE * > *aItems)
 
std::map< std::string, SGNODE * > FACEMAP
 
bool readSTEPZ(Handle(TDocStd_Document)&m_doc, const char *aFileName)
 
bool readIGES(Handle(TDocStd_Document) &m_doc, const char *fname)
 
SGLIB_API bool WriteVRML(const char *filename, bool overwrite, SGNODE *aTopNode, bool reuse, bool renameNodes)
Write out the given node and its subnodes to a VRML2 file.
 
SGLIB_API SGNODE * GetSGNodeParent(SGNODE *aNode)
 
SGLIB_API void DestroyNode(SGNODE *aNode) noexcept
Delete the given SG* class node.
 
SGLIB_API bool AddSGNodeChild(SGNODE *aParent, SGNODE *aChild)
 
SGLIB_API bool AddSGNodeRef(SGNODE *aParent, SGNODE *aChild)
 
static SGNODE * getColor(IFSG_SHAPE &shape, int colorIdx)
 
Handle(XCAFDoc_ColorTool) m_color
 
SGNODE * GetFace(const std::string &id)
 
Handle(TDocStd_Document) m_doc
 
bool GetShape(const std::string &id, std::vector< SGNODE * > *&listPtr)
 
Handle(XCAFDoc_ShapeTool) m_assy
 
SGNODE * GetColor(Quantity_ColorRGBA *colorObj)