mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0031949: JT Import - some colors are lost while reading XT representation from JT file
Added checking to style of faces from SHELL and edges from WIRE RWMesh_CafReader::fillDocument() is virtual now
This commit is contained in:
parent
cece953cb4
commit
596e783958
@ -415,14 +415,9 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// store a plain list of sub-shapes in case if they have custom attributes (usually per-face color)
|
// store a plain list of sub-shapes in case if they have custom attributes (usually per-face color)
|
||||||
RWMesh_NodeAttributes aSubShapeAttribs;
|
|
||||||
for (TopoDS_Iterator aSubShapeIter (theShape, Standard_True, Standard_False); aSubShapeIter.More(); aSubShapeIter.Next())
|
for (TopoDS_Iterator aSubShapeIter (theShape, Standard_True, Standard_False); aSubShapeIter.More(); aSubShapeIter.Next())
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& aSubShape = aSubShapeIter.Value();
|
addSubShapeIntoDoc(theTools, aSubShapeIter.Value(), aNewRefLabel);
|
||||||
if (myAttribMap.Find (aSubShape.Located (TopLoc_Location()), aSubShapeAttribs))
|
|
||||||
{
|
|
||||||
addSubShapeIntoDoc (theTools, aSubShape, aNewRefLabel, aSubShapeAttribs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
@ -434,8 +429,7 @@ Standard_Boolean RWMesh_CafReader::addShapeIntoDoc (CafDocumentTools& theTools,
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
Standard_Boolean RWMesh_CafReader::addSubShapeIntoDoc (CafDocumentTools& theTools,
|
Standard_Boolean RWMesh_CafReader::addSubShapeIntoDoc (CafDocumentTools& theTools,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const TDF_Label& theParentLabel,
|
const TDF_Label& theParentLabel)
|
||||||
const RWMesh_NodeAttributes& theAttribs)
|
|
||||||
{
|
{
|
||||||
if (theShape.IsNull()
|
if (theShape.IsNull()
|
||||||
|| myXdeDoc.IsNull())
|
|| myXdeDoc.IsNull())
|
||||||
@ -443,17 +437,36 @@ Standard_Boolean RWMesh_CafReader::addSubShapeIntoDoc (CafDocumentTools& theTool
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RWMesh_NodeAttributes aShapeAttribs;
|
||||||
const TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
|
const TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
|
||||||
|
const Standard_Boolean aHasAttribs = myAttribMap.Find(theShape.Located(TopLoc_Location()), aShapeAttribs);
|
||||||
|
|
||||||
|
// check for the attribute
|
||||||
|
// shell or wire may not contain an attribute, but its subshapes need to be checked
|
||||||
|
if (!aHasAttribs && aShapeType != TopAbs_SHELL &&
|
||||||
|
aShapeType != TopAbs_WIRE)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TopoDS_Iterator aSubShapeIter(theShape, Standard_True, Standard_False); aSubShapeIter.More(); aSubShapeIter.Next())
|
||||||
|
{
|
||||||
|
addSubShapeIntoDoc(theTools, aSubShapeIter.Value(), theParentLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aHasAttribs)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
TDF_Label aNewLabel = theTools.ShapeTool->AddSubShape (theParentLabel, theShape);
|
TDF_Label aNewLabel = theTools.ShapeTool->AddSubShape (theParentLabel, theShape);
|
||||||
if (aNewLabel.IsNull())
|
if (aNewLabel.IsNull())
|
||||||
{
|
{
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
Handle(XCAFDoc_ShapeMapTool) aShapeMapTool = XCAFDoc_ShapeMapTool::Set(aNewLabel);
|
||||||
Handle(XCAFDoc_ShapeMapTool) aShapeMapTool = XCAFDoc_ShapeMapTool::Set (aNewLabel);
|
aShapeMapTool->SetShape(theShape);
|
||||||
aShapeMapTool->SetShape (theShape);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if new label is a reference get referred shape
|
// if new label is a reference get referred shape
|
||||||
TDF_Label aNewRefLabel = aNewLabel;
|
TDF_Label aNewRefLabel = aNewLabel;
|
||||||
@ -461,19 +474,10 @@ Standard_Boolean RWMesh_CafReader::addSubShapeIntoDoc (CafDocumentTools& theTool
|
|||||||
|
|
||||||
// put attributes to the Product (shared across Instances)
|
// put attributes to the Product (shared across Instances)
|
||||||
static const TCollection_AsciiString anEmptyString;
|
static const TCollection_AsciiString anEmptyString;
|
||||||
setShapeName (aNewRefLabel, aShapeType, theAttribs.Name, TDF_Label(), anEmptyString);
|
setShapeName (aNewRefLabel, aShapeType, aShapeAttribs.Name, TDF_Label(), anEmptyString);
|
||||||
setShapeStyle (theTools, aNewRefLabel, theAttribs.Style);
|
setShapeStyle (theTools, aNewRefLabel, aShapeAttribs.Style);
|
||||||
setShapeNamedData (theTools, aNewRefLabel, theAttribs.NamedData);
|
setShapeNamedData (theTools, aNewRefLabel, aShapeAttribs.NamedData);
|
||||||
|
|
||||||
RWMesh_NodeAttributes aSubShapeAttribs;
|
|
||||||
for (TopoDS_Iterator aSubShapeIter (theShape, Standard_True, Standard_False); aSubShapeIter.More(); aSubShapeIter.Next())
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& aSubShape = aSubShapeIter.Value();
|
|
||||||
if (myAttribMap.Find (aSubShape.Located (TopLoc_Location()), aSubShapeAttribs))
|
|
||||||
{
|
|
||||||
addSubShapeIntoDoc (theTools, aSubShape, theParentLabel, aSubShapeAttribs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! Fill document with new root shapes.
|
//! Fill document with new root shapes.
|
||||||
Standard_EXPORT void fillDocument();
|
Standard_EXPORT virtual void fillDocument();
|
||||||
|
|
||||||
//! Append new shape into the document (recursively).
|
//! Append new shape into the document (recursively).
|
||||||
Standard_EXPORT Standard_Boolean addShapeIntoDoc (CafDocumentTools& theTools,
|
Standard_EXPORT Standard_Boolean addShapeIntoDoc (CafDocumentTools& theTools,
|
||||||
@ -211,8 +211,7 @@ protected:
|
|||||||
//! Append new sub-shape into the document (recursively).
|
//! Append new sub-shape into the document (recursively).
|
||||||
Standard_EXPORT Standard_Boolean addSubShapeIntoDoc (CafDocumentTools& theTools,
|
Standard_EXPORT Standard_Boolean addSubShapeIntoDoc (CafDocumentTools& theTools,
|
||||||
const TopoDS_Shape& theShape,
|
const TopoDS_Shape& theShape,
|
||||||
const TDF_Label& theParentLabel,
|
const TDF_Label& theParentLabel);
|
||||||
const RWMesh_NodeAttributes& theAttribs);
|
|
||||||
|
|
||||||
//! Put name attribute onto the label.
|
//! Put name attribute onto the label.
|
||||||
Standard_EXPORT void setShapeName (const TDF_Label& theLabel,
|
Standard_EXPORT void setShapeName (const TDF_Label& theLabel,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user