1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0031350: Foundation Classes - Dump improvement for OCAF classes

- do not dump document in CDM_MetaData, just pointer text;
- move ID dump in to TDF_Attribute;
- extend TDF_Attribute with other important states(obtained by methods);
- extend TDocStd_Document  with other important states;
- avoid dumping of shapes in TNaming_UsedShapes (it takes much time);
- extend XCAFDoc, XCAFDimTolObjects dump to json;
- correct XCAFDoc_ColorTool, XCAFDoc_MaterialTool, XCAFDoc_LayerTool to dump only connected to the object information;
- correct XCAFDoc_Material to dump name and density value only if it exists;
- add check on correct direction in gp_Ax3.
This commit is contained in:
nds
2020-12-16 12:08:49 +03:00
committed by bugmaster
parent 9283bba22f
commit 39b707a6d2
38 changed files with 385 additions and 57 deletions

View File

@@ -318,3 +318,75 @@ void XCAFDimTolObjects_DatumObject::SetDatumTargetNumber(const Standard_Integer
{
myDatumTargetNumber = theNumber;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void XCAFDimTolObjects_DatumObject::DumpJson (Standard_OStream& theOStream,
Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
if (!myName.IsNull())
{
Standard_CString aDatumName = myName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDatumName)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModifierWithValue)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValueOfModifier)
if (!myDatumTarget.IsNull())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDatumTarget)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPosition)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDTarget)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsValidDT)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDTargetType)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAxis)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myWidth)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDatumTargetNumber)
if (myHasPlane)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPlane)
}
if (myHasPnt)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPnt)
}
if (myHasPntText)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPntText)
}
if (!myPresentation.IsNull())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPresentation)
}
if (!mySemanticName.IsNull())
{
Standard_CString aSemanticName = mySemanticName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSemanticName)
}
if (!myPresentationName.IsNull())
{
Standard_CString aPresentationName = myPresentationName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aPresentationName)
}
for (XCAFDimTolObjects_DatumModifiersSequence::Iterator aModifIt (myModifiers); aModifIt.More(); aModifIt.Next())
{
XCAFDimTolObjects_DatumSingleModif aModifier = aModifIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aModifier)
}
}

View File

@@ -201,6 +201,9 @@ public:
return myIsValidDT;
}
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DatumObject,Standard_Transient)
private:

View File

@@ -482,3 +482,96 @@ void XCAFDimTolObjects_DimensionObject::RemoveDescription(const Standard_Integer
myDescriptions = aDescriptions;
myDescriptionNames = aDescriptionNames;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void XCAFDimTolObjects_DimensionObject::DumpJson (Standard_OStream& theOStream,
Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType)
if (!myVal.IsNull())
{
for (Standard_Integer anId = myVal->Lower(); anId <= myVal->Upper(); anId++)
{
Standard_Real aValue = myVal->Value (anId);
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
}
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myQualifier)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsHole)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFormVariance)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGrade)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myL)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myR)
if (!myPath.IsNull())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPath)
}
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDir)
if (myHasPoint1)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPnt1)
}
if (myHasPoint2)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPnt2)
}
if (myHasPlane)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPlane)
}
if (myHasPntText)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPntText)
}
if (!myPresentation.IsNull())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPresentation)
}
if (!mySemanticName.IsNull())
{
Standard_CString aSemanticName = mySemanticName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSemanticName)
}
if (!myPresentationName.IsNull())
{
Standard_CString aPresentationName = myPresentationName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aPresentationName)
}
for (NCollection_Vector<Handle(TCollection_HAsciiString)>::Iterator aDescIt (myDescriptions); aDescIt.More(); aDescIt.Next())
{
if (aDescIt.Value().IsNull())
continue;
Standard_CString aDescription = aDescIt.Value()->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDescription)
}
for (NCollection_Vector<Handle(TCollection_HAsciiString)>::Iterator aDescNameIt (myDescriptionNames); aDescNameIt.More(); aDescNameIt.Next())
{
if (aDescNameIt.Value().IsNull())
continue;
Standard_CString aDescriptionName = aDescNameIt.Value()->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDescriptionName)
}
for (XCAFDimTolObjects_DimensionModifiersSequence::Iterator aModifIt (myModifiers); aModifIt.More(); aModifIt.Next())
{
XCAFDimTolObjects_DimensionModif aModifier = aModifIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aModifier)
}
}

View File

@@ -292,6 +292,9 @@ public:
myDescriptionNames.Append(theName);
}
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_DimensionObject,Standard_Transient)
private:

View File

@@ -279,3 +279,66 @@ Standard_Boolean XCAFDimTolObjects_GeomToleranceObject::HasAxis () const
{
return myHasAxis;
}
//=======================================================================
//function : DumpJson
//purpose :
//=======================================================================
void XCAFDimTolObjects_GeomToleranceObject::DumpJson (Standard_OStream& theOStream,
Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myType)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfValue)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMatReqModif)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZoneModif)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValueOfZoneModif)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxValueModif)
if (myHasAxis)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAxis)
}
if (myHasPlane)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPlane)
}
if (myHasPnt)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPnt)
}
if (myHasPntText)
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPntText)
}
if (!myPresentation.IsNull())
{
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPresentation)
}
if (!mySemanticName.IsNull())
{
Standard_CString aSemanticName = mySemanticName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSemanticName)
}
if (!myPresentationName.IsNull())
{
Standard_CString aPresentationName = myPresentationName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aPresentationName)
}
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myAffectedPlane)
for (XCAFDimTolObjects_GeomToleranceModifiersSequence::Iterator aModifIt (myModifiers); aModifIt.More(); aModifIt.Next())
{
XCAFDimTolObjects_GeomToleranceModif aModifier = aModifIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aModifier)
}
}

View File

@@ -214,6 +214,8 @@ public:
return myAffectedPlane;
}
//! Dumps the content of me into the stream
Standard_EXPORT void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
DEFINE_STANDARD_RTTIEXT(XCAFDimTolObjects_GeomToleranceObject,Standard_Transient)