-// Copyright (C) 2014-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <TopoDS.hxx>
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <XCAFApp_Application.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
+#include <XCAFDoc_ColorTool.hxx>
+#include <XCAFDoc_MaterialTool.hxx>
#include <Locale_Convert.h>
+// read geometry
+std::shared_ptr<GeomAPI_Shape> setGeom(const Handle(XCAFDoc_ShapeTool) &shapeTool,
+ const TDF_Label &theLabel,
+ std::string& theError);
+
+/// read attributs for label
+void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool,
+ const Handle(XCAFDoc_ColorTool) &theColorTool,
+ const Handle(XCAFDoc_MaterialTool) &TheMaterialTool,
+ const TDF_Label &theLabel,
+ const TopLoc_Location &theLoc,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::map< std::wstring, std::list<std::wstring>> &theMaterialShape,
+ bool theIsRef);
+
+// store Materiel for theShapeLabel in the map theMaterialShape
+void storeMaterial(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ const Handle(Standard_Transient) &theEnti,
+ const TopTools_IndexedMapOfShape &theIndices,
+ const Handle(Transfer_TransientProcess) &theTP,
+ const TDF_Label &theShapeLabel,
+ std::map< std::wstring, std::list<std::wstring>> &theMaterialShape);
+
//=============================================================================
TopoDS_Shape getShape(const Handle(Standard_Transient) &theEnti,
const Handle(Transfer_TransientProcess) &theTP)
setShapeAttributes(shapeTool, colorTool, materialTool, mainLabel,
TopLoc_Location(),theResultBody,theMaterialShape,false);
- std::shared_ptr<GeomAPI_Shape> ageom = setgeom(shapeTool,mainLabel,theError);
+ std::shared_ptr<GeomAPI_Shape> ageom = setGeom(shapeTool,mainLabel,theError);
STEPControl_Reader aReader = theReader.ChangeReader();
}
//=============================================================================
-std::shared_ptr<GeomAPI_Shape> setgeom(const Handle(XCAFDoc_ShapeTool) &theShapeTool,
- const TDF_Label &theLabel,
+std::shared_ptr<GeomAPI_Shape> setGeom(const Handle(XCAFDoc_ShapeTool) &theShapeTool,
+ const TDF_Label& /*theLabel*/,
std::string& theError)
{
BRep_Builder aB;
aGeomShape->setImpl(new TopoDS_Shape(shape));
return aGeomShape;
} else {
- for (Standard_Integer i=1; i<aFrshapes.Length(); i++) {
+ for (Standard_Integer i=1; i<=aFrshapes.Length(); i++) {
TopoDS_Shape aS = theShapeTool->GetShape(aFrshapes.Value(i));
TDF_Label aLabel = theShapeTool->FindShape(aS, Standard_False);
if ( (!aLabel.IsNull()) && (theShapeTool->IsShape(aLabel)) ) {
if (aS.IsNull()) {
continue;
} else {
- if (!theShapeTool->IsReference(aLabel) ){
+ if (aS.ShapeType() != TopAbs_SOLID && !theShapeTool->IsReference(aLabel)){
for(TDF_ChildIterator anIt(aLabel); anIt.More(); anIt.Next()) {
aB.Add(aCompound, theShapeTool->GetShape(anIt.Value()) );
}
// Check if any BRep entity has been read, there must be at least a vertex
if (!TopExp_Explorer( aShape, TopAbs_VERTEX ).More()) {
theError = "No geometrical data in the imported file.";
- std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
aGeomShape->setImpl(new TopoDS_Shape());
return aGeomShape;
}
const Handle(Standard_Transient) &theEnti,
const TopTools_IndexedMapOfShape &theIndices,
const Handle(Transfer_TransientProcess) &theTP,
- const TDF_Label &theShapeLabel,
+ const TDF_Label &/*theShapeLabel*/,
std::map< std::wstring, std::list<std::wstring>> &theMaterialShape )
{
// Treat Product Definition Shape only.
}
}
}
-