1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029451: Information Message Alert to debug an algorithm or object functionality

Dump/Init implementation in OCCT object and parsing it in VInspector (partially)
This commit is contained in:
nds
2019-08-02 08:07:13 +03:00
parent 9e7172d372
commit b416dd9bb6
90 changed files with 1173 additions and 610 deletions

View File

@@ -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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
//! The TypeOfPresention3d means that the interactive object

View File

@@ -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();
}

View File

@@ -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));

View File

@@ -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<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
Standard_SStream aSStream (OS);
TCollection::Split (aSStream, aStreamValues);
TCollection_AsciiString aKey;
TCollection::Split (OS, aStreamValues, aKey);
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<Standard_Real> aValues;
if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
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;
}

View File

@@ -19,7 +19,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
@@ -310,10 +309,18 @@ public:
}
//! Dumps the content of me on the stream <OS>.
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 <OS>.
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:

View File

@@ -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<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
//Standard_SStream aSStream (OS);
//TCollection::Split (aSStream, aStreamValues);
//TCollection::Split (OS, aStreamValues, aKey);
//TCollection_AsciiString anXYZValue;
//if (aStreamValues.Size() == 1)

View File

@@ -17,7 +17,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
@@ -279,10 +278,18 @@ public:
Standard_EXPORT void Add(const gp_Pnt& theP);
//! Dumps the content of me on the stream <OS>.
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 <OS>.
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:

View File

@@ -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

View File

@@ -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] =

View File

@@ -12,6 +12,7 @@
// commercial license or contractual agreement.
#include <Graphic3d_Aspects.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -477,6 +477,9 @@ public:
&& myIsTextZoomable == theOther.myIsTextZoomable;
}
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS) const;
protected:
Handle(Graphic3d_ShaderProgram) myProgram;

View File

@@ -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 <Graphic3d_PolygonOffset.hxx>
#include <Aspect.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -15,6 +15,7 @@
#define _Graphic3d_PolygonOffset_HeaderFile
#include <Aspect_PolygonOffsetMode.hxx>
#include <Standard_OStream.hxx>
//! 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 <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS) const;
};
#endif // _Graphic3d_PolygonOffset_HeaderFile

View File

@@ -15,6 +15,7 @@
#include <Prs3d_ArrowAspect.hxx>
#include <Prs3d_InvalidAngle.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -57,6 +57,9 @@ public:
void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myArrowAspect = theAspect; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectLine3d) myArrowAspect;

View File

@@ -17,6 +17,7 @@
#define _Prs3d_BasicAspect_HeaderFile
#include <Standard.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
@@ -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 <OS>.
virtual void Dump (Standard_OStream& OS) const = 0;
};
DEFINE_STANDARD_HANDLE(Prs3d_BasicAspect, Standard_Transient)

View File

@@ -14,6 +14,9 @@
#include <Prs3d_DatumAspect.hxx>
#include <Prs3d.hxx>
#include <TCollection.hxx>
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<Prs3d_DatumAttribute, Standard_Real> myAttributes;
//NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
//NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> 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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
private:
Prs3d_DatumAxes myAxes;
Standard_Boolean myToDrawLabels;

View File

@@ -16,6 +16,8 @@
#include <Aspect_TypeOfLine.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Prs3d.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -115,6 +115,9 @@ public:
//! Returns format.
const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Prs3d_LineAspect) myLineAspect;

View File

@@ -14,6 +14,8 @@
#include <Prs3d_LineAspect.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -63,6 +63,9 @@ public:
void SetAspect (const Handle(Graphic3d_AspectLine3d)& theAspect) { myAspect = theAspect; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectLine3d) myAspect;

View File

@@ -14,6 +14,8 @@
#include <Prs3d_PlaneAspect.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Prs3d_LineAspect) myEdgesAspect;

View File

@@ -14,6 +14,8 @@
#include <Prs3d_PointAspect.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectMarker3d) myAspect;

View File

@@ -18,6 +18,7 @@
#include <Graphic3d_MaterialAspect.hxx>
#include <Quantity_Color.hxx>
#include <Standard_Type.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -62,6 +62,9 @@ public:
void SetAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myAspect = theAspect; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectFillArea3d) myAspect;

View File

@@ -17,6 +17,8 @@
#include <Prs3d_TextAspect.hxx>
#include <Font_NameOfFont.hxx>
#include <Graphic3d.hxx>
#include <TCollection.hxx>
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);
}

