1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0031350: Inspectors - property view in DFBrowser for DumpJson

(cherry picked from commit 19b5d8465313c119c9d2f344041e67883226ec61)
This commit is contained in:
nds
2020-11-09 06:24:03 +03:00
parent dee527369c
commit b34d24534d
46 changed files with 521 additions and 129 deletions

View File

@@ -150,12 +150,12 @@ void CDM_MetaData::UnsetIsReadOnly() {
//function : DumpJson
//purpose :
//=======================================================================
void CDM_MetaData::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
void CDM_MetaData::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRetrieved)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDocument)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myDocument)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myFolder)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName)

View File

@@ -418,10 +418,14 @@ void TDF_Attribute::DumpJson (Standard_OStream& theOStream, Standard_Integer the
TDF_Tool::Entry (Label(), aLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTransaction)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySavedTransaction)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, ID())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Transaction())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, UntilTransaction())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myNext.get())
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBackup.get())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsValid())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsNew())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsBackuped())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsForgotten())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags)
}

View File

@@ -212,5 +212,4 @@ void TDataStd_AsciiString::DumpJson (Standard_OStream& theOStream, Standard_Inte
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myString)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -339,5 +339,4 @@ void TDataStd_BooleanArray::DumpJson (Standard_OStream& theOStream, Standard_Int
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLower)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpper)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -323,5 +323,4 @@ void TDataStd_BooleanList::DumpJson (Standard_OStream& theOStream, Standard_Inte
const Standard_Byte& aValue = aListIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -326,5 +326,4 @@ void TDataStd_ByteArray::DumpJson (Standard_OStream& theOStream, Standard_Intege
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -340,10 +340,12 @@ Handle(TDF_DeltaOnModification) TDataStd_ExtStringArray::DeltaOnModification
//function : DumpJson
//purpose :
//=======================================================================
void TDataStd_ExtStringArray::DumpJson (Standard_OStream& theOStream, Standard_Integer /*theDepth*/) const
void TDataStd_ExtStringArray::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
for (TColStd_Array1OfExtendedString::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
{
const TCollection_ExtendedString& aValue = aValueIt.Value();
@@ -351,5 +353,4 @@ void TDataStd_ExtStringArray::DumpJson (Standard_OStream& theOStream, Standard_I
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -372,15 +372,15 @@ Standard_OStream& TDataStd_ExtStringList::Dump (Standard_OStream& anOS) const
//function : DumpJson
//purpose :
//=======================================================================
void TDataStd_ExtStringList::DumpJson (Standard_OStream& theOStream, Standard_Integer /*theDepth*/) const
void TDataStd_ExtStringList::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
for (TDataStd_ListOfExtendedString::Iterator aListIt (myList); aListIt.More(); aListIt.Next())
{
const TCollection_ExtendedString& aValue = aListIt.Value();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aValue);
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -215,5 +215,4 @@ void TDataStd_Integer::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -355,5 +355,4 @@ void TDataStd_IntegerArray::DumpJson (Standard_OStream& theOStream, Standard_Int
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -379,5 +379,4 @@ void TDataStd_IntegerList::DumpJson (Standard_OStream& theOStream, Standard_Inte
const Standard_Integer& aValue = aListIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -205,5 +205,4 @@ void TDataStd_Name::DumpJson (Standard_OStream& theOStream, Standard_Integer the
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myString)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -260,5 +260,4 @@ void TDataStd_Real::DumpJson (Standard_OStream& theOStream, Standard_Integer the
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDimension)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -351,5 +351,4 @@ void TDataStd_RealArray::DumpJson (Standard_OStream& theOStream, Standard_Intege
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -377,6 +377,4 @@ void TDataStd_RealList::DumpJson (Standard_OStream& theOStream, Standard_Integer
const Standard_Real& aValue = aListIt.Value();
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -350,6 +350,4 @@ void TDataStd_ReferenceArray::DumpJson (Standard_OStream& theOStream, Standard_I
TDF_Tool::Entry (anArrayIt.Value(), aLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -403,6 +403,4 @@ void TDataStd_ReferenceList::DumpJson (Standard_OStream& theOStream, Standard_In
TDF_Tool::Entry (aListIt.Value(), aLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -730,6 +730,4 @@ void TDataStd_TreeNode::DumpJson (Standard_OStream& theOStream, Standard_Integer
TDF_Tool::Entry (myLast->Label(), aLast);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLast)
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myTreeID)
}

View File

@@ -141,6 +141,4 @@ void TDataStd_UAttribute::DumpJson (Standard_OStream& theOStream, Standard_Integ
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
}

View File

@@ -910,6 +910,13 @@ void TDocStd_Document::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, CDM_Document)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myStorageFormat)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsSaved())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsChanged())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsEmpty())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsValid())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, GetAvailableUndos())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, GetAvailableRedos())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, HasOpenCommand())
for (TDF_DeltaList::Iterator anUndoIt (myUndos); anUndoIt.More(); anUndoIt.Next())
{

View File

@@ -196,18 +196,4 @@ void TNaming_UsedShapes::DumpJson (Standard_OStream& theOStream, Standard_Intege
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
for (TNaming_DataMapOfShapePtrRefShape::Iterator aMapIt (myMap); aMapIt.More(); aMapIt.Next())
{
const TopoDS_Shape& aShape = aMapIt.Key();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aShape)
TCollection_AsciiString aLabel;
TDF_Tool::Entry (aMapIt.Value()->Label(), aLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
const TopoDS_Shape& aRefShape = aMapIt.Value()->Shape();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aRefShape)
}
}

View File

@@ -312,3 +312,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 aName = myName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aName)
}
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

