From: nds Date: Fri, 2 Aug 2019 05:07:13 +0000 (+0300) Subject: 0029451: Information Message Alert to debug an algorithm or object functionality X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b416dd9bb62006c84a51ad847a4515d46e092317;p=occt-copy.git 0029451: Information Message Alert to debug an algorithm or object functionality Dump/Init implementation in OCCT object and parsing it in VInspector (partially) --- diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index 42e7796768..e9b86446f2 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -98,7 +98,7 @@ void AIS_InteractiveObject::SetCappingStyle (const Handle(Graphic3d_AspectFillCa const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter); if (!aPrs3d.IsNull()) { - const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation(); + const Handle(Graphic3d_Structure)& aStruct = aPrs3d; if (!aStruct.IsNull()) { const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups(); @@ -175,3 +175,27 @@ void AIS_InteractiveObject::SetAspect(const Handle(Prs3d_BasicAspect)& theAspect aGroup->SetGroupPrimitivesAspect (aTextAspect->Aspect()); } } + +const TCollection_AsciiString AIS_InteractiveObject_ClassName = "AIS_InteractiveObject"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void AIS_InteractiveObject::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, AIS_InteractiveObject_ClassName); + + { + Standard_SStream aTmpStream; + SelectMgr_SelectableObject::Dump (aTmpStream); + DUMP_VALUES (OS, "SelectMgr_SelectableObject", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_VALUES (OS, "InteractiveContext", TCollection::GetPointerInfo (myCTXPtr)); + DUMP_VALUES (OS, "Owner", TCollection::GetPointerInfo (myOwner)); + DUMP_VALUES (OS, "CappingStyle", TCollection::GetPointerInfo (myCappingStyle)); + + DUMP_STOP_KEY (OS, AIS_InteractiveObject_ClassName); + +} diff --git a/src/AIS/AIS_InteractiveObject.hxx b/src/AIS/AIS_InteractiveObject.hxx index 5730d8e35d..4e411b08e0 100644 --- a/src/AIS/AIS_InteractiveObject.hxx +++ b/src/AIS/AIS_InteractiveObject.hxx @@ -124,6 +124,9 @@ public: Standard_DEPRECATED("Deprecated method, results might be undefined") Standard_EXPORT void SetAspect (const Handle(Prs3d_BasicAspect)& anAspect); + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: //! The TypeOfPresention3d means that the interactive object diff --git a/src/BVH/BVH_Box.hxx b/src/BVH/BVH_Box.hxx index 47efa7fdec..446aa5ac98 100644 --- a/src/BVH/BVH_Box.hxx +++ b/src/BVH/BVH_Box.hxx @@ -117,7 +117,7 @@ public: DUMP_VALUES (OS, "IsValid", IsValid()); OS << "Bnd_Box" << TCollection::DumpSeparator(); - BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS, Standard_DumpMask_SingleValue); + BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS); OS << TCollection::DumpSeparator(); } diff --git a/src/BVH/BVH_Tree.hxx b/src/BVH/BVH_Tree.hxx index c17e3817f3..a6dd5bfe73 100644 --- a/src/BVH/BVH_Tree.hxx +++ b/src/BVH/BVH_Tree.hxx @@ -212,7 +212,7 @@ public: //! @name methods for accessing serialized tree data DUMP_VALUES (OS, "NodeIndex", theNodeIndex); OS << "Bnd_Box" << TCollection::DumpSeparator(); - BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS, Standard_DumpMask_SingleValue); + BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS); OS << TCollection::DumpSeparator(); DUMP_VALUES (OS, "BegPrimitive", BegPrimitive (theNodeIndex)); diff --git a/src/Bnd/Bnd_Box.cxx b/src/Bnd/Bnd_Box.cxx index cdd9dc9d73..2d09365bff 100644 --- a/src/Bnd/Bnd_Box.cxx +++ b/src/Bnd/Bnd_Box.cxx @@ -991,7 +991,7 @@ const TCollection_AsciiString Bnd_Box_ClassName = "Bnd_Box"; //purpose : //======================================================================= -void Bnd_Box::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void Bnd_Box::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, Bnd_Box_ClassName); @@ -1012,32 +1012,32 @@ void Bnd_Box::Dump (Standard_OStream& OS, const Standard_Integer theMask) const //purpose : //======================================================================= -Standard_Boolean Bnd_Box::Init (const Standard_OStream& OS) +Standard_Boolean Bnd_Box::Init (const Standard_SStream& OS) { NCollection_IndexedDataMap aStreamValues; - Standard_SStream aSStream (OS); - TCollection::Split (aSStream, aStreamValues); - - TCollection_AsciiString anXYZValue; - if (aStreamValues.Size() == 1) - { - TCollection_AsciiString aValueStr = aStreamValues.FindFromIndex (1); - Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator()); - if (aPosition < 1) - return Standard_False; - anXYZValue = aValueStr.Split (aPosition); - } - - NCollection_Vector aValues; - if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues)) + TCollection_AsciiString aKey; + TCollection::Split (OS, aStreamValues, aKey); + + TCollection_AsciiString aXmin, anYmin, aZmin, aXmax, anYmax, aZmax, aGap, aFlags; + if (!aStreamValues.FindFromKey ("Xmin", aXmin) || + !aStreamValues.FindFromKey ("Ymin", anYmin) || + !aStreamValues.FindFromKey ("Zmin", aZmin) || + !aStreamValues.FindFromKey ("Xmax", aXmax) || + !aStreamValues.FindFromKey ("Ymax", anYmax) || + !aStreamValues.FindFromKey ("Zmax", aZmax) || + !aStreamValues.FindFromKey ("Gap", aGap) || + !aStreamValues.FindFromKey ("Flags", aFlags)) return Standard_False; - if (aValues.Size() != 8) - return Standard_False; + Xmin = aXmin.RealValue(); + Ymin = anYmin.RealValue(); + Zmin = aZmin.RealValue(); + Xmax = aXmax.RealValue(); + Ymax = anYmax.RealValue(); + Zmax = aZmax.RealValue(); - Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6)); - Gap = aValues.Value (7); - Flags = (Standard_Integer)aValues.Value (8); + Gap = aGap.RealValue(); + Flags = aFlags.IntegerValue(); return Standard_True; } diff --git a/src/Bnd/Bnd_Box.hxx b/src/Bnd/Bnd_Box.hxx index 30b41958e3..1859587d61 100644 --- a/src/Bnd/Bnd_Box.hxx +++ b/src/Bnd/Bnd_Box.hxx @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -310,10 +309,18 @@ public: } //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; //! Dumps the content of me on the stream . - Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS); + Standard_EXPORT Standard_Boolean Init (const Standard_SStream& OS); + + //! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax) + //! \return the string value + Standard_EXPORT TCollection_AsciiString ToString() const { return ""; } + + //! Converts text value into parameters if possible, the string format is: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax) + //! \return true if conversion is done + Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue) { (void)theValue; return Standard_False; } protected: diff --git a/src/Bnd/Bnd_OBB.cxx b/src/Bnd/Bnd_OBB.cxx index d59b0a058d..edc5effe9d 100644 --- a/src/Bnd/Bnd_OBB.cxx +++ b/src/Bnd/Bnd_OBB.cxx @@ -685,7 +685,7 @@ const TCollection_AsciiString Bnd_OBB_ClassName = "Bnd_OBB"; //purpose : //======================================================================= -void Bnd_OBB::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const +void Bnd_OBB::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, Bnd_OBB_ClassName); { @@ -722,11 +722,10 @@ void Bnd_OBB::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) co //purpose : //======================================================================= -Standard_Boolean Bnd_OBB::Init (const Standard_OStream& /*OS*/) +Standard_Boolean Bnd_OBB::Init (const Standard_SStream& /*OS*/) { //NCollection_DataMap aStreamValues; - //Standard_SStream aSStream (OS); - //TCollection::Split (aSStream, aStreamValues); + //TCollection::Split (OS, aStreamValues, aKey); //TCollection_AsciiString anXYZValue; //if (aStreamValues.Size() == 1) diff --git a/src/Bnd/Bnd_OBB.hxx b/src/Bnd/Bnd_OBB.hxx index 0a3b2212cf..f4fe73ea28 100644 --- a/src/Bnd/Bnd_OBB.hxx +++ b/src/Bnd/Bnd_OBB.hxx @@ -17,7 +17,6 @@ #include #include -#include #include #include #include @@ -279,10 +278,18 @@ public: Standard_EXPORT void Add(const gp_Pnt& theP); //! Dumps the content of me on the stream . - Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS); + Standard_EXPORT Standard_Boolean Init (const Standard_SStream& OS); //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; + + //! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax) + //! \return the string value + Standard_EXPORT TCollection_AsciiString ToString() const { return ""; } + + //! Converts text value into parameters if possible, the string format is: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax) + //! \return true if conversion is done + Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue) { (void)theValue; return Standard_False; } protected: diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index f217793dae..79e16c91fb 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -105,6 +105,7 @@ Graphic3d_NameOfTexture2D.hxx Graphic3d_NameOfTextureEnv.hxx Graphic3d_NameOfTexturePlane.hxx Graphic3d_NMapOfTransient.hxx +Graphic3d_PolygonOffset.cxx Graphic3d_PolygonOffset.hxx Graphic3d_PriorityDefinitionError.hxx Graphic3d_RenderingMode.hxx diff --git a/src/Graphic3d/Graphic3d.cxx b/src/Graphic3d/Graphic3d.cxx index 19e05b2e8f..e56b15c8fe 100644 --- a/src/Graphic3d/Graphic3d.cxx +++ b/src/Graphic3d/Graphic3d.cxx @@ -19,7 +19,7 @@ namespace { static Standard_CString Graphic3d_Table_PrintZLayerId[6] = { - "INKNOWN", "DEFAULT", "TOP", "TOPMOST", "TOP_OSD", "BOT_OSD" + "UNKNOWN", "DEFAULT", "TOP", "TOPMOST", "TOP_OSD", "BOT_OSD" }; static Standard_CString Graphic3d_Table_PrintHorizontalTextAlignment[3] = diff --git a/src/Graphic3d/Graphic3d_Aspects.cxx b/src/Graphic3d/Graphic3d_Aspects.cxx index b8d12a4937..37da13eee7 100644 --- a/src/Graphic3d/Graphic3d_Aspects.cxx +++ b/src/Graphic3d/Graphic3d_Aspects.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Aspects, Standard_Transient) @@ -60,3 +61,61 @@ void Graphic3d_Aspects::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTe myTextureSet = new Graphic3d_TextureSet (theTexture); } + +const TCollection_AsciiString Graphic3d_Aspects_ClassName = "Graphic3d_Aspects"; + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + +void Graphic3d_Aspects::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Graphic3d_Aspects_ClassName); + + /*Handle(Graphic3d_ShaderProgram) myProgram; + Handle(Graphic3d_TextureSet) myTextureSet; + Handle(Graphic3d_MarkerImage) myMarkerImage; + Handle(Graphic3d_HatchStyle) myHatchStyle; + Handle(TCollection_HAsciiString) myTextFont; + Graphic3d_MaterialAspect myFrontMaterial; + Graphic3d_MaterialAspect myBackMaterial; + + Quantity_ColorRGBA myInteriorColor; + Quantity_ColorRGBA myBackInteriorColor; + Quantity_ColorRGBA myEdgeColor; + */ + { + Standard_SStream aTmpStream; + myPolygonOffset.Dump (aTmpStream); + DUMP_VALUES (OS, "PolygonOffset", TCollection::ToDumpString (aTmpStream)); + } + + /*Aspect_InteriorStyle myInteriorStyle; + Graphic3d_TypeOfShadingModel myShadingModel; + Graphic3d_AlphaMode myAlphaMode; + Standard_ShortReal myAlphaCutoff; + + Aspect_TypeOfLine myLineType; + Standard_ShortReal myLineWidth; + + Aspect_TypeOfMarker myMarkerType; + Standard_ShortReal myMarkerScale; + + Aspect_TypeOfStyleText myTextStyle; + Aspect_TypeOfDisplayText myTextDisplayType; + Font_FontAspect myTextFontAspect; + Standard_ShortReal myTextAngle; + */ + + DUMP_VALUES (OS, "ToSkipFirstEdge", myToSkipFirstEdge); + DUMP_VALUES (OS, "ToDistinguishMaterials", myToDistinguishMaterials); + DUMP_VALUES (OS, "ToDrawEdges", myToDrawEdges); + DUMP_VALUES (OS, "ToDrawSilhouette", myToDrawSilhouette); + DUMP_VALUES (OS, "ToSuppressBackFaces", myToSuppressBackFaces); + DUMP_VALUES (OS, "ToMapTexture", myToMapTexture); + DUMP_VALUES (OS, "IsTextZoomable", myIsTextZoomable); + + + DUMP_STOP_KEY (OS, Graphic3d_Aspects_ClassName); +} diff --git a/src/Graphic3d/Graphic3d_Aspects.hxx b/src/Graphic3d/Graphic3d_Aspects.hxx index 70aa6a2779..b3de652709 100644 --- a/src/Graphic3d/Graphic3d_Aspects.hxx +++ b/src/Graphic3d/Graphic3d_Aspects.hxx @@ -477,6 +477,9 @@ public: && myIsTextZoomable == theOther.myIsTextZoomable; } + //! Dumps the content of me on the stream . + Standard_EXPORT void Dump (Standard_OStream& OS) const; + protected: Handle(Graphic3d_ShaderProgram) myProgram; diff --git a/src/Graphic3d/Graphic3d_PolygonOffset.cxx b/src/Graphic3d/Graphic3d_PolygonOffset.cxx new file mode 100644 index 0000000000..28b1ac52e0 --- /dev/null +++ b/src/Graphic3d/Graphic3d_PolygonOffset.cxx @@ -0,0 +1,35 @@ +// Copyright (c) 2016 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include +#include + +const TCollection_AsciiString Graphic3d_PolygonOffset_ClassName = "Graphic3d_PolygonOffset"; + +//======================================================================= +//function : Dump +//purpose : +//======================================================================= + +void Graphic3d_PolygonOffset::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Graphic3d_PolygonOffset_ClassName); + + DUMP_VALUES (OS, "Mode", Aspect::PolygonOffsetModeToString (Mode)); + DUMP_VALUES (OS, "Factor", Factor); + DUMP_VALUES (OS, "Units", Units); + + DUMP_STOP_KEY (OS, Graphic3d_PolygonOffset_ClassName); +} diff --git a/src/Graphic3d/Graphic3d_PolygonOffset.hxx b/src/Graphic3d/Graphic3d_PolygonOffset.hxx index 6bc5d09297..ce85b2f63e 100644 --- a/src/Graphic3d/Graphic3d_PolygonOffset.hxx +++ b/src/Graphic3d/Graphic3d_PolygonOffset.hxx @@ -15,6 +15,7 @@ #define _Graphic3d_PolygonOffset_HeaderFile #include +#include //! Polygon offset parameters. struct Graphic3d_PolygonOffset @@ -33,6 +34,10 @@ struct Graphic3d_PolygonOffset && Factor == theOther.Factor && Units == theOther.Units; } + + //! Dumps the content of me on the stream . + Standard_EXPORT void Dump (Standard_OStream& OS) const; + }; #endif // _Graphic3d_PolygonOffset_HeaderFile diff --git a/src/Prs3d/Prs3d_ArrowAspect.cxx b/src/Prs3d/Prs3d_ArrowAspect.cxx index dcd3b0204c..87a1d7336c 100644 --- a/src/Prs3d/Prs3d_ArrowAspect.cxx +++ b/src/Prs3d/Prs3d_ArrowAspect.cxx @@ -15,6 +15,7 @@ #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ArrowAspect, Prs3d_BasicAspect) @@ -65,3 +66,24 @@ void Prs3d_ArrowAspect::SetAngle (const Standard_Real theAngle) || theAngle >= M_PI / 2.0, "Prs3d_ArrowAspect::SetAngle() - angle out of range"); myAngle = theAngle; } + +const TCollection_AsciiString Prs3d_ArrowAspect_ClassName = "Prs3d_ArrowAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_ArrowAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_ArrowAspect_ClassName); + { + Standard_SStream aTmpStream; + myArrowAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_VALUES (OS, "Angle", myAngle); + DUMP_VALUES (OS, "Length", myLength); + + DUMP_STOP_KEY (OS, Prs3d_ArrowAspect_ClassName); +} diff --git a/src/Prs3d/Prs3d_ArrowAspect.hxx b/src/Prs3d/Prs3d_ArrowAspect.hxx index 6489b5a0db..7e24885672 100644 --- a/src/Prs3d/Prs3d_ArrowAspect.hxx +++ b/src/Prs3d/Prs3d_ArrowAspect.hxx @@ -57,6 +57,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myArrowAspect = theAspect; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectLine3d) myArrowAspect; diff --git a/src/Prs3d/Prs3d_BasicAspect.hxx b/src/Prs3d/Prs3d_BasicAspect.hxx index 7578c71a20..cfde64bbc2 100644 --- a/src/Prs3d/Prs3d_BasicAspect.hxx +++ b/src/Prs3d/Prs3d_BasicAspect.hxx @@ -17,6 +17,7 @@ #define _Prs3d_BasicAspect_HeaderFile #include +#include #include #include @@ -25,6 +26,10 @@ class Prs3d_BasicAspect : public Standard_Transient { DEFINE_STANDARD_RTTIEXT(Prs3d_BasicAspect, Standard_Transient) + + //! Dumps the content of me on the stream . + virtual void Dump (Standard_OStream& OS) const = 0; + }; DEFINE_STANDARD_HANDLE(Prs3d_BasicAspect, Standard_Transient) diff --git a/src/Prs3d/Prs3d_DatumAspect.cxx b/src/Prs3d/Prs3d_DatumAspect.cxx index 5afab0e8d7..5f92713a11 100644 --- a/src/Prs3d/Prs3d_DatumAspect.cxx +++ b/src/Prs3d/Prs3d_DatumAspect.cxx @@ -14,6 +14,9 @@ #include +#include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect) // ======================================================================= @@ -167,3 +170,40 @@ Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) } return Prs3d_DP_None; } + +const TCollection_AsciiString Prs3d_DatumAspect_ClassName = "Prs3d_DatumAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_DatumAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_DatumAspect_ClassName); + + DUMP_VALUES (OS, "Axes", Prs3d::DatumAxesToString (myAxes)); + DUMP_VALUES (OS, "ToDrawLabels", myToDrawLabels); + DUMP_VALUES (OS, "ToDrawArrows", myToDrawArrows); + + //NCollection_DataMap myAttributes; + //NCollection_DataMap myShadedAspects; + //NCollection_DataMap myLineAspects; + + { + Standard_SStream aTmpStream; + myTextAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myPointAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "PointAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myArrowAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream)); + } + DUMP_STOP_KEY (OS, Prs3d_DatumAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_DatumAspect.hxx b/src/Prs3d/Prs3d_DatumAspect.hxx index 42e90b8f04..1dc6726e5c 100644 --- a/src/Prs3d/Prs3d_DatumAspect.hxx +++ b/src/Prs3d/Prs3d_DatumAspect.hxx @@ -144,6 +144,9 @@ public: //! Returns type of arrow for a type of axis Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const; + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + private: Prs3d_DatumAxes myAxes; Standard_Boolean myToDrawLabels; diff --git a/src/Prs3d/Prs3d_DimensionAspect.cxx b/src/Prs3d/Prs3d_DimensionAspect.cxx index 6e1141f9cd..e1029603b9 100755 --- a/src/Prs3d/Prs3d_DimensionAspect.cxx +++ b/src/Prs3d/Prs3d_DimensionAspect.cxx @@ -16,6 +16,8 @@ #include #include +#include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect) @@ -59,3 +61,43 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor) myTextAspect->SetColor (theColor); myArrowAspect->SetColor (theColor); } + +const TCollection_AsciiString Prs3d_DimensionAspect_ClassName = "Prs3d_DimensionAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_DimensionAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_DimensionAspect_ClassName); + { + Standard_SStream aTmpStream; + myLineAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "LineAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myTextAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myArrowAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream)); + } + DUMP_VALUES (OS, "ValueStringFormat", myValueStringFormat); + DUMP_VALUES (OS, "ExtensionSize", myExtensionSize); + DUMP_VALUES (OS, "ArrowTailSize", myArrowTailSize); + DUMP_VALUES (OS, "ArrowOrientation", Prs3d::DimensionArrowOrientationToString (myArrowOrientation)); + DUMP_VALUES (OS, "TextHPosition", Prs3d::DimensionTextHorizontalPositionToString (myTextHPosition)); + DUMP_VALUES (OS, "TextVPosition", Prs3d::DimensionTextVerticalPositionToString (myTextVPosition)); + + DUMP_VALUES (OS, "ToDisplayUnits", myToDisplayUnits); + DUMP_VALUES (OS, "IsText3d", myIsText3d); + DUMP_VALUES (OS, "IsTextShaded", myIsTextShaded); + DUMP_VALUES (OS, "IsArrows3d", myIsArrows3d); + + DUMP_STOP_KEY (OS, Prs3d_DimensionAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_DimensionAspect.hxx b/src/Prs3d/Prs3d_DimensionAspect.hxx index c6b80ac099..7b5b18670c 100644 --- a/src/Prs3d/Prs3d_DimensionAspect.hxx +++ b/src/Prs3d/Prs3d_DimensionAspect.hxx @@ -115,6 +115,9 @@ public: //! Returns format. const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Prs3d_LineAspect) myLineAspect; diff --git a/src/Prs3d/Prs3d_LineAspect.cxx b/src/Prs3d/Prs3d_LineAspect.cxx index b648b1026a..2458f1ef7d 100644 --- a/src/Prs3d/Prs3d_LineAspect.cxx +++ b/src/Prs3d/Prs3d_LineAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_LineAspect, Prs3d_BasicAspect) // ======================================================================= @@ -27,3 +29,21 @@ Prs3d_LineAspect::Prs3d_LineAspect (const Quantity_Color& theColor, { // } + +const TCollection_AsciiString Prs3d_LineAspect_ClassName = "Prs3d_LineAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_LineAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_LineAspect_ClassName); + { + Standard_SStream aTmpStream; + myAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream)); + } + DUMP_STOP_KEY (OS, Prs3d_LineAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_LineAspect.hxx b/src/Prs3d/Prs3d_LineAspect.hxx index cb20cfb647..4947d06a4c 100644 --- a/src/Prs3d/Prs3d_LineAspect.hxx +++ b/src/Prs3d/Prs3d_LineAspect.hxx @@ -63,6 +63,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myAspect = theAspect; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectLine3d) myAspect; diff --git a/src/Prs3d/Prs3d_PlaneAspect.cxx b/src/Prs3d/Prs3d_PlaneAspect.cxx index 8d71bb33bc..840e23422b 100644 --- a/src/Prs3d/Prs3d_PlaneAspect.cxx +++ b/src/Prs3d/Prs3d_PlaneAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PlaneAspect, Prs3d_BasicAspect) // ======================================================================= @@ -37,3 +39,43 @@ Prs3d_PlaneAspect::Prs3d_PlaneAspect() { // } + +const TCollection_AsciiString Prs3d_PlaneAspect_ClassName = "Prs3d_PlaneAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_PlaneAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_PlaneAspect_ClassName); + { + Standard_SStream aTmpStream; + myEdgesAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "EdgesAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myIsoAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "IsoAspect", TCollection::ToDumpString (aTmpStream)); + } + { + Standard_SStream aTmpStream; + myArrowAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "ArrowAspect", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_VALUES (OS, "ArrowsLength", myArrowsLength); + DUMP_VALUES (OS, "ArrowsSize", myArrowsSize); + DUMP_VALUES (OS, "ArrowsAngle", myArrowsAngle); + DUMP_VALUES (OS, "PlaneXLength", myPlaneXLength); + DUMP_VALUES (OS, "PlaneYLength", myPlaneYLength); + DUMP_VALUES (OS, "IsoDistance", myIsoDistance); + DUMP_VALUES (OS, "DrawCenterArrow", myDrawCenterArrow); + DUMP_VALUES (OS, "DrawEdgesArrows", myDrawEdgesArrows); + DUMP_VALUES (OS, "DrawEdges", myDrawEdges); + DUMP_VALUES (OS, "DrawIso", myDrawIso); + + DUMP_STOP_KEY (OS, Prs3d_PlaneAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_PlaneAspect.hxx b/src/Prs3d/Prs3d_PlaneAspect.hxx index 4833059bc7..8f9c407f4a 100644 --- a/src/Prs3d/Prs3d_PlaneAspect.hxx +++ b/src/Prs3d/Prs3d_PlaneAspect.hxx @@ -96,6 +96,9 @@ public: //! Returns the distance between isoparameters used in the display of planes. Standard_Real IsoDistance() const { return myIsoDistance; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Prs3d_LineAspect) myEdgesAspect; diff --git a/src/Prs3d/Prs3d_PointAspect.cxx b/src/Prs3d/Prs3d_PointAspect.cxx index b69b01689f..0de1072148 100644 --- a/src/Prs3d/Prs3d_PointAspect.cxx +++ b/src/Prs3d/Prs3d_PointAspect.cxx @@ -14,6 +14,8 @@ #include +#include + IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PointAspect, Prs3d_BasicAspect) // ======================================================================= @@ -40,3 +42,22 @@ Prs3d_PointAspect::Prs3d_PointAspect (const Quantity_Color& theColor, { // } + +const TCollection_AsciiString Prs3d_PointAspect_ClassName = "Prs3d_PointAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_PointAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_PointAspect_ClassName); + { + Standard_SStream aTmpStream; + myAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_STOP_KEY (OS, Prs3d_PointAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_PointAspect.hxx b/src/Prs3d/Prs3d_PointAspect.hxx index 7c2fcd3c70..315df2b4de 100644 --- a/src/Prs3d/Prs3d_PointAspect.hxx +++ b/src/Prs3d/Prs3d_PointAspect.hxx @@ -61,6 +61,9 @@ public: //! Returns marker's texture. const Handle(Graphic3d_MarkerImage)& GetTexture() const { return myAspect->GetMarkerImage(); } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectMarker3d) myAspect; diff --git a/src/Prs3d/Prs3d_ShadingAspect.cxx b/src/Prs3d/Prs3d_ShadingAspect.cxx index 102deb416a..37f20b0482 100644 --- a/src/Prs3d/Prs3d_ShadingAspect.cxx +++ b/src/Prs3d/Prs3d_ShadingAspect.cxx @@ -18,6 +18,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ShadingAspect, Prs3d_BasicAspect) @@ -164,3 +165,22 @@ Standard_Real Prs3d_ShadingAspect::Transparency (const Aspect_TypeOfFacingModel } return 0.0; } + +const TCollection_AsciiString Prs3d_ShadingAspect_ClassName = "Prs3d_ShadingAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_ShadingAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_ShadingAspect_ClassName); + { + Standard_SStream aTmpStream; + myAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "Aspect", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_STOP_KEY (OS, Prs3d_ShadingAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_ShadingAspect.hxx b/src/Prs3d/Prs3d_ShadingAspect.hxx index 8510621a31..377e7234b2 100644 --- a/src/Prs3d/Prs3d_ShadingAspect.hxx +++ b/src/Prs3d/Prs3d_ShadingAspect.hxx @@ -62,6 +62,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myAspect = theAspect; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectFillArea3d) myAspect; diff --git a/src/Prs3d/Prs3d_TextAspect.cxx b/src/Prs3d/Prs3d_TextAspect.cxx index d194818103..8d41ce7174 100644 --- a/src/Prs3d/Prs3d_TextAspect.cxx +++ b/src/Prs3d/Prs3d_TextAspect.cxx @@ -17,6 +17,8 @@ #include #include +#include +#include IMPLEMENT_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect) @@ -47,3 +49,28 @@ Prs3d_TextAspect::Prs3d_TextAspect (const Handle(Graphic3d_AspectText3d)& theAsp { // } + +const TCollection_AsciiString Prs3d_TextAspect_ClassName = "Prs3d_TextAspect"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void Prs3d_TextAspect::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, Prs3d_TextAspect_ClassName); + { + Standard_SStream aTmpStream; + myTextAspect->Dump (aTmpStream); + DUMP_VALUES (OS, "TextAspect", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_VALUES (OS, "Height", myHeight); + + DUMP_VALUES (OS, "HorizontalJustification", Graphic3d::HorizontalTextAlignmentToString (myHorizontalJustification)); + DUMP_VALUES (OS, "VerticalJustification", Graphic3d::VerticalTextAlignmentToString (myVerticalJustification)); + DUMP_VALUES (OS, "Orientation", Graphic3d::TextPathToString (myOrientation)); + + DUMP_STOP_KEY (OS, Prs3d_TextAspect_ClassName); +} + diff --git a/src/Prs3d/Prs3d_TextAspect.hxx b/src/Prs3d/Prs3d_TextAspect.hxx index cf59e1aefa..b9bc47381c 100644 --- a/src/Prs3d/Prs3d_TextAspect.hxx +++ b/src/Prs3d/Prs3d_TextAspect.hxx @@ -97,6 +97,9 @@ public: void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + protected: Handle(Graphic3d_AspectText3d) myTextAspect; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index 90c297b3e2..f9820cdf0d 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -836,3 +836,43 @@ void PrsMgr_PresentableObject::PolygonOffsets (Standard_Integer& theMode, myDrawer->ShadingAspect()->Aspect()->PolygonOffsets (theMode, theFactor, theUnits); } } + +const TCollection_AsciiString PrsMgr_PresentableObject_ClassName = "PrsMgr_PresentableObject"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void PrsMgr_PresentableObject::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, PrsMgr_PresentableObject_ClassName); + + DUMP_VALUES (OS, "Parent", TCollection::GetPointerInfo (myParent)); + + DUMP_VALUES (OS, "Width", myOwnWidth); + DUMP_VALUES (OS, "OwnColor", hasOwnColor); + DUMP_VALUES (OS, "OwnMaterial", hasOwnMaterial); + + DUMP_VALUES (OS, "InfiniteState", myInfiniteState); + DUMP_VALUES (OS, "IsMutable", myIsMutable); + DUMP_VALUES (OS, "HasOwnPresentations", myHasOwnPresentations); + + DUMP_STOP_KEY (OS, PrsMgr_PresentableObject_ClassName); + +/* + PrsMgr_Presentations myPresentations; //!< list of presentations + Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes; //!< sequence of object-specific clipping planes + Handle(Prs3d_Drawer) myDrawer; //!< main presentation attributes + Handle(Prs3d_Drawer) myHilightDrawer; //!< (optional) custom presentation attributes for highlighting selected object + Handle(Prs3d_Drawer) myDynHilightDrawer; //!< (optional) custom presentation attributes for highlighting detected object + Handle(Graphic3d_TransformPers) myTransformPersistence; //!< transformation persistence + Handle(Geom_Transformation) myLocalTransformation; //!< local transformation relative to parent object + Handle(Geom_Transformation) myTransformation; //!< absolute transformation of this object (combined parents + local transformations) + Handle(Geom_Transformation) myCombinedParentTransform; //!< transformation of parent object (combined for all parents) + PrsMgr_ListOfPresentableObjects myChildren; //!< list of children + gp_GTrsf myInvTransformation; //!< inversion of absolute transformation (combined parents + local transformations) + PrsMgr_TypeOfPresentation3d myTypeOfPresentation3d; //!< presentation type + + Aspect_TypeOfFacingModel myCurrentFacingModel; //!< current facing model +*/ +} diff --git a/src/PrsMgr/PrsMgr_PresentableObject.hxx b/src/PrsMgr/PrsMgr_PresentableObject.hxx index 6275cc4cdd..10a17585b3 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.hxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.hxx @@ -479,6 +479,9 @@ public: //! @name simplified presentation properties API //! Clears settings provided by the drawing tool aDrawer. Standard_EXPORT virtual void UnsetAttributes(); + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const; + public: //! @name deprecated methods //! gives the list of modes which are flagged "to be updated". diff --git a/src/Quantity/Quantity_Color.cxx b/src/Quantity/Quantity_Color.cxx index 5ade8c2482..4033df494c 100644 --- a/src/Quantity/Quantity_Color.cxx +++ b/src/Quantity/Quantity_Color.cxx @@ -3937,7 +3937,7 @@ const TCollection_AsciiString Quantity_Color_ClassName = "Quantity_Color"; //purpose : //======================================================================= -void Quantity_Color::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void Quantity_Color::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, Quantity_Color_ClassName); @@ -3953,11 +3953,12 @@ void Quantity_Color::Dump (Standard_OStream& OS, const Standard_Integer theMask) //purpose : //======================================================================= -Standard_Boolean Quantity_Color::Init (const Standard_OStream& OS) +Standard_Boolean Quantity_Color::Init (const Standard_OStream& /*OS*/) { //NCollection_IndexedDataMap aStreamValues; //Standard_SStream aSStream (OS); - //TCollection::Split (aSStream, aStreamValues); + //TCollection_AsciiString aKey; + //TCollection::Split (aSStream, aStreamValues, aKey); //TCollection_AsciiString anXYZValue; //if (!aStreamValues.FindFromKey (Quantity_Color_ClassName, anXYZValue)) diff --git a/src/Quantity/Quantity_Color.hxx b/src/Quantity/Quantity_Color.hxx index f164e5a257..d9687544eb 100644 --- a/src/Quantity/Quantity_Color.hxx +++ b/src/Quantity/Quantity_Color.hxx @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -267,7 +266,7 @@ Standard_Boolean operator == (const Quantity_Color& Other) const Standard_EXPORT static void Test(); //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; //! Dumps the content of me on the stream . Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS); diff --git a/src/Quantity/Quantity_ColorRGBA.cxx b/src/Quantity/Quantity_ColorRGBA.cxx index ddc623c572..ffada11dad 100644 --- a/src/Quantity/Quantity_ColorRGBA.cxx +++ b/src/Quantity/Quantity_ColorRGBA.cxx @@ -207,7 +207,7 @@ const TCollection_AsciiString Quantity_ColorRGBA_ClassName = "Quantity_ColorRGBA //purpose : //======================================================================= -void Quantity_ColorRGBA::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const +void Quantity_ColorRGBA::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, Quantity_ColorRGBA_ClassName); diff --git a/src/Quantity/Quantity_ColorRGBA.hxx b/src/Quantity/Quantity_ColorRGBA.hxx index 3dcc33b1cf..11b1eafd0e 100644 --- a/src/Quantity/Quantity_ColorRGBA.hxx +++ b/src/Quantity/Quantity_ColorRGBA.hxx @@ -122,7 +122,7 @@ public: const bool theAlphaComponentIsOff = false); //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; private: diff --git a/src/SelectMgr/SelectMgr_EntityOwner.cxx b/src/SelectMgr/SelectMgr_EntityOwner.cxx index d537c01dd6..5a8aa57b44 100644 --- a/src/SelectMgr/SelectMgr_EntityOwner.cxx +++ b/src/SelectMgr/SelectMgr_EntityOwner.cxx @@ -82,3 +82,22 @@ void SelectMgr_EntityOwner::HilightWithColor (const Handle(PrsMgr_PresentationMa mySelectable->HilightOwnerWithColor (thePM, theStyle, this); } } + +const TCollection_AsciiString SelectMgr_EntityOwner_ClassName = "SelectMgr_EntityOwner"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void SelectMgr_EntityOwner::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, SelectMgr_EntityOwner_ClassName); + + + DUMP_VALUES (OS, "Selectable", TCollection::GetPointerInfo (mySelectable)); + DUMP_VALUES (OS, "Priority", mypriority); + DUMP_VALUES (OS, "IsSelected", myIsSelected); + DUMP_VALUES (OS, "ComesFromDecomposition", myFromDecomposition); + + DUMP_STOP_KEY (OS, SelectMgr_EntityOwner_ClassName); +} diff --git a/src/SelectMgr/SelectMgr_EntityOwner.hxx b/src/SelectMgr/SelectMgr_EntityOwner.hxx index eec5e128f1..a385c8b596 100644 --- a/src/SelectMgr/SelectMgr_EntityOwner.hxx +++ b/src/SelectMgr/SelectMgr_EntityOwner.hxx @@ -170,6 +170,9 @@ public: //! Sets flag indicating this owner points to a part of object (TRUE) or to entire object (FALSE). void SetComesFromDecomposition (const Standard_Boolean theIsFromDecomposition) { myFromDecomposition = theIsFromDecomposition; } + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const; + public: //! Sets the selectable object. diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cxx b/src/SelectMgr/SelectMgr_SelectableObject.cxx index 4980ecf7b6..ab1d099be6 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.cxx @@ -548,3 +548,32 @@ const Handle(SelectMgr_EntityOwner)& SelectMgr_SelectableObject::GetAssemblyOwne { return THE_NULL_ENTITYOWNER; } + +const TCollection_AsciiString SelectMgr_SelectableObject_ClassName = "SelectMgr_SelectableObject"; + +// ======================================================================= +// function : Dump +// purpose : +// ======================================================================= +void SelectMgr_SelectableObject::Dump (Standard_OStream& OS) const +{ + DUMP_START_KEY (OS, SelectMgr_SelectableObject_ClassName); + + { + Standard_SStream aTmpStream; + PrsMgr_PresentableObject::Dump (aTmpStream); + DUMP_VALUES (OS, "PrsMgr_PresentableObject", TCollection::ToDumpString (aTmpStream)); + } + + DUMP_VALUES (OS, "GlobalSelectionMode", myGlobalSelMode); + //DUMP_VALUES (OS, "mycurrent", mycurrent); + DUMP_VALUES (OS, "IsAutoHilight", myAutoHilight); + +/* + SelectMgr_SequenceOfSelection myselections; //!< list of selections + Handle(Prs3d_Presentation) mySelectionPrs; //!< optional presentation for highlighting selected object + Handle(Prs3d_Presentation) myHilightPrs; //!< optional presentation for highlighting detected object +*/ + + DUMP_STOP_KEY (OS, SelectMgr_SelectableObject_ClassName); +} diff --git a/src/SelectMgr/SelectMgr_SelectableObject.hxx b/src/SelectMgr/SelectMgr_SelectableObject.hxx index 2da46a4120..c4d525cc01 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.hxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.hxx @@ -169,6 +169,9 @@ public: //! Returns common entity owner if the object is an assembly Standard_EXPORT virtual const Handle(SelectMgr_EntityOwner)& GetAssemblyOwner() const; + //! Dumps the content of me on the stream . + Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE; + public: //! Begins the iteration scanning for sensitive primitives. diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.cxx b/src/SelectMgr/SelectMgr_ViewerSelector.cxx index cc403b7632..e2c7ef5405 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.cxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.cxx @@ -35,7 +35,7 @@ #include -#define REPORT_SELECTION_BUILD +//#define REPORT_SELECTION_BUILD #ifdef REPORT_SELECTION_BUILD #include #include @@ -767,7 +767,9 @@ void SelectMgr_ViewerSelector::TraverseSensitives() } } +#ifdef REPORT_SELECTION_BUILD MESSAGE_INFO ("SortResult", "", &aPerfMeter, aParentAlert); +#endif SortResult(); #ifdef REPORT_SELECTION_BUILD Standard_SStream aStreamDone; diff --git a/src/Standard/FILES b/src/Standard/FILES index 79bcc5a515..1199f5f973 100755 --- a/src/Standard/FILES +++ b/src/Standard/FILES @@ -24,7 +24,6 @@ Standard_DimensionError.hxx Standard_DimensionMismatch.hxx Standard_DivideByZero.hxx Standard_DomainError.hxx -Standard_DumpMask.hxx Standard_ErrorHandler.cxx Standard_ErrorHandler.hxx Standard_ExtCharacter.hxx diff --git a/src/Standard/Standard_DumpMask.hxx b/src/Standard/Standard_DumpMask.hxx deleted file mode 100644 index 5fe235580f..0000000000 --- a/src/Standard/Standard_DumpMask.hxx +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef _Standard_DumpMask_HeaderFile -#define _Standard_DumpMask_HeaderFile - - -//! Sets how much information should be dumped in Dump of the object -enum Standard_DumpMask -{ - Standard_DumpMask_Empty = 0x0000, //! empty output - Standard_DumpMask_Fields = 0x0001, //! only class fields value - Standard_DumpMask_Methods = 0x0002, //! only methods result - Standard_DumpMask_ClassName = 0x0004, //! the first row of Dump has class name - Standard_DumpMask_SingleValue = 0x0008, //! dump is combined in one value - Standard_DumpMask_Whole = Standard_DumpMask_Fields | Standard_DumpMask_Methods, - Standard_DumpMask_WholeAndClassName = Standard_DumpMask_Whole | Standard_DumpMask_ClassName -}; - -#endif // _Standard_DumpMask_HeaderFile diff --git a/src/TCollection/TCollection.cxx b/src/TCollection/TCollection.cxx index e07f8f7f4b..b0f90d8c34 100644 --- a/src/TCollection/TCollection.cxx +++ b/src/TCollection/TCollection.cxx @@ -136,12 +136,23 @@ TCollection_AsciiString TCollection::Join (const NCollection_List& theValues) + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theKey) { TCollection_AsciiString aStreamStr (theStream.str().c_str()); + TCollection_AsciiString aSplitValue, aTailValue, aKey; + if (SplitKey (aStreamStr, aSplitValue, aTailValue, aKey)) + { + if (aTailValue.IsEmpty()) + { + theKey = aKey; + aStreamStr = aSplitValue; + } + } + NCollection_List aValues; - Split (aStreamStr, DumpSeparator(), aValues); + split (aStreamStr, DumpSeparator(), aValues); for (NCollection_List::Iterator anIterator (aValues); anIterator.More(); anIterator.Next()) { @@ -155,10 +166,10 @@ void TCollection::Split (const Standard_SStream& theStream, // ---------------------------------------------------------------------------- -// Split +// split // ---------------------------------------------------------------------------- -void TCollection::Split (const TCollection_AsciiString& theValue, +void TCollection::split (const TCollection_AsciiString& theValue, const TCollection_AsciiString& theSeparator, NCollection_List& theValues) { @@ -186,16 +197,6 @@ void TCollection::Split (const TCollection_AsciiString& theValue, aCurrentString = aCurrentString.Split (theSeparator.Length()); } - - if (theValues.Size() == 1) - { - TCollection_AsciiString aKey, aValue; - if (!SplitKey (theValues.First(), aValue, aKey)) - return; - - theValues.Clear(); - Split (aValue, DumpSeparator(), theValues); - } } // ---------------------------------------------------------------------------- @@ -331,6 +332,7 @@ Standard_Boolean TCollection::SplitDumped (const TCollection_AsciiString& theSou Standard_Boolean TCollection::SplitKey (const TCollection_AsciiString& theSourceValue, TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theTailValue, TCollection_AsciiString& theKey) { Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen()); @@ -350,11 +352,16 @@ Standard_Boolean TCollection::SplitKey (const TCollection_AsciiString& theSource aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket TCollection_AsciiString aStopKey = StopKey (theKey); - aBracketPosition = theSourceValue.Search (aStopKey); - if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length()) + aBracketPosition = aTailValue.Search (aStopKey); + if (aBracketPosition <= 1 || aBracketPosition >= aTailValue.Length()) return Standard_False; theSplitValue = aTailValue; aTailValue = theSplitValue.Split (aBracketPosition - 1); + + if (aTailValue.Length() == aStopKey.Length()) + theTailValue = ""; + else + theTailValue = aTailValue.SubString (aStopKey.Length(), aTailValue.Length()); return Standard_True; } diff --git a/src/TCollection/TCollection.hxx b/src/TCollection/TCollection.hxx index 33f57f9852..0fb4763509 100644 --- a/src/TCollection/TCollection.hxx +++ b/src/TCollection/TCollection.hxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -113,13 +114,15 @@ public: //! \param theStream stream value //! \param theValues [out] container of split values Standard_EXPORT static void Split (const Standard_SStream& theStream, - NCollection_IndexedDataMap& theValues); + NCollection_IndexedDataMap& theValues, + TCollection_AsciiString& theKey); +private: //! Unites list of string into one string using the separator - Standard_EXPORT static void Split (const TCollection_AsciiString& theValue, + Standard_EXPORT static void split (const TCollection_AsciiString& theValue, const TCollection_AsciiString& theSeparator, NCollection_List& theValues); - +public: //! Unites list of string into one string using the separator Standard_EXPORT static Standard_Boolean SplitReal (const TCollection_AsciiString& theValue, const TCollection_AsciiString& theSeparator, @@ -143,7 +146,7 @@ public: //! Splits a AsciiString into two sub-strings using Dump keys. //! Example: //! aString contains "abcdefg" - //! aString.SplitDumped() gives = "abc" and returns "defg" + //! aString.SplitDumped() gives theSplitValue = "abc", theTailValue = "defg", theKey = "key" Standard_EXPORT static Standard_Boolean SplitDumped (const TCollection_AsciiString& theSourceValue, TCollection_AsciiString& theSplitValue, TCollection_AsciiString& theTailValue, @@ -153,8 +156,13 @@ public: //! theSplitValue = value, theKey = key. Standard_EXPORT static Standard_Boolean SplitKey (const TCollection_AsciiString& theSourceValue, TCollection_AsciiString& theSplitValue, + TCollection_AsciiString& theTailValue, TCollection_AsciiString& theKey); + //! Returns true if the value has bracket key + static Standard_Boolean HasBracketKey (const TCollection_AsciiString& theSourceValue) + { return theSourceValue.Search (TCollection::XMLBracketOpen()) >= 0; } + protected: static TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); } static TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); } diff --git a/src/TopLoc/TopLoc_Datum3D.cxx b/src/TopLoc/TopLoc_Datum3D.cxx index 19ad955b37..4197b30b5b 100644 --- a/src/TopLoc/TopLoc_Datum3D.cxx +++ b/src/TopLoc/TopLoc_Datum3D.cxx @@ -49,7 +49,7 @@ const TCollection_AsciiString TopLoc_Datum3D_ClassName = "TopLoc_Datum3D"; //purpose : //======================================================================= -void TopLoc_Datum3D::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void TopLoc_Datum3D::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, TopLoc_Datum3D_ClassName); diff --git a/src/TopLoc/TopLoc_Datum3D.hxx b/src/TopLoc/TopLoc_Datum3D.hxx index 72830e6ffb..99b79163ef 100644 --- a/src/TopLoc/TopLoc_Datum3D.hxx +++ b/src/TopLoc/TopLoc_Datum3D.hxx @@ -54,7 +54,7 @@ public: //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; //! Writes the contents of this Datum3D to the stream S. Standard_EXPORT void ShallowDump (Standard_OStream& S) const; diff --git a/src/TopLoc/TopLoc_ItemLocation.cxx b/src/TopLoc/TopLoc_ItemLocation.cxx index 86c35c0f19..f8fb0a4cb5 100644 --- a/src/TopLoc/TopLoc_ItemLocation.cxx +++ b/src/TopLoc/TopLoc_ItemLocation.cxx @@ -41,7 +41,7 @@ const TCollection_AsciiString TopLoc_ItemLocation_ClassName = "TopLoc_ItemLocati //purpose : //======================================================================= -void TopLoc_ItemLocation::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void TopLoc_ItemLocation::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, TopLoc_ItemLocation_ClassName); diff --git a/src/TopLoc/TopLoc_ItemLocation.hxx b/src/TopLoc/TopLoc_ItemLocation.hxx index e40fa8195e..62ab486b9c 100644 --- a/src/TopLoc/TopLoc_ItemLocation.hxx +++ b/src/TopLoc/TopLoc_ItemLocation.hxx @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -52,7 +51,7 @@ public: Standard_EXPORT TopLoc_ItemLocation(const Handle(TopLoc_Datum3D)& D, const Standard_Integer P); //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; friend class TopLoc_Location; diff --git a/src/TopLoc/TopLoc_Location.cxx b/src/TopLoc/TopLoc_Location.cxx index 00672c5b4d..5ea95b97df 100644 --- a/src/TopLoc/TopLoc_Location.cxx +++ b/src/TopLoc/TopLoc_Location.cxx @@ -238,7 +238,7 @@ const TCollection_AsciiString TopLoc_Location_ClassName = "TopLoc_Location"; //purpose : //======================================================================= -void TopLoc_Location::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void TopLoc_Location::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, TopLoc_Location_ClassName); @@ -252,7 +252,6 @@ void TopLoc_Location::Dump (Standard_OStream& OS, const Standard_Integer theMask TopLoc_SListOfItemLocation items = myItems; if (!items.IsEmpty()) { - DUMP_VALUES (OS, "Items", ""); while (items.More()) { Standard_SStream aTmpStream; diff --git a/src/TopLoc/TopLoc_Location.hxx b/src/TopLoc/TopLoc_Location.hxx index 20cc078348..6be35f54c8 100644 --- a/src/TopLoc/TopLoc_Location.hxx +++ b/src/TopLoc/TopLoc_Location.hxx @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -145,7 +144,7 @@ Standard_Boolean operator != (const TopLoc_Location& Other) const } //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; //! Prints the contents of on the stream . Standard_EXPORT void ShallowDump (Standard_OStream& S) const; diff --git a/src/TopoDS/TopoDS_Shape.cxx b/src/TopoDS/TopoDS_Shape.cxx index b586afb525..f7b62f8628 100644 --- a/src/TopoDS/TopoDS_Shape.cxx +++ b/src/TopoDS/TopoDS_Shape.cxx @@ -42,7 +42,7 @@ const TCollection_AsciiString TopoDS_Shape_ClassName = "TopoDS_Shape"; //purpose : //======================================================================= -void TopoDS_Shape::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const +void TopoDS_Shape::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, TopoDS_Shape_ClassName); diff --git a/src/TopoDS/TopoDS_Shape.hxx b/src/TopoDS/TopoDS_Shape.hxx index d3173651af..0f014b7bf3 100644 --- a/src/TopoDS/TopoDS_Shape.hxx +++ b/src/TopoDS/TopoDS_Shape.hxx @@ -281,7 +281,7 @@ public: void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; } //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; private: diff --git a/src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx b/src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx index 4bb6d0108b..79eed21d1b 100644 --- a/src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx +++ b/src/XmlDrivers/XmlDrivers_MessageReportStorage.cxx @@ -255,7 +255,8 @@ void XmlDrivers_MessageReportStorage::exportAlertParameters (const Handle(Messag Handle(Message_AttributeStream) aValuesArrayAlert = Handle(Message_AttributeStream)::DownCast (anAttribute); // store values NCollection_IndexedDataMap aValues; - TCollection::Split (aValuesArrayAlert->GetStream(), aValues); + TCollection_AsciiString aKey; + TCollection::Split (aValuesArrayAlert->GetStream(), aValues, aKey); if (aValues.IsEmpty()) return; int anArraySize = 2 * aValues.Size(); diff --git a/src/gp/gp_Mat.cxx b/src/gp/gp_Mat.cxx index fd2d13dd30..bacfb35d6f 100644 --- a/src/gp/gp_Mat.cxx +++ b/src/gp/gp_Mat.cxx @@ -273,7 +273,7 @@ void gp_Mat::Power (const Standard_Integer N) const TCollection_AsciiString gp_Map_ClassName = "gp_Mat"; -void gp_Mat::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void gp_Mat::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, gp_Map_ClassName); diff --git a/src/gp/gp_Mat.hxx b/src/gp/gp_Mat.hxx index 4a0e36a01e..041d003462 100644 --- a/src/gp/gp_Mat.hxx +++ b/src/gp/gp_Mat.hxx @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -257,7 +256,7 @@ public: Standard_NODISCARD gp_Mat Transposed() const; //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; friend class gp_XYZ; diff --git a/src/gp/gp_Trsf.cxx b/src/gp/gp_Trsf.cxx index 98a83731fd..31928dca70 100644 --- a/src/gp/gp_Trsf.cxx +++ b/src/gp/gp_Trsf.cxx @@ -858,7 +858,7 @@ const TCollection_AsciiString gp_Trsf_ClassName = "gp_Trsf"; //purpose : //======================================================================= -void gp_Trsf::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void gp_Trsf::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, gp_Trsf_ClassName); diff --git a/src/gp/gp_Trsf.hxx b/src/gp/gp_Trsf.hxx index 443eded074..66d6e22581 100644 --- a/src/gp/gp_Trsf.hxx +++ b/src/gp/gp_Trsf.hxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -352,7 +351,7 @@ void operator *= (const gp_Trsf& T) } //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; friend class gp_GTrsf; diff --git a/src/gp/gp_XYZ.cxx b/src/gp/gp_XYZ.cxx index c6ea78353b..5482e44a96 100644 --- a/src/gp/gp_XYZ.cxx +++ b/src/gp/gp_XYZ.cxx @@ -45,7 +45,7 @@ const TCollection_AsciiString gp_XYZ_ClassName = "gp_XYZ"; //purpose : //======================================================================= -void gp_XYZ::Dump (Standard_OStream& OS, const Standard_Integer theMask) const +void gp_XYZ::Dump (Standard_OStream& OS) const { DUMP_START_KEY (OS, gp_XYZ_ClassName); @@ -61,11 +61,12 @@ void gp_XYZ::Dump (Standard_OStream& OS, const Standard_Integer theMask) const //purpose : //======================================================================= -Standard_Boolean gp_XYZ::Init (const Standard_OStream& OS) +Standard_Boolean gp_XYZ::Init (const Standard_OStream& /*OS*/) { /*NCollection_IndexedDataMap aStreamValues; Standard_SStream aSStream (OS); - TCollection::Split (aSStream, aStreamValues); + TCollection_AsciiString aKey; + TCollection::Split (aSStream, aStreamValues, aKey); TCollection_AsciiString anXYZValue; if (aStreamValues.FindFromKey (gp_XYZ_ClassName, anXYZValue)) diff --git a/src/gp/gp_XYZ.hxx b/src/gp/gp_XYZ.hxx index b18e51cc40..1d22742917 100644 --- a/src/gp/gp_XYZ.hxx +++ b/src/gp/gp_XYZ.hxx @@ -23,7 +23,6 @@ #include #include -#include #include class Standard_ConstructionError; @@ -329,7 +328,7 @@ public: //! Dumps the content of me on the stream . - Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const; + Standard_EXPORT void Dump (Standard_OStream& OS) const; //! Dumps the content of me on the stream . Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS); diff --git a/tools/MessageModel/FILES b/tools/MessageModel/FILES index 3274a6ec51..b51b3d85e6 100644 --- a/tools/MessageModel/FILES +++ b/tools/MessageModel/FILES @@ -6,8 +6,6 @@ MessageModel_ItemAlert.cxx MessageModel_ItemAlert.hxx MessageModel_ItemBase.cxx MessageModel_ItemBase.hxx -MessageModel_ItemPropertiesAttributeStream.cxx -MessageModel_ItemPropertiesAttributeStream.hxx MessageModel_ItemPropertiesReport.cxx MessageModel_ItemPropertiesReport.hxx MessageModel_ItemReport.cxx diff --git a/tools/MessageModel/MessageModel_Actions.cxx b/tools/MessageModel/MessageModel_Actions.cxx index 0914b8d004..8122224588 100644 --- a/tools/MessageModel/MessageModel_Actions.cxx +++ b/tools/MessageModel/MessageModel_Actions.cxx @@ -336,14 +336,14 @@ void MessageModel_Actions::OnTestPropetyPanel() { gp_XYZ aCoords (1.3, 2.3, 3.4); Standard_SStream aStream; - aCoords.Dump (aStream, Standard_DumpMask_SingleValue); + aCoords.Dump (aStream); MESSAGE_INFO_STREAM(aStream, "gp_XYZ", "", &aPerfMeter, NULL); } // Bnd_Box { Bnd_Box aBox(20., 15., 10., 25., 20., 15.); Standard_SStream aStream; - aBox.Dump (aStream, Standard_DumpMask_SingleValue); + aBox.Dump (aStream); MESSAGE_INFO_STREAM(aStream, "Bnd_Box", "", &aPerfMeter, NULL); } // Bnd_OBB @@ -351,7 +351,7 @@ void MessageModel_Actions::OnTestPropetyPanel() Bnd_OBB anOBB (gp_Pnt (-10., -15., -10.), gp_Dir (1., 0., 0.), gp_Dir (0., 1., 0.), gp_Dir (0., 0., 1.), 5., 10., 5.); Standard_SStream aStream; - anOBB.Dump (aStream, Standard_DumpMask_SingleValue); + anOBB.Dump (aStream); MESSAGE_INFO_STREAM(aStream, "Bnd_OBB", "", &aPerfMeter, NULL); } myTreeModel->UpdateTreeModel(); diff --git a/tools/MessageModel/MessageModel_ItemAlert.cxx b/tools/MessageModel/MessageModel_ItemAlert.cxx index 56c8d6f550..6fd070c874 100644 --- a/tools/MessageModel/MessageModel_ItemAlert.cxx +++ b/tools/MessageModel/MessageModel_ItemAlert.cxx @@ -15,7 +15,6 @@ #include -#include #include #include #include @@ -170,6 +169,33 @@ int MessageModel_ItemAlert::initRowCount() const return aCurrentItem->myChildAlerts.Size(); } +// ======================================================================= +// function : GetStream +// purpose : +// ======================================================================= +void MessageModel_ItemAlert::GetStream (Standard_OStream& OS) const +{ + Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert()); + if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull()) + { + Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute(); + if (!anAttribute.IsNull()) + { + if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull()) + { + //if (GetProperties().IsNull()) + //{ + // TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false); + // SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem)); + //} + Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute()); + //Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties()); + OS << anAttributeStream->GetStream().str(); + } + } + } +} + // ======================================================================= // function : createChild // purpose : @@ -215,17 +241,22 @@ void MessageModel_ItemAlert::Init() } } - Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert); + /*Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(myAlert); if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull()) { Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute(); - if (!anAttribute.IsNull()) { if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull()) { - TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false); - SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem)); + if (GetProperties().IsNull()) + { + TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false); + SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem)); + } + Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute()); + Handle(MessageModel_ItemPropertiesAttributeStream) aProperties = Handle(MessageModel_ItemPropertiesAttributeStream)::DownCast (GetProperties()); + aProperties->Init (anAttributeStream->GetStream()); } //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject))) // myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject()); @@ -236,7 +267,7 @@ void MessageModel_ItemAlert::Init() //Bnd_Box aBox; //if (aBox.Init (Standard_SStream (aDescription.ToCString()))) // myPresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox))); - } + }*/ MessageModel_ItemBase::Init(); } diff --git a/tools/MessageModel/MessageModel_ItemAlert.hxx b/tools/MessageModel/MessageModel_ItemAlert.hxx index f139fb54c2..c87d39a51e 100644 --- a/tools/MessageModel/MessageModel_ItemAlert.hxx +++ b/tools/MessageModel/MessageModel_ItemAlert.hxx @@ -77,6 +77,10 @@ public: //! \return number of children. Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE; + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE; + //! Sets some shape to present the item //! \param theShape shape instance void SetCustomShape (const TopoDS_Shape& theShape) { myCustomShape = theShape; } diff --git a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx b/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx deleted file mode 100644 index f0f24c957c..0000000000 --- a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// Created on: 2019-02-25 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties) - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void MessageModel_ItemPropertiesAttributeStream::Init() -{ - MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast(getItem()); - if (!anAlertItem) - return; - - Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlertItem->GetAlert()); - if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull()) - return; - - Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute()); - if (anAttributeStream.IsNull()) - return; - - TCollection::Split (anAttributeStream->GetStream(), myValues); - - TreeModel_ItemProperties::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void MessageModel_ItemPropertiesAttributeStream::Reset() -{ - myValues.Clear(); - - TreeModel_ItemProperties::Reset(); -} - -// ======================================================================= -// function : RowCount -// purpose : -// ======================================================================= - -int MessageModel_ItemPropertiesAttributeStream::GetTableRowCount() const -{ - const NCollection_IndexedDataMap& aValues = GetValues(); - return aValues.Size(); -} - -// ======================================================================= -// function : Data -// purpose : -// ======================================================================= - -QVariant MessageModel_ItemPropertiesAttributeStream::GetTableData (const int theRow, const int theColumn, int theRole) const -{ - const NCollection_IndexedDataMap& aValues = GetValues(); - - if (theRole == Qt::DisplayRole) - { - if (theColumn == 0) return aValues.FindKey (theRow + 1).ToCString(); - else if (theColumn == 1) return aValues.FindFromIndex (theRow + 1).ToCString(); - } - return QVariant(); -} - -// ======================================================================= -// function : GetTableEditType -// purpose : -// ======================================================================= -ViewControl_EditType MessageModel_ItemPropertiesAttributeStream::GetTableEditType (const int theRow, const int) const -{ - //switch (theRow) - //{ - // case 0: return ViewControl_EditType_Spin; - // default: return ViewControl_EditType_None; - //} - return ViewControl_EditType_None; -} - -// ======================================================================= -// function : SetTableData -// purpose : -// ======================================================================= -bool MessageModel_ItemPropertiesAttributeStream::SetTableData (const int theRow, const int theColumn, const QVariant& theValue) -{ - //Handle(Message_Report) aReport = getItemReport(); - //switch (theRow) - //{ - // case 0: aReport->SetLimit (theValue.toInt()); break; - // default: break; - //} - return true; -} diff --git a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx b/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx deleted file mode 100644 index 96a86f611c..0000000000 --- a/tools/MessageModel/MessageModel_ItemPropertiesAttributeStream.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// Created on: 2019-02-25 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef MessageModel_ItemReportProperties_H -#define MessageModel_ItemReportProperties_H - -#include -#include -#include -#include - - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -class QItemDelegate; - -DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties) - -//! \class MessageModel_ItemPropertiesAttributeStream -//! \brief This is an interace for ViewControl_TableModel to give real values of the model -//! It should be filled or redefined. -class MessageModel_ItemPropertiesAttributeStream : public TreeModel_ItemProperties -{ -public: - - //! Constructor - Standard_EXPORT MessageModel_ItemPropertiesAttributeStream (TreeModel_ItemBasePtr theItem) - : TreeModel_ItemProperties (theItem) {} - - //! Destructor - virtual ~MessageModel_ItemPropertiesAttributeStream() {} - - //! If me has internal values, it should be initialized here. - Standard_EXPORT virtual void Init(); - - //! If the item has internal values, there should be reseted here. - Standard_EXPORT virtual void Reset(); - - //! Returns number of rows, depending on orientation: myColumnCount or size of values container - //! \param theParent an index of the parent item - //! \return an integer value - Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE; - - //! Returns content of the model index for the given role, it is obtained from internal container of values - //! It returns value only for DisplayRole. - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE; - - //! Returns type of edit control for the model index. By default, it is an empty control - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit type - Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE; - - //! Sets the value into the table cell. Only 1st column value might be modified. - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theValue a new cell value - Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE; - - DEFINE_STANDARD_RTTIEXT (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties) - -protected: - //! Returns attribute with stream value - const NCollection_IndexedDataMap& GetValues() const - { - if (!IsInitialized()) - const_cast(this)->Init(); - return myValues; - } - -protected: - NCollection_IndexedDataMap myValues; -}; - -#endif diff --git a/tools/MessageView/MessageView_Window.cxx b/tools/MessageView/MessageView_Window.cxx index 72b06db0ad..420b2e7b4b 100644 --- a/tools/MessageView/MessageView_Window.cxx +++ b/tools/MessageView/MessageView_Window.cxx @@ -443,6 +443,10 @@ void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, cons if (!anItemBase) continue; + Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->GetProperties(); + if (anItemProperties) + anItemProperties->GetPresentations (-1, -1, aPresentations); + MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast(anItemBase); if (!anAlertItem) continue; diff --git a/tools/TInspectorEXE/TInspectorEXE.cxx b/tools/TInspectorEXE/TInspectorEXE.cxx index 75ccf87870..1c42a38530 100644 --- a/tools/TInspectorEXE/TInspectorEXE.cxx +++ b/tools/TInspectorEXE/TInspectorEXE.cxx @@ -131,8 +131,8 @@ int main (int argc, char** argv) aReport->SetActive (Standard_True);//Standard_False); aPlugins.insert("TKMessageView"); - //anActivatedPluginName = "TKVInspector"; - anActivatedPluginName = "TKMessageView"; + anActivatedPluginName = "TKVInspector"; + //anActivatedPluginName = "TKMessageView"; } else anActivatedPluginName = *aPlugins.rbegin(); diff --git a/tools/TKTreeModel/EXTERNLIB b/tools/TKTreeModel/EXTERNLIB index faee5c912f..74b7426c22 100644 --- a/tools/TKTreeModel/EXTERNLIB +++ b/tools/TKTreeModel/EXTERNLIB @@ -2,4 +2,5 @@ TKernel TKMath TKPrim TKTopAlgo +TKTInspectorAPI CSF_QT \ No newline at end of file diff --git a/tools/TreeModel/FILES b/tools/TreeModel/FILES index d7662e6a0e..7e40097f82 100644 --- a/tools/TreeModel/FILES +++ b/tools/TreeModel/FILES @@ -10,7 +10,11 @@ TreeModel_ItemProperties.cxx TreeModel_ItemProperties.hxx TreeModel_ItemPropertiesCreator.cxx TreeModel_ItemPropertiesCreator.hxx +TreeModel_ItemPropertiesStream.cxx +TreeModel_ItemPropertiesStream.hxx TreeModel_ItemRole.hxx +TreeModel_ItemStream.cxx +TreeModel_ItemStream.hxx TreeModel_ModelBase.cxx TreeModel_ModelBase.hxx TreeModel_Tools.cxx diff --git a/tools/TreeModel/TreeModel_ItemBase.cxx b/tools/TreeModel/TreeModel_ItemBase.cxx index af8dc1f860..c988ace51f 100644 --- a/tools/TreeModel/TreeModel_ItemBase.cxx +++ b/tools/TreeModel/TreeModel_ItemBase.cxx @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -48,6 +49,24 @@ void TreeModel_ItemBase::SetProperties (const Handle(TreeModel_ItemProperties)& // ======================================================================= Handle(TreeModel_ItemProperties) TreeModel_ItemBase::GetProperties() const { + if (myProperties.IsNull() && Parent()) + { + TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false); + //TreeModel_ItemBase* anItem = (TreeModel_ItemBase*)this; + anItem->SetProperties (new TreeModel_ItemPropertiesStream (anItem)); + } + + if (!myProperties.IsNull() && !myProperties->IsInitialized()) + { + Handle(TreeModel_ItemPropertiesStream) aPropertiesStream = Handle(TreeModel_ItemPropertiesStream)::DownCast (myProperties); + if (!aPropertiesStream.IsNull()) + { + Standard_SStream aStream; + GetStream (aStream); + aPropertiesStream->Init (aStream); + } + } + return myProperties; } @@ -96,10 +115,16 @@ TreeModel_ItemBasePtr TreeModel_ItemBase::Child (int theRow, int theColumn, cons TreeModel_ItemBasePtr anItem; if (isToCreate) { int aRowCount = rowCount(); - if (myProperties.IsNull() || theRow < aRowCount - myProperties->ChildItemCount()) - anItem = createChild (theRow, theColumn); - else if (!myProperties.IsNull()) - anItem = myProperties->CreateChildItem (theRow, theColumn); + Handle(TreeModel_ItemProperties) aProperties = GetProperties(); + int aChildOffset = aProperties.IsNull() ? 0 : aProperties->ChildItemCount(); + if (!aProperties.IsNull() && theRow < aChildOffset) + anItem = aProperties->CreateChildItem (theRow, theColumn); + else + anItem = createChild (theRow - aChildOffset, theColumn); + //if (aProperties.IsNull() || theRow < aRowCount - aProperties->ChildItemCount()) + // anItem = createChild (theRow, theColumn); + //else if (!aProperties.IsNull()) + // anItem = aProperties->CreateChildItem (theRow, theColumn); if (anItem) m_ChildItems[aPos] = anItem; @@ -128,7 +153,10 @@ QVariant TreeModel_ItemBase::cachedValue (const int theItemRole) const QVariant aValueToCache; if (theItemRole == TreeModel_ItemRole_RowCountRole) { - aValueToCache = myProperties.IsNull() ? initRowCount() : (initRowCount() + myProperties->ChildItemCount()); + int aRowCount = initRowCount(); + Handle(TreeModel_ItemProperties) aProperties = GetProperties(); + int aChildOffset = aProperties.IsNull() ? 0 : aProperties->ChildItemCount(); + aValueToCache = aRowCount + aChildOffset; } else aValueToCache = initValue (theItemRole); @@ -137,6 +165,21 @@ QVariant TreeModel_ItemBase::cachedValue (const int theItemRole) const return myCachedValues.contains (theItemRole) ? myCachedValues[theItemRole] : QVariant(); } +// ======================================================================= +// function : Init +// purpose : +// ======================================================================= +void TreeModel_ItemBase::Init() +{ + //if (myProperties.IsNull() && Parent()) + //{ + // TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false); + // SetProperties (new TreeModel_ItemPropertiesStream (anItem)); + //} + + m_bInitialized = true; +} + // ======================================================================= // function : initValue // purpose : diff --git a/tools/TreeModel/TreeModel_ItemBase.hxx b/tools/TreeModel/TreeModel_ItemBase.hxx index 45da4d7805..871d1afe50 100644 --- a/tools/TreeModel/TreeModel_ItemBase.hxx +++ b/tools/TreeModel/TreeModel_ItemBase.hxx @@ -85,7 +85,7 @@ public: //! Sets the item internal initialized state to the true. If the item has internal values, //! there should be initialized here. - virtual void Init() { m_bInitialized = true; } + Standard_EXPORT virtual void Init(); //! Returns data object of the item. //! \return object @@ -99,6 +99,10 @@ public: //! \param theRole an item role Standard_EXPORT virtual void Reset(int theRole); + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + virtual void GetStream (Standard_OStream& OS) const { (void)OS; } + //! Gets the parent of the item, or TreeModel_ItemBasePtr() if it has no parent. //! \return pointer to the item TreeModel_ItemBasePtr Parent() const { return m_pParent; }; diff --git a/tools/TreeModel/TreeModel_ItemProperties.hxx b/tools/TreeModel/TreeModel_ItemProperties.hxx index 8310cd3a61..82422cc0fc 100644 --- a/tools/TreeModel/TreeModel_ItemProperties.hxx +++ b/tools/TreeModel/TreeModel_ItemProperties.hxx @@ -50,7 +50,7 @@ class TreeModel_ItemProperties : public Standard_Transient public: //! Constructor - TreeModel_ItemProperties (const TreeModel_ItemBasePtr& theItem) : myItem (theItem) {} + TreeModel_ItemProperties (const TreeModel_ItemBasePtr& theItem) : myItem (theItem), m_bInitialized (Standard_False) {} //! Destructor ~TreeModel_ItemProperties() {} diff --git a/tools/TreeModel/TreeModel_ItemPropertiesStream.cxx b/tools/TreeModel/TreeModel_ItemPropertiesStream.cxx new file mode 100644 index 0000000000..56e6b077dd --- /dev/null +++ b/tools/TreeModel/TreeModel_ItemPropertiesStream.cxx @@ -0,0 +1,204 @@ +// Created on: 2019-02-25 +// Created by: Natalia ERMOLAEVA +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemPropertiesStream, TreeModel_ItemProperties) + +// ======================================================================= +// function : Init +// purpose : +// ======================================================================= + +void TreeModel_ItemPropertiesStream::Init (const Standard_SStream& theStream) +{ + myStream << theStream.str(); + + NCollection_IndexedDataMap aValues; + TCollection::Split (theStream, aValues, myKey); + + TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(getItem()); + if (!aStreamParent) + myKey = "Dump"; + + for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++) + { + TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex); + if (TCollection::HasBracketKey (aValue)) + myChildren.Add (aValues.FindKey (anIndex), aValue); + else + myValues.Add (aValues.FindKey (anIndex), aValue); + } + TreeModel_ItemProperties::Init(); +} + +// ======================================================================= +// function : Reset +// purpose : +// ======================================================================= + +void TreeModel_ItemPropertiesStream::Reset() +{ + myStream.str (std::string()); + myKey = ""; + myValues.Clear(); + myChildren.Clear(); + + TreeModel_ItemProperties::Reset(); +} + +// ======================================================================= +// function : GetChildKey +// purpose : +// ======================================================================= +TCollection_AsciiString TreeModel_ItemPropertiesStream::GetChildKey (const Standard_Integer theRow) const +{ + return GetChildrenValues().FindKey (theRow + 1).ToCString(); +} + +// ======================================================================= +// function : GetChildStream +// purpose : +// ======================================================================= + +void TreeModel_ItemPropertiesStream::GetChildStream (const Standard_Integer theRow, Standard_OStream& OS) const +{ + TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(getItem()); + if (!aStreamParent) + OS << myStream.str(); + else + OS << GetChildrenValues().FindFromIndex (theRow + 1); +} + +// ======================================================================= +// function : RowCount +// purpose : +// ======================================================================= + +int TreeModel_ItemPropertiesStream::GetTableRowCount() const +{ + const NCollection_IndexedDataMap& aValues = GetValues(); + return aValues.Size(); +} + +// ======================================================================= +// function : Data +// purpose : +// ======================================================================= + +QVariant TreeModel_ItemPropertiesStream::GetTableData (const int theRow, const int theColumn, int theRole) const +{ + const NCollection_IndexedDataMap& aValues = GetValues(); + + if (theRole == Qt::DisplayRole || theRole == Qt::ToolTipRole) + { + if (theColumn == 0) return aValues.FindKey (theRow + 1).ToCString(); + else if (theColumn == 1) return aValues.FindFromIndex (theRow + 1).ToCString(); + } + return QVariant(); +} + +// ======================================================================= +// function : GetTableEditType +// purpose : +// ======================================================================= +ViewControl_EditType TreeModel_ItemPropertiesStream::GetTableEditType (const int /*theRow*/, const int) const +{ + //switch (theRow) + //{ + // case 0: return ViewControl_EditType_Spin; + // default: return ViewControl_EditType_None; + //} + return ViewControl_EditType_None; +} + +// ======================================================================= +// function : SetTableData +// purpose : +// ======================================================================= +bool TreeModel_ItemPropertiesStream::SetTableData (const int /*theRow*/, const int /*theColumn*/, const QVariant& /*theValue*/) +{ + //Handle(Message_Report) aReport = getItemReport(); + //switch (theRow) + //{ + // case 0: aReport->SetLimit (theValue.toInt()); break; + // default: break; + //} + return true; +} + +// ======================================================================= +// function : GetPresentations +// purpose : +// ======================================================================= + +void TreeModel_ItemPropertiesStream::GetPresentations (const int theRow, const int theColumn, + NCollection_List& thePresentations) +{ + if (theColumn == 0) + return; + + if (theRow < 0) // full presentation + { + Bnd_Box aBox; + if (aBox.Init (myStream)) + thePresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox))); + } + + + //QVariant aValue = GetTableData (theRow, theColumn, Qt::DisplayRole); + //TCollection_AsciiString aStrValue = aValue.toString().toStdString().c_str(); + + //gp_XYZ aPoint; + //if (!aPoint.Init (Standard_SStream (aStrValue.ToCString()))) + // return; + + //thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint))); +} + +// ======================================================================= +// function : ChildItemCount +// purpose : +// ======================================================================= +int TreeModel_ItemPropertiesStream::ChildItemCount() const +{ + TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(getItem()); + if (!aStreamParent && (GetChildrenValues().Size() || GetValues().Size())) + return 1; // "Dump" item + + return GetChildrenValues().Size(); +} + +// ======================================================================= +// function : CreateChildItem +// purpose : +// ======================================================================= +TreeModel_ItemBasePtr TreeModel_ItemPropertiesStream::CreateChildItem (int theRow, int theColumn) const +{ + return TreeModel_ItemStream::CreateItem (getItem(), theRow, theColumn); +} diff --git a/tools/TreeModel/TreeModel_ItemPropertiesStream.hxx b/tools/TreeModel/TreeModel_ItemPropertiesStream.hxx new file mode 100644 index 0000000000..5df0f8ab64 --- /dev/null +++ b/tools/TreeModel/TreeModel_ItemPropertiesStream.hxx @@ -0,0 +1,133 @@ +// Created on: 2019-02-25 +// Created by: Natalia ERMOLAEVA +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef MessageModel_ItemReportProperties_H +#define MessageModel_ItemReportProperties_H + +#include +#include +#include +#include + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +class QItemDelegate; + +DEFINE_STANDARD_HANDLE (TreeModel_ItemPropertiesStream, TreeModel_ItemProperties) + +//! \class TreeModel_ItemPropertiesStream +//! \brief This is an interace for ViewControl_TableModel to give real values of the model +//! It should be filled or redefined. +class TreeModel_ItemPropertiesStream : public TreeModel_ItemProperties +{ +public: + + //! Constructor + Standard_EXPORT TreeModel_ItemPropertiesStream (TreeModel_ItemBasePtr theItem) + : TreeModel_ItemProperties (theItem) {} + + //! Destructor + virtual ~TreeModel_ItemPropertiesStream() {} + + //! Returns Key of the current stream + const TCollection_AsciiString& GetKey() const { return myKey; } + + //! Returns Key of the current stream + Standard_EXPORT TCollection_AsciiString GetChildKey (const Standard_Integer theRow) const; + + //! Returns sub stream inside the current stream + Standard_EXPORT void GetChildStream (const Standard_Integer theRow, Standard_OStream& OS) const; + + //! If me has internal values, it should be initialized here. + Standard_EXPORT virtual void Init (const Standard_SStream& theStream); + + //! If the item has internal values, there should be reseted here. + Standard_EXPORT virtual void Reset(); + + //! Returns number of rows, depending on orientation: myColumnCount or size of values container + //! \param theParent an index of the parent item + //! \return an integer value + Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE; + + //! Returns content of the model index for the given role, it is obtained from internal container of values + //! It returns value only for DisplayRole. + //! \param theRow a model index row + //! \param theColumn a model index column + //! \param theRole a view role + //! \return value intepreted depending on the given role + Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE; + + //! Returns type of edit control for the model index. By default, it is an empty control + //! \param theRow a model index row + //! \param theColumn a model index column + //! \return edit type + Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE; + + //! Sets the value into the table cell. Only 1st column value might be modified. + //! \param theRow a model index row + //! \param theColumn a model index column + //! \param theValue a new cell value + Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE; + + //! Returns presentation of the attribute to be visualized in the view + //! \param theRow a model index row + //! \param theColumn a model index column + //! \thePresentations [out] container of presentation handles to be visualized + Standard_EXPORT virtual void GetPresentations (const int theRow, const int theColumn, + NCollection_List& thePresentations) Standard_OVERRIDE; + + //! Returns number of item children + //! \return an integer value, ZERO by default + Standard_EXPORT virtual int ChildItemCount() const Standard_OVERRIDE; + + //! Creates a child item in the given position. + //! \param theRow the child row position + //! \param theColumn the child column position + //! \return the created item + Standard_EXPORT virtual TreeModel_ItemBasePtr CreateChildItem (int theRow, int theColumn) const; + + DEFINE_STANDARD_RTTIEXT (TreeModel_ItemPropertiesStream, TreeModel_ItemProperties) + +protected: + //! Returns attribute with stream value + const NCollection_IndexedDataMap& GetChildrenValues() const + { + return myChildren; + } + + //! Returns attribute with stream value + const NCollection_IndexedDataMap& GetValues() const + { + return myValues; + } + +protected: + TCollection_AsciiString myKey; + Standard_SStream myStream; + NCollection_IndexedDataMap myValues; + NCollection_IndexedDataMap myChildren; +}; + +#endif diff --git a/tools/TreeModel/TreeModel_ItemStream.cxx b/tools/TreeModel/TreeModel_ItemStream.cxx new file mode 100644 index 0000000000..6255eeaa69 --- /dev/null +++ b/tools/TreeModel/TreeModel_ItemStream.cxx @@ -0,0 +1,75 @@ +// Created on: 2019-02-25 +// Created by: Natalia ERMOLAEVA +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +#include + +// ======================================================================= +// function : initValue +// purpose : +// ======================================================================= +QVariant TreeModel_ItemStream::initValue (const int theItemRole) const +{ + QVariant aParentValue = TreeModel_ItemBase::initValue (theItemRole); + if (aParentValue.isValid()) + return aParentValue; + + if (Column() != 0) + return QVariant(); + + if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole) + return QVariant(); + + TreeModel_ItemBasePtr aParentItem = Parent(); + if (!aParentItem) + return QVariant(); + + TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(aParentItem); + if (!aStreamParent) + return "Dump"; + + Handle(TreeModel_ItemPropertiesStream) aStreamProperties = Handle(TreeModel_ItemPropertiesStream)::DownCast (aParentItem->GetProperties()); + if (aStreamProperties.IsNull()) + return QVariant(); + + return aStreamProperties->GetChildKey (Row()).ToCString(); +} + +// ======================================================================= +// function : GetStream +// purpose : +// ======================================================================= +void TreeModel_ItemStream::GetStream (Standard_OStream& OS) const +{ + TreeModel_ItemBasePtr aParentItem = Parent(); + if (!aParentItem) + return; + + Handle(TreeModel_ItemPropertiesStream) aStreamProperties = Handle(TreeModel_ItemPropertiesStream)::DownCast (aParentItem->GetProperties()); + if (aStreamProperties.IsNull()) + return; + + aStreamProperties->GetChildStream (Row(), OS); +} + +// ======================================================================= +// function : createChild +// purpose : +// ======================================================================= +TreeModel_ItemBasePtr TreeModel_ItemStream::createChild (int, int) +{ + return TreeModel_ItemBasePtr(); +} diff --git a/tools/TreeModel/TreeModel_ItemStream.hxx b/tools/TreeModel/TreeModel_ItemStream.hxx new file mode 100644 index 0000000000..48e0edd2db --- /dev/null +++ b/tools/TreeModel/TreeModel_ItemStream.hxx @@ -0,0 +1,78 @@ +// Created on: 2019-02-25 +// Created by: Natalia ERMOLAEVA +// Copyright (c) 2019 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef TreeModel_ItemStream_H +#define TreeModel_ItemStream_H + +#include +#include + +class TreeModel_ItemStream; +typedef QExplicitlySharedDataPointer TreeModel_ItemStreamPtr; + +//! \class TreeModel_ItemStream +//! Parent item, that corresponds to AIS_InteractiveContext +//! Children of the item are: +//! - "Property" item to show context attributes such as selection filters and drawer properties +//! - presentation items to show all interactive elements displayed/erased in the context +class TreeModel_ItemStream : public TreeModel_ItemBase +{ +public: + + //! Creates an item wrapped by a shared pointer + static TreeModel_ItemStreamPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + { return TreeModel_ItemStreamPtr (new TreeModel_ItemStream (theParent, theRow, theColumn)); } + + //! Destructor + virtual ~TreeModel_ItemStream() Standard_OVERRIDE {}; + + //! Returns number of displayed presentations + //! \return rows count + virtual int initRowCount() const Standard_OVERRIDE { return 0; } + + //! Returns item information for the given role. Fills internal container if it was not filled yet + //! \param theItemRole a value role + //! \return the value + Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; + + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE; + +protected: + + //! Initialize the current item. It creates a backup of the specific item information + //! Do nothing as context has been already set into item + virtual void initItem() const Standard_OVERRIDE {} + +protected: + + //! Creates a child item in the given position. + //! \param theRow the child row position + //! \param theColumn the child column position + //! \return the created item + virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; + +private: + + //! Constructor + //! param theParent a parent item + //! \param theRow the item row positition in the parent item + //! \param theColumn the item column positition in the parent item + TreeModel_ItemStream(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + : TreeModel_ItemBase(theParent, theRow, theColumn) {} +}; + +#endif diff --git a/tools/TreeModel/TreeModel_ModelBase.cxx b/tools/TreeModel/TreeModel_ModelBase.cxx index 1b07852a45..c5d285cf4a 100644 --- a/tools/TreeModel/TreeModel_ModelBase.cxx +++ b/tools/TreeModel/TreeModel_ModelBase.cxx @@ -198,8 +198,9 @@ int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const if (aProperties) break; } + // TODO: dump properties should be united with properties created by the creator + aParentItem->SetProperties (aProperties); } - aParentItem->SetProperties (aProperties); } return aParentItem ? aParentItem->rowCount() : 0; diff --git a/tools/VInspector/VInspector_ItemBVHTree.cxx b/tools/VInspector/VInspector_ItemBVHTree.cxx index 01c8744aa2..c18b8cd4d7 100644 --- a/tools/VInspector/VInspector_ItemBVHTree.cxx +++ b/tools/VInspector/VInspector_ItemBVHTree.cxx @@ -163,7 +163,8 @@ TreeModel_ItemBasePtr VInspector_ItemBVHTree::createChild (int theRow, int theCo // ======================================================================= TopoDS_Shape VInspector_ItemBVHTree::buildPresentationShape() { - opencascade::handle > aBVHTree = myTree; + return TopoDS_Shape(); + /*opencascade::handle > aBVHTree = myTree; if (aBVHTree.IsNull()) return TopoDS_Shape(); @@ -194,5 +195,5 @@ TopoDS_Shape VInspector_ItemBVHTree::buildPresentationShape() aBuilder.Add (aCompound, aShape); } } - return aCompound; + return aCompound;*/ } diff --git a/tools/VInspector/VInspector_ItemFolderObject.hxx b/tools/VInspector/VInspector_ItemFolderObject.hxx index dc4b36ac65..6d49bd9d21 100644 --- a/tools/VInspector/VInspector_ItemFolderObject.hxx +++ b/tools/VInspector/VInspector_ItemFolderObject.hxx @@ -20,7 +20,6 @@ #include #include -#include #include class Prs3d_Drawer; diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerArray.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerArray.cxx deleted file mode 100644 index 9836ba073d..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerArray.cxx +++ /dev/null @@ -1,217 +0,0 @@ -// Created on: 2019-03-15 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Init() -{ - VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast(Parent()); - myLayer = aParentItem->GetLayer (Row(), myLayerId); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Reset() -{ - VInspector_ItemBase::Reset(); - myLayer = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlLayer::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayer::initValue (const int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return Column() == 0 ? "Empty element" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aLayerId = Graphic3d::ZLayerIdToString (myLayerId); - if (aLayerId.IsEmpty()) - aLayerId = TCollection_AsciiString (myLayerId); - return theItemRole == Qt::ToolTipRole ? QVariant ("") - : QVariant (QString("%1 (%2)") - .arg(aLayer->DynamicType()->Name()) - .arg (aLayerId.ToCString())); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : GetTableRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlLayer::GetTableRowCount() const -{ - return 40; -} - -// ======================================================================= -// function : GetTableData -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayer::GetTableData (const int theRow, const int theColumn, const int theRole) const -{ - if (theRole != Qt::DisplayRole) - return QVariant(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return QVariant(); - - bool isFirstColumn = theColumn == 0; - - switch (theRow) - { - case 0: return isFirstColumn ? QVariant ("NbStructures") : QVariant (aLayer->NbStructures()); - case 1: return isFirstColumn ? QVariant ("NbStructuresNotCulled") : QVariant (aLayer->NbStructuresNotCulled()); - case 2: return isFirstColumn ? QVariant ("NbPriorities") : QVariant (aLayer->NbPriorities()); - - case 3: return isFirstColumn ? QVariant ("ArrayOfStructures") : QVariant (aLayer->ArrayOfStructures().Size()); - case 4: return isFirstColumn ? QVariant ("IsCulled") : QVariant (aLayer->IsCulled()); - case 5: return isFirstColumn ? QVariant ("NbOfTransformPersistenceObjects") : QVariant (aLayer->NbOfTransformPersistenceObjects()); - - case 6: return isFirstColumn ? QVariant ("CullableStructuresBVH") : QVariant (aLayer->CullableStructuresBVH().Size()); - case 7: return isFirstColumn ? QVariant ("CullableTrsfPersStructuresBVH") : QVariant (aLayer->CullableTrsfPersStructuresBVH().Size()); - case 8: return isFirstColumn ? QVariant ("NonCullableStructures") : QVariant (aLayer->NonCullableStructures().Size()); - - default: - break; - } - - Standard_Integer aRow = theRow - 9; - return getLayerSettingsTableData (aRow, theColumn, theRole, aLayer->LayerSettings()); -} - -// ======================================================================= -// function : getLayerSettingsTableData -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayer::getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole, - const Graphic3d_ZLayerSettings& theSettings) const -{ - bool isFirstColumn = theColumn == 0; - - switch (theRow) - { - case 0: return isFirstColumn ? QVariant ("LayerSettings:") : QVariant(); - case 1: return isFirstColumn ? QVariant ("Name") : QVariant (theSettings.Name().ToCString()); - case 2: return isFirstColumn ? QVariant ("Lights") : QVariant (ViewControl_Tools::GetPointerInfo (theSettings.Lights()).ToCString()); - - case 3: return isFirstColumn ? QVariant ("Origin") : QVariant (ViewControl_Tools::ToString (theSettings.Origin()).ToCString()); - case 4: return isFirstColumn ? QVariant ("OriginTransformation") - : QVariant (ViewControl_Tools::ToString (theSettings.OriginTransformation()).ToCString()); - - case 5: return isFirstColumn ? QVariant ("HasCullingDistance") : QVariant (theSettings.HasCullingDistance()); - case 6: return isFirstColumn ? QVariant ("CullingDistance") - : QVariant (theSettings.HasCullingDistance() ? theSettings.CullingDistance() : 0); - - case 7: return isFirstColumn ? QVariant ("HasCullingSize") : QVariant (theSettings.HasCullingSize()); - case 8: return isFirstColumn ? QVariant ("CullingSize") - : QVariant (theSettings.HasCullingSize() ? theSettings.CullingSize() : 0); - - case 9: return isFirstColumn ? QVariant ("IsImmediate") : QVariant (theSettings.IsImmediate()); - case 10: return isFirstColumn ? QVariant ("UseEnvironmentTexture") : QVariant (theSettings.UseEnvironmentTexture()); - case 11: return isFirstColumn ? QVariant ("ToEnableDepthTest") : QVariant (theSettings.ToEnableDepthTest()); - case 12: return isFirstColumn ? QVariant ("ToEnableDepthWrite") : QVariant (theSettings.ToEnableDepthWrite()); - case 13: return isFirstColumn ? QVariant ("ToClearDepth") : QVariant (theSettings.ToClearDepth()); - case 14: return isFirstColumn ? QVariant ("ToRenderInDepthPrepass") : QVariant (theSettings.ToRenderInDepthPrepass()); - - case 15: return isFirstColumn ? QVariant ("PolygonOffset: Mode") - : QVariant (Aspect::PolygonOffsetModeToString (theSettings.PolygonOffset().Mode)); - case 16: return isFirstColumn ? QVariant ("PolygonOffset: Factor") : QVariant (theSettings.PolygonOffset().Factor); - case 17: return isFirstColumn ? QVariant ("PolygonOffset: Units") : QVariant (theSettings.PolygonOffset().Units); - - default: break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlLayer::createChild (int theRow, int theColumn) -{ - (void)theRow; - (void)theColumn; - - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx deleted file mode 100644 index b2c9546afc..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerArray.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// Created on: 2019-03-15 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemOpenGlLayer_H -#define VInspector_ItemOpenGlLayer_H - -#include -#include - -#include -#include - -class Graphic3d_Group; - -class VInspector_ItemOpenGlLayer; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlLayerPtr; - -//! \class VInspector_ItemOpenGlLayer -//! Parent item, that corresponds to AIS_InteractiveContext -//! Children of the item are: -//! - "Property" item to show context attributes such as selection filters and drawer properties -//! - presentation items to show all interactive elements displayed/erased in the context -class VInspector_ItemOpenGlLayer : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlLayer() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const - { return Handle(OpenGl_Layer)::DownCast (GetObject());} - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns number of table rows - //! \return an integer value - virtual int GetTableRowCount() const Standard_OVERRIDE; - - //! Returns table value for the row in form: - //! \param theRow a model index row - //! \param theColumn a model index column - virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE; - -protected: - - //! Initialize the current item. It creates a backup of the specific item information - //! Do nothing as context has been already set into item - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of displayed presentations - //! \return rows count - Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE; - - //! Returns item information for the given role. Fills internal container if it was not filled yet - //! \param theItemRole a value role - //! \return the value - Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; - -protected: - //! Returns table presentation of layer settings - QVariant getLayerSettingsTableData (const int theRow, const int theColumn, const int theRole, - const Graphic3d_ZLayerSettings& theSettings) const; - - //! Creates a child item in the given position. - //! \param theRow the child row position - //! \param theColumn the child column position - //! \return the created item - virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; - -private: - - //! Constructor - //! param theParent a parent item - //! \param theRow the item row positition in the parent item - //! \param theColumn the item column positition in the parent item - VInspector_ItemOpenGlLayer(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(OpenGl_Layer) myLayer; //! current layer - Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemPresentableObject.cxx b/tools/VInspector/VInspector_ItemPresentableObject.cxx index a66255ca63..10fa1d1e9d 100644 --- a/tools/VInspector/VInspector_ItemPresentableObject.cxx +++ b/tools/VInspector/VInspector_ItemPresentableObject.cxx @@ -267,6 +267,19 @@ void VInspector_ItemPresentableObject::GetPresentations (NCollection_ListDump (OS); +} + // ======================================================================= // function : GetTableRowCount // purpose : diff --git a/tools/VInspector/VInspector_ItemPresentableObject.hxx b/tools/VInspector/VInspector_ItemPresentableObject.hxx index 6f1fab2a4d..358e171f0a 100644 --- a/tools/VInspector/VInspector_ItemPresentableObject.hxx +++ b/tools/VInspector/VInspector_ItemPresentableObject.hxx @@ -64,6 +64,10 @@ public: //! \thePresentations [out] container of presentation handles to be visualized Standard_EXPORT virtual void GetPresentations (NCollection_List& thePresentations); + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE; + //! Returns number of table rows //! \return an integer value virtual int GetTableRowCount() const Standard_OVERRIDE; diff --git a/tools/VInspector/VInspector_ItemPresentations.cxx b/tools/VInspector/VInspector_ItemPresentations.cxx index a90383eef6..d5a34974e6 100644 --- a/tools/VInspector/VInspector_ItemPresentations.cxx +++ b/tools/VInspector/VInspector_ItemPresentations.cxx @@ -145,7 +145,7 @@ Handle(Prs3d_Presentation) VInspector_ItemPresentations::GetPresentation (const continue; if (theRowId - aNextPresentationIndex == aCurrentIndex) { - theName = "";//QString ("Prs3d_Presentation (mode = %1)").arg (aPrsIter.ChangeValue().Mode()).toStdString().c_str(); + theName = "Prs3d_Presentation"; return aPrs3d; } aCurrentIndex++; diff --git a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx b/tools/VInspector/VInspector_ItemPrs3dAspect.cxx index 6f40a868a6..a8b4abafbb 100644 --- a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx +++ b/tools/VInspector/VInspector_ItemPrs3dAspect.cxx @@ -119,6 +119,19 @@ int VInspector_ItemPrs3dAspect::initRowCount() const return 0; } +// ======================================================================= +// function : GetStream +// purpose : +// ======================================================================= +void VInspector_ItemPrs3dAspect::GetStream (Standard_OStream& OS) const +{ + Handle(Prs3d_BasicAspect) anAspect = GetAspect(); + if (anAspect.IsNull()) + return; + + anAspect->Dump (OS); +} + // ======================================================================= // function : createChild // purpose : diff --git a/tools/VInspector/VInspector_ItemPrs3dAspect.hxx b/tools/VInspector/VInspector_ItemPrs3dAspect.hxx index 8f34f7ba50..1e7b839841 100644 --- a/tools/VInspector/VInspector_ItemPrs3dAspect.hxx +++ b/tools/VInspector/VInspector_ItemPrs3dAspect.hxx @@ -103,6 +103,10 @@ protected: //! \return the value virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE; + //! Creates a child item in the given position. //! \param theRow the child row position //! \param theColumn the child column position diff --git a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx b/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx index a52eefd941..2062f72aa2 100644 --- a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx +++ b/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx @@ -155,6 +155,19 @@ void VInspector_ItemSelectBasicsEntityOwner::initItem() const const_cast(this)->Init(); } +// ======================================================================= +// function : GetStream +// purpose : +// ======================================================================= +void VInspector_ItemSelectBasicsEntityOwner::GetStream (Standard_OStream& OS) const +{ + Handle(SelectMgr_EntityOwner) anEntityOwner = Handle(SelectMgr_EntityOwner)::DownCast (getEntityOwner()); + if (anEntityOwner.IsNull()) + return; + + anEntityOwner->Dump (OS); +} + // ======================================================================= // function : GetTableRowCount // purpose : diff --git a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx b/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx index bf544d43c1..f32bbeda75 100644 --- a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx +++ b/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx @@ -52,6 +52,10 @@ public: //! Returns the current entity owner Handle(SelectBasics_EntityOwner) EntityOwner() const { return myOwner; } + //! Returns stream value of the item to fulfill property panel. + //! \return stream value or dummy + Standard_EXPORT virtual void GetStream (Standard_OStream& OS) const Standard_OVERRIDE; + //! Returns number of table rows //! \return an integer value virtual int GetTableRowCount() const Standard_OVERRIDE; diff --git a/tools/VInspector/VInspector_Window.cxx b/tools/VInspector/VInspector_Window.cxx index cab89e4ec7..1c2f6e405b 100644 --- a/tools/VInspector/VInspector_Window.cxx +++ b/tools/VInspector/VInspector_Window.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +//#include #include #include #include @@ -134,7 +134,7 @@ VInspector_Window::VInspector_Window() //((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (VINSPECTOR_DEFAULT_TREE_VIEW_WIDTH, // VINSPECTOR_DEFAULT_TREE_VIEW_HEIGHT)); VInspector_ViewModel* aTreeModel = new VInspector_ViewModel (myTreeView); - aTreeModel-> AddPropertiesCreator(new VInspector_PropertiesCreator()); + //aTreeModel->AddPropertiesCreator(new VInspector_PropertiesCreator()); myTreeView->setModel (aTreeModel); // hide Visibility column TreeModel_HeaderSection anItem = aTreeModel->GetHeaderItem ((int)TreeModel_ColumnType_Visibility); @@ -156,7 +156,7 @@ VInspector_Window::VInspector_Window() // property view myPaneCreators.Append (new VInspectorPaneAIS_PaneCreator()); - aTreeModel->AddPropertiesCreator (new VInspectorPaneAIS_PropertiesCreator()); + //aTreeModel->AddPropertiesCreator (new VInspectorPaneAIS_PropertiesCreator()); myPropertyView = new ViewControl_PropertyView (myMainWindow, QSize(VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH, VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT)); @@ -862,12 +862,12 @@ void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&, if (!aTreeItemSelected) return; - Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties(); NCollection_List aSelPresentations; + Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties(); if (anItemProperties) anItemProperties->GetPresentations (-1, -1, aSelPresentations); - else - GetSelectedShapes (aSelPresentations); + //else + GetSelectedShapes (aSelPresentations); myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations); //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();