View File

@@ -97,6 +97,9 @@ public:
void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
protected:
Handle(Graphic3d_AspectText3d) myTextAspect;

View File

@@ -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
*/
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
public: //! @name deprecated methods
//! gives the list of modes which are flagged "to be updated".

View File

@@ -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<TCollection_AsciiString, TCollection_AsciiString> 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))

View File

@@ -18,7 +18,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_ShortReal.hxx>
@@ -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 <OS>.
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 <OS>.
Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);

View File

@@ -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);

View File

@@ -122,7 +122,7 @@ public:
const bool theAlphaComponentIsOff = false);
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
Standard_EXPORT void Dump (Standard_OStream& OS) const;
private:

View File

@@ -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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const;
public:
//! Sets the selectable object.

View File

@@ -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);
}

View File

@@ -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 <OS>.
Standard_EXPORT virtual void Dump (Standard_OStream& OS) const Standard_OVERRIDE;
public:
//! Begins the iteration scanning for sensitive primitives.

View File

@@ -35,7 +35,7 @@
#include <algorithm>
#define REPORT_SELECTION_BUILD
//#define REPORT_SELECTION_BUILD
#ifdef REPORT_SELECTION_BUILD
#include <Message_Alerts.hxx>
#include <Message_PerfMeter.hxx>
@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -136,12 +136,23 @@ TCollection_AsciiString TCollection::Join (const NCollection_List<TCollection_As
// ----------------------------------------------------------------------------
void TCollection::Split (const Standard_SStream& theStream,
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& 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<TCollection_AsciiString> aValues;
Split (aStreamStr, DumpSeparator(), aValues);
split (aStreamStr, DumpSeparator(), aValues);
for (NCollection_List<TCollection_AsciiString>::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<TCollection_AsciiString>& 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;
}

View File

@@ -25,6 +25,7 @@
#include <TCollection_AsciiString.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <NCollection_IndexedMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Vector.hxx>
@@ -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<TCollection_AsciiString, TCollection_AsciiString>& theValues);
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& 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<TCollection_AsciiString>& 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 "<key>abc</key>defg"
//! aString.SplitDumped() gives <me> = "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 (">"); }

View File

@@ -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);

View File

@@ -54,7 +54,7 @@ public:
//! Dumps the content of me on the stream <OS>.
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;

View File

@@ -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);

View File

@@ -19,7 +19,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
@@ -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 <OS>.
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;

View File

@@ -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;

View File

@@ -23,7 +23,6 @@
#include <TopLoc_SListOfItemLocation.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
@@ -145,7 +144,7 @@ Standard_Boolean operator != (const TopLoc_Location& Other) const
}
//! Dumps the content of me on the stream <OS>.
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 <me> on the stream <s>.
Standard_EXPORT void ShallowDump (Standard_OStream& S) const;

View File

@@ -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);

View File

@@ -281,7 +281,7 @@ public:
void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; }
//! Dumps the content of me on the stream <OS>.
Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
Standard_EXPORT void Dump (Standard_OStream& OS) const;
private:

View File

@@ -255,7 +255,8 @@ void XmlDrivers_MessageReportStorage::exportAlertParameters (const Handle(Messag
Handle(Message_AttributeStream) aValuesArrayAlert = Handle(Message_AttributeStream)::DownCast (anAttribute);
// store values
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
TCollection::Split (aValuesArrayAlert->GetStream(), aValues);
TCollection_AsciiString aKey;
TCollection::Split (aValuesArrayAlert->GetStream(), aValues, aKey);
if (aValues.IsEmpty())
return;
int anArraySize = 2 * aValues.Size();

View File

@@ -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);

View File

@@ -17,7 +17,6 @@
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
@@ -257,7 +256,7 @@ public:
Standard_NODISCARD gp_Mat Transposed() const;
//! Dumps the content of me on the stream <OS>.
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;

View File

@@ -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);

View File

@@ -22,7 +22,6 @@
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Handle.hxx>
#include <Standard_OStream.hxx>
@@ -352,7 +351,7 @@ void operator *= (const gp_Trsf& T)
}
//! Dumps the content of me on the stream <OS>.
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;

View File

@@ -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<TCollection_AsciiString, TCollection_AsciiString> 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))

View File