@@ -472,3 +472,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

@@ -277,3 +277,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)

View File

@@ -24,6 +24,7 @@
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
#include <TNaming_NamedShape.hxx>
#include <TopoDS_Shape.hxx>
#include <XCAFDoc.hxx>
@@ -810,5 +811,12 @@ void XCAFDoc_ColorTool::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShapeTool.get())
TDF_LabelSequence aLabels;
GetColors (aLabels);
for (TDF_LabelSequence::Iterator aColorLabelIt (aLabels); aColorLabelIt.More(); aColorLabelIt.Next())
{
TCollection_AsciiString aColorLabel;
TDF_Tool::Entry (aColorLabelIt.Value(), aColorLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aColorLabel)
}
}

View File

@@ -560,4 +560,7 @@ void XCAFDoc_Datum::DumpJson (Standard_OStream& theOStream, Standard_Integer the
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName.get())
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myDescription.get())
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myIdentification.get())
Handle(XCAFDimTolObjects_DatumObject) anObject = GetObject();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anObject.get())
}

View File

@@ -26,6 +26,7 @@
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
#include <XCAFDimTolObjects_DatumObject.hxx>
#include <XCAFDimTolObjects_DimensionObject.hxx>
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
@@ -1102,5 +1103,39 @@ void XCAFDoc_DimTolTool::DumpJson (Standard_OStream& theOStream, Standard_Intege
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShapeTool.get())
TDF_LabelSequence aLabels;
GetDimensionLabels (aLabels);
for (TDF_LabelSequence::Iterator aDimLabelIt (aLabels); aDimLabelIt.More(); aDimLabelIt.Next())
{
TCollection_AsciiString aDimensionLabel;
TDF_Tool::Entry (aDimLabelIt.Value(), aDimensionLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDimensionLabel)
}
aLabels.Clear();
GetGeomToleranceLabels (aLabels);
for (TDF_LabelSequence::Iterator aGeomToleranceLabelIt (aLabels); aGeomToleranceLabelIt.More(); aGeomToleranceLabelIt.Next())
{
TCollection_AsciiString aGeomToleranceLabel;
TDF_Tool::Entry (aGeomToleranceLabelIt.Value(), aGeomToleranceLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aGeomToleranceLabel)
}
aLabels.Clear();
GetDimTolLabels (aLabels);
for (TDF_LabelSequence::Iterator aDimTolLabelIt (aLabels); aDimTolLabelIt.More(); aDimTolLabelIt.Next())
{
TCollection_AsciiString aDimTolLabelLabel;
TDF_Tool::Entry (aDimTolLabelIt.Value(), aDimTolLabelLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDimTolLabelLabel)
}
aLabels.Clear();
GetDatumLabels (aLabels);
for (TDF_LabelSequence::Iterator aDatumLabelIt (aLabels); aDatumLabelIt.More(); aDatumLabelIt.Next())
{
TCollection_AsciiString aDatumLabel;
TDF_Tool::Entry (aDatumLabelIt.Value(), aDatumLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDatumLabel)
}
}

View File

@@ -471,4 +471,7 @@ void XCAFDoc_Dimension::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
Handle(XCAFDimTolObjects_DimensionObject) anObject = GetObject();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anObject.get())
}

View File

@@ -441,4 +441,7 @@ void XCAFDoc_GeomTolerance::DumpJson (Standard_OStream& theOStream, Standard_Int
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
Handle(XCAFDimTolObjects_GeomToleranceObject) anObject = GetObject();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anObject.get())
}

View File

@@ -499,7 +499,7 @@ void XCAFDoc_GraphNode::DumpJson (Standard_OStream& theOStream, Standard_Integer
for (XCAFDoc_GraphNodeSequence::Iterator anIteratorFather (myFathers); anIteratorFather.More(); anIteratorFather.Next())
{
const Handle(XCAFDoc_GraphNode)& aFather = anIteratorFather.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aFather.get())
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aFather)
}
for (XCAFDoc_GraphNodeSequence::Iterator anIteratorChild (myChildren); anIteratorChild.More(); anIteratorChild.Next())
@@ -507,6 +507,4 @@ void XCAFDoc_GraphNode::DumpJson (Standard_OStream& theOStream, Standard_Integer
const Handle(XCAFDoc_GraphNode)& aChild = anIteratorChild.Value();
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aChild.get())
}
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myGraphID)
}

View File

@@ -25,6 +25,7 @@
#include <TDF_ChildIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
#include <TopoDS_Shape.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_DocumentTool.hxx>
@@ -632,5 +633,12 @@ void XCAFDoc_LayerTool::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShapeTool.get())
TDF_LabelSequence aLabels;
GetLayerLabels (aLabels);
for (TDF_LabelSequence::Iterator aLayerLabelIt (aLabels); aLayerLabelIt.More(); aLayerLabelIt.Next())
{
TCollection_AsciiString aLayerLabel;
TDF_Tool::Entry (aLayerLabelIt.Value(), aLayerLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLayerLabel)
}
}

View File

@@ -199,9 +199,27 @@ void XCAFDoc_Material::DumpJson (Standard_OStream& theOStream, Standard_Integer
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myName.get())
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myDescription.get())
if (!myName.IsNull())
{
Standard_CString aName = myName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aName)
}
if (!myDescription.IsNull())
{
Standard_CString aDescriptionName = myDescription->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDescriptionName)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDensity)
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myDensName.get())
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myDensValType.get())
if (!myDensName.IsNull())
{
Standard_CString aDensName = myDensName->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDensName)
}
if (!myDensValType.IsNull())
{
Standard_CString aDensValType = myDensValType->ToCString();
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aDensValType)
}
}

View File