@@ -23,7 +23,6 @@
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_DumpMask.hxx>
#include <Standard_OStream.hxx>
class Standard_ConstructionError;
@@ -329,7 +328,7 @@ public:
//! Dumps the content of me on the stream <OS>.
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 <OS>.
Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);

View File

@@ -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

View File

@@ -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();

View File

@@ -15,7 +15,6 @@
#include <inspector/MessageModel_ItemAlert.hxx>
#include <inspector/MessageModel_ItemPropertiesAttributeStream.hxx>
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/MessageModel_Tools.hxx>
@@ -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();
}

View File

@@ -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; }

View File

@@ -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 <inspector/MessageModel_ItemPropertiesAttributeStream.hxx>
#include <inspector/MessageModel_ItemAlert.hxx>
#include <inspector/ShapeView_ItemShape.hxx>
#include <inspector/ShapeView_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <BRep_Tool.hxx>
#include <Message_AlertExtended.hxx>
#include <TCollection.hxx>
#include <TopoDS.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
// =======================================================================
// function : Init
// purpose :
// =======================================================================
void MessageModel_ItemPropertiesAttributeStream::Init()
{
MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(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<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
return aValues.Size();
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant MessageModel_ItemPropertiesAttributeStream::GetTableData (const int theRow, const int theColumn, int theRole) const
{
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& 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;
}

View File

@@ -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<MessageModel_ItemAlert>(anItemBase);
if (!anAlertItem)
continue;

View File

@@ -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();

View File

@@ -2,4 +2,5 @@ TKernel
TKMath
TKPrim
TKTopAlgo
TKTInspectorAPI
CSF_QT

View File

@@ -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

View File

@@ -15,6 +15,7 @@
#include <inspector/TreeModel_ItemBase.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemPropertiesStream.hxx>
#include <inspector/TreeModel_ItemRole.hxx>
#include <Standard_WarningsDisable.hxx>
@@ -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 :

View File

@@ -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; };

View File

@@ -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() {}

View File

@@ -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 <inspector/TreeModel_ItemPropertiesStream.hxx>
#include <inspector/TreeModel_ItemStream.hxx>
#include <inspector/Convert_TransientShape.hxx>
#include <inspector/Convert_Tools.hxx>
#include <Bnd_Box.hxx>
#include <gp_XYZ.hxx>
#include <TCollection.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QFont>
#include <Standard_WarningsRestore.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemPropertiesStream, TreeModel_ItemProperties)
// =======================================================================
// function : Init
// purpose :
// =======================================================================
void TreeModel_ItemPropertiesStream::Init (const Standard_SStream& theStream)
{
myStream << theStream.str();
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
TCollection::Split (theStream, aValues, myKey);
TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast<TreeModel_ItemStream>(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<TreeModel_ItemStream>(getItem());
if (!aStreamParent)
OS << myStream.str();
else
OS << GetChildrenValues().FindFromIndex (theRow + 1);
}
// =======================================================================
// function : RowCount
// purpose :
// =======================================================================
int TreeModel_ItemPropertiesStream::GetTableRowCount() const
{
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
return aValues.Size();
}
// =======================================================================
// function : Data
// purpose :
// =======================================================================
QVariant TreeModel_ItemPropertiesStream::GetTableData (const int theRow, const int theColumn, int theRole) const
{
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& 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<Handle(Standard_Transient)>& 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<TreeModel_ItemStream>(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);
}

View File

@@ -35,24 +35,33 @@
class QItemDelegate;
DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
DEFINE_STANDARD_HANDLE (TreeModel_ItemPropertiesStream, TreeModel_ItemProperties)
//! \class MessageModel_ItemPropertiesAttributeStream
//! \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 MessageModel_ItemPropertiesAttributeStream : public TreeModel_ItemProperties
class TreeModel_ItemPropertiesStream : public TreeModel_ItemProperties
{
public:
//! Constructor
Standard_EXPORT MessageModel_ItemPropertiesAttributeStream (TreeModel_ItemBasePtr theItem)
Standard_EXPORT TreeModel_ItemPropertiesStream (TreeModel_ItemBasePtr theItem)
: TreeModel_ItemProperties (theItem) {}
//! Destructor
virtual ~MessageModel_ItemPropertiesAttributeStream() {}
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();
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();
@@ -82,19 +91,43 @@ public:
//! \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)
//! 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<Handle(Standard_Transient)>& 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<TCollection_AsciiString, TCollection_AsciiString>& GetChildrenValues() const
{
return myChildren;
}
//! Returns attribute with stream value
const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetValues() const
{
if (!IsInitialized())
const_cast<MessageModel_ItemPropertiesAttributeStream*>(this)->Init();
return myValues;
}
protected:
TCollection_AsciiString myKey;
Standard_SStream myStream;
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myValues;
NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myChildren;
};
#endif

View File

@@ -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 <inspector/TreeModel_ItemStream.hxx>
#include <inspector/TreeModel_ItemPropertiesStream.hxx>
// =======================================================================
// 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<TreeModel_ItemStream>(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();
}

View File

@@ -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 <Standard.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
class TreeModel_ItemStream;
typedef QExplicitlySharedDataPointer<TreeModel_ItemStream> 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

View File

@@ -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;

View File

@@ -163,7 +163,8 @@ TreeModel_ItemBasePtr VInspector_ItemBVHTree::createChild (int theRow, int theCo
// =======================================================================
TopoDS_Shape VInspector_ItemBVHTree::buildPresentationShape()
{
opencascade::handle<BVH_Tree<Standard_Real, 3> > aBVHTree = myTree;
return TopoDS_Shape();
/*opencascade::handle<BVH_Tree<Standard_Real, 3> > 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;*/
}

View File

@@ -20,7 +20,6 @@
#include <inspector/VInspector_ItemBase.hxx>
#include <AIS_InteractiveObject.hxx>
#include <NCollection_List.hxx>
#include <TCollection_AsciiString.hxx>
class Prs3d_Drawer;

View File

@@ -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 <inspector/VInspector_ItemOpenGlLayer.hxx>
#include <inspector/VInspector_ItemOpenGlLayerList.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <AIS.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <Aspect.hxx>
#include <Graphic3d.hxx>
#include <OpenGl_Layer.hxx>
#include <OpenGl_Group.hxx>
#include <OpenGl_PrimitiveArray.hxx>
#include <OpenGl_Text.hxx>
#include <SelectMgr.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QStringList>
#include <Standard_WarningsRestore.hxx>
// =======================================================================
// function : Init
// purpose :
// =======================================================================
void VInspector_ItemOpenGlLayer::Init()
{
VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast<VInspector_ItemOpenGlLayerList>(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<VInspector_ItemOpenGlLayer*>(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();
}

View File

@@ -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 <Standard.hxx>
#include <inspector/VInspector_ItemBase.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
#include <OpenGl_Layer.hxx>
class Graphic3d_Group;
class VInspector_ItemOpenGlLayer;
typedef QExplicitlySharedDataPointer<VInspector_ItemOpenGlLayer> 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: <function name> <function value>
//! \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

View File

@@ -267,6 +267,19 @@ void VInspector_ItemPresentableObject::GetPresentations (NCollection_List<Handle
thePresentations.Append (GetInteractiveObject());
}
// =======================================================================
// function : GetStream
// purpose :
// =======================================================================
void VInspector_ItemPresentableObject::GetStream (Standard_OStream& OS) const
{
Handle(AIS_InteractiveObject) anIO = GetInteractiveObject();
if (anIO.IsNull())
return;
anIO->Dump (OS);
}
// =======================================================================
// function : GetTableRowCount
// purpose :

View File

@@ -64,6 +64,10 @@ public:
//! \thePresentations [out] container of presentation handles to be visualized
Standard_EXPORT virtual void GetPresentations (NCollection_List<Handle(Standard_Transient)>& 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;

View File

@@ -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++;

View File

@@ -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 :

View File

@@ -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

View File

@@ -155,6 +155,19 @@ void VInspector_ItemSelectBasicsEntityOwner::initItem() const
const_cast<VInspector_ItemSelectBasicsEntityOwner*>(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 :

View File

@@ -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;

View File

@@ -48,7 +48,7 @@
#include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
#include <inspector/VInspector_ItemFolderObject.hxx>
#include <inspector/VInspector_ItemPresentableObject.hxx>
#include <inspector/VInspector_PropertiesCreator.hxx>
//#include <inspector/VInspector_PropertiesCreator.hxx>
#include <inspector/VInspector_TableModelValues.hxx>
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/VInspector_Tools.hxx>
@@ -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<Handle(Standard_Transient)> 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();