@@ -22,6 +22,7 @@
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
#include <XCAFDoc.hxx>
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_Material.hxx>
@@ -276,5 +277,12 @@ void XCAFDoc_MaterialTool::DumpJson (Standard_OStream& theOStream, Standard_Inte
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myShapeTool.get())
TDF_LabelSequence aLabels;
GetMaterialLabels (aLabels);
for (TDF_LabelSequence::Iterator aMaterialLabelIt (aLabels); aMaterialLabelIt.More(); aMaterialLabelIt.Next())
{
TCollection_AsciiString aMaterialLabel;
TDF_Tool::Entry (aMaterialLabelIt.Value(), aMaterialLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aMaterialLabel)
}
}

View File

@@ -134,6 +134,9 @@ Standard_Boolean gp_Ax3::InitFromJson (const Standard_SStream& theSStream, Stan
SetXDirection (aXDir);
SetYDirection (anYDir);
if (!Direction().IsEqual (aDir, Precision::Confusion()))
return Standard_False;
theStreamPos = aPos;
return Standard_True;
}

View File

@@ -31,7 +31,7 @@
#include <QObject>
#include <Standard_WarningsRestore.hxx>
//#define USE_DUMPJSON
#define USE_DUMPJSON
// =======================================================================
// function : hasAttribute
@@ -77,24 +77,18 @@ void DFBrowser_Item::Init()
int anAttributeId = 0;
for (TDF_AttributeIterator anAttrIt (aParentLabel); anAttrIt.More(); anAttrIt.Next(), anAttributeId++)
{
if (anAttributeId == aRowId)
anAttribute = anAttrIt.Value();
if (anAttributeId != aRowId)
{
continue;
}
anAttribute = anAttrIt.Value();
break;
}
SetAttribute (anAttribute);
}
else {
int aCurrentId = aRowId - aNbAttributes;
TDF_ChildIterator aLabelsIt (aParentLabel);
TDF_Label aLabel;
for (int aLabelId = 0; aLabelsIt.More(); aLabelsIt.Next(), aLabelId++)
{
if (aLabelId < aCurrentId)
continue;
aLabel = aLabelsIt.Value();
break;
}
if (!aLabel.IsNull())
setLabel (aLabel);
aParentItem->InitChildLabels (aRowId, aCurrentId);
}
TreeModel_ItemBase::Init();
}
@@ -123,30 +117,53 @@ int DFBrowser_Item::initRowCount() const
// function : initValue
// purpose :
// =======================================================================
QVariant DFBrowser_Item::initValue (const int theItemRole) const
QVariant DFBrowser_Item::initValue (const int theRole) const
{
if (!HasAttribute())
return DFBrowser_ItemBase::initValue (theItemRole);
if (theItemRole == DFBrowserPane_ItemRole_DisplayExtended || theItemRole == DFBrowserPane_ItemRole_ToolTipExtended)
{
int aRole = theItemRole == DFBrowserPane_ItemRole_DisplayExtended ? Qt::DisplayRole : Qt::ToolTipRole;
QVariant aValue = DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(), aRole, Column());
QString anAdditionalInfo = DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(),
DFBrowser_ItemRole_AdditionalInfo, Column()).toString();
if (!anAdditionalInfo.isEmpty())
{
if (theItemRole == DFBrowserPane_ItemRole_DisplayExtended)
anAdditionalInfo = TreeModel_Tools::CutString (anAdditionalInfo);
if (!anAdditionalInfo.isEmpty())
aValue = QVariant (aValue.toString() + QString (" [%1]").arg (anAdditionalInfo));
//if (aRole == Qt::ToolTipRole)
// aValue = wrapTextByWords(aValue.toString().toStdString(), INFO_LENGHT).c_str();
}
return aValue;
// label item
return DFBrowser_ItemBase::initValue (theRole);
}
return DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(), theItemRole, Column());
else
{
// attribute item
switch (theRole)
{
case Qt::DisplayRole:
case Qt::ToolTipRole:
case Qt::DecorationRole:
case Qt::ForegroundRole:
case DFBrowserPane_ItemRole_DisplayShort:
case DFBrowser_ItemRole_AdditionalInfo:
{
if (Column() == 0)
return DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(), theRole, Column());
else
return QVariant();
}
case DFBrowserPane_ItemRole_DisplayExtended:
case DFBrowserPane_ItemRole_ToolTipExtended:
{
int aRole = theRole == DFBrowserPane_ItemRole_DisplayExtended ? Qt::DisplayRole : Qt::ToolTipRole;
QVariant aValue = DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(), aRole, Column());
QString anAdditionalInfo = DFBrowser_Module::GetAttributeInfo (GetAttribute(), GetModule(),
DFBrowser_ItemRole_AdditionalInfo, Column()).toString();
if (!anAdditionalInfo.isEmpty())
{
if (theRole == DFBrowserPane_ItemRole_DisplayExtended)
anAdditionalInfo = TreeModel_Tools::CutString (anAdditionalInfo);
if (!anAdditionalInfo.isEmpty())
aValue = QVariant (aValue.toString() + QString (" [%1]").arg (anAdditionalInfo));
//if (aRole == Qt::ToolTipRole)
// aValue = wrapTextByWords(aValue.toString().toStdString(), INFO_LENGHT).c_str();
}
return aValue;
}
default:
break;
}
}
return QVariant();
}
// =======================================================================
@@ -161,7 +178,9 @@ void DFBrowser_Item::initStream (Standard_OStream& theOStream) const
#ifdef USE_DUMPJSON
Handle(TDF_Attribute) anAttribute = GetAttribute();
if (!anAttribute.IsNull())
{
anAttribute->DumpJson (theOStream);
}
#else
(void)theOStream;
#endif

View File

@@ -56,13 +56,13 @@ int DFBrowser_ItemApplication::initRowCount() const
// function : initValue
// purpose :
// =======================================================================
QVariant DFBrowser_ItemApplication::initValue (const int theItemRole) const
QVariant DFBrowser_ItemApplication::initValue (const int theRole) const
{
if (theItemRole == Qt::DisplayRole ||
theItemRole == Qt::EditRole ||
theItemRole == Qt::ToolTipRole ||
theItemRole == DFBrowserPane_ItemRole_DisplayExtended ||
theItemRole == DFBrowserPane_ItemRole_ToolTipExtended)
if (theRole == Qt::DisplayRole ||
theRole == Qt::EditRole ||
theRole == Qt::ToolTipRole ||
theRole == DFBrowserPane_ItemRole_DisplayExtended ||
theRole == DFBrowserPane_ItemRole_ToolTipExtended)
{
return "TDocStd_Application";
}

View File

@@ -96,12 +96,11 @@ int DFBrowser_ItemBase::initRowCount() const
// function : initValue
// purpose :
// =======================================================================
QVariant DFBrowser_ItemBase::initValue (const int theItemRole) const
QVariant DFBrowser_ItemBase::initValue (const int theRole) const
{
switch (theItemRole)
switch (theRole)
{
case Qt::DisplayRole:
case Qt::EditRole:
case Qt::ToolTipRole:
return DFBrowser_Tools::GetLabelInfo (myLabel, false);
case DFBrowserPane_ItemRole_DisplayExtended:
@@ -150,3 +149,46 @@ bool DFBrowser_ItemBase::SetUseAdditionalInfo (const bool theValue)
return aPreviousValue;
}
// =======================================================================
// function : InitChildLabels
// purpose :
// =======================================================================
void DFBrowser_ItemBase::InitChildLabels (const int theChildId, const int theLabelId)
{
TDF_Label aParentLabel = GetLabel();
// items can exist only by items with not empty label
if (aParentLabel.IsNull())
return;
int aChildItem = theChildId;
TDF_ChildIterator aLabelsIt (aParentLabel);
TDF_Label aLabel;
for (int aLabelId = 0; aLabelsIt.More(); aLabelsIt.Next(), aLabelId++, aChildItem++)
{
if (aLabelId < theLabelId)
continue;
aLabel = aLabelsIt.Value();
TreeModel_ItemBasePtr aChild = Child(aChildItem, 0, true);
if (!aChild)
{
continue;
}
if (aChild->IsInitialized())
{
continue;
}
DFBrowser_ItemBasePtr aChildItem = itemDynamicCast<DFBrowser_Item> (aChild);
aChildItem->InitWithLabel (aLabel);
}
}
// =======================================================================
// function : InitWithLabel
// purpose :
// =======================================================================
void DFBrowser_ItemBase::InitWithLabel (TDF_Label theLabel)
{
setLabel (theLabel);
TreeModel_ItemBase::Init();
}

View File

@@ -59,6 +59,15 @@ public:
//! \param theRole the item model role
Standard_EXPORT virtual QVariant data (const QModelIndex& theIndex, int theRole) const Standard_OVERRIDE;
//! Iterates through the label and initialize all children in and after the given position
//! \param theChildId an index of this label child
//! \param theLabelId an index of the label
void InitChildLabels (const int theChildId, const int theLabelId);
//! Inits the item by the label
//! \theLabel label for this item
Standard_EXPORT void InitWithLabel (TDF_Label theLabel);
protected:
//! Sets the item label

View File

@@ -62,14 +62,14 @@ const Handle(TDocStd_Document)& DFBrowser_ItemDocument::getDocument() const
// function : initValue
// purpose :
// =======================================================================
QVariant DFBrowser_ItemDocument::initValue (const int theItemRole) const
QVariant DFBrowser_ItemDocument::initValue (const int theRole) const
{
if (theItemRole == Qt::DisplayRole ||
theItemRole == Qt::EditRole ||
theItemRole == DFBrowserPane_ItemRole_DisplayExtended ||
theItemRole == DFBrowserPane_ItemRole_ToolTipExtended)
if (theRole == Qt::DisplayRole ||
theRole == Qt::EditRole ||
theRole == DFBrowserPane_ItemRole_DisplayExtended ||
theRole == DFBrowserPane_ItemRole_ToolTipExtended)
return DFBrowser_Tools::GetLabelInfo (GetLabel());
if (theItemRole == Qt::DecorationRole)
if (theRole == Qt::DecorationRole)
return DFBrowser_Tools::GetLabelIcon (GetLabel());
return QVariant();

View File

@@ -95,8 +95,8 @@ QVariant DFBrowser_TreeLevelViewModel::data (const QModelIndex& theIndex, int th
if (!aDBrowserItem)
return QVariant();
bool aPrevValue = aDBrowserItem->SetUseAdditionalInfo (false);
aValue = anItemBase->data (anIndex, theRole);
bool aPrevValue = aDBrowserItem->SetUseAdditionalInfo (false);
aValue = anItemBase->data (anIndex, DFBrowserPane_ItemRole_DisplayShort);/*anItemBase->data (anIndex, theRole);*/
aDBrowserItem->SetUseAdditionalInfo (aPrevValue);
}
else { // column = 1

View File

@@ -33,8 +33,8 @@
#include <inspector/DFBrowser_PropertyPanel.hxx>
#include <inspector/DFBrowser_SearchLine.hxx>
#include <inspector/DFBrowser_SearchView.hxx>
#include <inspector/DFBrowser_Thread.hxx>
#include <inspector/DFBrowser_ThreadItemSearch.hxx>
//#include <inspector/DFBrowser_Thread.hxx>
//#include <inspector/DFBrowser_ThreadItemSearch.hxx>
#include <inspector/DFBrowser_Tools.hxx>
#include <inspector/DFBrowser_TreeLevelLine.hxx>
#include <inspector/DFBrowser_TreeLevelView.hxx>
@@ -101,7 +101,7 @@ const int DFBROWSER_DEFAULT_POSITION_Y = 60;
const int DEFAULT_PROPERTY_PANEL_HEIGHT = 200;
const int DEFAULT_BROWSER_HEIGHT = 800;
//#define USE_DUMPJSON
#define USE_DUMPJSON
// =======================================================================
// function : Constructor
@@ -163,7 +163,7 @@ DFBrowser_Window::DFBrowser_Window()
this, SLOT (onLevelDoubleClicked (const QModelIndex&)));
// property widget
QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("Properties additional"), myMainWindow);
aPropertyPanelWidget->setObjectName (aPropertyPanelWidget->windowTitle());
aPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
aPropertyPanelWidget->setWidget (myPropertyPanel->GetControl());
@@ -171,7 +171,7 @@ DFBrowser_Window::DFBrowser_Window()
// property view
#ifdef USE_DUMPJSON
myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel (DumpJson)"), myMainWindow);
myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
myPropertyView = new ViewControl_PropertyView (myMainWindow,
QSize(DFBROWSER_DEFAULT_VIEW_WIDTH, DFBROWSER_DEFAULT_VIEW_HEIGHT));
myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle());
@@ -209,15 +209,15 @@ DFBrowser_Window::DFBrowser_Window()
myMainWindow->splitDockWidget (aPropertyPanelWidget, aViewDockWidget, Qt::Vertical);
#ifdef USE_DUMPJSON
myMainWindow->tabifyDockWidget (aDumpDockWidget, myPropertyPanelWidget);
myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aViewDockWidget);
myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aPropertyPanelWidget);
myMainWindow->tabifyDockWidget (aDumpDockWidget, aViewDockWidget);
#else
myMainWindow->tabifyDockWidget (aDumpDockWidget, aViewDockWidget);
#endif
myTreeView->resize (DFBROWSER_DEFAULT_TREE_VIEW_WIDTH, DFBROWSER_DEFAULT_TREE_VIEW_HEIGHT);
myThread = new DFBrowser_Thread (this);
//myThread = new DFBrowser_Thread (this);
}
// =======================================================================
@@ -470,7 +470,7 @@ void DFBrowser_Window::Init (const NCollection_List<Handle(Standard_Transient)>&
QModelIndex aParentIndex = aModel->index (0, 0);
setExpandedLevels (myTreeView, aParentIndex, 3/*levels*/);
myThread->ProcessApplication();
//myThread->ProcessApplication();
myModule->SetInitialTreeViewSelection();
}
@@ -481,7 +481,7 @@ void DFBrowser_Window::Init (const NCollection_List<Handle(Standard_Transient)>&
void DFBrowser_Window::OpenFile (const TCollection_AsciiString& theFileName)
{
QApplication::setOverrideCursor (Qt::WaitCursor);
myThread->TerminateThread();
//myThread->TerminateThread();
myTreeLevelLine->ClearHistory();
QItemSelectionModel* aSelectionModel = myModule->GetOCAFViewSelectionModel();
@@ -491,7 +491,7 @@ void DFBrowser_Window::OpenFile (const TCollection_AsciiString& theFileName)
QModelIndex anIndex;
aSelectionModel->select (anIndex, QItemSelectionModel::ClearAndSelect);
}
ClearThreadCache();
//ClearThreadCache();
myTreeLevelLine->ClearHistory();
@@ -539,7 +539,7 @@ void DFBrowser_Window::OpenFile (const TCollection_AsciiString& theFileName)
QModelIndex aParentIndex = anOCAFViewModel->index (0, 0);
setExpandedLevels (myTreeView, aParentIndex, 3/*levels*/);
myThread->ProcessApplication();
//myThread->ProcessApplication();
myModule->SetInitialTreeViewSelection();
QApplication::restoreOverrideCursor();
}
@@ -594,6 +594,7 @@ void DFBrowser_Window::setOCAFModel (QAbstractItemModel* theModel)
myTreeView->setModel (theModel);
QItemSelectionModel* aSelectionModel = new QItemSelectionModel (theModel);
myTreeView->setSelectionMode (QAbstractItemView::ExtendedSelection);
myTreeView->setSelectionModel (aSelectionModel);
connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
@@ -611,18 +612,18 @@ void DFBrowser_Window::setOCAFModel (QAbstractItemModel* theModel)
void DFBrowser_Window::onBeforeUpdateTreeModel()
{
myTreeLevelLine->ClearHistory();
ClearThreadCache();
myThread->ProcessApplication();
//ClearThreadCache();
//myThread->ProcessApplication();
}
// =======================================================================
// function : ClearThreadCache
// purpose :
// =======================================================================
void DFBrowser_Window::ClearThreadCache()
{
DFBrowser_ThreadItemSearch::ClearValues (GetTreeLevelLine()->GetSearchLine());
}
//void DFBrowser_Window::ClearThreadCache()
//{
//DFBrowser_ThreadItemSearch::ClearValues (GetTreeLevelLine()->GetSearchLine());
//}
// =======================================================================
// function : TmpDirectory
@@ -750,6 +751,25 @@ void DFBrowser_Window::onTreeViewSelectionChanged (const QItemSelection& theSele
aDisplayer->ErasePresentations (View_PresentationType_Additional, false);
aDisplayer->DisplayPresentation (findPresentation (aSelectedIndex), View_PresentationType_Main);
// update preview
NCollection_List<Handle(Standard_Transient)> aSelPresentations;
//QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
{
QModelIndex anIndex = *aSelIt;
if (anIndex.column() != 0)
continue;
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
if (!anItemBase)
continue;
anItemBase->Presentations (aSelPresentations);
}
aDisplayer->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
}
// =======================================================================

View File

@@ -35,7 +35,7 @@
class DFBrowser_DumpView;
class DFBrowser_Module;
class DFBrowser_PropertyPanel;
class DFBrowser_Thread;
//class DFBrowser_Thread;
class DFBrowser_TreeLevelLine;
class ViewControl_MessageDialog;
@@ -109,7 +109,7 @@ public:
DFBrowser_Module* GetModule() const { return myModule; }
//! Clears thread cache
Standard_EXPORT void ClearThreadCache();
//Standard_EXPORT void ClearThreadCache();
//! Returns tree level line control
DFBrowser_TreeLevelLine* GetTreeLevelLine() const { return myTreeLevelLine; }
@@ -220,7 +220,7 @@ private:
ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
View_Window* myViewWindow; //!< V3d view to visualize presentations/references if it can be build for a selected item
DFBrowser_DumpView* myDumpView; //!< Text editor where "Dump" method output is shown
DFBrowser_Thread* myThread; //!< Threads manipulator, starting thread items, listens finalizing
//DFBrowser_Thread* myThread; //!< Threads manipulator, starting thread items, listens finalizing
ViewControl_MessageDialog* myExportToShapeViewDialog; //!< dialog about exporting TopoDS_Shape to ShapeView plugin
Handle(TInspectorAPI_PluginParameters) myParameters; //!< contains application, context, files that should be opened
QString myOpenedFileName; //!< cached name of opened file between parent is set, apply it by parent setting and nullify

View File

@@ -25,6 +25,7 @@ enum DFBrowserPane_ItemRole
DFBrowserPane_ItemRole_Decoration_40x40, //!< icon with greater size
DFBrowserPane_ItemRole_DisplayExtended, // extended item information (with additional information) for Qt::DisplayRole
DFBrowserPane_ItemRole_ToolTipExtended, // exteneded tool tip information for Qt::ToolTipRole
DFBrowserPane_ItemRole_DisplayShort, // extended item information (with additional information) for Qt::DisplayRole
DFBrowserPane_ItemRole_LastTreeRole //! last enumeration value to use outside incremented
};