-TModelingData TKShapeView
+TModelingData TKShapeView TKMessageModel TKMessageView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE
\ No newline at end of file
{
if (!myName.IsEmpty())
{
- send (myName, theGravity);
+ TCollection_AsciiString aName = myName;
myName.Clear();
+ send (aName, theGravity);
}
const Handle(Message_Report)& aReport = Report();
for (int aLevelIndex = myAlertLevels.Size(); aLevelIndex >= 1; aLevelIndex--)
{
Message_Level* aLevel = myAlertLevels.Value (aLevelIndex);
- if (myAlertLevels.Size() == 1) // the last level, the root item should be stopped
- {
- Message_AttributeMeter::StopAlert (aLevel->RootAlert());
- }
+ Message_AttributeMeter::StopAlert (aLevel->RootAlert());
myAlertLevels.Remove (aLevelIndex);
if (aLevel == theLevel)
OCCT_DUMP_FIELD_VALUE_GUID (theOStream, ID())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Transaction())
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, UntilTransaction())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsValid())
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsNew())
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- for (TColStd_Array1OfByte::Iterator aValueIt (myValues->Array1()); aValueIt.More(); aValueIt.Next())
+ if (!myValues.IsNull())
{
- const Standard_Byte& aValue = aValueIt.Value();
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
- }
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValues->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValues->Upper())
+
+ for (TColStd_Array1OfByte::Iterator aValueIt (myValues->Array1()); aValueIt.More(); aValueIt.Next())
+ {
+ const Standard_Byte& aValue = aValueIt.Value();
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ }
+ }
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLower)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpper)
}
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- for (TColStd_Array1OfByte::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ if (!myValue.IsNull())
{
- const Standard_Byte& aValue = aValueIt.Value();
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Upper())
+
+ for (TColStd_Array1OfByte::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ {
+ const Standard_Byte& aValue = aValueIt.Value();
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ }
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
}
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- for (TColStd_Array1OfExtendedString::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ if (!myValue.IsNull())
{
- const TCollection_ExtendedString& aValue = aValueIt.Value();
- OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aValue)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Upper())
+
+ for (TColStd_Array1OfExtendedString::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ {
+ const TCollection_ExtendedString& aValue = aValueIt.Value();
+ OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aValue)
+ }
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- for (TColStd_Array1OfInteger::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ if (!myValue.IsNull())
{
- const Standard_Integer& aValue = aValueIt.Value();
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Upper())
+
+ for (TColStd_Array1OfInteger::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ {
+ const Standard_Integer& aValue = aValueIt.Value();
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ }
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- for (TColStd_Array1OfReal::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ if (!myValue.IsNull())
{
- const Standard_Real& aValue = aValueIt.Value();
- OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myValue->Upper())
+
+ for (TColStd_Array1OfReal::Iterator aValueIt (myValue->Array1()); aValueIt.More(); aValueIt.Next())
+ {
+ const Standard_Real& aValue = aValueIt.Value();
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aValue)
+ }
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsDelta)
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- TCollection_AsciiString aLabel;
- for (TDataStd_LabelArray1::Iterator anArrayIt (myArray->Array1()); anArrayIt.More(); anArrayIt.Next())
+ if (!myArray.IsNull())
{
- aLabel.Clear();
- TDF_Tool::Entry (anArrayIt.Value(), aLabel);
- OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArray->Lower())
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myArray->Upper())
+
+ TCollection_AsciiString aLabel;
+ for (TDataStd_LabelArray1::Iterator anArrayIt (myArray->Array1()); anArrayIt.More(); anArrayIt.Next())
+ {
+ aLabel.Clear();
+ TDF_Tool::Entry (anArrayIt.Value(), aLabel);
+ OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
+ }
}
}
{
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+ OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID)
+
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
}
#include <Standard_DomainError.hxx>
+#include <Standard_Dump.hxx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
TDF_Attribute::Dump(anOS);
return anOS;
}
+
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void TFunction_Function::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
+
+ OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myDriverGUID)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFailure)
+}
Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
DEFINE_STANDARD_RTTIEXT(TFunction_Function,TDF_Attribute)
private:
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
- TCollection_AsciiString aLabel;
- TDF_Tool::Entry (myNode->Label(), aLabel);
- OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
+ TNaming_Node* p = myNode;
+ if (p != 0L)
+ {
+ TCollection_AsciiString aLabel;
+ TDF_Tool::Entry (myNode->Label(), aLabel);
+ OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aLabel)
+ }
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myEvolution)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVersion)
}
}
}
}
+
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void TPrsStd_AISPresentation::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
+
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAIS.get())
+}
//! update AIS viewer according to delta
Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False) Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
DEFINE_STANDARD_RTTIEXT(TPrsStd_AISPresentation,TDF_Attribute)
protected:
{
}
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void TPrsStd_AISViewer::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, TDF_Attribute)
+
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myInteractiveContext.get())
+}
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
#include <XCAFDoc.hxx>
#include <XCAFDoc_ColorType.hxx>
+#include <Quantity_ColorRGBA.hxx>
+
+#include <Standard_GUID.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TDF_Attribute.hxx>
#include <TDF_Label.hxx>
+#include <TDF_Reference.hxx>
#include <TDF_Tool.hxx>
+#include <TDataStd_AsciiString.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_Comment.hxx>
+#include <TDataStd_ByteArray.hxx>
+#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_Name.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TDataStd_Real.hxx>
+#include <TDataStd_TreeNode.hxx>
+#include <TDataStd_UAttribute.hxx>
#include <TDocStd_Document.hxx>
-#include <Standard_GUID.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <XCAFDoc_Area.hxx>
+#include <XCAFDoc_Centroid.hxx>
+#include <XCAFDoc_Color.hxx>
+#include <XCAFDoc_DimTol.hxx>
+#include <XCAFDoc_GraphNode.hxx>
+#include <XCAFDoc_Material.hxx>
+#include <XCAFDoc_ShapeMapTool.hxx>
+#include <XCAFDoc_Volume.hxx>
//=======================================================================
//function : ShapeRefGUID
static const Standard_GUID ID("efd213eb-6dfd-11d4-b9c8-0060b0ee281b");
return ID;
}
+
+//=======================================================================
+//function : AttributeInfo
+//purpose :
+//=======================================================================
+TCollection_AsciiString XCAFDoc::AttributeInfo (const Handle(TDF_Attribute)& theAtt)
+{
+ TCollection_AsciiString anInfo;
+
+ if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) ) {
+ Standard_CString type = "";
+ if ( theAtt->ID() == XCAFDoc::ShapeRefGUID() ) type = "Shape Instance Link";
+ else if ( theAtt->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorGen) ) type = "Generic Color Link";
+ else if ( theAtt->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorSurf) ) type = "Surface Color Link";
+ else if ( theAtt->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorCurv) ) type = "Curve Color Link";
+ else if ( theAtt->ID() == XCAFDoc::DimTolRefGUID() ) type = "DGT Link";
+ else if ( theAtt->ID() == XCAFDoc::DatumRefGUID() ) type = "Datum Link";
+ else if ( theAtt->ID() == XCAFDoc::MaterialRefGUID() ) type = "Material Link";
+ Handle(TDataStd_TreeNode) TN = Handle(TDataStd_TreeNode)::DownCast(theAtt);
+ TCollection_AsciiString ref;
+ if ( TN->HasFather() ) {
+ TDF_Tool::Entry ( TN->Father()->Label(), ref );
+ anInfo = type;
+ anInfo += TCollection_AsciiString (" ==> ") + ref;
+ }
+ else {
+ anInfo = type;
+ anInfo += TCollection_AsciiString (" <== (") + ref;
+ Handle(TDataStd_TreeNode) child = TN->First();
+ while ( ! child.IsNull() ) {
+ TDF_Tool::Entry ( child->Label(), ref );
+ if ( child != TN->First() ) anInfo += ", " ;
+ anInfo += ref;
+ child = child->Next();
+ }
+ anInfo += ")";
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDF_Reference)) ) {
+ Handle(TDF_Reference) val = Handle(TDF_Reference)::DownCast ( theAtt );
+ TCollection_AsciiString ref;
+ TDF_Tool::Entry ( val->Get(), ref );
+ anInfo += TCollection_AsciiString ("==> ") + ref;
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDF_TagSource)) ) {
+ Handle(TDF_TagSource) val = Handle(TDF_TagSource)::DownCast ( theAtt );
+ anInfo += TCollection_AsciiString ( val->Get() );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_Integer)) ) {
+ Handle(TDataStd_Integer) val = Handle(TDataStd_Integer)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get() );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_Real)) ) {
+ Handle(TDataStd_Real) val = Handle(TDataStd_Real)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get() );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_Name)) ) {
+ Handle(TDataStd_Name) val = Handle(TDataStd_Name)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get(), '?' );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_Comment)) ) {
+ Handle(TDataStd_Comment) val = Handle(TDataStd_Comment)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get(), '?' );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_AsciiString)) ) {
+ Handle(TDataStd_AsciiString) val = Handle(TDataStd_AsciiString)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get(), '?' );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_IntegerArray)) ) {
+ Handle(TDataStd_IntegerArray) val = Handle(TDataStd_IntegerArray)::DownCast ( theAtt );
+ for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
+ if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
+ anInfo += TCollection_AsciiString ( val->Value(j) );
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_RealArray)) ) {
+ Handle(TDataStd_RealArray) val = Handle(TDataStd_RealArray)::DownCast ( theAtt );
+ for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
+ if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
+ anInfo += TCollection_AsciiString ( val->Value(j) );
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_ByteArray)) ) {
+ Handle(TDataStd_ByteArray) val = Handle(TDataStd_ByteArray)::DownCast ( theAtt );
+ for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
+ if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
+ anInfo += TCollection_AsciiString ( val->Value(j) );
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TNaming_NamedShape)) ) {
+ Handle(TNaming_NamedShape) val = Handle(TNaming_NamedShape)::DownCast ( theAtt );
+ TopoDS_Shape S = val->Get();
+ if (!S.IsNull())
+ anInfo = S.TShape()->DynamicType()->Name();
+ else
+ anInfo = "Empty Shape";
+ if ( ! S.Location().IsIdentity() ) anInfo += TCollection_AsciiString ( "(located)" );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_ShapeMapTool)) ) {
+
+ Handle(XCAFDoc_ShapeMapTool) anAttr = Handle(XCAFDoc_ShapeMapTool)::DownCast ( theAtt );
+ anInfo += TCollection_AsciiString (anAttr->GetMap().Extent());
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_Volume)) ) {
+ Handle(XCAFDoc_Volume) val = Handle(XCAFDoc_Volume)::DownCast ( theAtt );
+ anInfo += TCollection_AsciiString ( val->Get() );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_Area)) ) {
+ Handle(XCAFDoc_Area) val = Handle(XCAFDoc_Area)::DownCast ( theAtt );
+ anInfo = TCollection_AsciiString ( val->Get() );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_Centroid)) ) {
+ Handle(XCAFDoc_Centroid) val = Handle(XCAFDoc_Centroid)::DownCast ( theAtt );
+ gp_Pnt myCentroid = val->Get();
+ anInfo = "(" ;
+ anInfo += TCollection_AsciiString ( myCentroid.X() );
+ anInfo += TCollection_AsciiString ( " , " );
+ anInfo += TCollection_AsciiString ( TCollection_AsciiString ( myCentroid.Y() ) );
+ anInfo += TCollection_AsciiString ( " , " );
+ anInfo += TCollection_AsciiString ( myCentroid.Z() );
+ anInfo += TCollection_AsciiString ( ")" );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(TDataStd_UAttribute)) ) {
+ if ( theAtt->ID() == XCAFDoc::AssemblyGUID() ) anInfo += TCollection_AsciiString ( "is assembly" );
+ if ( theAtt->ID() == XCAFDoc::InvisibleGUID() ) anInfo += TCollection_AsciiString ( "invisible" );
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_Color)) ) {
+ Handle(XCAFDoc_Color) val = Handle(XCAFDoc_Color)::DownCast ( theAtt );
+ Quantity_ColorRGBA C = val->GetColorRGBA();
+ char string[260];
+ Sprintf ( string, "%s (%g, %g, %g, %g)", C.GetRGB().StringName ( C.GetRGB().Name() ),
+ C.GetRGB().Red(), C.GetRGB().Green(), C.GetRGB().Blue(), C.Alpha());
+ anInfo = string;
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_DimTol)) ) {
+ Handle(XCAFDoc_DimTol) val = Handle(XCAFDoc_DimTol)::DownCast ( theAtt );
+ Standard_Integer kind = val->GetKind();
+ Handle(TColStd_HArray1OfReal) HAR = val->GetVal();
+ if(kind<20) { //dimension
+ anInfo = "Diameter (ValueRange[";
+ anInfo += TCollection_AsciiString ( HAR->Value(1) );
+ anInfo += TCollection_AsciiString ( "," );
+ anInfo += TCollection_AsciiString ( HAR->Value(2) );
+ anInfo += TCollection_AsciiString ( "])" );
+ }
+ else {
+ switch (kind) {
+ case 21: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_1"; break;
+ case 22: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_2"; break;
+ case 23: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_3"; break;
+ case 24: anInfo = "AngularityTolerance"; break;
+ case 25: anInfo = "CircularRunoutTolerance"; break;
+ case 26: anInfo = "CoaxialityTolerance"; break;
+ case 27: anInfo = "ConcentricityTolerance"; break;
+ case 28: anInfo = "ParallelismTolerance"; break;
+ case 29: anInfo = "PerpendicularityTolerance"; break;
+ case 30: anInfo = "SymmetryTolerance"; break;
+ case 31: anInfo = "TotalRunoutTolerance"; break;
+ case 35: anInfo = "ModifiedGeometricTolerance_1"; break;
+ case 36: anInfo = "ModifiedGeometricTolerance_2"; break;
+ case 37: anInfo = "ModifiedGeometricTolerance_3"; break;
+ case 38: anInfo = "CylindricityTolerance"; break;
+ case 39: anInfo = "FlatnessTolerance"; break;
+ case 40: anInfo = "LineProfileTolerance"; break;
+ case 41: anInfo = "PositionTolerance"; break;
+ case 42: anInfo = "RoundnessTolerance"; break;
+ case 43: anInfo = "StraightnessTolerance"; break;
+ case 44: anInfo = "SurfaceProfileTolerance"; break;
+ }
+ if (anInfo.Length() > 0) {
+ anInfo += " (Value=";
+ anInfo += TCollection_AsciiString (HAR->Value (1));
+ anInfo += ")";
+ }
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_Material)) ) {
+ Handle(XCAFDoc_Material) val = Handle(XCAFDoc_Material)::DownCast ( theAtt );
+ Standard_Real dens = val->GetDensity();
+ Standard_CString dimdens = "g/cu sm";
+ if(dens==0)
+ anInfo = val->GetName()->ToCString();
+ else {
+ anInfo = val->GetName()->ToCString();
+ anInfo += "(density=";
+ anInfo += TCollection_AsciiString ( dens );
+ anInfo += dimdens;
+ anInfo += ")";
+ }
+ }
+ else if ( theAtt->IsKind(STANDARD_TYPE(XCAFDoc_GraphNode)) ) {
+ Standard_CString type;
+ if ( theAtt->ID() == XCAFDoc::LayerRefGUID() ) {
+ type = "Layer Instance Link";
+ }
+ else if ( theAtt->ID() == XCAFDoc::SHUORefGUID() ) {
+ type = "SHUO Instance Link";
+ }
+ else if ( theAtt->ID() == XCAFDoc::DatumTolRefGUID() ) {
+ type = "DatumToler Link";
+ }
+ else if ( theAtt->ID() == XCAFDoc::DimensionRefFirstGUID() ) {
+ type = "Dimension Link First";
+ }
+ else if ( theAtt->ID() == XCAFDoc::DimensionRefSecondGUID() ) {
+ type = "Dimension Link Second";
+ }
+ else if ( theAtt->ID() == XCAFDoc::GeomToleranceRefGUID() ){
+ type = "GeomTolerance Link";
+ }
+ else if ( theAtt->ID() == XCAFDoc::DatumRefGUID() ){
+ type = "Datum Link";
+ }
+ else if (theAtt->ID() == XCAFDoc::ViewRefShapeGUID()){
+ type = "View Shape Link";
+ }
+ else if (theAtt->ID() == XCAFDoc::ViewRefGDTGUID()){
+ type = "View GD&T Link";
+ }
+ else if (theAtt->ID() == XCAFDoc::ViewRefPlaneGUID()) {
+ type = "View Clipping Plane Link";
+ }
+ else
+ return TCollection_AsciiString();
+
+ Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(theAtt);
+ TCollection_AsciiString ref;
+ Standard_Integer ii = 1;
+ if (DETGN->NbFathers()!=0) {
+
+ TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
+ anInfo = type;
+ anInfo += " ==> (";
+ anInfo += ref;
+ for (ii = 2; ii <= DETGN->NbFathers(); ii++) {
+ TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
+ anInfo += ", ";
+ anInfo += ref;
+ }
+ anInfo += ") ";
+ }
+ ii = 1;
+ if (DETGN->NbChildren()!=0) {
+ TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
+ anInfo += type;
+ anInfo += " <== (";
+ anInfo += ref;
+ for (ii = 2; ii <= DETGN->NbChildren (); ii++) {
+ TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
+ anInfo += ", ";
+ anInfo += ref;
+ }
+ anInfo += ") ";
+ }
+ }
+ return anInfo;
+}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
+#include <TCollection_AsciiString.hxx>
#include <XCAFDoc_ColorType.hxx>
+class TDF_Attribute;
class Standard_GUID;
class XCAFDoc_DocumentTool;
class XCAFDoc_Location;
//! Returns GUID for UAttribute identifying lock flag
Standard_EXPORT static const Standard_GUID& LockGUID();
+ //! Prints attribute information into a string.
+ //! @param theAtt an XDE attribute
+ //! @return the generated info value
+ Standard_EXPORT static TCollection_AsciiString AttributeInfo (const Handle(TDF_Attribute)& theAtt);
+
};
#endif // _XCAFDoc_HeaderFile
for (TopTools_IndexedMapOfShape::Iterator aMapIt (myMap); aMapIt.More(); aMapIt.Next())
{
- const TopoDS_Shape& aShape = aMapIt.Value();
- OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aShape)
+ const Handle(TopoDS_TShape)& aShape = aMapIt.Value().TShape();
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aShape)
}
}
for (XCAFDoc_DataMapOfShapeLabel::Iterator aShapeLabelIt (myShapeLabels); aShapeLabelIt.More(); aShapeLabelIt.Next())
{
- OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aShapeLabelIt.Key())
+ const TopoDS_Shape aShape = aShapeLabelIt.Key();
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &aShape)
TCollection_AsciiString aShapeLabel;
TDF_Tool::Entry (aShapeLabelIt.Value(), aShapeLabel);
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aShapeLabel)
}
-
+
for (XCAFDoc_DataMapOfShapeLabel::Iterator aSubShapeIt (mySubShapes); aSubShapeIt.More(); aSubShapeIt.Next())
{
- OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aSubShapeIt.Key())
+ const TopoDS_Shape aSubShape = aSubShapeIt.Key();
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &aSubShape)
- TCollection_AsciiString aSubShape;
- TDF_Tool::Entry (aSubShapeIt.Value(), aSubShape);
- OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSubShape)
+ TCollection_AsciiString aSubShapeLabel;
+ TDF_Tool::Entry (aSubShapeIt.Value(), aSubShapeLabel);
+ OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSubShapeLabel)
}
-
+
for (XCAFDoc_DataMapOfShapeLabel::Iterator aSimpleShapeIt (mySimpleShapes); aSimpleShapeIt.More(); aSimpleShapeIt.Next())
{
- OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aSimpleShapeIt.Key())
+ const TopoDS_Shape aSimpleShape = aSimpleShapeIt.Key();
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &aSimpleShape)
- TCollection_AsciiString aSimpleShape;
- TDF_Tool::Entry (aSimpleShapeIt.Value(), aSimpleShape);
- OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSimpleShape)
+ TCollection_AsciiString aSimpleShapeLabel;
+ TDF_Tool::Entry (aSimpleShapeIt.Value(), aSimpleShapeLabel);
+ OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aSimpleShapeLabel)
}
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, hasSimpleShapes)
if ( ! itr.More() ) { std::cout << "Syntax error: Attribute #" << num << " not found\n"; return 1; }
- const Handle(TDF_Attribute)& att = itr.Value();
- if ( att->IsKind(STANDARD_TYPE(TDataStd_TreeNode)) ) {
- Standard_CString type = "";
- if ( att->ID() == XCAFDoc::ShapeRefGUID() ) type = "Shape Instance Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorGen) ) type = "Generic Color Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorSurf) ) type = "Surface Color Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorCurv) ) type = "Curve Color Link";
- else if ( att->ID() == XCAFDoc::DimTolRefGUID() ) type = "DGT Link";
- else if ( att->ID() == XCAFDoc::DatumRefGUID() ) type = "Datum Link";
- else if ( att->ID() == XCAFDoc::MaterialRefGUID() ) type = "Material Link";
- Handle(TDataStd_TreeNode) TN = Handle(TDataStd_TreeNode)::DownCast(att);
- TCollection_AsciiString ref;
- if ( TN->HasFather() ) {
- TDF_Tool::Entry ( TN->Father()->Label(), ref );
- di << type << " ==> " << ref.ToCString();
- }
- else {
- di << type << " <== (" << ref.ToCString();
- Handle(TDataStd_TreeNode) child = TN->First();
- while ( ! child.IsNull() ) {
- TDF_Tool::Entry ( child->Label(), ref );
- if ( child != TN->First() ) di << ", ";
- di << ref.ToCString();
- child = child->Next();
- }
- di << ")";
- }
- }
- else if ( att->IsKind(STANDARD_TYPE(TDF_Reference)) ) {
- Handle(TDF_Reference) val = Handle(TDF_Reference)::DownCast ( att );
- TCollection_AsciiString ref;
- TDF_Tool::Entry ( val->Get(), ref );
- di << "==> " << ref.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_Integer)) ) {
- Handle(TDataStd_Integer) val = Handle(TDataStd_Integer)::DownCast ( att );
- TCollection_AsciiString str ( val->Get() );
- di << str.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_Real)) ) {
- Handle(TDataStd_Real) val = Handle(TDataStd_Real)::DownCast ( att );
- TCollection_AsciiString str ( val->Get() );
- di << str.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_Name)) ) {
- Handle(TDataStd_Name) val = Handle(TDataStd_Name)::DownCast ( att );
- di << val->Get();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_Comment)) ) {
- Handle(TDataStd_Comment) val = Handle(TDataStd_Comment)::DownCast ( att );
- di << val->Get();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_AsciiString)) ) {
- Handle(TDataStd_AsciiString) val = Handle(TDataStd_AsciiString)::DownCast ( att );
- di << val->Get();
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_IntegerArray)) ) {
- Handle(TDataStd_IntegerArray) val = Handle(TDataStd_IntegerArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) di << ", ";
- TCollection_AsciiString str ( val->Value(j) );
- di << str.ToCString();
- }
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_RealArray)) ) {
- Handle(TDataStd_RealArray) val = Handle(TDataStd_RealArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) di << ", ";
- TCollection_AsciiString str ( val->Value(j) );
- di << str.ToCString();
- }
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_ByteArray)) ) {
- Handle(TDataStd_ByteArray) val = Handle(TDataStd_ByteArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) di << ", ";
- TCollection_AsciiString str ( val->Value(j) );
- di << str.ToCString();
- }
- }
- else if ( att->IsKind(STANDARD_TYPE(TNaming_NamedShape)) ) {
- Handle(TNaming_NamedShape) val = Handle(TNaming_NamedShape)::DownCast ( att );
- TopoDS_Shape S = val->Get();
- di << S.TShape()->DynamicType()->Name();
- if ( ! S.Location().IsIdentity() ) di << "(located)";
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Volume)) ) {
- Handle(XCAFDoc_Volume) val = Handle(XCAFDoc_Volume)::DownCast ( att );
- TCollection_AsciiString str ( val->Get() );
- di << str.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Area)) ) {
- Handle(XCAFDoc_Area) val = Handle(XCAFDoc_Area)::DownCast ( att );
- TCollection_AsciiString str ( val->Get() );
- di << str.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Centroid)) ) {
- Handle(XCAFDoc_Centroid) val = Handle(XCAFDoc_Centroid)::DownCast ( att );
- gp_Pnt myCentroid = val->Get();
- di << "(" ;
- di << myCentroid.X();
- di <<" , ";
- di << myCentroid.Y();
- di <<" , ";
- di << myCentroid.Z();
- di << ")";
- }
- else if ( att->IsKind(STANDARD_TYPE(TDataStd_UAttribute)) ) {
- if ( att->ID() == XCAFDoc::AssemblyGUID() ) di << "is assembly";
- if ( att->ID() == XCAFDoc::InvisibleGUID() ) di << "invisible";
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Color)) ) {
- Handle(XCAFDoc_Color) val = Handle(XCAFDoc_Color)::DownCast ( att );
- Quantity_ColorRGBA C = val->GetColorRGBA();
- char string[260];
- Sprintf ( string, "%s (%g, %g, %g, %g)", C.GetRGB().StringName ( C.GetRGB().Name() ),
- C.GetRGB().Red(), C.GetRGB().Green(), C.GetRGB().Blue(), C.Alpha());
- di << string;
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_DimTol)) ) {
- Handle(XCAFDoc_DimTol) val = Handle(XCAFDoc_DimTol)::DownCast ( att );
- Standard_Integer kind = val->GetKind();
- Handle(TColStd_HArray1OfReal) HAR = val->GetVal();
- if(kind<20) { //dimension
- di<<"Diameter (ValueRange["<<HAR->Value(1)<<","<<HAR->Value(2)<<"])";
- }
- else {
- switch(kind) {
- case 21: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_1 (Value="<<HAR->Value(1)<<")"; break;
- case 22: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_2 (Value="<<HAR->Value(1)<<")"; break;
- case 23: di << "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_3 (Value="<<HAR->Value(1)<<")"; break;
- case 24: di << "AngularityTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 25: di << "CircularRunoutTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 26: di << "CoaxialityTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 27: di << "ConcentricityTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 28: di << "ParallelismTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 29: di << "PerpendicularityTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 30: di << "SymmetryTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 31: di << "TotalRunoutTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 35: di << "ModifiedGeometricTolerance_1 (Value="<<HAR->Value(1)<<")"; break;
- case 36: di << "ModifiedGeometricTolerance_2 (Value="<<HAR->Value(1)<<")"; break;
- case 37: di << "ModifiedGeometricTolerance_3 (Value="<<HAR->Value(1)<<")"; break;
- case 38: di << "CylindricityTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 39: di << "FlatnessTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 40: di << "LineProfileTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 41: di << "PositionTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 42: di << "RoundnessTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 43: di << "StraightnessTolerance (Value="<<HAR->Value(1)<<")"; break;
- case 44: di << "SurfaceProfileTolerance (Value="<<HAR->Value(1)<<")"; break;
- }
- }
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_Material)) ) {
- Handle(XCAFDoc_Material) val = Handle(XCAFDoc_Material)::DownCast ( att );
- Standard_Real dens = val->GetDensity();
- Standard_CString dimdens = "g/cu sm";
- if(dens==0)
- di<<val->GetName()->ToCString();
- else
- di<<val->GetName()->ToCString()<<"(density="<<dens<<dimdens<<")";
- }
- else if ( att->IsKind(STANDARD_TYPE(XCAFDoc_GraphNode)) ) {
- Standard_CString type;
- if ( att->ID() == XCAFDoc::LayerRefGUID() ) {
- type = "Layer Instance Link";
- }
- else if ( att->ID() == XCAFDoc::SHUORefGUID() ) {
- type = "SHUO Instance Link";
- }
- else if ( att->ID() == XCAFDoc::DatumTolRefGUID() ) {
- type = "DatumToler Link";
- }
- else if ( att->ID() == XCAFDoc::DimensionRefFirstGUID() ) {
- type = "Dimension Link First";
- }
- else if ( att->ID() == XCAFDoc::DimensionRefSecondGUID() ) {
- type = "Dimension Link Second";
- }
- else if ( att->ID() == XCAFDoc::GeomToleranceRefGUID() ){
- type = "GeomTolerance Link";
- }
- else if ( att->ID() == XCAFDoc::DatumRefGUID() ){
- type = "Datum Link";
- }
- else if (att->ID() == XCAFDoc::ViewRefShapeGUID()){
- type = "View Shape Link";
- }
- else if (att->ID() == XCAFDoc::ViewRefGDTGUID()){
- type = "View GD&T Link";
- }
- else if (att->ID() == XCAFDoc::ViewRefPlaneGUID()) {
- type = "View Clipping Plane Link";
- }
- else return 0;
-
- Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast(att);
- TCollection_AsciiString ref;
- Standard_Integer ii = 1;
- if (DETGN->NbFathers()!=0) {
-
- TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
- di << type<< " ==> (" << ref.ToCString();
- for (ii = 2; ii <= DETGN->NbFathers(); ii++) {
- TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
- di << ", " << ref.ToCString();
- }
- di << ") ";
- }
- ii = 1;
- if (DETGN->NbChildren()!=0) {
- TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
- di << type<< " <== (" << ref.ToCString();
- for (ii = 2; ii <= DETGN->NbChildren(); ii++) {
- TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
- di << ", " << ref.ToCString();
- }
- di << ")";
- }
+ TCollection_AsciiString anInfo = XCAFDoc::AttributeInfo ( itr.Value() );
+ if (!anInfo.IsEmpty())
+ {
+ di << anInfo.ToCString();
}
return 0;
}
#include <inspector/Convert_Tools.hxx>
#include <inspector/Convert_TransientShape.hxx>
+#include <AIS_Line.hxx>
#include <AIS_Plane.hxx>
#include <AIS_Shape.hxx>
#include <BRep_Builder.hxx>
#include <BRepPreviewAPI_MakeBox.hxx>
#include <BRepTools.hxx>
#include <gp_XY.hxx>
+#include <Geom_Line.hxx>
#include <Geom_Plane.hxx>
#include <Prs3d_PlaneAspect.hxx>
#include <Standard_Dump.hxx>
gp_Dir aDir;
if (aDir.InitFromJson (theSStream, aStartPos))
{
- thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeEdge (gp::Origin(), aDir.XYZ())));
+ gp_Lin aLin (gp::Origin(), aDir);
+ Handle(Geom_Line) aGeomLine = new Geom_Line (aLin);
+ CreatePresentation (aGeomLine, thePresentations);
return;
}
return Standard_True;
}
+//=======================================================================
+//function : CreatePresentation
+//purpose :
+//=======================================================================
+void Convert_Tools::CreatePresentation (const Handle(Geom_Line)& theLine,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+ Handle(AIS_Line) aLinePrs = new AIS_Line (theLine);
+ aLinePrs->SetColor (Quantity_NOC_TOMATO);
+ thePresentations.Append (aLinePrs);
+}
+
//=======================================================================
//function : CreatePresentation
//purpose :
return;
Handle(AIS_Shape) aSourcePrs = new AIS_Shape (aBoxShape);
+ aSourcePrs->Attributes()->SetAutoTriangulation (Standard_False);
aSourcePrs->SetColor (Quantity_NOC_WHITE);
aSourcePrs->SetTransparency (0.5);
thePresentations.Append (aSourcePrs);
Handle(AIS_Shape) aTransformedPrs = new AIS_Shape (aBoxShape);
+ aTransformedPrs->Attributes()->SetAutoTriangulation (Standard_False);
aTransformedPrs->SetColor (Quantity_NOC_TOMATO);
aTransformedPrs->SetTransparency (0.5);
aTransformedPrs->SetLocalTransformation (theTrsf);
#include <QVariant>
#include <Standard_WarningsRestore.hxx>
+class Geom_Line;
class Geom_Plane;
class Geom_Transformation;
const gp_Pnt& thePntMax,
TopoDS_Shape& theShape);
+ //! Creates presentation AIS_Line
+ //! \param theLine source line
+ //! \param thePresentations container to collect new presentations
+ Standard_EXPORT static void CreatePresentation (const Handle(Geom_Line)& theLine,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
//! Creates presentation AIS_Plane
//! \param thePlane source plane
- //! \param thePresentations container to collect new presentation/s
+ //! \param thePresentations container to collect new presentations
Standard_EXPORT static void CreatePresentation (const Handle(Geom_Plane)& thePlane,
NCollection_List<Handle(Standard_Transient)>& thePresentations);
//! Creates two presentations base on gp_Trsf: box in initial place and transformed box
//! \param thePlane source plane
- //! \param thePresentations container to collect new presentation/s
+ //! \param thePresentations container to collect new presentations
Standard_EXPORT static void CreatePresentation (const gp_Trsf& theTrsf,
NCollection_List<Handle(Standard_Transient)>& thePresentations);
#include <inspector/DFBrowser_ItemRole.hxx>
#include <inspector/DFBrowser_Module.hxx>
#include <inspector/DFBrowser_Tools.hxx>
+#include <inspector/DFBrowser_Window.hxx>
#include <inspector/DFBrowserPane_AttributePane.hxx>
#include <inspector/DFBrowserPane_ItemRole.hxx>
#include <QObject>
#include <Standard_WarningsRestore.hxx>
-//#define USE_DUMPJSON
-
// =======================================================================
// function : hasAttribute
// purpose :
if (!HasAttribute())
return;
-#ifdef USE_DUMPJSON
- Handle(TDF_Attribute) anAttribute = GetAttribute();
- if (!anAttribute.IsNull())
- anAttribute->DumpJson (theOStream);
-#else
- (void)theOStream;
-#endif
+ if (DFBrowser_Window::IsUseDumpJson())
+ {
+ Handle(TDF_Attribute) anAttribute = GetAttribute();
+ if (!anAttribute.IsNull())
+ {
+ anAttribute->DumpJson (theOStream);
+ }
+ }
}
// =======================================================================
#include <inspector/DFBrowserPane_ItemRole.hxx>
#include <inspector/DFBrowserPane_Tools.hxx>
-#include <inspector/DFBrowserPaneXDE_AttributePaneCreator.hxx>
-#include <inspector/DFBrowserPaneXDE_Tools.hxx>
-
#include <XCAFApp_Application.hxx>
+#include <XCAFDoc.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QItemSelectionModel>
myPaneCreators.clear();
RegisterPaneCreator (new DFBrowserPane_AttributePaneCreator());
- if (!theApplication.IsNull() && DFBrowserPaneXDE_Tools::IsXDEApplication (theApplication))
- RegisterPaneCreator (new DFBrowserPaneXDE_AttributePaneCreator (myPaneCreators[0]));
}
// =======================================================================
anAttributePane = dynamic_cast<DFBrowserPane_AttributePane*> (anAPIPane);
}
+ TCollection_AsciiString anInfo;
+ if (theRole == DFBrowser_ItemRole_AdditionalInfo)
+ {
+ anInfo = XCAFDoc::AttributeInfo (theAttribute);
+ }
QVariant aValue;
- if (anAttributePane)
+ if (!anInfo.IsEmpty())
+ {
+ aValue = anInfo.ToCString();
+ }
+ else if (anAttributePane)
aValue = anAttributePane->GetAttributeInfo (theAttribute,
theRole == DFBrowser_ItemRole_AdditionalInfo ? DFBrowserPane_ItemRole_ShortInfo : theRole,
theColumnId);
Qt::ItemFlags DFBrowser_TreeLevelViewModel::flags (const QModelIndex& theIndex) const
{
if (!theIndex.isValid())
- return 0;
+ return Qt::NoItemFlags;
Qt::ItemFlags aFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return aFlags;
// =======================================================================
void DFBrowser_TreeModel::InitColumns()
{
- SetHeaderItem (0, TreeModel_HeaderSection ("Name"));
+ setHeaderItem (0, TreeModel_HeaderSection ("Name"));
}
// =======================================================================
#include <OSD_Directory.hxx>
#include <OSD_Environment.hxx>
#include <OSD_Protection.hxx>
-#include <OSD_Thread.hxx>
+
#include <inspector/View_Displayer.hxx>
#include <inspector/View_ToolBar.hxx>
#include <inspector/View_Viewer.hxx>
#include <inspector/ViewControl_Tools.hxx>
#include <Standard_WarningsDisable.hxx>
-#include <Standard_ThreadId.hxx>
#include <QAction>
#include <QApplication>
#include <QComboBox>
#include <QList>
#include <QMainWindow>
#include <QItemSelectionModel>
+#include <QPushButton>
#include <QTabWidget>
#include <QToolBar>
#include <QTreeView>
const int DEFAULT_PROPERTY_PANEL_HEIGHT = 200;
const int DEFAULT_BROWSER_HEIGHT = 800;
-//#define USE_DUMPJSON
+static Standard_Boolean MyIsUseDumpJson = Standard_False;
// =======================================================================
// function : Constructor
connect (aLevelView, SIGNAL (indexDoubleClicked (const QModelIndex&)),
this, SLOT (onLevelDoubleClicked (const QModelIndex&)));
- // property widget
- QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
+ // property custom panel with specific parameters of attributes
+ QDockWidget* aPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel (custom)"), myMainWindow);
aPropertyPanelWidget->setObjectName (aPropertyPanelWidget->windowTitle());
aPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
aPropertyPanelWidget->setWidget (myPropertyPanel->GetControl());
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, aPropertyPanelWidget);
- // property view
-#ifdef USE_DUMPJSON
- myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel (DumpJson)"), myMainWindow);
+ // property panel
+ myUseDumpJson = new QWidget(myMainWindow);
+ QVBoxLayout* aLay = new QVBoxLayout(myUseDumpJson);
+ QPushButton* aUseDumpJson = new QPushButton ("Use DumpJson", myMainWindow);
+ aLay->addWidget (aUseDumpJson);
+ aLay->addStretch(1);
+ connect(aUseDumpJson, SIGNAL (clicked (bool)), this, SLOT (onUseDumpJson()));
+ myUseDumpJson->setVisible (false);
+
+ myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
myPropertyView = new ViewControl_PropertyView (myMainWindow,
QSize(DFBROWSER_DEFAULT_VIEW_WIDTH, DFBROWSER_DEFAULT_VIEW_HEIGHT));
myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle());
myPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
myPropertyPanelWidget->setWidget (myPropertyView->GetControl());
+ updatePropertyPanelWidget();
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
-#endif
// dump view window
QWidget* aDumpWidget = new QWidget(myMainWindow);
myViewWindow->Displayer()->SetAttributeColor (Quantity_Color(aHColor.red() / 255., aHColor.green() / 255.,
aHColor.blue() / 255., Quantity_TOC_sRGB), View_PresentationType_Additional);
- myMainWindow->splitDockWidget (aPropertyPanelWidget, aViewDockWidget, Qt::Vertical);
+ myMainWindow->splitDockWidget (myPropertyPanelWidget, aViewDockWidget, Qt::Vertical);
+ myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aPropertyPanelWidget);
-#ifdef USE_DUMPJSON
- myMainWindow->tabifyDockWidget (aDumpDockWidget, myPropertyPanelWidget);
- myMainWindow->tabifyDockWidget (myPropertyPanelWidget, aViewDockWidget);
-#else
myMainWindow->tabifyDockWidget (aDumpDockWidget, aViewDockWidget);
-#endif
myTreeView->resize (DFBROWSER_DEFAULT_TREE_VIEW_WIDTH, DFBROWSER_DEFAULT_TREE_VIEW_HEIGHT);
return aTmpDir;
}
+// =======================================================================
+// function : SetUseDumpJson
+// purpose :
+// =======================================================================
+void DFBrowser_Window::SetUseDumpJson (const Standard_Boolean theValue)
+{
+ MyIsUseDumpJson = theValue;
+}
+
+// =======================================================================
+// function : IsUseDumpJson
+// purpose :
+// =======================================================================
+Standard_Boolean DFBrowser_Window::IsUseDumpJson()
+{
+ return MyIsUseDumpJson;
+}
+
// =======================================================================
// function : onTreeViewContextMenuRequested
// purpose :
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand All"), SLOT (onExpandAll()), GetMainWindow(), this));
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Collapse All"), SLOT (onCollapseAll()), GetMainWindow(), this));
+ aMenu->addSeparator();
+ QAction* aUseDumpJsonAction = ViewControl_Tools::CreateAction (tr ("Use DumpJson"), SLOT (onUseDumpJson()), GetMainWindow(), this);
+ aUseDumpJsonAction->setCheckable(true);
+ aUseDumpJsonAction->setChecked (IsUseDumpJson());
+ aMenu->addAction (aUseDumpJsonAction);
+
QPoint aPoint = myTreeView->mapToGlobal (thePosition);
aMenu->exec (aPoint);
}
}
}
+// =======================================================================
+// function : onUseDumpJson
+// purpose :
+// =======================================================================
+void DFBrowser_Window::onUseDumpJson()
+{
+ SetUseDumpJson(!IsUseDumpJson());
+ updatePropertyPanelWidget();
+
+ QApplication::setOverrideCursor (Qt::WaitCursor);
+ myModule->UpdateTreeModel();
+ QApplication::restoreOverrideCursor();
+}
+
// =======================================================================
// function : onTreeViewSelectionChanged
// purpose :
if (!myModule)
return;
-#ifdef USE_DUMPJSON
- if (myPropertyPanelWidget->toggleViewAction()->isChecked())
- myPropertyView->Init (ViewControl_Tools::CreateTableModelValues (myTreeView->selectionModel()));
-#endif
+ if (IsUseDumpJson() && myPropertyPanelWidget->toggleViewAction()->isChecked())
+ {
+ myPropertyView->Init (ViewControl_Tools::CreateTableModelValues (myTreeView->selectionModel()));
+ }
// previuos selection should be cleared in the panel selectors
DFBrowser_AttributePaneStack* anAttributePaneStack = myPropertyPanel->GetAttributesStack();
thePresentations.Append (aPresentation);
}
}
+
+// =======================================================================
+// function : updatePropertyPanelWidget
+// purpose :
+// =======================================================================
+void DFBrowser_Window::updatePropertyPanelWidget()
+{
+ bool aUseDumpJson = IsUseDumpJson();
+
+ myUseDumpJson->setVisible (!aUseDumpJson);
+ myPropertyPanelWidget->setWidget (aUseDumpJson ? myPropertyView->GetControl() : myUseDumpJson);
+}
//! \return string value
Standard_EXPORT static TCollection_AsciiString TmpDirectory();
+ //! Sets whether DumpJson is used when the tree view is generated
+ Standard_EXPORT static void SetUseDumpJson(const Standard_Boolean theValue);
+
+ //! Returns whether DumpJson is used when the tree view is generated
+ Standard_EXPORT static Standard_Boolean IsUseDumpJson();
+
private slots:
//! Cleans history in tree level line, clears cache of thread processing, starts threads for application
//! Collapses all levels for all selected items
void onCollapseAll();
+ //! Setting flag whether DumpJSon should be applied to build tree model items structure
+ void onUseDumpJson();
+
//! Updates all controls by changed selection in OCAF tree view
//! \param theSelected list of selected tree view items
//! \param theDeselected list of deselected tree view items
//! \return container of presentations or NULL
void findPresentations (const QModelIndexList& theIndices, AIS_ListOfInteractive& thePresentations);
+ //! Updates content of Property Panel dock widget. It contains button to activate DumpJson or view with content of it.
+ void updatePropertyPanelWidget();
+
private:
DFBrowser_Module* myModule; //!< current module
DFBrowser_TreeLevelLine* myTreeLevelLine; //!< navigate line of tree levels to the selected item
QTreeView* myTreeView; //!< OCAF tree view
QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget
+ QWidget* myUseDumpJson; //!< button to activate/deactivate using of DumpJson
DFBrowser_PropertyPanel* myPropertyPanel; //!< property panel shows full information about attribute or search view
ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
View_Window* myViewWindow; //!< V3d view to visualize presentations/references if it can be build for a selected item
#include <inspector/DFBrowserPane_AttributePaneCreator.hxx>
#include <TDF_Attribute.hxx>
-
#include <TDF_Reference.hxx>
-// the types are defined in TDF library
-#include <inspector/DFBrowserPane_TDFReference.hxx>
-#include <inspector/DFBrowserPane_TDFTagSource.hxx>
-
-#include <TDataStd_Current.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDataStd_Comment.hxx>
-#include <TDataStd_Integer.hxx>
-#include <TDataStd_IntegerArray.hxx>
-#include <TDataStd_Real.hxx>
-#include <TDataStd_RealArray.hxx>
-#include <TDataStd_ExtStringArray.hxx>
-#include <TDataStd_UAttribute.hxx>
#include <TDataStd_TreeNode.hxx>
-#include <TDataStd_Directory.hxx>
-#include <TDataStd_NoteBook.hxx>
-#include <TDataStd_Expression.hxx>
-#include <TDataStd_Relation.hxx>
-#include <TDataStd_Variable.hxx>
-#include <TDataStd_Tick.hxx>
-#include <TDataStd_AsciiString.hxx>
-#include <TDataStd_IntPackedMap.hxx>
-#include <TDataStd_IntegerList.hxx>
-#include <TDataStd_RealList.hxx>
-#include <TDataStd_ExtStringList.hxx>
-#include <TDataStd_BooleanList.hxx>
#include <TDataStd_ReferenceList.hxx>
-#include <TDataStd_BooleanArray.hxx>
#include <TDataStd_ReferenceArray.hxx>
-#include <TDataStd_ByteArray.hxx>
-#include <TDataStd_NamedData.hxx>
-
-#include <TDocStd_Modified.hxx>
-#include <TDocStd_Owner.hxx>
-#include <TDocStd_XLink.hxx>
-#include <TDocStd_XLinkRoot.hxx>
-#include <TPrsStd_AISViewer.hxx>
-#include <TPrsStd_AISPresentation.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Naming.hxx>
#include <TNaming_UsedShapes.hxx>
-#include <TFunction_Function.hxx>
-#include <TFunction_GraphNode.hxx>
-#include <TFunction_Scope.hxx>
-
-// the types are defined in TDataStd.cdl
-// Basic attributes
-#include <inspector/DFBrowserPane_TDataStdCurrent.hxx>
-#include <inspector/DFBrowserPane_TDataStdName.hxx>
-#include <inspector/DFBrowserPane_TDataStdComment.hxx>
-#include <inspector/DFBrowserPane_TDataStdInteger.hxx>
-#include <inspector/DFBrowserPane_TDataStdIntegerArray.hxx>
-#include <inspector/DFBrowserPane_TDataStdReal.hxx>
-#include <inspector/DFBrowserPane_TDataStdRealArray.hxx>
-#include <inspector/DFBrowserPane_TDataStdExtStringArray.hxx>
-#include <inspector/DFBrowserPane_TDataStdUAttribute.hxx>
-
-#include <inspector/DFBrowserPane_TDataStdTreeNode.hxx>
-#include <inspector/DFBrowserPane_TDataStdDirectory.hxx>
-#include <inspector/DFBrowserPane_TDataStdNoteBook.hxx>
-#include <inspector/DFBrowserPane_TDataStdExpression.hxx>
-#include <inspector/DFBrowserPane_TDataStdRelation.hxx>
-#include <inspector/DFBrowserPane_TDataStdVariable.hxx>
-
-//Extension
-#include <inspector/DFBrowserPane_TDataStdTick.hxx>
-#include <inspector/DFBrowserPane_TDataStdAsciiString.hxx>
-#include <inspector/DFBrowserPane_TDataStdIntPackedMap.hxx>
-// Lists:
-#include <inspector/DFBrowserPane_TDataStdIntegerList.hxx>
-#include <inspector/DFBrowserPane_TDataStdRealList.hxx>
-#include <inspector/DFBrowserPane_TDataStdExtStringList.hxx>
-#include <inspector/DFBrowserPane_TDataStdBooleanList.hxx>
+#include <inspector/DFBrowserPane_TDFReference.hxx>
#include <inspector/DFBrowserPane_TDataStdReferenceList.hxx>
-
-// Arrays:
-#include <inspector/DFBrowserPane_TDataStdBooleanArray.hxx>
#include <inspector/DFBrowserPane_TDataStdReferenceArray.hxx>
-#include <inspector/DFBrowserPane_TDataStdByteArray.hxx>
-#include <inspector/DFBrowserPane_TDataStdNamedData.hxx>
-
-// TDocStd attributes
-#include <inspector/DFBrowserPane_TDocStdModified.hxx>
-#include <inspector/DFBrowserPane_TDocStdOwner.hxx>
-#include <inspector/DFBrowserPane_TDocStdXLink.hxx>
-#include <inspector/DFBrowserPane_TDocStdXLinkRoot.hxx>
-
-// TPrsStd attributes
-#include <inspector/DFBrowserPane_TPrsStdAISViewer.hxx>
-#include <inspector/DFBrowserPane_TPrsStdAISPresentation.hxx>
-
-// TNaming attributes
+#include <inspector/DFBrowserPane_TDataStdTreeNode.hxx>
#include <inspector/DFBrowserPane_TNamingNamedShape.hxx>
#include <inspector/DFBrowserPane_TNamingNaming.hxx>
#include <inspector/DFBrowserPane_TNamingUsedShapes.hxx>
-// TFunction attributes
-#include <inspector/DFBrowserPane_TFunctionFunction.hxx>
-#include <inspector/DFBrowserPane_TFunctionGraphNode.hxx>
-#include <inspector/DFBrowserPane_TFunctionScope.hxx>
-
// =======================================================================
// function : Constructor
// purpose :
DFBrowserPane_AttributePaneAPI* aPane = 0;
if (theAttributeName == STANDARD_TYPE (TDF_Reference)->Name())
aPane = new DFBrowserPane_TDFReference();
- else if (theAttributeName == STANDARD_TYPE (TDF_TagSource)->Name())
- aPane = new DFBrowserPane_TDFTagSource();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Current)->Name()) // Basic attributes
- aPane = new DFBrowserPane_TDataStdCurrent();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Name)->Name())
- aPane = new DFBrowserPane_TDataStdName();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Comment)->Name())
- aPane = new DFBrowserPane_TDataStdComment();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Integer)->Name())
- aPane = new DFBrowserPane_TDataStdInteger();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_IntegerArray)->Name())
- aPane = new DFBrowserPane_TDataStdIntegerArray();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Real)->Name())
- aPane = new DFBrowserPane_TDataStdReal();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_RealArray)->Name())
- aPane = new DFBrowserPane_TDataStdRealArray();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_ExtStringArray)->Name())
- aPane = new DFBrowserPane_TDataStdExtStringArray();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_UAttribute)->Name())
- aPane = new DFBrowserPane_TDataStdUAttribute();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_TreeNode)->Name()) // Attributes for organization
+ else if (theAttributeName == STANDARD_TYPE (TDataStd_TreeNode)->Name())
aPane = new DFBrowserPane_TDataStdTreeNode();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Directory)->Name())
- aPane = new DFBrowserPane_TDataStdDirectory();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_NoteBook)->Name()) // Other attributes
- aPane = new DFBrowserPane_TDataStdNoteBook();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Expression)->Name())
- aPane = new DFBrowserPane_TDataStdExpression();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Relation)->Name())
- aPane = new DFBrowserPane_TDataStdRelation();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Variable)->Name())
- aPane = new DFBrowserPane_TDataStdVariable();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_Tick)->Name()) //Extension
- aPane = new DFBrowserPane_TDataStdTick();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_AsciiString)->Name())
- aPane = new DFBrowserPane_TDataStdAsciiString();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_IntPackedMap)->Name())
- aPane = new DFBrowserPane_TDataStdIntPackedMap();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_IntegerList)->Name()) // Lists
- aPane = new DFBrowserPane_TDataStdIntegerList();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_RealList)->Name())
- aPane = new DFBrowserPane_TDataStdRealList();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_ExtStringList)->Name())
- aPane = new DFBrowserPane_TDataStdExtStringList();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_BooleanList)->Name())
- aPane = new DFBrowserPane_TDataStdBooleanList();
else if (theAttributeName == STANDARD_TYPE (TDataStd_ReferenceList)->Name())
aPane = new DFBrowserPane_TDataStdReferenceList();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_BooleanArray)->Name()) // Arrays:
- aPane = new DFBrowserPane_TDataStdBooleanArray();
else if (theAttributeName == STANDARD_TYPE (TDataStd_ReferenceArray)->Name())
aPane = new DFBrowserPane_TDataStdReferenceArray();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_ByteArray)->Name())
- aPane = new DFBrowserPane_TDataStdByteArray();
- else if (theAttributeName == STANDARD_TYPE (TDataStd_NamedData)->Name())
- aPane = new DFBrowserPane_TDataStdNamedData();
- else if (theAttributeName == STANDARD_TYPE (TDocStd_Modified)->Name()) // TDocStd attributes
- aPane = new DFBrowserPane_TDocStdModified();
- else if (theAttributeName == STANDARD_TYPE (TDocStd_Owner)->Name())
- aPane = new DFBrowserPane_TDocStdOwner();
- else if (theAttributeName == STANDARD_TYPE (TDocStd_XLink)->Name())
- aPane = new DFBrowserPane_TDocStdXLink();
- else if (theAttributeName == STANDARD_TYPE (TDocStd_XLinkRoot)->Name())
- aPane = new DFBrowserPane_TDocStdXLinkRoot();
- else if (theAttributeName == STANDARD_TYPE (TPrsStd_AISViewer)->Name()) // TPrsStd attributes
- aPane = new DFBrowserPane_TPrsStdAISViewer();
- else if (theAttributeName == STANDARD_TYPE (TPrsStd_AISPresentation)->Name())
- aPane = new DFBrowserPane_TPrsStdAISPresentation();
- else if (theAttributeName == STANDARD_TYPE (TNaming_NamedShape)->Name()) // TNaming attributes
+ else if (theAttributeName == STANDARD_TYPE (TNaming_NamedShape)->Name())
aPane = new DFBrowserPane_TNamingNamedShape();
else if (theAttributeName == STANDARD_TYPE (TNaming_Naming)->Name())
aPane = new DFBrowserPane_TNamingNaming();
else if (theAttributeName == STANDARD_TYPE (TNaming_UsedShapes)->Name())
aPane = new DFBrowserPane_TNamingUsedShapes();
- else if (theAttributeName == STANDARD_TYPE (TFunction_Function)->Name()) // TFunction attributes
- aPane = new DFBrowserPane_TFunctionFunction();
- else if (theAttributeName == STANDARD_TYPE (TFunction_GraphNode)->Name())
- aPane = new DFBrowserPane_TFunctionGraphNode();
- else if (theAttributeName == STANDARD_TYPE (TFunction_Scope)->Name())
- aPane = new DFBrowserPane_TFunctionScope();
return aPane;
}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDFTagSource.hxx>
-
-#include <TDF_TagSource.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDFTagSource::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDF_TagSource) anAttribute = Handle(TDF_TagSource)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append ("Get");
- theValues.append (anAttribute->Get());
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDFTagSource_H
-#define DFBrowserPane_TDFTagSource_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDFTagSource
-//! \brief The class to manipulate of TDF_TagSource attribute
-class DFBrowserPane_TDFTagSource : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDFTagSource() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDFTagSource() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdAsciiString.hxx>
-
-#include <TDataStd_AsciiString.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QIcon>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdAsciiString::GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(TDataStd_AsciiString) anAttribute = Handle(TDataStd_AsciiString)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append ("Get");
- theValues.append (anAttribute->Get().ToCString());
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdAsciiString_H
-#define DFBrowserPane_TDataStdAsciiString_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdAsciiString
-//! \brief The class to manipulate of TDataStd_AsciiString attribute
-class DFBrowserPane_TDataStdAsciiString : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdAsciiString() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdAsciiString() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdBooleanArray.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <TDataStd_BooleanArray.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QGridLayout>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdBooleanArray::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
-
- myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdBooleanArray::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdBooleanArray::GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(TDataStd_BooleanArray) anAttribute = Handle(TDataStd_BooleanArray)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append (anAttribute->Lower());
- theValues.append (anAttribute->Upper());
- for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
- theValues.append (anAttribute->Value (aValueId));
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdBooleanArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
- return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdBooleanArray_H
-#define DFBrowserPane_TDataStdBooleanArray_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdBooleanArray
-//! \brief The class to manipulate of TDataStd_BooleanArray attribute
-class DFBrowserPane_TDataStdBooleanArray : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdBooleanArray() : DFBrowserPane_AttributePane(), myArrayTableHelper(getPaneModel()) {}
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPane_TDataStdBooleanArray() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Calls Init of array table helper
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns short attribute information using array table helper
- //! \param theAttribute a current attribute
- //! \param theValues container of output values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperArray myArrayTableHelper; //!< common interface to fill array pane
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdBooleanList.hxx>
-
-#include <TDataStd_BooleanList.hxx>
-#include <TDataStd_ListIteratorOfListOfByte.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdBooleanList::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_BooleanList) anAttribute = Handle(TDataStd_BooleanList)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- for (TDataStd_ListIteratorOfListOfByte aBoolListIt (anAttribute->List()); aBoolListIt.More(); aBoolListIt.Next())
- {
- theValues.append ("Value");
- theValues.append (aBoolListIt.Value());
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdBooleanList_H
-#define DFBrowserPane_TDataStdBooleanList_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdBooleanList
-//! \brief The class to manipulate of TDataStd_BooleanList attribute
-class DFBrowserPane_TDataStdBooleanList : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdBooleanList() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdBooleanList() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdByteArray.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <TDataStd_ByteArray.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdByteArray::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
-
- myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdByteArray::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdByteArray::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_ByteArray) anAttribute = Handle(TDataStd_ByteArray)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append (anAttribute->Lower());
- theValues.append (anAttribute->Upper());
- for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
- theValues.append (anAttribute->Value (aValueId));
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdByteArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
- return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdByteArray_H
-#define DFBrowserPane_TDataStdByteArray_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdByteArray
-//! \brief The class to manipulate of TDataStd_ByteArra attribute
-class DFBrowserPane_TDataStdByteArray : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdByteArray() : DFBrowserPane_AttributePane(), myArrayTableHelper(getPaneModel()) {}
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPane_TDataStdByteArray() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Calls Init of array table helper
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns short attribute information using array table helper
- //! \param theAttribute a current attribute
- //! \param theValues container of output values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperArray myArrayTableHelper; //!< common interface to fill array pane
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdComment.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_Comment.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdComment::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Comment) anAttribute = Handle(TDataStd_Comment)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append ("Get");
- theValues.append (DFBrowserPane_Tools::ToString (anAttribute->Get()));
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdComment_H
-#define DFBrowserPane_TDataStdComment_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdComment
-//! \brief The class to manipulate of TDataStd_Comment attribute
-class DFBrowserPane_TDataStdComment : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdComment() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdComment() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdCurrent.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_Current.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdCurrent::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Current) anAttribute = Handle(TDataStd_Current)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append ("GetLabel");
- theValues.append (DFBrowserPane_Tools::GetEntry (anAttribute->GetLabel()).ToCString());
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdCurrent_H
-#define DFBrowserPane_TDataStdCurrent_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdCurrent
-//! \brief The class to manipulate of TDataStd_Current attribute
-class DFBrowserPane_TDataStdCurrent : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdCurrent() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdCurrent() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdDirectory.hxx>
-
-#include <TDataStd_Directory.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdDirectory::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdDirectory_H
-#define DFBrowserPane_TDataStdDirectory_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdDirectory
-//! \brief The class to manipulate of TDataStd_Directory attribute
-class DFBrowserPane_TDataStdDirectory : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdDirectory() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdDirectory() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdExpression.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_Expression.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdExpression::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Expression) anAttribute = Handle(TDataStd_Expression)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append ("GetExpression");
- theValues.append (DFBrowserPane_Tools::ToString (anAttribute->GetExpression()));
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdExpression_H
-#define DFBrowserPane_TDataStdExpression_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdExpression
-//! \brief The class to manipulate of TDataStd_Expression attribute
-class DFBrowserPane_TDataStdExpression : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdExpression() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdExpression() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdExtStringArray.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <TDataStd_ExtStringArray.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdExtStringArray::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
-
- myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdExtStringArray::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdExtStringArray::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_ExtStringArray) anAttribute = Handle(TDataStd_ExtStringArray)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append (anAttribute->Lower());
- theValues.append (anAttribute->Upper());
- for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
- theValues.append (DFBrowserPane_Tools::ToString (anAttribute->Value(aValueId)));
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdExtStringArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
- return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdExtStringArray_H
-#define DFBrowserPane_TDataStdExtStringArray_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdExtStringArray
-//! \brief The class to manipulate of TDataStd_ExtStringArray attribute
-class DFBrowserPane_TDataStdExtStringArray : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdExtStringArray() : DFBrowserPane_AttributePane(), myArrayTableHelper(getPaneModel()) {}
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPane_TDataStdExtStringArray() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Calls Init of array table helper
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns short attribute information using array table helper
- //! \param theAttribute a current attribute
- //! \param theValues container of output values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperArray myArrayTableHelper; //!< common interface to fill array pane
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdExtStringList.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_ExtStringList.hxx>
-#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdExtStringList::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_ExtStringList) anAttribute = Handle(TDataStd_ExtStringList)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- for (TDataStd_ListIteratorOfListOfExtendedString aValuesIt(anAttribute->List()); aValuesIt.More(); aValuesIt.Next())
- {
- theValues.append ("Value");
- theValues.append (DFBrowserPane_Tools::ToString (aValuesIt.Value()));
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdExtStringList_H
-#define DFBrowserPane_TDataStdExtStringList_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdExtStringList
-//! \brief The class to manipulate of TDataStd_ExtStringList attribute
-class DFBrowserPane_TDataStdExtStringList : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdExtStringList() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdExtStringList() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdIntPackedMap.hxx>
-
-#include <TDataStd_IntPackedMap.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdIntPackedMap::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_IntPackedMap) anAttribute = Handle(TDataStd_IntPackedMap)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- int anIndexInMap = 0;
- for (TColStd_MapIteratorOfPackedMapOfInteger aValueIt(anAttribute->GetMap()); aValueIt.More(); aValueIt.Next(), anIndexInMap++)
- {
- theValues.append (QString ("GetMap [%1]").arg(anIndexInMap));
- theValues.append (aValueIt.Key());
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdIntPackedMap_H
-#define DFBrowserPane_TDataStdIntPackedMap_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdIntPackedMap
-//! \brief The class to manipulate of TDataStd_IntPackedMap attribute
-class DFBrowserPane_TDataStdIntPackedMap : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdIntPackedMap() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdIntPackedMap() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdInteger.hxx>
-
-#include <TDataStd_Integer.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdInteger::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Integer) anAttribute = Handle(TDataStd_Integer)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append ("Get");
- theValues.append (anAttribute->Get());
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdInteger_H
-#define DFBrowserPane_TDataStdInteger_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdInteger
-//! \brief The class to manipulate of TDataStd_Integer attribute
-class DFBrowserPane_TDataStdInteger : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdInteger() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdInteger() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdIntegerArray.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <TDataStd_IntegerArray.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdIntegerArray::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
-
- myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdIntegerArray::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdIntegerArray::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_IntegerArray) anAttribute = Handle(TDataStd_IntegerArray)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append (anAttribute->Lower());
- theValues.append (anAttribute->Upper());
- for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
- theValues.append (anAttribute->Value(aValueId));
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdIntegerArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
- return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdIntegerArray_H
-#define DFBrowserPane_TDataStdIntegerArray_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdIntegerArray
-//! \brief The class to manipulate of TDataStd_IntegerArray attribute
-class DFBrowserPane_TDataStdIntegerArray : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdIntegerArray() : DFBrowserPane_AttributePane(), myArrayTableHelper(getPaneModel()) {}
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPane_TDataStdIntegerArray() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Calls Init of array table helper
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns short attribute information using array table helper
- //! \param theAttribute a current attribute
- //! \param theValues container of output values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperArray myArrayTableHelper; //!< common interface to fill array pane
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdIntegerList.hxx>
-
-#include <TDataStd_IntegerList.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdIntegerList::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_IntegerList) anAttribute = Handle(TDataStd_IntegerList)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- for (TColStd_ListIteratorOfListOfInteger aValuesIt (anAttribute->List()); aValuesIt.More(); aValuesIt.Next())
- {
- theValues.append ("Value");
- theValues.append (aValuesIt.Value());
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdIntegerList_H
-#define DFBrowserPane_TDataStdIntegerList_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdIntegerList
-//! \brief The class to manipulate of TDataStd_IntegerList attribute
-class DFBrowserPane_TDataStdIntegerList : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdIntegerList() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdIntegerList() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdName.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_Name.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdName::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Name) anAttribute = Handle(TDataStd_Name)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append ("Get");
- theValues.append (DFBrowserPane_Tools::ToString (anAttribute->Get()));
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdName_H
-#define DFBrowserPane_TDataStdName_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdName
-//! \brief The class to manipulate of TDataStd_Name attribute
-class DFBrowserPane_TDataStdName : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdName() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdName() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdNamedData.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TColStd_DataMapOfStringInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-
-#include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
-#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
-#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
-#include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
-#include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
-#include <TDataStd_DataMapOfStringByte.hxx>
-#include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
-#include <TDataStd_DataMapOfStringReal.hxx>
-#include <TDataStd_DataMapOfStringString.hxx>
-#include <TDataStd_HDataMapOfStringHArray1OfInteger.hxx>
-#include <TDataStd_NamedData.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QTableView>
-#include <QTabWidget>
-#include <QVariant>
-#include <QVBoxLayout>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-static const QString VALUES_INTEGER = "values_integer";
-static const QString VALUES_REAL = "values_real";
-static const QString VALUES_STRING = "values_string";
-static const QString VALUES_BYTE = "values_byte";
-static const QString VALUES_INT_ARRAY = "values_int_array";
-static const QString VALUES_REAL_ARRAY = "values_real_array";
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPane_TDataStdNamedData::DFBrowserPane_TDataStdNamedData()
- : DFBrowserPane_AttributePane(), myRealValues (0), myStringValues(0), myByteValues(0), myIntArrayValues(0),
- myRealArrayValues(0)
-{
- myPaneModel = createPaneModel();
- myRealValuesModel = createPaneModel();
- myStringValuesModel = createPaneModel();
- myByteValuesModel = createPaneModel();
- myIntArrayValuesModel = createPaneModel();
- myRealArrayModel = createPaneModel();
-}
-
-// =======================================================================
-// function : createPaneModel
-// purpose :
-// =======================================================================
-DFBrowserPane_AttributePaneModel* DFBrowserPane_TDataStdNamedData::createPaneModel()
-{
- DFBrowserPane_AttributePaneModel* aTableModel = new DFBrowserPane_AttributePaneModel();
- aTableModel->SetColumnCount (2);
- aTableModel->SetItalicColumns (QList<int>());
- return aTableModel;
-}
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdNamedData::CreateWidget (QWidget* theParent)
-{
- QTabWidget* aMainWidget = new QTabWidget (theParent);
- // gray text is visualized by default, better the black one (Qt4)
- QPalette aPalette = aMainWidget->palette();
- aPalette.setColor(QPalette::Foreground, Qt::black);
- aMainWidget->setPalette (aPalette);
-
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
- aMainWidget->addTab (myTableView, "Integers");
-
- myRealValues = new DFBrowserPane_TableView (aMainWidget);
- myRealValues->SetModel (myRealValuesModel);
- aMainWidget->addTab (myRealValues, "Reals");
-
- myStringValues = new DFBrowserPane_TableView (aMainWidget);
- myStringValues->SetModel (myStringValuesModel);
- aMainWidget->addTab (myStringValues, "Strings");
-
- myByteValues = new DFBrowserPane_TableView (aMainWidget);
- myByteValues->SetModel (myByteValuesModel);
- aMainWidget->addTab (myByteValues, "Bytes");
-
- myIntArrayValues = new DFBrowserPane_TableView (aMainWidget);
- myIntArrayValues->SetModel (myIntArrayValuesModel);
- aMainWidget->addTab (myIntArrayValues, "ArraysOfIntegers");
-
- myRealArrayValues = new DFBrowserPane_TableView (aMainWidget);
- myRealArrayValues->SetModel (myRealArrayModel);
- aMainWidget->addTab (myRealArrayValues, "ArraysOfReals");
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdNamedData::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
-
- getPaneModel()->Init (getPartOfValues (VALUES_INTEGER, VALUES_REAL, aValues));
- if (myTableView)
- myTableView->GetTableView()->resizeColumnToContents (0);
- myRealValuesModel->Init (getPartOfValues (VALUES_REAL, VALUES_STRING, aValues));
- if (myRealValues)
- myRealValues->GetTableView()->resizeColumnToContents (0);
- myStringValuesModel->Init (getPartOfValues (VALUES_STRING, VALUES_BYTE, aValues));
- if (myStringValues)
- myStringValues->GetTableView()->resizeColumnToContents (0);
- myByteValuesModel->Init (getPartOfValues (VALUES_BYTE, VALUES_INT_ARRAY, aValues));
- if (myByteValues)
- myByteValues->GetTableView()->resizeColumnToContents (0);
- myIntArrayValuesModel->Init (getPartOfValues (VALUES_INT_ARRAY, VALUES_REAL_ARRAY, aValues));
- if (myIntArrayValues)
- myIntArrayValues->GetTableView()->resizeColumnToContents (0);
- myRealArrayModel->Init (getPartOfValues (VALUES_REAL_ARRAY, "", aValues));
- if (myRealArrayValues)
- myRealArrayValues->GetTableView()->resizeColumnToContents (0);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdNamedData::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_NamedData) anAttribute = Handle(TDataStd_NamedData)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append (VALUES_INTEGER);
- for (TColStd_DataMapIteratorOfDataMapOfStringInteger anIntIter(anAttribute->GetIntegersContainer());
- anIntIter.More(); anIntIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (anIntIter.Key()));
- theValues.append (anIntIter.Value());
- }
- theValues.append (VALUES_REAL);
- for (TDataStd_DataMapIteratorOfDataMapOfStringReal aRealIter(anAttribute->GetRealsContainer());
- aRealIter.More(); aRealIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (aRealIter.Key()));
- theValues.append (aRealIter.Value());
- }
- theValues.append (VALUES_STRING);
- for (TDataStd_DataMapIteratorOfDataMapOfStringString aStrIter(anAttribute->GetStringsContainer());
- aStrIter.More(); aStrIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (aStrIter.Key()));
- theValues.append (DFBrowserPane_Tools::ToString (aStrIter.Value()));
- }
- theValues.append (VALUES_BYTE);
- for (TDataStd_DataMapIteratorOfDataMapOfStringByte aByteIter(anAttribute->GetBytesContainer());
- aByteIter.More(); aByteIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (aByteIter.Key()));
- theValues.append (aByteIter.Value());
- }
- theValues.append (VALUES_INT_ARRAY);
- QStringList anArrayValues;
- for (TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger anIntArrayIter(anAttribute->GetArraysOfIntegersContainer());
- anIntArrayIter.More(); anIntArrayIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (anIntArrayIter.Key()));
- anArrayValues.clear();
- const Handle(TColStd_HArray1OfInteger)& aSubIt = anIntArrayIter.Value();
- if (!aSubIt.IsNull())
- {
- for (Standard_Integer aLowerId = aSubIt->Lower(), i = aLowerId, anUpperId = aSubIt->Upper(); i <= anUpperId; i++)
- anArrayValues.append (QString::number (aSubIt->Value (i)));
- }
- theValues.append (anArrayValues.join (QString (',')));
- }
- theValues.append (VALUES_REAL_ARRAY);
- for (TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal aRealArrayIter (anAttribute->GetArraysOfRealsContainer());
- aRealArrayIter.More(); aRealArrayIter.Next())
- {
- theValues.append (DFBrowserPane_Tools::ToString (aRealArrayIter.Key()));
- anArrayValues.clear();
- const Handle(TColStd_HArray1OfReal)& aSubIt = aRealArrayIter.Value();
- if (!aSubIt.IsNull())
- {
- for (Standard_Integer aLowerId = aSubIt->Lower(), i = aLowerId, anUpperId = aSubIt->Upper(); i <= anUpperId; i++)
- anArrayValues.append (QString::number (aSubIt->Value (i)));
- }
- theValues.append (anArrayValues.join (QString (',')));
- }
-}
-
-// =======================================================================
-// function : getPartOfValues
-// purpose :
-// =======================================================================
-QList<QVariant> DFBrowserPane_TDataStdNamedData::getPartOfValues (const QString& theKey1, const QString& theKey2,
- const QList<QVariant>& theValues) const
-{
- QList<QVariant> aValues;
-
- bool aFoundKey1 = false, aFoundKey2 = false;
- for (int aValueId = 0; aValueId < theValues.size() && !aFoundKey2; aValueId++)
- {
- QString aValue = theValues[aValueId].toString();
- if (!aFoundKey1)
- aFoundKey1 = aValue == theKey1;
- else
- {
- aFoundKey2 = aValue == theKey2;
- if (!aFoundKey2)
- aValues.append (aValue);
- }
- }
- return aValues;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdNamedData_H
-#define DFBrowserPane_TDataStdNamedData_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-class DFBrowserPane_AttributePaneModel;
-class DFBrowserPane_TableView;
-
-//! \class DFBrowserPane_TDataStdNamedData
-//! \brief The class to manipulate of TDataStd_NamedData attribute
-//! This pane contains six pair of table views, where values of this data container presented
-//! The first table in pair presents size of a separate data container, the second presents values
-//! Each control for data container is grouped in a checkable group box to switch off/on using of a container.
-class DFBrowserPane_TDataStdNamedData : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdNamedData();
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdNamedData() {}
-
- //! Creates a new widget that contains containers for attribute values
- //! \param theParent a parent widget
- //! \return pane widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Gets values of attribute using GetValues(), after fill tables if the pane with the values and Init the view model
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model. The values are separated by an auxiliary key for getPartOfValues
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- //! Obtains sub container of a general values container for given keys to fill tables for this kind
- //! \param theKey1 a key where values are started
- //! \param theKey2 a key before that the values are got
- //! \param theValues a full container of values for the current attribute
- //! \returns sub container
- QList<QVariant> getPartOfValues (const QString& theKey1, const QString& theKey2,
- const QList<QVariant>& theValues) const;
-
- //! Creates a model with two columns: "Name" to "Value". The orientation is horizontal
- DFBrowserPane_AttributePaneModel* createPaneModel();
-
-private:
- //! myPaneMode and myTableView are used for int values
-
- DFBrowserPane_AttributePaneModel* myRealValuesModel; //!< real values model
- DFBrowserPane_TableView* myRealValues; //!< values table view
-
- DFBrowserPane_AttributePaneModel* myStringValuesModel; //!< string values model
- DFBrowserPane_TableView* myStringValues; //!< values table view
-
- DFBrowserPane_AttributePaneModel* myByteValuesModel; //!< byte values model
- DFBrowserPane_TableView* myByteValues; //!< values table view
-
- DFBrowserPane_AttributePaneModel* myIntArrayValuesModel; //!< int array values model
- DFBrowserPane_TableView* myIntArrayValues; //!< values table view
-
- DFBrowserPane_AttributePaneModel* myRealArrayModel; //!< real array values model
- DFBrowserPane_TableView* myRealArrayValues; //!< values table view
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdNoteBook.hxx>
-
-#include <TDataStd_NoteBook.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdNoteBook::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdNoteBook_H
-#define DFBrowserPane_TDataStdNoteBook_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdNoteBook
-//! \brief The class to manipulate of TDataStd_NoteBook attribute
-class DFBrowserPane_TDataStdNoteBook : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdNoteBook() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdNoteBook() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdReal.hxx>
-
-#include <TDataStd_Real.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdReal::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_Real) anAttribute = Handle(TDataStd_Real)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- theValues.append ("Get");
- theValues.append (anAttribute->Get());
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdReal_H
-#define DFBrowserPane_TDataStdReal_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdReal
-//! \brief The class to manipulate of TDataStd_Real attribute
-class DFBrowserPane_TDataStdReal : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdReal() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdReal() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdRealArray.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-
-#include <TDataStd_RealArray.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPane_TDataStdRealArray::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (getPaneModel());
-
- myArrayTableHelper.CreateWidget (aMainWidget, myTableView);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdRealArray::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdRealArray::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_RealArray) anAttribute = Handle(TDataStd_RealArray)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append (anAttribute->Lower());
- theValues.append (anAttribute->Upper());
- for (int aValueId = anAttribute->Lower(); aValueId <= anAttribute->Upper(); aValueId++)
- theValues.append (anAttribute->Value(aValueId));
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdRealArray::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- QList<QVariant> aValues;
- GetValues (theAttribute, aValues);
- myArrayTableHelper.Init (aValues);
- return myArrayTableHelper.GetShortAttributeInfo (theAttribute, theValues);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdRealArray_H
-#define DFBrowserPane_TDataStdRealArray_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperArray.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdRealArray
-//! \brief The class to manipulate of TDataStd_RealArray attribute
-class DFBrowserPane_TDataStdRealArray : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDataStdRealArray() : DFBrowserPane_AttributePane(), myArrayTableHelper(getPaneModel()) {}
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPane_TDataStdRealArray() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Calls Init of array table helper
- //! \param theAttribute a current attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns short attribute information using array table helper
- //! \param theAttribute a current attribute
- //! \param theValues container of output values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperArray myArrayTableHelper; //!< common interface to fill array pane
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdRealList.hxx>
-
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <TDataStd_RealList.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdRealList::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_RealList) anAttribute = Handle(TDataStd_RealList)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- for (TColStd_ListIteratorOfListOfReal aRealListIt(anAttribute->List()); aRealListIt.More(); aRealListIt.Next())
- {
- theValues.append ("Value");
- theValues.append (aRealListIt.Value());
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdRealList_H
-#define DFBrowserPane_TDataStdRealList_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdRealList
-//! \brief The class to manipulate of TDataStd_RealList attribute
-class DFBrowserPane_TDataStdRealList : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdRealList() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdRealList() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdRelation.hxx>
-
-#include <TDataStd_Relation.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdRelation::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdRelation_H
-#define DFBrowserPane_TDataStdRelation_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdRelation
-//! \brief The class to manipulate of TDataStd_Relation attribute
-class DFBrowserPane_TDataStdRelation : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdRelation() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdRelation() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdTick.hxx>
-
-#include <TDataStd_Tick.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdTick::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdTick_H
-#define DFBrowserPane_TDataStdTick_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdTick
-//! \brief The class to manipulate of TDataStd_Tick attribute
-class DFBrowserPane_TDataStdTick : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdTick() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdTick() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
// =======================================================================
void DFBrowserPane_TDataStdTreeNodeModel::InitColumns()
{
- SetHeaderItem (0, TreeModel_HeaderSection ("Name"));
+ setHeaderItem (0, TreeModel_HeaderSection ("Name"));
}
// =======================================================================
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdUAttribute.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDataStd_UAttribute.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdUAttribute::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDataStd_UAttribute) anAttribute = Handle(TDataStd_UAttribute)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- char aStr[256];
- theAttribute->ID().ToCString(aStr);
- TCollection_AsciiString aString(aStr);
-
- theValues.append ("ID");
- theValues.append (DFBrowserPane_Tools::ToString (aString));
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdUAttribute_H
-#define DFBrowserPane_TDataStdUAttribute_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdUAttribute
-//! \brief The class to manipulate of TDataStd_UAttribute attribute
-class DFBrowserPane_TDataStdUAttribute : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDataStdUAttribute() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdUAttribute() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDataStdVariable.hxx>
-
-#include <TDataStd_Variable.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDataStdVariable::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDataStdVariable_H
-#define DFBrowserPane_TDataStdVariable_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDataStdVariable
-//! \brief The class to manipulate of TDataStd_Variable attribute
-class DFBrowserPane_TDataStdVariable : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TDataStdVariable() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDataStdVariable() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDocStdModified.hxx>
-
-#include <TDocStd_Modified.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDocStdModified::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDocStdModified_H
-#define DFBrowserPane_TDocStdModified_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDocStdModified
-//! \brief The class to manipulate of TDocStd_Modified attribute
-class DFBrowserPane_TDocStdModified : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDocStdModified() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDocStdModified() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDocStdOwner.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TDocStd_Document.hxx>
-#include <TDocStd_Owner.hxx>
-#include <TDF_Delta.hxx>
-#include <TDF_ListIteratorOfDeltaList.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QGridLayout>
-#include <QGroupBox>
-#include <QTableView>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPane_TDocStdOwner::DFBrowserPane_TDocStdOwner()
- : DFBrowserPane_AttributePane()
-{
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDocStdOwner::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDocStd_Owner) anAttribute = Handle(TDocStd_Owner)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- Handle(TDocStd_Document) aDocument = anAttribute->GetDocument();
- if (aDocument.IsNull())
- return;
-
- TCollection_AsciiString aDocumentInfo = Standard_Dump::GetPointerInfo (aDocument).ToCString();
- TColStd_SequenceOfExtendedString anExtensions;
- aDocument->Extensions(anExtensions);
- TCollection_AsciiString aSeparationStr = "---------------------------";
- theValues << aSeparationStr.ToCString() << aSeparationStr.ToCString()
- << STANDARD_TYPE (CDM_Document)->Name() << aDocumentInfo.ToCString()
- << aSeparationStr.ToCString() << aSeparationStr.ToCString()
- << "StorageFormat" << DFBrowserPane_Tools::ToString (aDocument->StorageFormat())
- << "Extensions" << convertToString (anExtensions)
- << "FromReferencesNumber" << QString::number (aDocument->FromReferencesNumber())
- << "ToReferencesNumber" << QString::number (aDocument->ToReferencesNumber())
- << "IsReadOnly" << DFBrowserPane_Tools::BoolToStr (aDocument->IsReadOnly())
- << "Modifications" << QString::number (aDocument->Modifications());
-
- TColStd_SequenceOfExtendedString aComments;
- aDocument->Extensions(aComments);
- // if the document application is empty, Application() sents an exception, it is called in LoadResources() of:
- // FindFileExtension, FindDescription and others, so we need the check for it
- bool isDocumentOpened = aDocument->IsOpened();
-
- // CDM_Document methods
- theValues << "Comments" << convertToString (aComments)
- // << "Presentation" << DFBrowserPane_Tools::ToString (aDocument->Presentation())
- << "IsStored" << DFBrowserPane_Tools::BoolToStr (aDocument->IsStored())
- << "StorageVersion" << QString::number (aDocument->StorageVersion())
- << "Folder" << (aDocument->IsStored() ? DFBrowserPane_Tools::ToString (aDocument->Folder()) : "")
- << "HasRequestedFolder" << DFBrowserPane_Tools::BoolToStr (aDocument->HasRequestedFolder())
- << "RequestedFolder" << (aDocument->HasRequestedFolder() ? DFBrowserPane_Tools::ToString (aDocument->RequestedFolder()) : "")
- << "RequestedName" << DFBrowserPane_Tools::ToString (aDocument->RequestedName())
- << "HasRequestedPreviousVersion" << DFBrowserPane_Tools::BoolToStr (aDocument->HasRequestedPreviousVersion())
- << "RequestedPreviousVersion" << (aDocument->HasRequestedPreviousVersion() ?
- DFBrowserPane_Tools::ToString (aDocument->RequestedPreviousVersion()) : "")
- << "RequestedComment" << DFBrowserPane_Tools::ToString (aDocument->RequestedComment())
- << "FindFileExtension" << (isDocumentOpened ? DFBrowserPane_Tools::BoolToStr (aDocument->FindFileExtension()) : "")
- << "FileExtension" << (isDocumentOpened ? DFBrowserPane_Tools::ToString (aDocument->FileExtension()) : "")
- << "FindDescription" << (isDocumentOpened ? DFBrowserPane_Tools::BoolToStr (aDocument->FindDescription()) : "")
- << "Description" << (isDocumentOpened ? DFBrowserPane_Tools::ToString (aDocument->Description()) : "")
- << "IsModified" << DFBrowserPane_Tools::BoolToStr (aDocument->IsModified())
- << "IsOpened" << DFBrowserPane_Tools::BoolToStr (aDocument->IsOpened())
- << "CanClose" << DFBrowserPane_Tools::ToName(DB_CDM_CAN_CLOSE_STATUS, aDocument->CanClose()).ToCString()
- << "ReferenceCounter" << QString::number (aDocument->ReferenceCounter());
-
- // TDocStd_Document methods
- TCollection_AsciiString aDocumentDataInfo = !aDocument->GetData().IsNull()
- ? Standard_Dump::GetPointerInfo (aDocument->GetData()).ToCString() : "";
- theValues << aSeparationStr.ToCString() << aSeparationStr.ToCString()
- << STANDARD_TYPE (TDocStd_Document)->Name() << ""
- << aSeparationStr.ToCString() << aSeparationStr.ToCString()
- << "IsSaved" << DFBrowserPane_Tools::BoolToStr (aDocument->IsSaved())
- << "IsChanged" << DFBrowserPane_Tools::BoolToStr (aDocument->IsChanged())
- << "GetSavedTime" << QString::number (aDocument->GetSavedTime())
- << "GetName" << (aDocument->IsSaved() ? DFBrowserPane_Tools::ToString (aDocument->GetName()) : "")
- << "GetPath" << (aDocument->IsSaved() ? DFBrowserPane_Tools::ToString (aDocument->GetPath()) : "")
- << "GetData" << aDocumentDataInfo.ToCString()
- << "Main" << DFBrowserPane_Tools::GetEntry (aDocument->Main()).ToCString()
- << "IsEmpty" << DFBrowserPane_Tools::BoolToStr (aDocument->IsEmpty())
- << "IsValid" << DFBrowserPane_Tools::BoolToStr (aDocument->IsValid())
- << "HasOpenCommand" << DFBrowserPane_Tools::BoolToStr (aDocument->HasOpenCommand())
- << "GetUndoLimit" << QString::number (aDocument->GetUndoLimit())
- << "GetAvailableUndos" << QString::number (aDocument->GetAvailableUndos())
- << "GetUndos" << convertToString (aDocument->GetUndos())
- << "GetAvailableRedos" << QString::number (aDocument->GetAvailableRedos())
- << "GetRedos" << convertToString (aDocument->GetRedos())
- << "EmptyLabelsSavingMode" << DFBrowserPane_Tools::BoolToStr (aDocument->EmptyLabelsSavingMode())
- << "IsNestedTransactionMode" << DFBrowserPane_Tools::BoolToStr (aDocument->IsNestedTransactionMode())
- << "ModificationMode" << DFBrowserPane_Tools::BoolToStr (aDocument->ModificationMode());
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDocStdOwner::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(TDocStd_Owner) anAttribute = Handle(TDocStd_Owner)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
-
- Handle(TDocStd_Document) aDocument = anAttribute->GetDocument();
- if (aDocument.IsNull())
- return;
-
- theValues.append (DFBrowserPane_Tools::ToString (aDocument->StorageFormat()));
-}
-
-// =======================================================================
-// function : convertToString
-// purpose :
-// =======================================================================
-QString DFBrowserPane_TDocStdOwner::convertToString (const TDF_DeltaList& theDeltaList)
-{
- QStringList aNames;
-
- for (TDF_ListIteratorOfDeltaList aDeltaIt (theDeltaList); aDeltaIt.More(); aDeltaIt.Next())
- {
- QString aName = DFBrowserPane_Tools::ToString (aDeltaIt.Value()->Name());
- aNames.append (aName.isEmpty() ? "-" : aName);
- }
- return QString ("[%1]").arg (aNames.join (";"));
-}
-
-// =======================================================================
-// function : convertToString
-// purpose :
-// =======================================================================
-QString DFBrowserPane_TDocStdOwner::convertToString (const TColStd_SequenceOfExtendedString& theExtensions)
-{
- QStringList aNames;
- for (Standard_Integer anExtensionId = 1, aNumber = theExtensions.Length(); anExtensionId <= aNumber; anExtensionId++)
- aNames.append (DFBrowserPane_Tools::ToString (theExtensions(anExtensionId)));
-
- return QString ("[%1]").arg (aNames.join (";"));
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDocStdOwner_H
-#define DFBrowserPane_TDocStdOwner_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <TDF_DeltaList.hxx>
-
-//! \class DFBrowserPane_TDocStdOwner
-//! \brief The class to manipulate of TDocStd_Owner attribute
-class DFBrowserPane_TDocStdOwner : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPane_TDocStdOwner();
-
- //! Destructor
- virtual ~DFBrowserPane_TDocStdOwner() {}
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- //! Generate string container by the parameter list
- //! \param a list of TDF delta
- //! \param string result
- static QString convertToString (const TDF_DeltaList& theList);
-
- //! Generate string container by the parameter list
- //! \param a list of extensions
- //! \param string result
- static QString convertToString (const TColStd_SequenceOfExtendedString& theExtensions);
-
- //! Generate string container by the ext string value
- //! \param an ext string [short*]
- //! \param string result
- static QString convertToString (const Standard_ExtString& theValue) { (void)theValue; return ""; }
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDocStdXLink.hxx>
-
-#include <TDocStd_XLink.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDocStdXLink::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TDocStd_XLink) anAttribute = Handle(TDocStd_XLink)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- theValues.append ("LabelEntry");
- theValues.append (anAttribute->LabelEntry().ToCString());
- theValues.append ("DocumentEntry");
- theValues.append (anAttribute->DocumentEntry().ToCString());
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDocStdXLink_H
-#define DFBrowserPane_TDocStdXLink_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDocStdXLink
-//! \brief The class to manipulate of TDocStd_XLink attribute
-class DFBrowserPane_TDocStdXLink : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDocStdXLink() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDocStdXLink() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TDocStdXLinkRoot.hxx>
-
-#include <TDocStd_XLinkRoot.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TDocStdXLinkRoot::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TDocStdXLinkRoot_H
-#define DFBrowserPane_TDocStdXLinkRoot_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TDocStdXLinkRoot
-//! \brief The class to manipulate of TDocStd_XLinkRoot attribute
-class DFBrowserPane_TDocStdXLinkRoot : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TDocStdXLinkRoot() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TDocStdXLinkRoot() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TFunctionFunction.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TFunction_Function.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TFunctionFunction::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TFunction_Function) anAttribute = Handle(TFunction_Function)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- char aStr[256];
- anAttribute->GetDriverGUID().ToCString (aStr);
- TCollection_AsciiString aString(aStr);
-
- theValues.append ("GetDriverGUID");
- theValues.append (DFBrowserPane_Tools::ToString(aString));
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TFunctionFunction_H
-#define DFBrowserPane_TFunctionFunction_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TFunctionFunction
-//! \brief The class to manipulate of TFunction_Function attribute
-class DFBrowserPane_TFunctionFunction : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TFunctionFunction() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TFunctionFunction() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TFunctionGraphNode.hxx>
-
-#include <TFunction_GraphNode.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TFunctionGraphNode::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TFunctionGraphNode_H
-#define DFBrowserPane_TFunctionGraphNode_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TFunctionGraphNode
-//! \brief The class to manipulate of TFunction_GraphNode attribute
-class DFBrowserPane_TFunctionGraphNode : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TFunctionGraphNode() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TFunctionGraphNode() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TFunctionScope.hxx>
-
-#include <TFunction_Scope.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TFunctionScope::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TFunctionScope_H
-#define DFBrowserPane_TFunctionScope_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TFunctionScope
-//! \brief The class to manipulate of TFunction_Scope attribute
-class DFBrowserPane_TFunctionScope : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPane_TFunctionScope() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TFunctionScope() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
}
TopoDS_Shape aShape = getSelectedShapes();
if (!aShape.IsNull())
- theRefPresentation = new AIS_Shape (aShape);
+ {
+ Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
+ aPresentation->Attributes()->SetAutoTriangulation (Standard_False);
+ theRefPresentation = aPresentation;
+ }
}
// =======================================================================
}
TopoDS_Shape aShape = aComp;
if (!aShape.IsNull() && aHasShapes)
- aPresentation = new AIS_Shape (aShape);
-
+ {
+ Handle(AIS_Shape) aPrs = new AIS_Shape (aShape);
+ aPrs->Attributes()->SetAutoTriangulation (Standard_False);
+ aPresentation = aPrs;
+ }
return aPresentation;
}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TPrsStdAISPresentation.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <TPrsStd_AISPresentation.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPane_TPrsStdAISPresentation::DFBrowserPane_TPrsStdAISPresentation()
- : DFBrowserPane_AttributePane()
-{
-}
-
-// =======================================================================
-// function : toString
-// purpose :
-// =======================================================================
-QString toString (const Quantity_NameOfColor& theNameOfColor)
-{
- Quantity_Color aColor(theNameOfColor);
- return QString ("(%1, %2, %3)").arg (aColor.Red()).arg (aColor.Green()).arg (aColor.Blue());
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPane_TPrsStdAISPresentation::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TPrsStd_AISPresentation) anAttribute = Handle(TPrsStd_AISPresentation)::DownCast (theAttribute);
- if (anAttribute.IsNull())
- return;
- Handle(AIS_InteractiveObject) anIO = anAttribute->GetAIS();
-
- char aStr[256];
- anAttribute->GetDriverGUID().ToCString(aStr);
- TCollection_AsciiString aString(aStr);
-
- theValues << "GetDriverGUID" << DFBrowserPane_Tools::ToString (aString)
- << "GetAIS" << (anIO.IsNull() ? "Null" : anAttribute->DynamicType()->Name())
- << "IsDisplayed" << DFBrowserPane_Tools::BoolToStr (anAttribute->IsDisplayed())
- << "GetContext()" << ((!anIO.IsNull() && !anIO->GetContext().IsNull()) ?
- Standard_Dump::GetPointerInfo (anIO->GetContext()).ToCString() : "")
- << "HasOwnMaterial" << DFBrowserPane_Tools::BoolToStr (anAttribute->HasOwnMaterial())
- << "Material" << (anAttribute->HasOwnMaterial() ?
- DFBrowserPane_Tools::ToName (DB_MATERIAL_TYPE, anAttribute->Material()) : "").ToCString()
- << "Transparency" << TCollection_AsciiString (anAttribute->Transparency()).ToCString()
- << "HasOwnColor" << DFBrowserPane_Tools::BoolToStr (anAttribute->HasOwnColor())
- << "Color" << (anAttribute->HasOwnColor() ? toString (anAttribute->Color()) : "")
- << "HasOwnWidth"<< DFBrowserPane_Tools::BoolToStr (anAttribute->HasOwnWidth())
- << "Width"<< (anAttribute->HasOwnWidth() ? QString::number (anAttribute->Width()) : "")
- << "HasOwnMode"<< DFBrowserPane_Tools::BoolToStr (anAttribute->HasOwnMode())
- << "Width"<< (anAttribute->HasOwnMode() ? DFBrowserPane_Tools::ToName (
- DB_DISPLAY_MODE, anAttribute->Mode()) : "").ToCString()
- << "HasOwnSelectionMode" << DFBrowserPane_Tools::BoolToStr (anAttribute->HasOwnSelectionMode())
- << "SelectionMode" << (anAttribute->HasOwnSelectionMode() ?
- QString::number (anAttribute->SelectionMode()) : "");
-}
-
-// =======================================================================
-// function : GetPresentation
-// purpose :
-// =======================================================================
-Handle(Standard_Transient) DFBrowserPane_TPrsStdAISPresentation::GetPresentation (
- const Handle(TDF_Attribute)& theAttribute)
-{
- Handle(Standard_Transient) aPresentation;
-
- Handle(TPrsStd_AISPresentation) anAttribute = Handle(TPrsStd_AISPresentation)::DownCast (theAttribute);
- if (!anAttribute.IsNull())
- aPresentation = anAttribute->GetAIS();
-
- return aPresentation;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TPrsStdAISPresentation_H
-#define DFBrowserPane_TPrsStdAISPresentation_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TPrsStdAISPresentation
-//! \brief The class to manipulate of TPrsStdAIS_Presentation attribute
-class DFBrowserPane_TPrsStdAISPresentation : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPane_TPrsStdAISPresentation();
-
- //! Destructor
- virtual ~DFBrowserPane_TPrsStdAISPresentation() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns presentation of the attribute to be visualized in the view
- //! \param theAttribute a current attribute
- //! \return handle of presentation if the attribute has, to be visualized
- Standard_EXPORT virtual Handle(Standard_Transient) GetPresentation
- (const Handle (TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPane_TPrsStdAISViewer.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <AIS_InteractiveContext.hxx>
-#include <TPrsStd_AISViewer.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function :
-// purpose :
-// =======================================================================
-void DFBrowserPane_TPrsStdAISViewer::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(TPrsStd_AISViewer) aViewerAttribute = Handle(TPrsStd_AISViewer)::DownCast (theAttribute);
- if (!aViewerAttribute)
- return;
-
- Handle(AIS_InteractiveContext) aContext = aViewerAttribute->GetInteractiveContext();
- TCollection_AsciiString aPointerInfo = !aContext.IsNull()
- ? Standard_Dump::GetPointerInfo (aContext).ToCString() : "";
-
- theValues << "GetInteractiveContext" << aPointerInfo.ToCString();
-
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPane_TPrsStdAISViewer_H
-#define DFBrowserPane_TPrsStdAISViewer_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-
-//! \class DFBrowserPane_TPrsStdAISViewer
-//! \brief The class to manipulate of TPrsStd_AISViewer attribute
-class DFBrowserPane_TPrsStdAISViewer : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPane_TPrsStdAISViewer() {}
-
- //! Destructor
- virtual ~DFBrowserPane_TPrsStdAISViewer() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- virtual void GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
DFBrowserPane_SelectionKind.hxx
DFBrowserPane_TableView.cxx
DFBrowserPane_TableView.hxx
-DFBrowserPane_TDataStdAsciiString.cxx
-DFBrowserPane_TDataStdAsciiString.hxx
-DFBrowserPane_TDataStdBooleanArray.cxx
-DFBrowserPane_TDataStdBooleanArray.hxx
-DFBrowserPane_TDataStdBooleanList.cxx
-DFBrowserPane_TDataStdBooleanList.hxx
-DFBrowserPane_TDataStdByteArray.cxx
-DFBrowserPane_TDataStdByteArray.hxx
-DFBrowserPane_TDataStdComment.cxx
-DFBrowserPane_TDataStdComment.hxx
-DFBrowserPane_TDataStdCurrent.cxx
-DFBrowserPane_TDataStdCurrent.hxx
-DFBrowserPane_TDataStdDirectory.cxx
-DFBrowserPane_TDataStdDirectory.hxx
-DFBrowserPane_TDataStdExpression.cxx
-DFBrowserPane_TDataStdExpression.hxx
-DFBrowserPane_TDataStdExtStringArray.cxx
-DFBrowserPane_TDataStdExtStringArray.hxx
-DFBrowserPane_TDataStdExtStringList.cxx
-DFBrowserPane_TDataStdExtStringList.hxx
-DFBrowserPane_TDataStdInteger.cxx
-DFBrowserPane_TDataStdInteger.hxx
-DFBrowserPane_TDataStdIntegerArray.cxx
-DFBrowserPane_TDataStdIntegerArray.hxx
-DFBrowserPane_TDataStdIntegerList.cxx
-DFBrowserPane_TDataStdIntegerList.hxx
-DFBrowserPane_TDataStdIntPackedMap.cxx
-DFBrowserPane_TDataStdIntPackedMap.hxx
-DFBrowserPane_TDataStdName.cxx
-DFBrowserPane_TDataStdName.hxx
-DFBrowserPane_TDataStdNamedData.cxx
-DFBrowserPane_TDataStdNamedData.hxx
-DFBrowserPane_TDataStdNoteBook.cxx
-DFBrowserPane_TDataStdNoteBook.hxx
-DFBrowserPane_TDataStdReal.cxx
-DFBrowserPane_TDataStdReal.hxx
-DFBrowserPane_TDataStdRealArray.cxx
-DFBrowserPane_TDataStdRealArray.hxx
-DFBrowserPane_TDataStdRealList.cxx
-DFBrowserPane_TDataStdRealList.hxx
DFBrowserPane_TDataStdReferenceArray.cxx
DFBrowserPane_TDataStdReferenceArray.hxx
DFBrowserPane_TDataStdReferenceList.cxx
DFBrowserPane_TDataStdReferenceList.hxx
-DFBrowserPane_TDataStdRelation.cxx
-DFBrowserPane_TDataStdRelation.hxx
-DFBrowserPane_TDataStdTick.cxx
-DFBrowserPane_TDataStdTick.hxx
DFBrowserPane_TDataStdTreeNode.cxx
DFBrowserPane_TDataStdTreeNode.hxx
DFBrowserPane_TDataStdTreeNodeItem.cxx
DFBrowserPane_TDataStdTreeNodeItem.hxx
DFBrowserPane_TDataStdTreeNodeModel.cxx
DFBrowserPane_TDataStdTreeNodeModel.hxx
-DFBrowserPane_TDataStdUAttribute.cxx
-DFBrowserPane_TDataStdUAttribute.hxx
-DFBrowserPane_TDataStdVariable.cxx
-DFBrowserPane_TDataStdVariable.hxx
DFBrowserPane_TDFReference.cxx
DFBrowserPane_TDFReference.hxx
-DFBrowserPane_TDFTagSource.cxx
-DFBrowserPane_TDFTagSource.hxx
-DFBrowserPane_TDocStdModified.cxx
-DFBrowserPane_TDocStdModified.hxx
-DFBrowserPane_TDocStdOwner.cxx
-DFBrowserPane_TDocStdOwner.hxx
-DFBrowserPane_TDocStdXLink.cxx
-DFBrowserPane_TDocStdXLink.hxx
-DFBrowserPane_TDocStdXLinkRoot.cxx
-DFBrowserPane_TDocStdXLinkRoot.hxx
-DFBrowserPane_TFunctionFunction.cxx
-DFBrowserPane_TFunctionFunction.hxx
-DFBrowserPane_TFunctionGraphNode.cxx
-DFBrowserPane_TFunctionGraphNode.hxx
-DFBrowserPane_TFunctionScope.cxx
-DFBrowserPane_TFunctionScope.hxx
DFBrowserPane_TNamingNamedShape.cxx
DFBrowserPane_TNamingNamedShape.hxx
DFBrowserPane_TNamingNaming.cxx
DFBrowserPane_TNamingUsedShapes.cxx
DFBrowserPane_TNamingUsedShapes.hxx
DFBrowserPane_Tools.cxx
-DFBrowserPane_Tools.hxx
-DFBrowserPane_TPrsStdAISPresentation.cxx
-DFBrowserPane_TPrsStdAISPresentation.hxx
-DFBrowserPane_TPrsStdAISViewer.cxx
-DFBrowserPane_TPrsStdAISViewer.hxx
\ No newline at end of file
+DFBrowserPane_Tools.hxx
\ No newline at end of file
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_AttributeCommonPane.hxx>
-
-#include <inspector/DFBrowserPane_ItemRole.hxx>
-#include <inspector/DFBrowserPaneXDE_XDEDRAW.hxx>
-
-#include <TDataStd_TreeNode.hxx>
-#include <TDF_Reference.hxx>
-#include <TNaming_NamedShape.hxx>
-#include <XCAFDoc_Volume.hxx>
-#include <XCAFDoc_Area.hxx>
-#include <XCAFDoc_Centroid.hxx>
-#include <TDataStd_UAttribute.hxx>
-#include <XCAFDoc_Color.hxx>
-#include <XCAFDoc_DimTol.hxx>
-#include <XCAFDoc_Material.hxx>
-#include <XCAFDoc_GraphNode.hxx>
-
-#include <set>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QStringList>
-#include <Standard_WarningsRestore.hxx>
-
-static std::set<Standard_CString> AttributeTypes;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_AttributeCommonPane::DFBrowserPaneXDE_AttributeCommonPane (DFBrowserPane_AttributePaneAPI* theStandardPane)
-: DFBrowserPane_AttributePane()
-{
- myStandardPane = dynamic_cast<DFBrowserPane_AttributePane*> (theStandardPane);
-}
-
-// =======================================================================
-// function : ProcessAttribute
-// purpose :
-// =======================================================================
-bool DFBrowserPaneXDE_AttributeCommonPane::ProcessAttribute (Standard_CString theAttributeType)
-{
- if (AttributeTypes.empty())
- {
- AttributeTypes.insert (STANDARD_TYPE (TDataStd_TreeNode)->Name());
- AttributeTypes.insert (STANDARD_TYPE (TDF_Reference)->Name());
- AttributeTypes.insert (STANDARD_TYPE (TNaming_NamedShape)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_Volume)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_Area)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_Centroid)->Name());
- AttributeTypes.insert (STANDARD_TYPE (TDataStd_UAttribute)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_Color)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_DimTol)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_Material)->Name());
- AttributeTypes.insert (STANDARD_TYPE (XCAFDoc_GraphNode)->Name());
- }
- return AttributeTypes.find (theAttributeType) != AttributeTypes.end();
-}
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPaneXDE_AttributeCommonPane::CreateWidget (QWidget* theParent)
-{
- return myStandardPane ? myStandardPane->CreateWidget (theParent) : 0;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- if (myStandardPane)
- myStandardPane->Init (theAttribute);
-}
-
-// =======================================================================
-// function : GetSelectionModels
-// purpose :
-// =======================================================================
-std::list<QItemSelectionModel*> DFBrowserPaneXDE_AttributeCommonPane::GetSelectionModels()
-{
- return myStandardPane ? myStandardPane->GetSelectionModels() : std::list<QItemSelectionModel*>();
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- if (myStandardPane)
- myStandardPane->GetValues (theAttribute, theValues);
-}
-
-// =======================================================================
-// function : GetAttributeInfo
-// purpose :
-// =======================================================================
-QVariant DFBrowserPaneXDE_AttributeCommonPane::GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- int theRole, int theColumnId)
-{
- QVariant aValue;
- if (myStandardPane)
- {
- if (theRole == DFBrowserPane_ItemRole_ShortInfo)
- {
- QList<QVariant> aValues;
- GetShortAttributeInfo (theAttribute, aValues);
- QStringList anInfoList;
- for (QList<QVariant>::const_iterator aValuesIt = aValues.begin(); aValuesIt != aValues.end(); aValuesIt++)
- anInfoList.append (aValuesIt->toString());
- aValue = anInfoList.join (", ");
- }
- else
- aValue = myStandardPane->GetAttributeInfo (theAttribute, theRole, theColumnId);
- }
- else
- aValue = DFBrowserPane_AttributePane::GetAttributeInfoByType (theAttribute->DynamicType()->Name(),
- theRole, theColumnId);
- return aValue;
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::GetShortAttributeInfo (
- const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- theValues.append (DFBrowserPaneXDE_XDEDRAW::GetAttributeInfo (theAttribute).ToCString());
-}
-
-// =======================================================================
-// function : GetSelectionKind
-// purpose :
-// =======================================================================
-int DFBrowserPaneXDE_AttributeCommonPane::GetSelectionKind (QItemSelectionModel* theModel)
-{
- if (myStandardPane)
- return myStandardPane->GetSelectionKind (theModel);
-
- return DFBrowserPane_AttributePane::GetSelectionKind (theModel);
-}
-
-// =======================================================================
-// function : GetSelectionParameters
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::GetSelectionParameters (QItemSelectionModel* theModel,
- NCollection_List<Handle(Standard_Transient)>& theParameters,
- NCollection_List<TCollection_AsciiString>& theItemNames)
-{
- if (myStandardPane)
- myStandardPane->GetSelectionParameters (theModel, theParameters, theItemNames);
-
- DFBrowserPane_AttributePane::GetSelectionParameters (theModel, theParameters, theItemNames);
-}
-
-// =======================================================================
-// function : GetPresentation
-// purpose :
-// =======================================================================
-Handle(Standard_Transient) DFBrowserPaneXDE_AttributeCommonPane::GetPresentation (
- const Handle(TDF_Attribute)& theAttribute)
-{
- Handle(Standard_Transient) anIO;
- if (myStandardPane)
- anIO = myStandardPane->GetPresentation (theAttribute);
- return anIO;
-}
-
-// =======================================================================
-// function : GetReferences
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::GetReferences (
- const Handle(TDF_Attribute)& theAttribute,
- NCollection_List<TDF_Label>& theRefLabels,
- Handle(Standard_Transient)& theRefPresentation)
-{
- Handle(Standard_Transient) anIO;
- if (myStandardPane)
- myStandardPane->GetReferences (theAttribute, theRefLabels, theRefPresentation);
-}
-
-// =======================================================================
-// function : GetAttributeReferences
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_AttributeCommonPane::GetAttributeReferences (
- const Handle(TDF_Attribute)& theAttribute,
- NCollection_List<Handle(TDF_Attribute)>& theRefAttributes,
- Handle(Standard_Transient)& theRefPresentation)
-{
- Handle(Standard_Transient) anIO;
- if (myStandardPane)
- myStandardPane->GetAttributeReferences (theAttribute, theRefAttributes, theRefPresentation);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_AttributeCommonPane_H
-#define DFBrowserPaneXDE_AttributeCommonPane_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-class QWidget;
-class QItemSelectionModel;
-
-//! \class DFBrowserPaneXDE_AttributeCommonPane
-//! \brief It covers standard attribute panes. The purpose is to return XDE specific short information for
-//! several kinds of attributes. The other functionality is the same as for standard panes, it just sends
-//! it to the panes.
-class DFBrowserPaneXDE_AttributeCommonPane : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_AttributeCommonPane (DFBrowserPane_AttributePaneAPI* theStandardPane);
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_AttributeCommonPane() {}
-
- //! Returns true if this type can be processed by this pane. It contains standard attributes that
- //! have difference in presentation (TDataStd_TreeNode, TDF_Reference, TNaming_NamedShape and TDataStd_UAttribute).
- //! Also it contains XCAFDoc attributes (should be implemented in this package or pane will be empty)
- //! \param theAttributeType an attribute type
- Standard_EXPORT static bool ProcessAttribute (Standard_CString theAttributeType);
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Initializes the content of the pane by the parameter attribute
- //! \param theAttribute an OCAF attribute
- Standard_EXPORT void Init (const Handle(TDF_Attribute)& theAttribute);
-
- //! Returns list of selection models. In default implementation it contains a selection model for the table view
- //! \returns container of models
- Standard_EXPORT virtual std::list<QItemSelectionModel*> GetSelectionModels() Standard_OVERRIDE;
-
- //! Returns information for the given attribute
- //! \param theAttribute a current attribute
- //! \param theRole a role of information, used by tree model (e.g. DisplayRole, icon, background and so on)
- //! \param theColumnId a tree model column
- //! \return value, interpreted by tree model depending on the role
- Standard_EXPORT virtual QVariant GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- int theRole, int theColumnId) Standard_OVERRIDE;
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns selection kind for the model, it may be General selection or Additional selection for example
- //! \param theModel one of selection models provided by this pane
- //! \return selection kind
- Standard_EXPORT virtual int GetSelectionKind (QItemSelectionModel* theModel) Standard_OVERRIDE;
-
- //! Returns selection parameters, that may be useful for communicate between tools
- //! \param theModel one of selection models provided by this pane
- //! \theParameters a container of parameters, might be extended depending on the pane state(e.g. selection)
- //! \theItemNames names to be selected for each selection parameter
- Standard_EXPORT virtual void GetSelectionParameters (QItemSelectionModel* theModel,
- NCollection_List<Handle(Standard_Transient)>& theParameters,
- NCollection_List<TCollection_AsciiString>& theItemNames) Standard_OVERRIDE;
-
- //! Returns presentation of the attribute to be visualized in the view
- //! \param theAttribute a current attribute
- //! \return handle of presentation if the attribute has, to be visualized
- Standard_EXPORT virtual Handle(Standard_Transient) GetPresentation
- (const Handle (TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns container of Label references to the attribute
- //! \param theAttribute a current attribute
- //! \param theRefLabels a container of label references, to be selected in tree view
- //! \param theRefPresentation handle of presentation for the references, to be visualized
- Standard_EXPORT virtual void GetReferences (const Handle(TDF_Attribute)& theAttribute,
- NCollection_List<TDF_Label>& theRefLabels,
- Handle(Standard_Transient)& theRefPresentation) Standard_OVERRIDE;
-
- //! Returns container of Attribute references to the attribute
- //! \param theAttribute a current attribute
- //! \param theRefAttributes a container of attribute references, to be selected in tree view
- //! \param theRefPresentation handle of presentation for the references, to be visualized
- Standard_EXPORT virtual void GetAttributeReferences (const Handle(TDF_Attribute)& theAttribute,
- NCollection_List<Handle(TDF_Attribute)>& theRefAttributes,
- Handle(Standard_Transient)& theRefPresentation) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_AttributePane* myStandardPane; //!< pane, that corresponds to the current type of attribute
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_AttributePaneCreator.hxx>
-
-#include <inspector/DFBrowserPaneXDE_AttributeCommonPane.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocArea.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocCentroid.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocColor.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocColorTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocDatum.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocDimension.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocDimTol.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocDimTolTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocDocumentTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocGeomTolerance.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocGraphNode.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocLayerTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocLocation.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocMaterial.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocMaterialTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocShapeMapTool.hxx>
-#include <inspector/DFBrowserPaneXDE_XCAFDocShapeTool.hxx>
-
-#include <XCAFDoc_Area.hxx>
-#include <XCAFDoc_Centroid.hxx>
-#include <XCAFDoc_Color.hxx>
-#include <XCAFDoc_ColorTool.hxx>
-#include <XCAFDoc_Datum.hxx>
-#include <XCAFDoc_Dimension.hxx>
-#include <XCAFDoc_GeomTolerance.hxx>
-#include <XCAFDoc_DimTol.hxx>
-#include <XCAFDoc_DimTolTool.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <XCAFDoc_GraphNode.hxx>
-#include <XCAFDoc_LayerTool.hxx>
-#include <XCAFDoc_Location.hxx>
-#include <XCAFDoc_Material.hxx>
-#include <XCAFDoc_MaterialTool.hxx>
-#include <XCAFDoc_ShapeMapTool.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
-#include <XCAFDoc_ShapeMapTool.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_AttributePaneCreator::DFBrowserPaneXDE_AttributePaneCreator(
- DFBrowserPane_AttributePaneCreatorAPI* theStandardPaneCreator)
-: myStandardPaneCreator (theStandardPaneCreator)
-{
-}
-
-// =======================================================================
-// function : CreateAttributePane
-// purpose :
-// =======================================================================
-DFBrowserPane_AttributePaneAPI* DFBrowserPaneXDE_AttributePaneCreator::CreateAttributePane (Standard_CString theAttributeName)
-{
- DFBrowserPane_AttributePaneAPI* aPane = 0;
- if (DFBrowserPaneXDE_AttributeCommonPane::ProcessAttribute (theAttributeName))
- {
- DFBrowserPane_AttributePaneAPI* aStandardPane = myStandardPaneCreator->CreateAttributePane (theAttributeName);
- if (!aStandardPane)
- aStandardPane = createXDEPane (theAttributeName);
- aPane = new DFBrowserPaneXDE_AttributeCommonPane (aStandardPane);
- }
- else
- aPane = createXDEPane (theAttributeName);
-
- return aPane;
-}
-
-// =======================================================================
-// function : createXDEPane
-// purpose :
-// =======================================================================
-DFBrowserPane_AttributePaneAPI* DFBrowserPaneXDE_AttributePaneCreator::createXDEPane (Standard_CString theAttributeName)
-{
- DFBrowserPane_AttributePaneAPI* aPane = 0;
- if (theAttributeName == STANDARD_TYPE (XCAFDoc_ShapeMapTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocShapeMapTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Area)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocArea();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Centroid)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocCentroid();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Color)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocColor();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_ColorTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocColorTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Datum)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocDatum();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Dimension)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocDimension();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_DimTol)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocDimTol();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_DimTolTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocDimTolTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_DocumentTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocDocumentTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_GeomTolerance)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocGeomTolerance();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_GraphNode)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocGraphNode();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_LayerTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocLayerTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Location)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocLocation();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_Material)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocMaterial();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_MaterialTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocMaterialTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_ShapeMapTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocShapeMapTool();
- else if (theAttributeName == STANDARD_TYPE (XCAFDoc_ShapeTool)->Name())
- aPane = new DFBrowserPaneXDE_XCAFDocShapeTool();
- return aPane;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_ATTRIBUTEPANECREATOR_H
-#define DFBrowserPaneXDE_ATTRIBUTEPANECREATOR_H
-
-#include <inspector/DFBrowserPane_AttributePaneCreatorAPI.hxx>
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-class DFBrowserPane_AttributePaneAPI;
-
-//! \class DFBrowserPaneXDE_AttributePaneCreator
-//! \brief This class can creates attribute pane for XDE attribute name.
-//! It creates the following panes:
-//! - custom panes for XCAFDoc attributes own panes
-//! - extended panes (modified short information) for several types of attribute (use AttributeCommonPane)
-//! - common panes described in DFBrowserPane library
-class DFBrowserPaneXDE_AttributePaneCreator : public DFBrowserPane_AttributePaneCreatorAPI
-{
-public:
-
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_AttributePaneCreator (DFBrowserPane_AttributePaneCreatorAPI* theStandardPaneCreator);
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_AttributePaneCreator() Standard_OVERRIDE {}
-
- //! Creates attribute panes for XCAFDoc attributes, extended and common panes from DFBrowserPane library
- //! \param theAttributeName a type of attribute
- //! \return an attribute pane if it can be created for this type
- Standard_EXPORT virtual DFBrowserPane_AttributePaneAPI* CreateAttributePane
- (Standard_CString theAttributeName) Standard_OVERRIDE;
-
-protected:
-
- //! Creates pane for XCAFDoc attribute name
- //! \param theAttributeName a type of attribute
- //! \return an attribute pane if it can be created for this type
- DFBrowserPane_AttributePaneAPI* createXDEPane (Standard_CString theAttributeName);
-
-private:
-
- DFBrowserPane_AttributePaneCreatorAPI* myStandardPaneCreator; //! pane creator for panes from DFBrowserPane library
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_Tools.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneAPI.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDF_ChildIterator.hxx>
-#include <TDF_Tool.hxx>
-#include <TDocStd_Document.hxx>
-
-#include <Standard_GUID.hxx>
-
-#include <XCAFDoc_Area.hxx>
-#include <XCAFDoc_Centroid.hxx>
-#include <XCAFDoc_Color.hxx>
-#include <XCAFDoc_Datum.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <XCAFDoc_GraphNode.hxx>
-#include <XCAFDoc_Location.hxx>
-#include <XCAFDoc_Material.hxx>
-#include <XCAFDoc_Volume.hxx>
-
-namespace DFBrowserPaneXDE_Tools
-{
-
- // =======================================================================
- // function : IsXDEApplication
- // purpose :
- // =======================================================================
- bool IsXDEApplication (const Handle(TDocStd_Application)& theApplication)
- {
- bool isXDEApp = false;
-
- Handle(TDocStd_Document) aDocument;
- Standard_Integer aNbDoc = theApplication->NbDocuments();
- if (aNbDoc == 0)
- return isXDEApp;
-
- theApplication->GetDocument (1, aDocument);
- if (aDocument.IsNull())
- return isXDEApp;
-
- for (TDF_ChildIterator aLabelsIt (aDocument->Main().Root()); aLabelsIt.More() && !isXDEApp; aLabelsIt.Next())
- {
- const TDF_Label aLabel = aLabelsIt.Value();
- if (aLabel.IsNull())
- break;
- Handle(TDF_Attribute) anAttribute;
- aLabel.FindAttribute (XCAFDoc_DocumentTool::GetID(), anAttribute);
- isXDEApp = !anAttribute.IsNull();
- }
- return isXDEApp;
- }
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_Tools_H
-#define DFBrowserPaneXDE_Tools_H
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-#include <TDF_Label.hxx>
-#include <TDocStd_Application.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QMap>
-#include <QWidget>
-#include <QString>
-#include <Standard_WarningsRestore.hxx>
-
-class DFBrowserPane_AttributePaneAPI;
-
-//! \namespace DFBrowserPaneXDE_Tools
-//! The namespace that gives auxiliary methods for XCAFDoc elements manipulation
-namespace DFBrowserPaneXDE_Tools
-{
- //! Returns true if the application is XDE: application has document where there is XCAFDoc_DocumentTool attribute in
- //! a child label of the root
- //! \param theApplication checked application
- //! \return boolean value
- Standard_EXPORT bool IsXDEApplication (const Handle(TDocStd_Application)& theApplication);
-}
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocArea.hxx>
-
-#include <XCAFDoc_Area.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocArea::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Area) anAttr = Handle(XCAFDoc_Area)::DownCast (theAttribute);
- theValues.append ("Get");
- theValues.append (anAttr->Get());
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocArea_H
-#define DFBrowserPaneXDE_XCAFDocArea_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocArea
-//! \brief The class to manipulate of XCAF_DocArea attribute
-class DFBrowserPaneXDE_XCAFDocArea : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPaneXDE_XCAFDocArea() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocArea() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocCentroid.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-
-#include <XCAFDoc_Centroid.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_XCAFDocCentroid::DFBrowserPaneXDE_XCAFDocCentroid()
-: DFBrowserPane_AttributePane()
-{
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocCentroid::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Centroid) anAttr = Handle(XCAFDoc_Centroid)::DownCast (theAttribute);
- gp_Pnt aPoint = anAttr->Get();
- theValues << "Get: X" << aPoint.X()
- << "Get: Y" << aPoint.Y()
- << "Get: Z" << aPoint.Z();
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocCentroid::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Centroid) anAttr = Handle(XCAFDoc_Centroid)::DownCast (theAttribute);
- gp_Pnt aPoint = anAttr->Get();
- theValues.append (QString ("(%1, %2, %3)").arg (aPoint.X()).arg (aPoint.Y()).arg (aPoint.Z()));
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocCentroid_H
-#define DFBrowserPaneXDE_XCAFDocCentroid_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocCentroid
-//! \brief The class to manipulate of XCAFDoc_Centroid attribute
-class DFBrowserPaneXDE_XCAFDocCentroid : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_XCAFDocCentroid();
-
- //! Destructor
- Standard_EXPORT virtual ~DFBrowserPaneXDE_XCAFDocCentroid() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocColor.hxx>
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-
-#include <XCAFDoc_Color.hxx>
-
-#include <Quantity_Color.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QColor>
-#include <Standard_WarningsRestore.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_XCAFDocColor::DFBrowserPaneXDE_XCAFDocColor()
-: DFBrowserPane_AttributePane()
-{
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocColor::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Color) anAttr = Handle(XCAFDoc_Color)::DownCast (theAttribute);
- const Quantity_Color& aColor = anAttr->GetColor();
-
- theValues << "GetColor: Red" << aColor.Red();
- theValues << "GetColor: Green" << aColor.Green();
- theValues << "GetColor: Blue" << aColor.Blue();
-
- theValues << "GetColor: Name" << aColor.Name();
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocColor::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Color) anAttr = Handle(XCAFDoc_Color)::DownCast (theAttribute);
- const Quantity_Color& aColor = anAttr->GetColor();
- theValues.append (QString ("(%1, %2, %3)").arg (aColor.Red()).arg (aColor.Green()).arg (aColor.Blue()));
-}
-
-// =======================================================================
-// function : GetAttributeInfo
-// purpose :
-// =======================================================================
-QVariant DFBrowserPaneXDE_XCAFDocColor::GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute, int theRole, int theColumnId)
-{
- if (theColumnId != 0)
- return DFBrowserPane_AttributePane::GetAttributeInfo (theAttribute, theRole, theColumnId);
-
- switch (theRole)
- {
- case Qt::BackgroundRole:
- {
- const Quantity_Color& aColor = Handle(XCAFDoc_Color)::DownCast (theAttribute)->GetColor();
- return QColor ((int)(aColor.Red()*255.), (int)(aColor.Green()*255.), (int)(aColor.Blue()*255.));
- }
- default:
- break;
- }
- return DFBrowserPane_AttributePane::GetAttributeInfo (theAttribute, theRole, theColumnId);
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocColor_H
-#define DFBrowserPaneXDE_XCAFDocColor_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocColor
-//! \brief The class to manipulate of XCAFDoc_Color attribute
-class DFBrowserPaneXDE_XCAFDocColor : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_XCAFDocColor();
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocColor() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns information for the given attribute
- //! \param theAttribute a current attribute
- //! \param theRole a role of information, used by tree model (e.g. DisplayRole, icon, background and so on)
- //! \param theColumnId a tree model column
- //! \return value, interpreted by tree model depending on the role
- Standard_EXPORT virtual QVariant GetAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- int theRole, int theColumnId) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocColorTool.hxx>
-
-#include <XCAFDoc_Area.hxx>
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocColorTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocColorTool_H
-#define DFBrowserPaneXDE_XCAFDocColorTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_
-//! \brief The class to manipulate of XCAFDoc_ColorTool attribute
-class DFBrowserPaneXDE_XCAFDocColorTool : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocColorTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocColorTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocDatum.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-
-#include <TCollection_HAsciiString.hxx>
-
-#include <XCAFDoc_Datum.hxx>
-#include <XCAFDimTolObjects_DatumObject.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_XCAFDocDatum::DFBrowserPaneXDE_XCAFDocDatum()
-: DFBrowserPane_AttributePane()
-{
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDatum::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Datum) anAttr = Handle(XCAFDoc_Datum)::DownCast (theAttribute);
-
- Handle(TCollection_HAsciiString) aName = anAttr->GetName();
- Handle(TCollection_HAsciiString) aDescription = anAttr->GetDescription();
- Handle(TCollection_HAsciiString) anIdentification = anAttr->GetIdentification();
-
- theValues << "Name" << (!aName.IsNull() ? aName->ToCString() : QString (""))
- << "Description" << (!aDescription.IsNull() ? aDescription->ToCString() : QString (""))
- << "Identification" << (!anIdentification.IsNull() ? anIdentification->ToCString() : QString (""));
-
- Handle(XCAFDimTolObjects_DatumObject) anObject = anAttr->GetObject();
- Handle(TCollection_HAsciiString) anObjectName;
- if (!anObject.IsNull())
- anObjectName = anObject->GetName();
- theValues << "Object" << (!anObjectName.IsNull() ? anObjectName->ToCString() : "Empty Name");
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDatum::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_Datum) anAttr = Handle(XCAFDoc_Datum)::DownCast (theAttribute);
-
- Handle(TCollection_HAsciiString) aName = anAttr->GetName();
- theValues << (!aName.IsNull() ? aName->ToCString() : QString (""));
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocDatum_H
-#define DFBrowserPaneXDE_XCAFDocDatum_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocDatum
-//! \brief The class to manipulate of XCAFDoc_Datum attribute
-class DFBrowserPaneXDE_XCAFDocDatum : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_XCAFDocDatum();
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocDatum() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocDimTol.hxx>
-
-#include <XCAFDoc_DimTol.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDimTol::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocDimTol_H
-#define DFBrowserPaneXDE_XCAFDocDimTol_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocDimTol
-//! \brief The class to manipulate of XCAFDoc_DimTol attribute
-class DFBrowserPaneXDE_XCAFDocDimTol : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocDimTol() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocDimTol() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocDimTolTool.hxx>
-
-#include <XCAFDoc_DimTolTool.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDimTolTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocDimTolTool_H
-#define DFBrowserPaneXDE_XCAFDocDimTolTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocDimTolTool
-//! \brief The class to manipulate of XCAFDoc_DimTolTool attribute
-class DFBrowserPaneXDE_XCAFDocDimTolTool : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPaneXDE_XCAFDocDimTolTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocDimTolTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocDimension.hxx>
-
-#include <XCAFDoc_Dimension.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDimension::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocDimension_H
-#define DFBrowserPaneXDE_XCAFDocDimension_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocDimension
-//! \brief The class to manipulate of XCAFDoc_Dimension attribute
-class DFBrowserPaneXDE_XCAFDocDimension : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocDimension() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocDimension() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocDocumentTool.hxx>
-
-#include <XCAFDoc_DocumentTool.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocDocumentTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocDocumentTool_H
-#define DFBrowserPaneXDE_XCAFDocDocumentTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_
-//! \brief The class to manipulate of XCAFDoc_DocumentTool attribute
-class DFBrowserPaneXDE_XCAFDocDocumentTool : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocDocumentTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocDocumentTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocGeomTolerance.hxx>
-
-#include <XCAFDoc_GeomTolerance.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocGeomTolerance::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocGeomTolerance_H
-#define DFBrowserPaneXDE_XCAFDocGeomTolerance_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocGeomTolerance
-//! \brief The class to manipulate of XCAFDoc_GeomTolerance attribute
-class DFBrowserPaneXDE_XCAFDocGeomTolerance : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocGeomTolerance() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocGeomTolerance() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocGraphNode.hxx>
-
-#include <XCAFDoc_GraphNode.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocGraphNode::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocGraphNode_H
-#define DFBrowserPaneXDE_XCAFDocGraphNode_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocGraphNode
-//! \brief The class to manipulate of XCAFDoc_GraphNode attribute
-class DFBrowserPaneXDE_XCAFDocGraphNode : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPaneXDE_XCAFDocGraphNode() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocGraphNode() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocLayerTool.hxx>
-
-#include <XCAFDoc_Area.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocLayerTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocLayerTool_H
-#define DFBrowserPaneXDE_XCAFDocLayerTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocLayerTool
-//! \brief The class to manipulate of XCAFDoc_LayerTool attribute
-class DFBrowserPaneXDE_XCAFDocLayerTool : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocLayerTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocLayerTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocLocation.hxx>
-
-#include <XCAFDoc_Location.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocLocation::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocLocation_H
-#define DFBrowserPaneXDE_XCAFDocLocation_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocLocation
-//! \brief The class to manipulate of XCAFDoc_Location attribute
-class DFBrowserPaneXDE_XCAFDocLocation : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocLocation() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocLocation() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocMaterial.hxx>
-
-#include <XCAFDoc_Material.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocMaterial::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocMaterial_H
-#define DFBrowserPaneXDE_XCAFDocMaterial_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocMaterial
-//! \brief The class to manipulate of XCAFDoc_Material attribute
-class DFBrowserPaneXDE_XCAFDocMaterial : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPaneXDE_XCAFDocMaterial() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocMaterial() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocMaterialTool.hxx>
-
-#include <XCAFDoc_MaterialTool.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocMaterialTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocMaterialTool_H
-#define DFBrowserPaneXDE_XCAFDocMaterialTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XCAFDocMaterialTool
-//! \brief The class to manipulate of XCAFDoc_MaterialTool attribute
-class DFBrowserPaneXDE_XCAFDocMaterialTool : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- DFBrowserPaneXDE_XCAFDocMaterialTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocMaterialTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocShapeMapTool.hxx>
-
-#include <inspector/DFBrowserPane_AttributePaneModel.hxx>
-#include <inspector/DFBrowserPane_HelperExport.hxx>
-#include <inspector/DFBrowserPane_ItemDelegateButton.hxx>
-#include <inspector/DFBrowserPane_TableView.hxx>
-#include <inspector/DFBrowserPane_Tools.hxx>
-
-#include <AIS_Shape.hxx>
-#include <BRepTools.hxx>
-#include <BRep_Builder.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Compound.hxx>
-#include <XCAFDoc_ShapeMapTool.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QEvent>
-#include <QFileDialog>
-#include <QGridLayout>
-#include <QHeaderView>
-#include <QIcon>
-#include <QMap>
-#include <QPainter>
-#include <QStyledItemDelegate>
-#include <QTableView>
-#include <QVariant>
-#include <QWidget>
-#include <Standard_WarningsRestore.hxx>
-
-const int COLUMN_EXPORT_WIDTH = 20;
-const int COLUMN_TYPE_WIDTH = 70;
-const int COLUMN_POINTER_WIDTH = 110;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-DFBrowserPaneXDE_XCAFDocShapeMapTool::DFBrowserPaneXDE_XCAFDocShapeMapTool()
-: DFBrowserPane_AttributePane(), myHelperExport (0)
-{
- QList<QVariant> aHeaderValues;
- aHeaderValues << "TShape"<< "Type" << "";
-
- getPaneModel()->SetHeaderValues (aHeaderValues, Qt::Horizontal);
- getPaneModel()->SetColumnCount (aHeaderValues.count());
- getPaneModel()->SetItalicColumns (QList<int>());
-}
-
-// =======================================================================
-// function : CreateWidget
-// purpose :
-// =======================================================================
-QWidget* DFBrowserPaneXDE_XCAFDocShapeMapTool::CreateWidget (QWidget* theParent)
-{
- QWidget* aMainWidget = new QWidget (theParent);
- aMainWidget->setVisible (false);
-
- myTableView = new DFBrowserPane_TableView (aMainWidget);
- myTableView->SetModel (myPaneModel);
- QTableView* aTableView = myTableView->GetTableView();
- aTableView->setSelectionModel (mySelectionModels.front());
- aTableView->horizontalHeader()->setStretchLastSection (false);
-
- aTableView->setColumnWidth (0, COLUMN_POINTER_WIDTH);
- aTableView->setColumnWidth (1, COLUMN_TYPE_WIDTH);
- aTableView->setColumnWidth (2, COLUMN_EXPORT_WIDTH);
- aTableView->verticalHeader()->setVisible (true);
- DFBrowserPane_ItemDelegateButton* anItemDelegate = new DFBrowserPane_ItemDelegateButton (aTableView,
- ":/icons/export_shape.png");
- QObject::connect (anItemDelegate, SIGNAL (buttonPressed (const QModelIndex&)),
- &myHelperExport, SLOT (OnButtonPressed (const QModelIndex&)));
- aTableView->setItemDelegateForColumn (2, anItemDelegate);
-
- QGridLayout* aLay = new QGridLayout (aMainWidget);
- aLay->setContentsMargins (0, 0, 0, 0);
- aLay->addWidget (myTableView, 0, 0);
-
- return aMainWidget;
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocShapeMapTool::Init (const Handle(TDF_Attribute)& theAttribute)
-{
- DFBrowserPane_AttributePaneAPI::Init (theAttribute);
-}
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocShapeMapTool::GetValues (const Handle(TDF_Attribute)& theAttribute, QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_ShapeMapTool) anAttr = Handle(XCAFDoc_ShapeMapTool)::DownCast (theAttribute);
-
- const TopTools_IndexedMapOfShape& aShapeMap = anAttr->GetMap();
- for (int aShapeValueId = 1, aNbShapes = aShapeMap.Extent(); aShapeValueId <= aNbShapes; aShapeValueId++)
- {
- const TopoDS_Shape& aShape = aShapeMap(aShapeValueId);
-
- if (!aShape.IsNull())
- theValues << Standard_Dump::GetPointerInfo (aShape.TShape()->This()).ToCString()
- << DFBrowserPane_Tools::ShapeTypeInfo (aShape)
- << "";
- else
- theValues << "" << "" << "";
- }
-}
-
-// =======================================================================
-// function : GetShortAttributeInfo
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocShapeMapTool::GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues)
-{
- Handle(XCAFDoc_ShapeMapTool) anAttr = Handle(XCAFDoc_ShapeMapTool)::DownCast (theAttribute);
- theValues.append (QString ("[%1]").arg (anAttr->GetMap().Extent()));
-}
-
-// =======================================================================
-// function : GetPresentation
-// purpose :
-// =======================================================================
-Handle(Standard_Transient) DFBrowserPaneXDE_XCAFDocShapeMapTool::GetPresentation (const Handle(TDF_Attribute)& theAttribute)
-{
- Handle(AIS_InteractiveObject) aPresentation;
-
- Handle(XCAFDoc_ShapeMapTool) anAttr = Handle(XCAFDoc_ShapeMapTool)::DownCast (theAttribute);
- if (anAttr.IsNull())
- return aPresentation;
-
- BRep_Builder aBuilder;
- TopoDS_Compound aComp;
- aBuilder.MakeCompound (aComp);
-
- const TopTools_IndexedMapOfShape& aShapeMap = anAttr->GetMap();
- for (int aShapeValueId = 1, aNbShapes = aShapeMap.Extent(); aShapeValueId <= aNbShapes; aShapeValueId++)
- {
- const TopoDS_Shape& aShape = aShapeMap(aShapeValueId);
- if (!aShape.IsNull())
- aBuilder.Add (aComp, aShape);
- }
- aPresentation = new AIS_Shape (aComp);
- return aPresentation;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocShapeMapTool_H
-#define DFBrowserPaneXDE_XCAFDocShapeMapTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <inspector/DFBrowserPane_HelperExport.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-class DFBrowserPane_TableView;
-class QWidget;
-
-//! \class DFBrowserPaneXDE_
-//! \brief The class to manipulate of XCAFDoc_ShapeMapTool attribute
-class DFBrowserPaneXDE_XCAFDocShapeMapTool : public DFBrowserPane_AttributePane
-{
-public:
- //! Constructor
- Standard_EXPORT DFBrowserPaneXDE_XCAFDocShapeMapTool();
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocShapeMapTool() {}
-
- //! Creates table view and call create widget of array table helper
- //! \param theParent a parent widget
- //! \return a new widget
- Standard_EXPORT virtual QWidget* CreateWidget (QWidget* theParent) Standard_OVERRIDE;
-
- //! Initializes the content of the pane by the parameter attribute
- //! \param theAttribute an OCAF attribute
- Standard_EXPORT virtual void Init (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
- //! Returns brief attribute information. In general case, it returns GetValues() result.
- //! \param theAttribute a current attribute
- //! \param theValues a result list of values
- Standard_EXPORT virtual void GetShortAttributeInfo (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-
- //! Returns presentation of the attribute to be visualized in the view
- //! \param theAttribute a current attribute
- //! \return handle of presentation if the attribute has, to be visualized
- Standard_EXPORT virtual Handle(Standard_Transient) GetPresentation
- (const Handle(TDF_Attribute)& theAttribute) Standard_OVERRIDE;
-
-private:
-
- DFBrowserPane_HelperExport myHelperExport; //!< processing of Export button click
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XCAFDocShapeTool.hxx>
-
-#include <XCAFDoc_ShapeTool.hxx>
-
-// =======================================================================
-// function : GetValues
-// purpose :
-// =======================================================================
-void DFBrowserPaneXDE_XCAFDocShapeTool::GetValues (const Handle(TDF_Attribute)&, QList<QVariant>&)
-{
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 DFBrowserPaneXDE_XCAFDocShapeTool_H
-#define DFBrowserPaneXDE_XCAFDocShapeTool_H
-
-#include <inspector/DFBrowserPane_AttributePane.hxx>
-#include <Standard.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_
-//! \brief The class to manipulate of XCAFDoc_ShapeTool attribute
-class DFBrowserPaneXDE_XCAFDocShapeTool : public DFBrowserPane_AttributePane
-{
-public:
-
- //! Constructor
- DFBrowserPaneXDE_XCAFDocShapeTool() {}
-
- //! Destructor
- virtual ~DFBrowserPaneXDE_XCAFDocShapeTool() {}
-
- //! Returns values to fill the table view model
- //! \param theAttribute a current attribute
- //! \param theValues a container of values
- Standard_EXPORT virtual void GetValues (const Handle(TDF_Attribute)& theAttribute,
- QList<QVariant>& theValues) Standard_OVERRIDE;
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/DFBrowserPaneXDE_XDEDRAW.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HArray1OfReal.hxx>
-
-#include <TDataStd_AsciiString.hxx>
-#include <TDataStd_ByteArray.hxx>
-#include <TDataStd_Comment.hxx>
-#include <TDataStd_Integer.hxx>
-#include <TDataStd_IntegerArray.hxx>
-#include <TDataStd_Name.hxx>
-#include <TDataStd_Real.hxx>
-#include <TDataStd_RealArray.hxx>
-#include <TDataStd_TreeNode.hxx>
-#include <TDataStd_UAttribute.hxx>
-
-#include <TDF_Reference.hxx>
-#include <TDF_Tool.hxx>
-
-#include <TNaming_NamedShape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <XCAFDoc.hxx>
-#include <XCAFDoc_Area.hxx>
-#include <XCAFDoc_Centroid.hxx>
-#include <XCAFDoc_Color.hxx>
-#include <XCAFDoc_ColorTool.hxx>
-#include <XCAFDoc_DimTol.hxx>
-#include <XCAFDoc_Dimension.hxx>
-#include <XCAFDoc_GeomTolerance.hxx>
-#include <XCAFDoc_Datum.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <XCAFDoc_GraphNode.hxx>
-#include <XCAFDoc_LayerTool.hxx>
-#include <XCAFDoc_Material.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
-#include <XCAFDoc_Volume.hxx>
-
-// =======================================================================
-// function : GetAttributeInfo
-// purpose :
-// =======================================================================
-TCollection_AsciiString DFBrowserPaneXDE_XDEDRAW::GetAttributeInfo (Handle(TDF_Attribute) att)
-{
- TCollection_AsciiString anInfo;
-
- if ( att->IsKind(STANDARD_TYPE (TDataStd_TreeNode)) ) {
- Standard_CString type = "";
- if ( att->ID() == XCAFDoc::ShapeRefGUID() ) type = "Shape Instance Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorGen) ) type = "Generic Color Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorSurf) ) type = "Surface Color Link";
- else if ( att->ID() == XCAFDoc::ColorRefGUID(XCAFDoc_ColorCurv) ) type = "Curve Color Link";
- else if ( att->ID() == XCAFDoc::DimTolRefGUID() ) type = "DGT Link";
- else if ( att->ID() == XCAFDoc::DatumRefGUID() ) type = "Datum Link";
- else if ( att->ID() == XCAFDoc::MaterialRefGUID() ) type = "Material Link";
- Handle(TDataStd_TreeNode) TN = Handle(TDataStd_TreeNode)::DownCast (att);
- TCollection_AsciiString ref;
- if ( TN->HasFather() ) {
- TDF_Tool::Entry ( TN->Father()->Label(), ref );
- anInfo = type;
- anInfo += TCollection_AsciiString (" ==> ") + ref.ToCString();
- }
- else {
- anInfo = type;
- anInfo += TCollection_AsciiString (" <== (") + ref.ToCString();
- Handle(TDataStd_TreeNode) child = TN->First();
- while ( ! child.IsNull() ) {
- TDF_Tool::Entry ( child->Label(), ref );
- if ( child != TN->First() ) anInfo += ", " ;
- anInfo += ref.ToCString();
- child = child->Next();
- }
- anInfo += ")";
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (TDF_Reference)) ) {
- Handle(TDF_Reference) val = Handle(TDF_Reference)::DownCast ( att );
- TCollection_AsciiString ref;
- TDF_Tool::Entry ( val->Get(), ref );
- anInfo += TCollection_AsciiString ("==> ") + ref.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_Integer)) ) {
- Handle(TDataStd_Integer) val = Handle(TDataStd_Integer)::DownCast ( att );
- anInfo = TCollection_AsciiString ( val->Get() );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_Real)) ) {
- Handle(TDataStd_Real) val = Handle(TDataStd_Real)::DownCast ( att );
- anInfo = TCollection_AsciiString ( val->Get() );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_Name)) ) {
- Handle(TDataStd_Name) val = Handle(TDataStd_Name)::DownCast ( att );
- anInfo = TCollection_AsciiString ( val->Get(), '?' );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_Comment)) ) {
- Handle(TDataStd_Comment) val = Handle(TDataStd_Comment)::DownCast ( att );
- anInfo = TCollection_AsciiString ( val->Get(), '?' );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_AsciiString)) ) {
- Handle(TDataStd_AsciiString) val = Handle(TDataStd_AsciiString)::DownCast ( att );
- anInfo = TCollection_AsciiString ( val->Get(), '?' );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_IntegerArray)) ) {
- Handle(TDataStd_IntegerArray) val = Handle(TDataStd_IntegerArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
- anInfo += TCollection_AsciiString ( val->Value(j) );
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_RealArray)) ) {
- Handle(TDataStd_RealArray) val = Handle(TDataStd_RealArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
- anInfo += TCollection_AsciiString ( val->Value(j) );
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_ByteArray)) ) {
- Handle(TDataStd_ByteArray) val = Handle(TDataStd_ByteArray)::DownCast ( att );
- for ( Standard_Integer j=val->Lower(); j <= val->Upper(); j++ ) {
- if ( j > val->Lower() ) anInfo += TCollection_AsciiString ( ", " );
- anInfo += TCollection_AsciiString ( val->Value(j) );
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (TNaming_NamedShape)) ) {
- Handle(TNaming_NamedShape) val = Handle(TNaming_NamedShape)::DownCast ( att );
- TopoDS_Shape S = val->Get();
- if (!S.IsNull())
- anInfo = S.TShape()->DynamicType()->Name();
- else
- anInfo = "Empty Shape";
- if ( ! S.Location().IsIdentity() ) anInfo += TCollection_AsciiString ( "(located)" );
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_Volume)) ) {
- Handle(XCAFDoc_Volume) val = Handle(XCAFDoc_Volume)::DownCast ( att );
- anInfo += TCollection_AsciiString ( val->Get() );
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_Area)) ) {
- Handle(XCAFDoc_Area) val = Handle(XCAFDoc_Area)::DownCast ( att );
- TCollection_AsciiString str ( val->Get() );
- anInfo = str.ToCString();
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_Centroid)) ) {
- Handle(XCAFDoc_Centroid) val = Handle(XCAFDoc_Centroid)::DownCast ( att );
- gp_Pnt myCentroid = val->Get();
- anInfo = "(" ;
- anInfo += TCollection_AsciiString ( myCentroid.X() ).ToCString();
- anInfo += TCollection_AsciiString ( " , " );
- anInfo += TCollection_AsciiString ( TCollection_AsciiString ( myCentroid.Y() ).ToCString() );
- anInfo += TCollection_AsciiString ( " , " );
- anInfo += TCollection_AsciiString ( myCentroid.Z() ).ToCString();
- anInfo += TCollection_AsciiString ( ")" );
- }
- else if ( att->IsKind(STANDARD_TYPE (TDataStd_UAttribute)) ) {
- if ( att->ID() == XCAFDoc::AssemblyGUID() ) anInfo += TCollection_AsciiString ( "is assembly" );
- if ( att->ID() == XCAFDoc::InvisibleGUID() ) anInfo += TCollection_AsciiString ( "invisible" );
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_Color)) ) {
- Handle(XCAFDoc_Color) val = Handle(XCAFDoc_Color)::DownCast ( att );
- Quantity_Color C = val->GetColor();
- char string[260];
- Sprintf ( string, "%s (%g, %g, %g)", C.StringName ( C.Name() ),
- C.Red(), C.Green(), C.Blue() );
- anInfo = string;
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_DimTol)) ) {
- Handle(XCAFDoc_DimTol) val = Handle(XCAFDoc_DimTol)::DownCast ( att );
- Standard_Integer kind = val->GetKind();
- Handle(TColStd_HArray1OfReal) HAR = val->GetVal();
- if(kind<20) { //dimension
- anInfo = "Diameter (ValueRange[";
- anInfo += TCollection_AsciiString ( HAR->Value(1) );
- anInfo += TCollection_AsciiString ( "," );
- anInfo += TCollection_AsciiString ( HAR->Value(2) );
- anInfo += TCollection_AsciiString ( "])" );
- }
- else {
- switch (kind) {
- case 21: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_1"; break;
- case 22: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_2"; break;
- case 23: anInfo = "GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol_3"; break;
- case 24: anInfo = "AngularityTolerance"; break;
- case 25: anInfo = "CircularRunoutTolerance"; break;
- case 26: anInfo = "CoaxialityTolerance"; break;
- case 27: anInfo = "ConcentricityTolerance"; break;
- case 28: anInfo = "ParallelismTolerance"; break;
- case 29: anInfo = "PerpendicularityTolerance"; break;
- case 30: anInfo = "SymmetryTolerance"; break;
- case 31: anInfo = "TotalRunoutTolerance"; break;
- case 35: anInfo = "ModifiedGeometricTolerance_1"; break;
- case 36: anInfo = "ModifiedGeometricTolerance_2"; break;
- case 37: anInfo = "ModifiedGeometricTolerance_3"; break;
- case 38: anInfo = "CylindricityTolerance"; break;
- case 39: anInfo = "FlatnessTolerance"; break;
- case 40: anInfo = "LineProfileTolerance"; break;
- case 41: anInfo = "PositionTolerance"; break;
- case 42: anInfo = "RoundnessTolerance"; break;
- case 43: anInfo = "StraightnessTolerance"; break;
- case 44: anInfo = "SurfaceProfileTolerance"; break;
- }
- if (anInfo.Length() > 0) {
- anInfo += " (Value=";
- anInfo += TCollection_AsciiString (HAR->Value (1));
- anInfo += ")";
- }
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_Material)) ) {
- Handle(XCAFDoc_Material) val = Handle(XCAFDoc_Material)::DownCast ( att );
- Standard_Real dens = val->GetDensity();
- Standard_CString dimdens = "g/cu sm";
- if(dens==0)
- anInfo = val->GetName()->ToCString();
- else {
- anInfo = val->GetName()->ToCString();
- anInfo += "(density=";
- anInfo += TCollection_AsciiString ( dens );
- anInfo += dimdens;
- anInfo += ")";
- }
- }
- else if ( att->IsKind(STANDARD_TYPE (XCAFDoc_GraphNode)) ) {
- Standard_CString type;
- if ( att->ID() == XCAFDoc::LayerRefGUID() ) {
- type = "Layer Instance Link";
- }
- else if ( att->ID() == XCAFDoc::SHUORefGUID() ) {
- type = "SHUO Instance Link";
- }
- else if ( att->ID() == XCAFDoc::DatumTolRefGUID() ) {
- type = "DatumToler Link";
- }
- else if ( att->ID() == XCAFDoc::DimensionRefFirstGUID() ) {
- type = "Dimension Link First";
- }
- else if ( att->ID() == XCAFDoc::DimensionRefSecondGUID() ) {
- type = "Dimension Link Second";
- }
- else if ( att->ID() == XCAFDoc::GeomToleranceRefGUID() ){
- type = "GeomTolerance Link";
- }
- else
- return TCollection_AsciiString();
-
- Handle(XCAFDoc_GraphNode) DETGN = Handle(XCAFDoc_GraphNode)::DownCast (att);
- TCollection_AsciiString ref;
- Standard_Integer ii = 1;
- if (DETGN->NbFathers()!=0) {
-
- TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
- anInfo = type;
- anInfo += " ==> (";
- anInfo += ref;
- for (ii = 2; ii <= DETGN->NbFathers(); ii++) {
- TDF_Tool::Entry ( DETGN->GetFather(ii)->Label(), ref );
- anInfo += ", ";
- anInfo += ref.ToCString();
- }
- anInfo += ") ";
- }
- ii = 1;
- if (DETGN->NbChildren ()!=0) {
- TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
- anInfo += type;
- anInfo += " <== (";
- anInfo += ref;
- for (ii = 2; ii <= DETGN->NbChildren (); ii++) {
- TDF_Tool::Entry ( DETGN->GetChild(ii)->Label(), ref );
- anInfo += ", ";
- anInfo += ref;
- }
- anInfo += ") ";
- }
- }
- return anInfo;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 _DFBrowserPaneXDE_XDEDRAW__H
-#define _DFBrowserPaneXDE_XDEDRAW__H
-
-#include <Standard.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDF_Attribute.hxx>
-
-//! \class DFBrowserPaneXDE_XDEDRAW
-//! \brief The tool that gives auxiliary methods for XDE elements manipulation
-class DFBrowserPaneXDE_XDEDRAW
-{
-public:
- //! Dumps the attribute information into a string. The similar information is provided in Draw for XDE format
- //! \param theAttribute
- //! \return the GUID value
- Standard_EXPORT static TCollection_AsciiString GetAttributeInfo (Handle(TDF_Attribute) theAttribute);
-};
-
-#endif
+++ /dev/null
-DFBrowserPaneXDE_AttributeCommonPane.cxx
-DFBrowserPaneXDE_AttributeCommonPane.hxx
-DFBrowserPaneXDE_AttributePaneCreator.cxx
-DFBrowserPaneXDE_AttributePaneCreator.hxx
-DFBrowserPaneXDE_Tools.cxx
-DFBrowserPaneXDE_Tools.hxx
-DFBrowserPaneXDE_XCAFDocArea.cxx
-DFBrowserPaneXDE_XCAFDocArea.hxx
-DFBrowserPaneXDE_XCAFDocCentroid.cxx
-DFBrowserPaneXDE_XCAFDocCentroid.hxx
-DFBrowserPaneXDE_XCAFDocColor.cxx
-DFBrowserPaneXDE_XCAFDocColor.hxx
-DFBrowserPaneXDE_XCAFDocColorTool.cxx
-DFBrowserPaneXDE_XCAFDocColorTool.hxx
-DFBrowserPaneXDE_XCAFDocDatum.cxx
-DFBrowserPaneXDE_XCAFDocDatum.hxx
-DFBrowserPaneXDE_XCAFDocDimension.cxx
-DFBrowserPaneXDE_XCAFDocDimension.hxx
-DFBrowserPaneXDE_XCAFDocDimTol.cxx
-DFBrowserPaneXDE_XCAFDocDimTol.hxx
-DFBrowserPaneXDE_XCAFDocDimTolTool.cxx
-DFBrowserPaneXDE_XCAFDocDimTolTool.hxx
-DFBrowserPaneXDE_XCAFDocDocumentTool.cxx
-DFBrowserPaneXDE_XCAFDocDocumentTool.hxx
-DFBrowserPaneXDE_XCAFDocGeomTolerance.cxx
-DFBrowserPaneXDE_XCAFDocGeomTolerance.hxx
-DFBrowserPaneXDE_XCAFDocGraphNode.cxx
-DFBrowserPaneXDE_XCAFDocGraphNode.hxx
-DFBrowserPaneXDE_XCAFDocLayerTool.cxx
-DFBrowserPaneXDE_XCAFDocLayerTool.hxx
-DFBrowserPaneXDE_XCAFDocLocation.cxx
-DFBrowserPaneXDE_XCAFDocLocation.hxx
-DFBrowserPaneXDE_XCAFDocMaterial.cxx
-DFBrowserPaneXDE_XCAFDocMaterial.hxx
-DFBrowserPaneXDE_XCAFDocMaterialTool.cxx
-DFBrowserPaneXDE_XCAFDocMaterialTool.hxx
-DFBrowserPaneXDE_XCAFDocShapeMapTool.cxx
-DFBrowserPaneXDE_XCAFDocShapeMapTool.hxx
-DFBrowserPaneXDE_XCAFDocShapeTool.cxx
-DFBrowserPaneXDE_XCAFDocShapeTool.hxx
-DFBrowserPaneXDE_XDEDRAW.cxx
-DFBrowserPaneXDE_XDEDRAW.hxx
--- /dev/null
+MessageModel.qrc
+MessageModel_Actions.cxx
+MessageModel_Actions.hxx
+MessageModel_ActionType.hxx
+MessageModel_ItemAlert.cxx
+MessageModel_ItemAlert.hxx
+MessageModel_ItemBase.cxx
+MessageModel_ItemBase.hxx
+MessageModel_ItemReport.cxx
+MessageModel_ItemReport.hxx
+MessageModel_ItemRoot.cxx
+MessageModel_ItemRoot.hxx
+MessageModel_TreeModel.cxx
+MessageModel_TreeModel.hxx
--- /dev/null
+<!DOCTYPE RCC><RCC version="1.0">
+ <qresource>
+ <file>icons/item_shape.png</file>
+ <file>icons/item_streamValues.png</file>
+ </qresource>
+</RCC>
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_ActionType_H
+#define MessageModel_ActionType_H
+
+//! Kind of action type for tree view context menu item
+enum MessageModel_ActionType
+{
+ MessageModel_ActionType_Activate, //!< set Message_Report active
+ MessageModel_ActionType_Deactivate, //!< set Message_Report not active
+ MessageModel_ActionType_Clear, //!< clear Message_Report alerts
+ MessageModel_ActionType_ExportToShapeView, //!< export TopoDS_Shape of selected item into TKShapeView plugin
+ MessageModel_ActionType_TestMetric, //!< test alerts
+ MessageModel_ActionType_TestMessenger, //!< test message view on messenger printer to report
+ MessageModel_ActionType_TestReportTree //!< test message view on hierarchical report
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_Actions.hxx>
+
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_TreeModel.hxx>
+#include <inspector/TInspectorAPI_PluginParameters.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <Message.hxx>
+#include <Message_AlertExtended.hxx>
+#include <Message_Messenger.hxx>
+#include <Message_PrinterToReport.hxx>
+#include <OSD_Chronometer.hxx>
+#include <Quantity_Color.hxx>
+#include <Quantity_ColorRGBA.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopoDS_AlertAttribute.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAction>
+#include <QFileDialog>
+#include <QItemSelectionModel>
+#include <QMenu>
+#include <QMessageBox>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+MessageModel_Actions::MessageModel_Actions (QWidget* theParent,
+ MessageModel_TreeModel* theTreeModel,
+ QItemSelectionModel* theModel)
+: QObject (theParent), myTreeModel (theTreeModel), mySelectionModel (theModel)
+{
+ myActions.insert (MessageModel_ActionType_Activate,
+ ViewControl_Tools::CreateAction (tr ("Activate"), SLOT (OnActivateReport()), parent(), this));
+ myActions.insert (MessageModel_ActionType_Deactivate,
+ ViewControl_Tools::CreateAction (tr ("Deactivate"), SLOT (OnDeactivateReport()), parent(), this));
+ myActions.insert (MessageModel_ActionType_Clear,
+ ViewControl_Tools::CreateAction (tr ("Clear"), SLOT (OnClearReport()), parent(), this));
+ myActions.insert (MessageModel_ActionType_ExportToShapeView,
+ ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
+}
+
+// =======================================================================
+// function : GetAction
+// purpose :
+// =======================================================================
+QAction* MessageModel_Actions::GetAction (const MessageModel_ActionType& theType)
+{
+ return myActions.contains (theType) ? myActions[theType] : 0;
+}
+
+// =======================================================================
+// function : AddMenuActions
+// purpose :
+// =======================================================================
+void MessageModel_Actions::AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu)
+{
+ MessageModel_ItemRootPtr aRootItem;
+ MessageModel_ItemReportPtr aReportItem;
+ MessageModel_ItemAlertPtr anAlertItem;
+ for (QModelIndexList::const_iterator aSelIt = theSelectedIndices.begin(); aSelIt != theSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ aRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItemBase);
+ if (aRootItem)
+ break;
+
+ aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
+ if (aReportItem)
+ break;
+
+ anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (anItemBase);
+ if (anAlertItem)
+ break;
+ }
+
+ if (aReportItem && !aReportItem->GetReport().IsNull())
+ {
+ theMenu->addAction (myActions[MessageModel_ActionType_Deactivate]);
+ theMenu->addAction (myActions[MessageModel_ActionType_Activate]);
+ theMenu->addAction (myActions[MessageModel_ActionType_Clear]);
+ }
+ else if (anAlertItem)
+ {
+ theMenu->addAction (myActions[MessageModel_ActionType_ExportToShapeView]);
+ }
+
+ theMenu->addSeparator();
+}
+
+// =======================================================================
+// function : getSelectedReport
+// purpose :
+// =======================================================================
+Handle(Message_Report) MessageModel_Actions::getSelectedReport (QModelIndex& theReportIndex) const
+{
+ MessageModel_ItemReportPtr aReportItem;
+ QModelIndexList aSelectedIndices = mySelectionModel->selectedIndexes();
+ for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
+ theReportIndex = anIndex;
+ if (aReportItem)
+ break;
+ }
+ if (!aReportItem)
+ return NULL;
+
+ return aReportItem->GetReport();
+}
+
+// =======================================================================
+// function : OnActivateReport
+// purpose :
+// =======================================================================
+static Handle(Message_PrinterToReport) MyPrinterToReport;
+static Message_SequenceOfPrinters MyDeactivatedPrinters;
+
+void MessageModel_Actions::OnActivateReport()
+{
+ if (MyPrinterToReport.IsNull())
+ MyPrinterToReport = new Message_PrinterToReport();
+
+ if (MyPrinterToReport->Report()->IsActiveInMessenger())
+ return;
+
+ MyDeactivatedPrinters = Message::DefaultMessenger()->Printers();
+ Message::DefaultMessenger()->ChangePrinters().Clear();
+
+ Message::DefaultMessenger()->AddPrinter (MyPrinterToReport);
+ Message::DefaultReport()->UpdateActiveInMessenger();
+
+ myTreeModel->UpdateTreeModel();
+}
+
+// =======================================================================
+// function : OnDeactivateReport
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnDeactivateReport()
+{
+ if (MyPrinterToReport.IsNull() || !MyPrinterToReport->Report()->IsActiveInMessenger())
+ return;
+
+ Message::DefaultMessenger()->RemovePrinter (MyPrinterToReport);
+ Message::DefaultMessenger()->ChangePrinters().Assign (MyDeactivatedPrinters);
+
+ myTreeModel->UpdateTreeModel();
+}
+
+// =======================================================================
+// function : OnClearReport
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnClearReport()
+{
+ QModelIndex aReportIndex;
+ Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+ if (aReport.IsNull())
+ return;
+
+ aReport->Clear();
+ myTreeModel->UpdateTreeModel();
+}
+
+// =======================================================================
+// function : OnExportToShapeView
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnExportToShapeView()
+{
+ TCollection_AsciiString aPluginName ("TKShapeView");
+
+ NCollection_List<Handle(Standard_Transient)> aPluginParameters;
+ if (myParameters->FindParameters (aPluginName))
+ aPluginParameters = myParameters->Parameters (aPluginName);
+ NCollection_List<TCollection_AsciiString> anItemNames;
+ if (myParameters->FindSelectedNames (aPluginName))
+ anItemNames = myParameters->GetSelectedNames (aPluginName);
+
+ QModelIndexList aSelectedIndices = mySelectionModel->selectedIndexes();
+ QStringList anExportedPointers;
+ for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (anItemBase);
+ if (!anAlertItem)
+ continue;
+
+ Handle(Message_Alert) anAlert = anAlertItem->GetAlert();
+ if (anAlert.IsNull())
+ continue;
+
+ Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (anAlert);
+ if (anExtAlert.IsNull())
+ continue;
+
+ Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+ if (anAttribute.IsNull())
+ continue;
+
+ if (!anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ continue;
+
+ const TopoDS_Shape aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
+ if (aShape.IsNull())
+ continue;
+ aPluginParameters.Append (aShape.TShape());
+ anItemNames.Append (TInspectorAPI_PluginParameters::ParametersToString (aShape));
+
+ anExportedPointers.append (Standard_Dump::GetPointerInfo (aShape.TShape(), true).ToCString());
+ }
+
+ if (anExportedPointers.empty())
+ return;
+ myParameters->SetSelectedNames (aPluginName, anItemNames);
+ myParameters->SetParameters (aPluginName, aPluginParameters);
+ QMessageBox::information (0, "Information", QString ("TShapes '%1' are sent to %2 tool.")
+ .arg (anExportedPointers.join (", ")).arg (QString (aPluginName.ToCString())));
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_Actions_H
+#define MessageModel_Actions_H
+
+#include <Standard.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/MessageModel_ActionType.hxx>
+#include <inspector/TInspectorAPI_PluginParameters.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QObject>
+#include <QMap>
+#include <QModelIndexList>
+#include <QPoint>
+#include <QString>
+#include <Standard_WarningsRestore.hxx>
+
+class Message_Report;
+class MessageModel_TreeModel;
+
+class QAction;
+class QItemSelectionModel;
+class QMenu;
+class QWidget;
+
+//! \class MessageModel_Actions
+//! \brief This is a listener of popup context menu items and selection change in message model
+class MessageModel_Actions : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageModel_Actions (QWidget* theParent,
+ MessageModel_TreeModel* theTreeModel,
+ QItemSelectionModel* theModel);
+
+ //! Destructor
+ virtual ~MessageModel_Actions() Standard_OVERRIDE {}
+
+ //! Returns action by the type
+ //! \param theType an action type
+ //! \return an action instance if it exists
+ Standard_EXPORT QAction* GetAction (const MessageModel_ActionType& theType);
+
+ //! Fills popup menu with actions depending on the current selection
+ //! \param theSelectedIndices tree model selected indices
+ //! \param theMenu menu to be filled
+ Standard_EXPORT void AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu);
+
+ //! Sets parameters container, it should be used when the plugin is initialized or in update content
+ //! \param theParameters a parameters container
+ void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters)
+ { myParameters = theParameters; }
+
+public slots:
+ //! Set selected report active
+ void OnActivateReport();
+
+ //! Set selected report not active
+ void OnDeactivateReport();
+
+ //! Clears container of alerts of selected report
+ void OnClearReport();
+
+ //! Exports the first selected shape into ShapeViewer plugin.
+ void OnExportToShapeView();
+
+protected:
+ //! Returns report of selected tree view item if a report item is selected
+ //! \param theReportIndex tree model index of the found report
+ //! \return report instance or NULL
+ Handle(Message_Report) getSelectedReport (QModelIndex& theReportIndex) const;
+
+protected:
+ MessageModel_TreeModel* myTreeModel; //< tree model
+ QItemSelectionModel* mySelectionModel; //< selection model
+ Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
+ QMap<MessageModel_ActionType, QAction*> myActions; //!< container of all actions
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemAlert.hxx>
+
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/MessageModel_TreeModel.hxx>
+
+#include <inspector/Convert_TransientShape.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <Message_AlertExtended.hxx>
+#include <Message_AttributeMeter.hxx>
+#include <Message_AttributeStream.hxx>
+#include <Message_CompositeAlerts.hxx>
+#include <Precision.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopoDS_AlertAttribute.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QColor>
+#include <QIcon>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant MessageModel_ItemAlert::initValue (const int theRole) const
+{
+ QVariant aParentValue = MessageModel_ItemBase::initValue (theRole);
+ if (aParentValue.isValid())
+ return aParentValue;
+
+ MessageModel_ItemReportPtr aReportItem = MessageModel_ItemReport::FindReportItem (Parent());
+ if (!aReportItem)
+ return QVariant();
+
+ Handle(Message_Report) aReport = aReportItem->GetReport();
+ if (aReport.IsNull())
+ return QVariant();
+
+ if (theRole == Qt::ForegroundRole)
+ {
+ if (!aReport->IsActiveInMessenger())
+ return QColor(Qt::darkGray);
+
+ return QVariant();
+ }
+
+ Handle(Message_Alert) anAlert = getAlert();
+ Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
+
+ // if the alert is composite, process the real alert
+ if (theRole == Qt::DecorationRole && Column() == 0)
+ {
+ if (anExtendedAlert.IsNull())
+ return QVariant();
+
+ Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+ if (anAttribute.IsNull())
+ return QVariant();
+
+ if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ return QIcon (":/icons/item_shape.png");
+ else if (!Handle(Message_AttributeStream)::DownCast (anAttribute).IsNull())
+ return QIcon (":/icons/item_streamValues.png");
+ else
+ return QVariant();
+ }
+
+ if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole)
+ return QVariant();
+
+ if (anAlert.IsNull())
+ return QVariant();
+
+ if (Column() == 0)
+ {
+ if (theRole == Qt::DisplayRole)
+ {
+ TCollection_AsciiString aMessageKey = anAlert->GetMessageKey();
+ if (aMessageKey.IsEmpty() && !Properties().IsNull())
+ aMessageKey = Properties()->Key();
+ return aMessageKey.ToCString();
+ }
+ else
+ return anAlert->DynamicType()->Name();
+ }
+
+ Message_MetricType aMetricType;
+ int aPosition;
+ if (MessageModel_TreeModel::IsMetricColumn (Column(), aMetricType, aPosition))
+ {
+ if (anExtendedAlert.IsNull())
+ return QVariant();
+
+ Handle(Message_AttributeMeter) anAttribute = Handle(Message_AttributeMeter)::DownCast (anExtendedAlert->Attribute());
+ if (anAttribute.IsNull() || !anAttribute->HasMetric (aMetricType))
+ return QVariant();
+
+ if (!anAttribute->IsMetricValid (aMetricType))
+ return QVariant ("in process");
+
+ if (aMetricType == Message_MetricType_ProcessCPUUserTime ||
+ aMetricType == Message_MetricType_ProcessCPUSystemTime ||
+ aMetricType == Message_MetricType_WallClock)
+ {
+ Standard_Real aCumulativeMetric = anAttribute->StopValue (aMetricType) - anAttribute->StartValue (aMetricType);
+ if (fabs (aCumulativeMetric) < Precision::Confusion())
+ return QVariant();
+
+ if (aPosition == 0) return aCumulativeMetric;
+ else if (aPosition == 1)
+ {
+ Standard_Real aReportCumulativeMetric = MessageModel_ItemReport::CumulativeMetric (aReport, aMetricType);
+ if (fabs (aReportCumulativeMetric) > Precision::Confusion())
+ return 100. * aCumulativeMetric / aReportCumulativeMetric;
+ else
+ return QVariant();
+ }
+ }
+ else
+ {
+ if (aPosition == 0) return anAttribute->StopValue (aMetricType);
+ else if (aPosition == 1)
+ {
+ Standard_Real aCumulativeMetric = anAttribute->StopValue (aMetricType) - anAttribute->StartValue (aMetricType);
+ if (fabs (aCumulativeMetric) < Precision::Confusion())
+ return QVariant();
+ else
+ return aCumulativeMetric;
+ }
+
+ }
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int MessageModel_ItemAlert::initRowCount() const
+{
+ const Handle(Message_Alert)& anAlert = getAlert();
+ if (anAlert.IsNull())
+ return 0;
+
+ Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlert);
+ if (anExtendedAlert.IsNull())
+ return 0;
+
+ Handle(Message_CompositeAlerts) aCompositeAlert = anExtendedAlert->CompositeAlerts();
+ if (aCompositeAlert.IsNull())
+ return 0;
+
+ MessageModel_ItemAlert* aCurrentItem = (MessageModel_ItemAlert*)this;
+ for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
+ {
+ const Message_ListOfAlert& anAlerts = aCompositeAlert->Alerts ((Message_Gravity)aGravityId);
+ {
+ for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
+ {
+ Message_ListOfAlert aCurAlerts;
+ aCurAlerts.Append (anIt.Value());
+ aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
+ }
+ }
+ }
+ return aCurrentItem->myChildAlerts.Size();
+}
+
+// =======================================================================
+// function : initStream
+// purpose :
+// =======================================================================
+void MessageModel_ItemAlert::initStream (Standard_OStream& theOStream) const
+{
+ Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
+ if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+ return;
+
+ Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+ if (anAttribute.IsNull())
+ return;
+
+ if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+ return;
+
+ Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+ theOStream << anAttributeStream->Stream().str();
+}
+
+// =======================================================================
+// function : SetStream
+// purpose :
+// =======================================================================
+bool MessageModel_ItemAlert::SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+ Standard_Integer& theLastPos) const
+{
+ Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast (getAlert());
+ if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+ return false;
+
+ Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+ if (anAttribute.IsNull())
+ return false;
+
+ if (Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+ return false;
+
+ Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+ TCollection_AsciiString aStreamValue = Standard_Dump::Text (anAttributeStream->Stream());
+
+ TCollection_AsciiString aNewValue = Standard_Dump::Text (theSStream);
+
+ Standard_SStream aStream;
+ aStream << aStreamValue.SubString (1, theStartPos - 1);
+ aStream << aNewValue;
+ if (theLastPos + 1 <= aStreamValue.Length())
+ aStream << aStreamValue.SubString (theLastPos + 1, aStreamValue.Length());
+
+ anAttributeStream->SetStream (aStream);
+
+ return true;
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr MessageModel_ItemAlert::createChild (int theRow, int theColumn)
+{
+ return MessageModel_ItemAlert::CreateItem (currentItem(), theRow, theColumn);
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void MessageModel_ItemAlert::Init()
+{
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (Parent());
+ MessageModel_ItemAlertPtr anAlertItem;
+ Handle(Message_Alert) anAlert;
+ if (aReportItem)
+ {
+ Message_ListOfAlert anAlerts;
+ if (aReportItem->GetChildAlerts (Row(), anAlerts))
+ {
+ myAlert = anAlerts.First();
+ }
+ }
+ else
+ {
+ anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (Parent());
+ if (anAlertItem)
+ {
+ Message_ListOfAlert anAlerts;
+ if (anAlertItem->GetChildAlerts (Row(), anAlerts))
+ {
+ myAlert = anAlerts.First();
+ }
+ }
+ }
+
+ 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 (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ myPresentation = new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape());
+ }
+ }
+ MessageModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void MessageModel_ItemAlert::Reset()
+{
+ MessageModel_ItemBase::Reset();
+ myAlert = Handle(Message_Alert)();
+ myChildAlerts.Clear();
+ myPresentation = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void MessageModel_ItemAlert::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<MessageModel_ItemAlert*>(this)->Init();
+}
+
+// =======================================================================
+// function : getAlert
+// purpose :
+// =======================================================================
+const Handle(Message_Alert)& MessageModel_ItemAlert::getAlert() const
+{
+ initItem();
+ return myAlert;
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_ItemAlert_H
+#define MessageModel_ItemAlert_H
+
+#include <inspector/MessageModel_ItemBase.hxx>
+
+#include <Message_Alert.hxx>
+#include <Message_ListOfAlert.hxx>
+#include <Message_Report.hxx>
+#include <NCollection_DataMap.hxx>
+#include <NCollection_List.hxx>
+#include <NCollection_Vector.hxx>
+#include <Standard.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QMap>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QAbstractTableModel;
+class MessageModel_ItemAlert;
+
+typedef QExplicitlySharedDataPointer<MessageModel_ItemAlert> MessageModel_ItemAlertPtr;
+
+//! \class MessageModel_ItemAlert
+//! This item is connected to Message_Alert.
+//! Parent is either MessageModel_ItemRoot or MessageModel_ItemAlert, children are MessageModel_ItemAlert or no children
+class MessageModel_ItemAlert : public MessageModel_ItemBase
+{
+public:
+ //! Creates an item wrapped by a shared pointer
+ //! \param theRow the item row positition in the parent item
+ //! \param theColumn the item column positition in the parent item
+ //! \return the pointer to the created item
+ static MessageModel_ItemAlertPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return MessageModel_ItemAlertPtr (new MessageModel_ItemAlert (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~MessageModel_ItemAlert() Standard_OVERRIDE {};
+
+ //! Returns the current shape
+ const Handle(Message_Alert)& GetAlert() const { return myAlert; }
+
+ //! Returns alert of the report for the parameter row
+ Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Return data value for the role.
+ //! \param theRole a value role
+ //! \return the value
+ Standard_EXPORT virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
+
+ //! \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 bool SetStream (const Standard_SStream& theSStream, Standard_Integer& theStartPos,
+ Standard_Integer& theLastPos) const Standard_OVERRIDE;
+
+ //! Returns presentation of the attribute to be visualized in the view
+ //! \thePresentations [out] container of presentation handles to be visualized
+ virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations) Standard_OVERRIDE
+ { TreeModel_ItemBase::Presentations (thePresentations); thePresentations.Append (myPresentation); }
+
+protected:
+
+ //! Initialize the current item.
+ virtual void initItem() const Standard_OVERRIDE;
+
+ //! Returns stream value of the item to fulfill property panel.
+ //! \return stream value or dummy
+ Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) 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
+ virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+ //! Returns current alert, initialized item if it has not been initialized yet
+ //! \return alert value
+ const Handle(Message_Alert)& getAlert() const;
+
+private:
+
+ //! Constructor
+ MessageModel_ItemAlert (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : MessageModel_ItemBase (theParent, theRow, theColumn) {}
+
+private:
+ Handle(Message_Alert) myAlert; //!< current alert item
+ NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
+ Handle(Standard_Transient) myPresentation; //!< item presentation
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemBase.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+
+// =======================================================================
+// function : GetRootItem
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr MessageModel_ItemBase::GetRootItem() const
+{
+ TreeModel_ItemBasePtr anItem = Parent();
+ while (anItem)
+ {
+ if (MessageModel_ItemRootPtr aThisRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItem))
+ {
+ return aThisRootItem;
+ }
+ anItem = anItem->Parent();
+ }
+ return TreeModel_ItemBasePtr();
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_ItemBase_H
+#define MessageModel_ItemBase_H
+
+#include <Standard.hxx>
+#include <TopoDS_Shape.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+class MessageModel_ItemBase;
+typedef QExplicitlySharedDataPointer<MessageModel_ItemBase> MessageModel_ItemBasePtr;
+
+//! \class MessageModel_ItemBase
+// \brief Declaration of the tree model base item.
+class MessageModel_ItemBase : public TreeModel_ItemBase
+{
+public:
+
+ //! Resets cached values
+ virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); }
+
+protected:
+
+ //! Initialize the current item. It creates a backup of the specific item information
+ virtual void initItem() const {};
+
+ //! 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
+ MessageModel_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : TreeModel_ItemBase (theParent, theRow, theColumn) {}
+
+ //! Return root item
+ //! \return an item instance
+ TreeModel_ItemBasePtr GetRootItem() const;
+};
+
+#endif
\ No newline at end of file
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemReport.hxx>
+
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_TreeModel.hxx>
+
+#include <Message.hxx>
+#include <Message_Alert.hxx>
+#include <Message_AttributeMeter.hxx>
+#include <Message_Messenger.hxx>
+#include <Message_PrinterToReport.hxx>
+#include <OSD_Path.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QColor>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant MessageModel_ItemReport::initValue (const int theRole) const
+{
+ QVariant aParentValue = MessageModel_ItemBase::initValue (theRole);
+ if (aParentValue.isValid())
+ return aParentValue;
+
+ const Handle(Message_Report)& aReport = getReport();
+ if (aReport.IsNull())
+ return QVariant();
+
+ if (theRole == Qt::ForegroundRole)
+ {
+ if (!aReport->IsActiveInMessenger())
+ return QColor(Qt::darkGray);
+
+ return QVariant();
+ }
+ if (theRole == Qt::ToolTipRole && !myDescription.IsEmpty() && Column() == 0) // display the exported file name in tool tip
+ {
+ OSD_Path aPath(myDescription);
+ return QString ("%1%2").arg (aPath.Name().ToCString()).arg (aPath.Extension().ToCString());
+ }
+
+ if (theRole != Qt::DisplayRole)
+ return QVariant();
+
+ if (Column() == 0)
+ return aReport->DynamicType()->Name();
+
+ Message_MetricType aMetricType;
+ int aPosition;
+ if (MessageModel_TreeModel::IsMetricColumn (Column(), aMetricType, aPosition) &&
+ (aMetricType == Message_MetricType_ProcessCPUUserTime || aMetricType == Message_MetricType_ProcessCPUSystemTime ||
+ aMetricType == Message_MetricType_WallClock))
+ {
+ if (aPosition == 0) return CumulativeMetric (aReport, aMetricType);
+ else if (aPosition == 1) return "100";
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int MessageModel_ItemReport::initRowCount() const
+{
+ const Handle(Message_Report)& aReport = getReport();
+ if (aReport.IsNull())
+ return 0;
+
+ MessageModel_ItemReport* aCurrentItem = (MessageModel_ItemReport*)this;
+ for (int aGravityId = Message_Trace; aGravityId <= Message_Fail; aGravityId++)
+ {
+ const Message_ListOfAlert& anAlerts = aReport->GetAlerts ((Message_Gravity)aGravityId);
+ for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
+ {
+ Message_ListOfAlert aCurAlerts;
+ aCurAlerts.Append (anIt.Value());
+ aCurrentItem->myChildAlerts.Bind(myChildAlerts.Size(), aCurAlerts);
+ }
+ }
+ return aCurrentItem->myChildAlerts.Size();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr MessageModel_ItemReport::createChild (int theRow, int theColumn)
+{
+ return MessageModel_ItemAlert::CreateItem (currentItem(), theRow, theColumn);
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void MessageModel_ItemReport::Init()
+{
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (Parent());
+ myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
+
+ MessageModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : getReport
+// purpose :
+// =======================================================================
+const Handle(Message_Report)& MessageModel_ItemReport::getReport() const
+{
+ initItem();
+ return myReport;
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void MessageModel_ItemReport::Reset()
+{
+ MessageModel_ItemBase::Reset();
+ myReport = Handle(Message_Report)();
+ myChildAlerts.Clear();
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void MessageModel_ItemReport::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<MessageModel_ItemReport*>(this)->Init();
+}
+
+// =======================================================================
+// function : FindReportItem
+// purpose :
+// =======================================================================
+MessageModel_ItemReportPtr MessageModel_ItemReport::FindReportItem (const TreeModel_ItemBasePtr& theItem)
+{
+ TreeModel_ItemBasePtr anItem = theItem;
+ while (anItem)
+ {
+ if (MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(anItem))
+ return aReportItem;
+
+ anItem = anItem->Parent();
+ }
+ return MessageModel_ItemReportPtr();
+}
+
+// =======================================================================
+// function : FindReport
+// purpose :
+// =======================================================================
+Handle(Message_Report) MessageModel_ItemReport::FindReport (const MessageModel_ItemBasePtr& theItem)
+{
+ Handle(Message_Report) aReport;
+
+ MessageModel_ItemBasePtr anItem = theItem;
+ while (anItem)
+ {
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(anItem);
+
+ if (aReportItem)
+ return aReportItem->GetReport();
+
+ anItem = itemDynamicCast<MessageModel_ItemBase>(anItem->Parent());
+ }
+ return NULL;
+}
+
+// =======================================================================
+// function : CumulativeMetric
+// purpose :
+// =======================================================================
+Standard_Real MessageModel_ItemReport::CumulativeMetric (const Handle(Message_Report)& theReport, const Message_MetricType theMetricType)
+{
+ if (!theReport->ActiveMetrics().Contains (theMetricType))
+ return 0;
+
+ Standard_Real aMetric = 0;
+ for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)
+ {
+ const Message_ListOfAlert& anAlerts = theReport->GetAlerts ((Message_Gravity)iGravity);
+ Handle(Message_AttributeMeter) aFirstAttribute/*, aLastAttribute*/;
+ for (Message_ListOfAlert::Iterator anAlertsIterator (anAlerts); anAlertsIterator.More(); anAlertsIterator.Next())
+ {
+ Handle(Message_AlertExtended) anAlert = Handle(Message_AlertExtended)::DownCast (anAlertsIterator.Value());
+ if (anAlert.IsNull())
+ continue;
+ Handle(Message_AttributeMeter) anAttribute = Handle(Message_AttributeMeter)::DownCast (anAlert->Attribute());
+ if (anAttribute.IsNull() || !anAttribute->HasMetric (theMetricType) || !anAttribute->IsMetricValid (theMetricType))
+ continue;
+
+ //if (aFirstAttribute.IsNull())
+ // aFirstAttribute = anAttribute;
+ //else
+ //{
+ //aLastAttribute = anAttribute;
+ //}
+ aMetric += anAttribute->StopValue (theMetricType) - anAttribute->StartValue (theMetricType);
+ }
+ //if (aFirstAttribute.IsNull())
+ // continue;
+ //if (aLastAttribute.IsNull())
+ // aLastAttribute = aFirstAttribute;
+
+ //aMetric += aLastAttribute->StopValue (theMetricType) - aFirstAttribute->StartValue (theMetricType);
+ }
+ return aMetric;
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_ItemReport_H
+#define MessageModel_ItemReport_H
+
+#include <inspector/MessageModel_ItemBase.hxx>
+#include <Standard.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Message_Alert.hxx>
+#include <Message_Report.hxx>
+#include <NCollection_DataMap.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QMap>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class MessageModel_ItemReport;
+typedef QExplicitlySharedDataPointer<MessageModel_ItemReport> MessageModel_ItemReportPtr;
+
+//! \class MessageModel_ItemReport
+//! This item is connected to Message_Alert.
+//! Parent is MessageModel_ItemRoot, children are MessageModel_ItemAlert or no children
+class MessageModel_ItemReport : public MessageModel_ItemBase
+{
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ //! \param theRow the item row positition in the parent item
+ //! \param theColumn the item column positition in the parent item
+ //! \return the pointer to the created item
+ static MessageModel_ItemReportPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return MessageModel_ItemReportPtr (new MessageModel_ItemReport (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~MessageModel_ItemReport() Standard_OVERRIDE {};
+
+ //! Returns the current shape
+ const Handle(Message_Report)& GetReport() const { return myReport; }
+
+ //! Returns alert of the report for the parameter row
+ Standard_Boolean GetChildAlerts (const int theRow, Message_ListOfAlert& theAlerts) const { return myChildAlerts.Find(theRow, theAlerts); }
+
+ //! Returns the report description or NULL
+ const TCollection_AsciiString& GetDescription() const { return myDescription; }
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Return data value for the role.
+ //! \param theRole a value role
+ //! \return the value
+ Standard_EXPORT virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
+
+ //! \return number of children.
+ Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+ //! Returns report of the tree model item. Iterates up by parents intil the report item is found.
+ //! \return an item or NULL
+ Standard_EXPORT static MessageModel_ItemReportPtr FindReportItem (const TreeModel_ItemBasePtr& theItem);
+
+ //! Returns report of the item
+ static Handle(Message_Report) FindReport (const MessageModel_ItemBasePtr& thetItem);
+
+ //! Returns report cumulative metric as stop time of the last alert minus start time of the first alert
+ Standard_EXPORT static Standard_Real CumulativeMetric (const Handle(Message_Report)& theReport, const Message_MetricType theMetricType);
+
+protected:
+
+ //! Initialize the current item.
+ virtual void initItem() 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
+ virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+ //! Returns number of child shapes. Init item if it is not initialized
+ //! \return integer value
+ int getRowCount() const;
+
+ //! Returns current shape, initialized item if it has not been initialized yet
+ //! \return shape value
+ const Handle(Message_Report)& getReport() const;
+
+private:
+
+ //! Constructor
+ MessageModel_ItemReport (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : MessageModel_ItemBase (theParent, theRow, theColumn) {}
+
+private:
+
+ NCollection_DataMap<Standard_Integer, Message_ListOfAlert> myChildAlerts; //!< container of child alerts
+
+ Handle(Message_Report) myReport; //!< current report
+ TCollection_AsciiString myDescription; //!< description
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemRoot.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+
+// =======================================================================
+// function : SetReport
+// purpose :
+// =======================================================================
+void MessageModel_ItemRoot::SetReport (const int theRowId, const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription)
+{
+ NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
+ for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
+ {
+ if (aRowId == theRowId)
+ break;
+ }
+ aReportsIt.Value().myReport = theReport;
+ aReportsIt.Value().myDescription = theReportDescription;
+}
+
+// =======================================================================
+// function : GetReport
+// purpose :
+// =======================================================================
+const Handle(Message_Report)& MessageModel_ItemRoot::GetReport (const int theRowId,
+ TCollection_AsciiString& theReportDescription)
+{
+ NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
+ for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
+ {
+ if (aRowId == theRowId)
+ break;
+ }
+ theReportDescription = aReportsIt.Value().myDescription;
+ return aReportsIt.Value().myReport;
+}
+
+// =======================================================================
+// function : HasReport
+// purpose :
+// =======================================================================
+Standard_Boolean MessageModel_ItemRoot::HasReport (const Handle(Message_Report)& theReport)
+{
+ NCollection_List<MessageModel_ReportInformation>::Iterator aReportsIt (myReports);
+ for (int aRowId = 0; aReportsIt.More(); aReportsIt.Next(), aRowId++)
+ {
+ if (aReportsIt.Value().myReport == theReport)
+ return Standard_True;
+ }
+ return Standard_False;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant MessageModel_ItemRoot::initValue (const int theRole) const
+{
+ QVariant aParentValue = MessageModel_ItemBase::initValue (theRole);
+ if (aParentValue.isValid())
+ return aParentValue;
+
+ if (Column() != 0)
+ return QVariant();
+
+ if (theRole == Qt::DisplayRole)
+ return myName.IsEmpty() ? "Message_Reports" : myName.ToCString();
+
+ return QVariant();
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr MessageModel_ItemRoot::createChild (int theRow, int theColumn)
+{
+ return MessageModel_ItemReport::CreateItem (currentItem(), theRow, theColumn);
+}
+
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_ItemRoot_H
+#define MessageModel_ItemRoot_H
+
+#include <Message_Alert.hxx>
+#include <Message_Report.hxx>
+#include <NCollection_List.hxx>
+#include <Standard.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <inspector/MessageModel_ItemBase.hxx>
+
+class MessageModel_ItemRoot;
+typedef QExplicitlySharedDataPointer<MessageModel_ItemRoot> MessageModel_ItemRootPtr;
+
+//! \struct to extend report by description
+struct MessageModel_ReportInformation
+{
+ //! Constructor
+ MessageModel_ReportInformation (Handle(Message_Report) theReport, const TCollection_AsciiString& theDescription)
+ : myReport (theReport), myDescription (theDescription) {}
+
+ Handle(Message_Report) myReport; //! report
+ TCollection_AsciiString myDescription; //! report description
+};
+
+//! \class MessageModel_ItemRoot
+//! Collects message reports that should be visualized in tree view. Reports are cached and if reports are not needed,
+//! cache should be cleared using RemoveAllReports
+//! Parent is NULL, children are MessageModel_ItemReport items.
+class MessageModel_ItemRoot : public MessageModel_ItemBase
+{
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ static MessageModel_ItemRootPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return MessageModel_ItemRootPtr (new MessageModel_ItemRoot (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~MessageModel_ItemRoot() Standard_OVERRIDE {};
+
+ //! Appends new report
+ //! \param theReport a report instance
+ //! \param theReportDescription an additional report information
+ void AddReport (const Handle(Message_Report)& theReport, const TCollection_AsciiString& theReportDescription)
+ { myReports.Append (MessageModel_ReportInformation (theReport, theReportDescription)); }
+
+ //! Set report, se it into the given row index
+ //! \param theRowId a report child row
+ //! \param theReport a report instance
+ //! \param theReportDescription an additional report information
+ Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription = "");
+
+ //! Returns true if report exists is in the list of the current reports
+ //! \param theReport a report instance
+ //! \return boolen value
+ Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
+
+ //!< Returns processed reports
+ const NCollection_List<MessageModel_ReportInformation>& Reports() const { return myReports; }
+
+ //! Clears internal container of added reports
+ void RemoveAllReports() { myReports.Clear(); }
+
+ //! Returns report by the number
+ //! \param theRowId an index of the report in the internal container.
+ Standard_EXPORT const Handle(Message_Report)& GetReport (const int theRowId, TCollection_AsciiString& theReportDescription);
+
+ //! Set the item name
+ //! \param theName text value
+ void SetName (const TCollection_AsciiString& theName) { myName = theName; }
+
+protected:
+
+ //! Return data value for the role.
+ //! \param theRole a value role
+ //! \return the value
+ virtual QVariant initValue (const int theRole) const Standard_OVERRIDE;
+
+ //! \return number of children.
+ virtual int initRowCount() const Standard_OVERRIDE { return myReports.Size(); }
+
+ //! 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
+ MessageModel_ItemRoot (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : MessageModel_ItemBase (theParent, theRow, theColumn) {}
+
+private:
+
+ NCollection_List<MessageModel_ReportInformation> myReports; //!< reports sent by algorithms
+ TCollection_AsciiString myName; //!< DisplayRole data, if defined
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_TreeModel.hxx>
+
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/TreeModel_ColumnType.hxx>
+
+#include <Message.hxx>
+
+const int COLUMN_NAME_WIDTH = 230;
+const int COLUMN_SIZE_WIDTH = 30;
+
+const int COLUMN_REAL_VALUE_WIDTH = 115;
+const int COLUMN_PERCENT_VALUE_WIDTH = 50;
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+MessageModel_TreeModel::MessageModel_TreeModel (QObject* theParent)
+: TreeModel_ModelBase (theParent)
+{
+}
+
+// =======================================================================
+// function : InitColumns
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::InitColumns()
+{
+ // 0 - Name, 1 - visibility, 2 - Row
+ setHeaderItem (TreeModel_ColumnType_Name, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
+ setHeaderItem (TreeModel_ColumnType_Visibility, TreeModel_HeaderSection ("Visibility", TreeModel_ModelBase::ColumnVisibilityWidth()));
+ setHeaderItem (TreeModel_ColumnType_Row, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH, Standard_True /*hidden*/));
+
+ int aNextIndex = 3;
+ for (int aMetricId = (int)Message_MetricType_None + 1; aMetricId <= (int)Message_MetricType_MemHeapUsage; aMetricId++)
+ {
+ Message_MetricType aMetricType = (Message_MetricType)aMetricId;
+ OSD_MemInfo::Counter aMemInfo;
+ bool isMemInfo = Message::ToOSDMetric (aMetricType, aMemInfo);
+
+ setHeaderItem (aNextIndex++,
+ TreeModel_HeaderSection (QString("%1 [%2]").arg (Message::MetricToString (aMetricType)).arg(isMemInfo ? "Mb" : "s"),
+ COLUMN_REAL_VALUE_WIDTH));
+ setHeaderItem (aNextIndex++, TreeModel_HeaderSection (isMemInfo ? "Delta" : "%", COLUMN_PERCENT_VALUE_WIDTH));
+ }
+}
+
+// =======================================================================
+// function : GetMetricColumns
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::GetMetricColumns (const Message_MetricType theMetricType, QList<int>& theMetricColumns)
+{
+ theMetricColumns.clear();
+ int aNextIndex = 3; // after default parent columns, see InitColumns
+ for (int aMetricId = (int)Message_MetricType_None + 1; aMetricId <= (int)Message_MetricType_MemHeapUsage; aMetricId++)
+ {
+ if (theMetricType != (Message_MetricType)aMetricId)
+ {
+ aNextIndex += 2;
+ continue;
+ }
+ theMetricColumns.append (aNextIndex++);
+ theMetricColumns.append (aNextIndex++);
+ }
+}
+
+// =======================================================================
+// function : IsMetricColumn
+// purpose :
+// =======================================================================
+bool MessageModel_TreeModel::IsMetricColumn (const int theColumnId, Message_MetricType& theMetricType, int& thePosition)
+{
+ int aNextIndex = 3; // after default parent columns, see InitColumns
+ for (int aMetricId = (int)Message_MetricType_None + 1; aMetricId <= (int)Message_MetricType_MemHeapUsage; aMetricId++)
+ {
+ if (theColumnId == aNextIndex || theColumnId == aNextIndex + 1)
+ {
+ theMetricType = (Message_MetricType)aMetricId;
+ thePosition = theColumnId - aNextIndex;
+ return true;
+ }
+ aNextIndex += 2;
+ }
+ return false;
+}
+
+// =======================================================================
+// function : createRootItem
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr MessageModel_TreeModel::createRootItem (const int theColumnId)
+{
+ return MessageModel_ItemRoot::CreateItem (TreeModel_ItemBasePtr(), 0, theColumnId);
+}
+
+// =======================================================================
+// function : HasReport
+// purpose :
+// =======================================================================
+Standard_Boolean MessageModel_TreeModel::HasReport (const Handle(Message_Report)& theReport)
+{
+ if (columnCount() == 0)
+ return Standard_False;
+
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
+ return aRootItem && aRootItem->HasReport (theReport);
+}
+
+// =======================================================================
+// function : AddReport
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::AddReport (const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription)
+{
+ for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
+ {
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
+ if (!aRootItem)
+ continue;
+ aRootItem->AddReport (theReport, theReportDescription);
+ }
+
+ Reset();
+ EmitLayoutChanged();
+}
+
+// =======================================================================
+// function : SetReport
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::SetReport (const int theRowId, const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription)
+{
+ for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
+ {
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (aColId));
+ if (!aRootItem)
+ continue;
+ aRootItem->SetReport (theRowId, theReport, theReportDescription);
+ }
+ Reset();
+ EmitLayoutChanged();
+}
+
+// =======================================================================
+// function : Reports
+// purpose :
+// =======================================================================
+const NCollection_List<MessageModel_ReportInformation>& MessageModel_TreeModel::Reports() const
+{
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
+ return aRootItem->Reports();
+}
+
+// =======================================================================
+// function : UpdateTreeModel
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::SetRootItemName (const TCollection_AsciiString& theName)
+{
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (RootItem (0));
+ if (aRootItem)
+ aRootItem->SetName (theName);
+}
+
+// =======================================================================
+// function : UpdateTreeModel
+// purpose :
+// =======================================================================
+void MessageModel_TreeModel::UpdateTreeModel()
+{
+ Reset();
+ EmitLayoutChanged();
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef MessageModel_TreeModel_H
+#define MessageModel_TreeModel_H
+
+#include <inspector/MessageModel_ItemBase.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <Standard.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <Message_Report.hxx>
+#include <inspector/TreeModel_ModelBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QMap>
+#include <QObject>
+#include <Standard_WarningsRestore.hxx>
+
+class MessageModel_TreeModel;
+
+//! \class MessageModel_TreeModel
+//! View model to visualize MessageReport/s content
+class MessageModel_TreeModel : public TreeModel_ModelBase
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageModel_TreeModel (QObject* theParent);
+
+ //! Destructor
+ virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
+
+ //! Creates model columns and root items.
+ Standard_EXPORT virtual void InitColumns() Standard_OVERRIDE;
+
+ //!< Returns columns of the model for the metric
+ //!< \param theMetricType metric
+ //!< \param theMetricColumns [out] container of metric columns
+ static Standard_EXPORT void GetMetricColumns (const Message_MetricType theMetricType, QList<int>& theMetricColumns);
+
+ //!< Returns metric type for the column
+ //!< \param theColumnId [in] index of the tree column
+ //!< \param theMetricType [out] metric type if found
+ //!< \param thePosition [out] index of the metric column, 0 - is metric, 1 - is delta
+ //!< \return true if the column has metric parameters
+ static Standard_EXPORT bool IsMetricColumn (const int theColumnId, Message_MetricType& theMetricType, int& thePosition);
+
+ //! Returns true if parameter report was added into the model
+ //! \param theReport a report instance
+ //! \return boolen value
+ Standard_EXPORT Standard_Boolean HasReport (const Handle(Message_Report)& theReport);
+
+ //! Add shape, append it to the model root item
+ //! \param theReport a report instance
+ //! \param theReportDescription an additional report information
+ Standard_EXPORT void AddReport (const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription = "");
+
+ //! Set report, se it into the given row index
+ //! \param theRowId a report child row
+ //! \param theReport a report instance
+ //! \param theReportDescription an additional report information
+ Standard_EXPORT void SetReport (const int theRowId, const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription = "");
+
+ //!< Returns processed reports
+ Standard_EXPORT const NCollection_List<MessageModel_ReportInformation>& Reports() const;
+
+ //! Sets the text value of the Root item, only "Name" column accepts the parameter value
+ //! \theName visulized text of root item
+ Standard_EXPORT void SetRootItemName (const TCollection_AsciiString& theName);
+
+ //! Updates tree model
+ Standard_EXPORT void UpdateTreeModel();
+
+protected:
+ //! Creates root item
+ //! \param theColumnId index of a column
+ virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) Standard_OVERRIDE;
+};
+
+#endif
--- /dev/null
+MessageView_ActionsTest.cxx
+MessageView_ActionsTest.hxx
+MessageView_Communicator.cxx
+MessageView_Communicator.hxx
+MessageView_MetricStatisticModel.cxx
+MessageView_MetricStatisticModel.hxx
+MessageView_VisibilityState.cxx
+MessageView_VisibilityState.hxx
+MessageView_Window.cxx
+MessageView_Window.hxx
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/MessageView_ActionsTest.hxx>
+
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_TreeModel.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <Message.hxx>
+#include <Message_AlertExtended.hxx>
+#include <Message_Level.hxx>
+#include <Message_Messenger.hxx>
+
+#include <gp_Ax1.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Ax3.hxx>
+#include <Bnd_Box.hxx>
+#include <Bnd_OBB.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <OSD_Chronometer.hxx>
+#include <Quantity_Color.hxx>
+#include <Quantity_ColorRGBA.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopoDS_AlertAttribute.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAction>
+#include <QFileDialog>
+#include <QItemSelectionModel>
+#include <QMenu>
+#include <QMessageBox>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+#include <ctime>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+MessageView_ActionsTest::MessageView_ActionsTest (QWidget* theParent,
+ MessageModel_TreeModel* theTreeModel, QItemSelectionModel* theModel)
+: QObject (theParent), myTreeModel (theTreeModel), mySelectionModel (theModel)
+{
+ myActions.insert (MessageModel_ActionType_TestMetric,
+ ViewControl_Tools::CreateAction ("Test <metric>", SLOT (OnTestMetric()), parent(), this));
+ myActions.insert (MessageModel_ActionType_TestMessenger,
+ ViewControl_Tools::CreateAction ("Test <Message_Messenger>", SLOT (OnTestMessenger()), parent(), this));
+ myActions.insert (MessageModel_ActionType_TestReportTree,
+ ViewControl_Tools::CreateAction ("Test <Tree of messages>", SLOT (OnTestReportTree()), parent(), this));
+}
+
+// =======================================================================
+// function : AddMenuActions
+// purpose :
+// =======================================================================
+void MessageView_ActionsTest::AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu)
+{
+ MessageModel_ItemReportPtr aReportItem;
+ for (QModelIndexList::const_iterator aSelIt = theSelectedIndices.begin(); aSelIt != theSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ MessageModel_ItemRootPtr aRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItemBase);
+ if (aRootItem)
+ continue;
+
+ aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
+ if (aReportItem)
+ break;
+
+ MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (anItemBase);
+ if (anAlertItem)
+ continue;
+ }
+
+ if (aReportItem && !aReportItem->GetReport().IsNull())
+ {
+ theMenu->addAction (myActions[MessageModel_ActionType_TestMetric]);
+ theMenu->addAction (myActions[MessageModel_ActionType_TestMessenger]);
+ theMenu->addAction (myActions[MessageModel_ActionType_TestReportTree]);
+
+ bool isReportEnabled = aReportItem->GetReport()->IsActiveInMessenger();
+ myActions[MessageModel_ActionType_TestMetric]->setEnabled (isReportEnabled);
+ myActions[MessageModel_ActionType_TestMessenger]->setEnabled (isReportEnabled);
+ myActions[MessageModel_ActionType_TestReportTree]->setEnabled (isReportEnabled);
+ }
+ theMenu->addSeparator();
+}
+
+// =======================================================================
+// function : getSelectedReport
+// purpose :
+// =======================================================================
+Handle(Message_Report) MessageView_ActionsTest::getSelectedReport (QModelIndex& theReportIndex) const
+{
+ MessageModel_ItemReportPtr aReportItem;
+ QModelIndexList aSelectedIndices = mySelectionModel->selectedIndexes();
+ for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
+ theReportIndex = anIndex;
+ if (aReportItem)
+ break;
+ }
+ if (!aReportItem)
+ return NULL;
+
+ return aReportItem->GetReport();
+}
+
+// =======================================================================
+// function : OnTestMetric
+// purpose :
+// =======================================================================
+void MessageView_ActionsTest::OnTestMetric()
+{
+ QModelIndex aReportIndex;
+ Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+ if (aReport.IsNull())
+ return;
+
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestMetric()");
+ unsigned int start_time = clock();
+
+ Standard_Integer aCounter = 1500;
+ Standard_Real aValue = 0., aValue2 = 0.1;
+
+ for (int aTopIt = 0; aTopIt < 4; aTopIt++)
+ {
+ Message::SendInfo() << "Calculate";
+ for (int j = 0; j < aCounter; j++)
+ {
+ for (int i = 0; i < aCounter; i++)
+ {
+ aValue = (aValue * 2. + 3.) * 0.5 - 0.3 * 0.5;
+
+ Standard_Real aValue3 = aValue + aValue2 * 0.2;
+ (void)aValue3;
+ }
+ }
+ }
+
+ myTreeModel->UpdateTreeModel();
+
+ unsigned int end_time = clock();
+ std::cout << "clock() = " << end_time - start_time << std::endl;
+}
+
+// =======================================================================
+// function : createShapeOnLevel
+// purpose :
+// =======================================================================
+void createShapeOnLevel()
+{
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY ("createShapeOnLevel")
+
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+
+ BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
+ TopoDS_Shape aShape = aBuilder.Shape();
+
+ Message::DefaultMessenger() << aShape;
+}
+
+// =======================================================================
+// function : createShape
+// purpose :
+// =======================================================================
+void createShape()
+{
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ BRepBuilderAPI_MakeEdge aBuilder (gp_Pnt (0., 0., 0.), gp_Pnt (20., 10., 20.));
+ TopoDS_Shape aShape = aBuilder.Shape();
+
+ Message::DefaultMessenger() << aShape;
+ createShapeOnLevel();
+}
+
+// =======================================================================
+// function : OnTestMessenger
+// purpose :
+// =======================================================================
+void MessageView_ActionsTest::OnTestMessenger()
+{
+ // string messages
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestMessenger()")
+
+ Message::DefaultMessenger()->Send ("Values");
+ Message::DefaultMessenger()->Send ("Values second");
+
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ // gp_XYZ
+ {
+ gp_XYZ aCoords (1.3, 2.3, 3.4);
+ aCoords.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // gp_Dir
+ {
+ gp_Dir aDir (0.3, 0.3, 0.4);
+ aDir.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // gp_Ax1
+ {
+ gp_Ax1 aCoords (gp_Pnt (1.3, 2.3, 3.4), gp_Dir (0.3, 0.3, 0.4));
+ aCoords.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // gp_Ax2
+ {
+ gp_Ax2 aCoords (gp_Pnt (10.3, 20.3, 30.4), gp_Dir (0.3, 0.3, 0.4));
+ aCoords.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // gp_Ax3
+ {
+ gp_Ax3 aPln (gp_Pnt (10., 20., 15.), gp_Dir (0., 0., 1.), gp_Dir (1., 0., 0.));
+ aPln.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // gp_Trsf
+ {
+ gp_Trsf aTrsf;
+ aTrsf.SetRotation (gp::OZ(), 0.3);
+ aTrsf.SetTranslationPart (gp_Vec (15., 15., 15.));
+ aTrsf.SetScaleFactor (3.);
+
+ aTrsf.DumpJson (sout);
+ sout.Flush(Standard_True);
+ }
+ // Bnd_Box
+ {
+ Bnd_Box aBox (gp_Pnt (20., 15., 10.), gp_Pnt (25., 20., 15.));
+ aBox.DumpJson (sout);
+ sout.Flush (Standard_True);
+ }
+ // Bnd_OBB
+ {
+ 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.);
+ anOBB.DumpJson (sout);
+ sout.Flush (Standard_True);
+ }
+ // Quantity_ColorRGBA
+ {
+ Quantity_ColorRGBA aColor (0.2f, 0.8f, 0.8f, 0.2f);
+ aColor.DumpJson (sout);
+ sout.Flush (Standard_True);
+ }
+ // Quantity_Color
+ {
+ Quantity_Color aColor (0.8, 0.8, 0.8, Quantity_TOC_RGB);
+ aColor.DumpJson (sout);
+ sout.Flush (Standard_True);
+ }
+ //shape messages
+ {
+ createShape();
+ }
+ myTreeModel->UpdateTreeModel();
+}
+
+// =======================================================================
+// function : levelAlerts
+// purpose :
+// =======================================================================
+void levelAlerts (const int theCurrentLevel, const int theTopLevel)
+{
+ if (theTopLevel - theCurrentLevel <= 0)
+ return;
+
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY (TCollection_AsciiString ("Level: " ) + theCurrentLevel)
+
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout << "Alert(" << theCurrentLevel << "): " << 1 << ", " << 2 << std::endl;
+ sout << "Alert(" << theCurrentLevel << "): " << 3 << ", " << 4 << std::endl;
+
+ levelAlerts (theCurrentLevel + 1, theTopLevel);
+
+ sout << "Alert(" << theCurrentLevel << "): " << 4 << ", " << 5 << std::endl;
+}
+
+// =======================================================================
+// function : levelAlert
+// purpose :
+// =======================================================================
+void levelAlert (const int theCurrentLevel, const int theTopLevel)
+{
+ if (theTopLevel - theCurrentLevel <= 0)
+ return;
+
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY ("levelAlert")
+
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+ sout << "Level: " << theCurrentLevel << "(Single, no alerts on the level)" << std::endl;
+
+ levelAlerts (theCurrentLevel + 1, theTopLevel);
+}
+
+// =======================================================================
+// function : OnTestReportTree
+// purpose :
+// =======================================================================
+void MessageView_ActionsTest::OnTestReportTree()
+{
+ OCCT_ADD_MESSAGE_LEVEL_SENTRY ("MessageModel_Actions::OnTestReportTree()")
+ Message_Messenger::StreamBuffer sout = Message::SendInfo();
+
+ int aTopLevel = 3;
+ levelAlerts (1, aTopLevel);
+
+ sout << "Alert: " << 4 << std::endl;
+ levelAlert (1, aTopLevel);
+
+ myTreeModel->UpdateTreeModel();
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 MessageView_ActionsTest_H
+#define MessageView_ActionsTest_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/MessageModel_ActionType.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QObject>
+#include <QMap>
+#include <QModelIndexList>
+#include <QPoint>
+#include <QString>
+#include <Standard_WarningsRestore.hxx>
+
+class Message_Report;
+class MessageModel_TreeModel;
+
+class QAction;
+class QItemSelectionModel;
+class QMenu;
+class QWidget;
+
+//! \class MessageView_ActionsTest
+//! Window that unites all MessageView controls.
+class MessageView_ActionsTest : public QObject
+{
+ Q_OBJECT
+public:
+
+ //! Constructor
+ MessageView_ActionsTest (QWidget* theParent, MessageModel_TreeModel* theTreeModel, QItemSelectionModel* theModel);
+
+ //! Destructor
+ virtual ~MessageView_ActionsTest() {}
+
+ //! Fills popup menu with actions depending on the current selection
+ //! \param theSelectedIndices tree model selected indices
+ //! \param theMenu menu to be filled
+ Standard_EXPORT void AddMenuActions (const QModelIndexList& theSelectedIndices, QMenu* theMenu);
+
+public slots:
+ //! Sending several alerts to check metric of message-alert-tool mechanizm
+ void OnTestMetric();
+
+ //! Sending several alerts to check property panel/presentations of messenger-alert-tool mechanizm
+ void OnTestMessenger();
+
+ //! Check tree of alerts
+ void OnTestReportTree();
+
+protected:
+ //! Returns report of selected tree view item if a report item is selected
+ //! \param theReportIndex tree model index of the found report
+ //! \return report instance or NULL
+ Handle(Message_Report) getSelectedReport (QModelIndex& theReportIndex) const;
+
+protected:
+ MessageModel_TreeModel* myTreeModel; //< tree model
+ QItemSelectionModel* mySelectionModel; //< selection model
+ QMap<MessageModel_ActionType, QAction*> myActions; //!< container of all actions
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/MessageView_Communicator.hxx>
+
+// =======================================================================
+// function : CreateCommunicator
+// purpose : Creates a communicator by the library loading
+// =======================================================================
+Standard_EXPORTEXTERNC TInspectorAPI_Communicator* CreateCommunicator()
+{
+ return new MessageView_Communicator();
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 MessageView_Communicator_H
+#define MessageView_Communicator_H
+
+#include <inspector/MessageView_Window.hxx>
+#include <inspector/TInspectorAPI_Communicator.hxx>
+
+//! \class MessageView_Communicator.
+//! \brief This is a connector from TInspector application to MessageView window
+class MessageView_Communicator : public TInspectorAPI_Communicator
+{
+public:
+
+ //! Constructor
+ MessageView_Communicator() : TInspectorAPI_Communicator(), myWindow (new MessageView_Window (0)) {}
+
+ //! Destructor
+ virtual ~MessageView_Communicator() Standard_OVERRIDE {}
+
+ //! Provides the container with a parent where this container should be inserted.
+ //! If Qt implementation, it should be QWidget with QLayout set inside
+ //! \param theParent a parent class
+ virtual void SetParent (void* theParent) Standard_OVERRIDE { myWindow->SetParent (theParent); }
+
+ //! Sets parameters container, it should be used when the plugin is initialized or in update content
+ //! \param theParameters a parameters container
+ virtual void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters) Standard_OVERRIDE
+ { myWindow->SetParameters (theParameters); }
+
+ //! Provide container for actions available in inspector on general level
+ //! \param theMenu if Qt implementation, it is QMenu object
+ virtual void FillActionsMenu(void* theMenu) Standard_OVERRIDE { myWindow->FillActionsMenu (theMenu); }
+
+ //! Returns plugin preferences, empty implementation by default
+ //! \param theItem container of preference elements
+ virtual void GetPreferences (TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
+ { myWindow->GetPreferences (theItem); }
+
+ //! Stores plugin preferences, empty implementation by default
+ //! \param theItem container of preference elements
+ virtual void SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem) Standard_OVERRIDE
+ { myWindow->SetPreferences (theItem); }
+
+ //! Calls update of the plugin's content
+ virtual void UpdateContent() Standard_OVERRIDE { myWindow->UpdateContent(); }
+
+private:
+
+ MessageView_Window* myWindow; //!< current window
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Svetlana SHUTINA
+// Copyright (c) 2021 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/MessageView_MetricStatisticModel.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+
+#include <Message_AlertExtended.hxx>
+#include <Message_Attribute.hxx>
+#include <Message_AttributeMeter.hxx>
+#include <Message_CompositeAlerts.hxx>
+#include <Message_Report.hxx>
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void MessageView_MetricStatisticModel::Init (const TreeModel_ItemBasePtr theItemBase)
+{
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport> (theItemBase);
+ if (aReportItem)
+ {
+ Handle(Message_Report) aReport = aReportItem->GetReport();
+ const Message_ListOfAlert& anAlerts = aReport->GetAlerts (Message_Info);
+ for (Message_ListOfAlert::Iterator anIt(anAlerts); anIt.More(); anIt.Next())
+ {
+ appendAlert (anIt.Value());
+ }
+ }
+ else
+ {
+ MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert> (theItemBase);
+ if (anAlertItem)
+ {
+ appendAlert (anAlertItem->GetAlert());
+ }
+ }
+ std::map<double, std::list<QString>> aTmpMap;
+ std::list<double> aTimes;
+ for (QMap<QString, QPair<int, double> >::Iterator anIterValue = myValues.begin();
+ anIterValue != myValues.end(); ++anIterValue)
+ {
+ std::map<double, std::list<QString>>::iterator anIter = aTmpMap.find (anIterValue.value().second);
+ if (anIter != aTmpMap.end())
+ {
+ aTmpMap.at (anIterValue.value().second).push_back (anIterValue.key());
+ }
+ else
+ {
+ std::list<QString> list;
+ list.push_back (anIterValue.key());
+ aTmpMap.insert (std::pair<double, std::list<QString> > (anIterValue.value().second, list));
+ aTimes.push_back (anIterValue.value().second);
+ }
+ }
+ aTimes.sort();
+ aTimes.reverse();
+
+ for (std::list<double>::iterator anIter = aTimes.begin(); anIter != aTimes.end(); anIter++)
+ {
+ double aTime = *anIter;
+ std::list<QString> names = aTmpMap.at (aTime);
+ for (std::list<QString>::iterator name = names.begin(); name != names.end(); name++)
+ {
+ int nb = myValues.find (*name).value().first;
+ RowValues value = {*name, nb, aTime};
+ setValueByIndex (-1, value);
+ }
+ }
+}
+
+// =======================================================================
+// function : appendAlert
+// purpose :
+// =======================================================================
+void MessageView_MetricStatisticModel::appendAlert(const Handle(Message_Alert)& theAlert)
+{
+ Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+ if (anExtAlert.IsNull())
+ {
+ return;
+ }
+ Handle(Message_Attribute) anAttr = anExtAlert->Attribute();
+ Handle(Message_AttributeMeter) anAttrMeter = Handle(Message_AttributeMeter)::DownCast (anAttr);
+ if(anAttrMeter.IsNull())
+ {
+ return;
+ }
+
+ int aCount = 1;
+ double aTime = 0;
+ if (myValues.contains (anAttr->GetName().ToCString()))
+ {
+ aCount = myValues.value (anAttr->GetName().ToCString()).first + 1;
+ aTime = myValues.value (anAttr->GetName().ToCString()).second
+ + anAttrMeter->StopValue (myMetricType) - anAttrMeter->StartValue (myMetricType);
+ }
+ else
+ {
+ aCount = 1;
+ aTime = anAttrMeter->StopValue (myMetricType) - anAttrMeter->StartValue (myMetricType);
+ }
+ myValues[anAttr->GetName().ToCString()] = qMakePair (aCount, aTime);
+
+ if (!anExtAlert->CompositeAlerts().IsNull())
+ {
+ const Message_ListOfAlert& anAlerts = anExtAlert->CompositeAlerts()->Alerts (Message_Info);
+ for (Message_ListOfAlert::Iterator anIt (anAlerts); anIt.More(); anIt.Next())
+ {
+ appendAlert (anIt.Value());
+ }
+ }
+}
+
+// =======================================================================
+// function : data
+// purpose :
+// =======================================================================
+QVariant MessageView_MetricStatisticModel::data (const QModelIndex& theIndex, int theRole) const
+{
+ switch (theRole)
+ {
+ case Qt::DisplayRole:
+ {
+ switch (theIndex.column())
+ {
+ case 0: return mySortValues[theIndex.row()].myName;
+ case 1: return mySortValues[theIndex.row()].myCounter;
+ case 2: return mySortValues[theIndex.row()].myTime;
+ }
+ break;
+ }
+ default: break;
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : setValueByIndex
+// purpose :
+// =======================================================================
+void MessageView_MetricStatisticModel::setValueByIndex (const int theIndex, const RowValues theValue)
+{
+ mySortValues.insert (theIndex == -1 ? mySortValues.size() : theIndex, theValue);
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Svetlana SHUTINA
+// Copyright (c) 2021 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.
+
+#pragma once
+
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Message_Alert.hxx>
+#include <Message_MetricType.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <Standard_WarningsRestore.hxx>
+
+//! @class MessageView_MetricStatisticModel
+//! Table model that sums for parameter alert the number of calls and
+//! metric time spent on the alert and its children.
+//! It visualizes a table with statistic information:
+//! the 1st column is alert name, the 2nd column is a counter of the name appearance,
+//! the 3rd column is the cummulative time.
+//! Tables rows are sorted by descending time.
+class MessageView_MetricStatisticModel : public QAbstractTableModel
+{
+private:
+ // Struct to describe a row of the table
+ struct RowValues
+ {
+ QString myName; //!< string values
+ int myCounter; //!< count of the values
+ double myTime; //!< total time
+ };
+
+public:
+ //! Constructor
+ MessageView_MetricStatisticModel (const Message_MetricType& theType, QObject* theParent = 0)
+ : QAbstractTableModel (theParent), myMetricType (theType) {}
+
+ //! Destructor
+ virtual ~MessageView_MetricStatisticModel() {}
+
+ //! Fills map of the fields values
+ //! \param theItemBase a parent item.
+ Standard_EXPORT void Init (const TreeModel_ItemBasePtr theItemBase);
+
+ //! Returns content of the model index for the given role,
+ //! it is obtained from internal container of values.
+ //! It returns value only for DisplayRole
+ //! \param theIndex a model index
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant data (const QModelIndex& theIndex, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+ //! Returns number of rows
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return myValues.size(); }
+
+ //! Returns number of columns
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 3; }
+
+private:
+
+ //! Sorts values and fills map of the fields values depends on unique text identifier. It's recursive.
+ //! \param theAlert unique text identifier. The alert should have attribute of the metric type
+ void appendAlert (const Handle(Message_Alert)& theAlert);
+
+ //! Adds theValues in the map to position theIndex
+ //! If theIndex is -1, the element will be added in the end of the map
+ //! \param theIndex the serial number in the map
+ //! \param theValues the field values
+ void setValueByIndex (const int theIndex, const RowValues theValues);
+
+private:
+ Message_MetricType myMetricType; //!< current metric type
+ QMap<QString, QPair<int, double> > myValues; //!< map of fields values
+ QMap<int, RowValues> mySortValues; //!< sorted map of fields values
+};
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/MessageView_VisibilityState.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+
+#include <Message_AlertExtended.hxx>
+#include <Message_AttributeStream.hxx>
+
+#include <TopoDS_AlertAttribute.hxx>
+
+// =======================================================================
+// function : CanBeVisible
+// purpose :
+// =======================================================================
+bool MessageView_VisibilityState::CanBeVisible (const QModelIndex& theIndex) const
+{
+ MessageModel_ItemAlertPtr anAlertItem = getAlertItem (theIndex);
+ if (anAlertItem)
+ {
+ NCollection_List<Handle(Standard_Transient)> aPresentations;
+ anAlertItem->Presentations (aPresentations);
+ if (!aPresentations.IsEmpty())
+ return true;
+ }
+ return false;
+}
+
+// =======================================================================
+// function : SetVisible
+// purpose :
+// =======================================================================
+bool MessageView_VisibilityState::SetVisible (const QModelIndex&, const bool, const bool)
+{
+ return false;
+}
+
+// =======================================================================
+// function : IsVisible
+// purpose :
+// =======================================================================
+bool MessageView_VisibilityState::IsVisible (const QModelIndex&) const
+{
+ return false;
+}
+
+// =======================================================================
+// function : OnClicked
+// purpose :
+// =======================================================================
+void MessageView_VisibilityState::OnClicked (const QModelIndex& theIndex)
+{
+ processClicked (theIndex);
+ emit itemClicked (theIndex);
+}
+
+// =======================================================================
+// function : getAlertItem
+// purpose :
+// =======================================================================
+MessageModel_ItemAlertPtr MessageView_VisibilityState::getAlertItem (const QModelIndex& theIndex) const
+{
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (theIndex);
+ if (!anItemBase)
+ return MessageModel_ItemAlertPtr();
+
+ MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(anItemBase);
+ return anAlertItem;
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 MessageView_VisibilityState_H
+#define MessageView_VisibilityState_H
+
+#include <inspector/TreeModel_VisibilityState.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/View_Displayer.hxx>
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <TopoDS_Shape.hxx>
+
+class TreeModel_ModelBase;
+
+//! \class MessageView_VisibilityState
+//! \brief Class provides connection between model and visualization control
+class MessageView_VisibilityState : public QObject, public TreeModel_VisibilityState
+{
+ Q_OBJECT
+public:
+ //! Constructor
+ MessageView_VisibilityState (TreeModel_ModelBase* theModel)
+ : TreeModel_VisibilityState (theModel), myPresentationType (View_PresentationType_Main) {}
+
+ //! Destructor
+ ~MessageView_VisibilityState() {}
+
+ //! Sets current displayer
+ //! \theDisplayer class that provides connection to visualized objects
+ void SetDisplayer (View_Displayer* theDisplayer) { myDisplayer = theDisplayer; }
+
+ //! Sets presentation type for displayer
+ //! \param theType type value
+ void SetPresentationType (const View_PresentationType theType) { myPresentationType = theType; }
+
+ //! Returns true if visibility of the item can be changed
+ //! \param theIndex tree model index
+ //! \return boolean value
+ Standard_EXPORT virtual bool CanBeVisible (const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+ //! Sets visibility state
+ //! \theIndex tree model index
+ //! \param theState visibility state
+ //! \param toEmitDataChanged boolean flag whether emit of the model should be done immediatelly
+ //! \return true if state is changed
+ Standard_EXPORT virtual bool SetVisible (const QModelIndex& theIndex, const bool theState, const bool toEmitDataChanged) Standard_OVERRIDE;
+
+ //! Returns visibility state value
+ Standard_EXPORT virtual bool IsVisible (const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+public slots:
+ //! Processes the mouse clicked on the index.
+ //! It changes the item visibility if model allows to change it.
+ //! \theIndex tree model index
+ void OnClicked (const QModelIndex& theIndex);
+
+signals:
+ //! Signal after OnClicked is performed
+ //! \theIndex tree model index
+ void itemClicked (const QModelIndex& theIndex);
+
+protected:
+ //! Gets the alert item
+ //! \theIndex tree model index
+ //! \return item or NULL
+ MessageModel_ItemAlertPtr getAlertItem (const QModelIndex& theIndex) const;
+
+private:
+ View_Displayer* myDisplayer; //! view displayer
+ View_PresentationType myPresentationType; //! presentation type
+};
+
+#endif
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/MessageView_Window.hxx>
+#include <inspector/MessageView_VisibilityState.hxx>
+#include <inspector/MessageView_ActionsTest.hxx>
+
+#include <inspector/MessageModel_Actions.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/MessageModel_ItemRoot.hxx>
+#include <inspector/MessageModel_TreeModel.hxx>
+#include <inspector/MessageView_MetricStatisticModel.hxx>
+
+#include <inspector/TreeModel_Tools.hxx>
+
+#include <inspector/ViewControl_PropertyView.hxx>
+#include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_TreeView.hxx>
+#include <inspector/Convert_Tools.hxx>
+
+#include <inspector/View_Viewer.hxx>
+#include <inspector/View_Widget.hxx>
+
+#include <AIS_Shape.hxx>
+#include <Graphic3d_Camera.hxx>
+#include <Message.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <inspector/View_Displayer.hxx>
+#include <inspector/View_ToolBar.hxx>
+#include <inspector/View_Widget.hxx>
+#include <inspector/View_Window.hxx>
+#include <inspector/View_Viewer.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QAction>
+#include <QDockWidget>
+#include <QFile>
+#include <QFileDialog>
+#include <QHeaderView>
+#include <QLayout>
+#include <QMainWindow>
+#include <QMenu>
+#include <QMessageBox>
+#include <QPushButton>
+#include <QTextStream>
+#include <QToolBar>
+#include <QToolButton>
+#include <QTreeView>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+const int DEFAULT_SHAPE_VIEW_WIDTH = 400;
+const int DEFAULT_SHAPE_VIEW_HEIGHT = 450;
+const int DEFAULT_SHAPE_VIEW_POSITION_X = 60;
+const int DEFAULT_SHAPE_VIEW_POSITION_Y = 60;
+
+const int MESSAGEVIEW_DEFAULT_TREE_VIEW_WIDTH = 950;
+const int MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT = 500;
+
+const int MESSAGEVIEW_DEFAULT_VIEW_WIDTH = 200;
+const int MESSAGEVIEW_DEFAULT_VIEW_HEIGHT = 300;
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+MessageView_Window::MessageView_Window (QWidget* theParent)
+: QObject (theParent)
+{
+ myMainWindow = new QMainWindow (theParent);
+
+ myTreeView = new ViewControl_TreeView (myMainWindow);
+ ((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (MESSAGEVIEW_DEFAULT_TREE_VIEW_WIDTH,
+ MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT));
+ MessageModel_TreeModel* aModel = new MessageModel_TreeModel (myTreeView);
+ aModel->InitColumns();
+
+ connect (myTreeView->header(), SIGNAL (sectionResized (int, int, int)),
+ this, SLOT(onHeaderResized (int, int, int)));
+
+ myTreeView->setModel (aModel);
+ MessageView_VisibilityState* aVisibilityState = new MessageView_VisibilityState (aModel);
+ aModel->SetVisibilityState (aVisibilityState);
+ connect (aVisibilityState, SIGNAL (itemClicked (const QModelIndex&)),
+ this, SLOT(onTreeViewVisibilityClicked(const QModelIndex&)));
+
+ TreeModel_Tools::UseVisibilityColumn (myTreeView);
+ TreeModel_Tools::SetDefaultHeaderSections (myTreeView);
+
+ QItemSelectionModel* aSelectionModel = new QItemSelectionModel (aModel);
+ myTreeView->setSelectionMode (QAbstractItemView::ExtendedSelection);
+ myTreeView->setSelectionModel (aSelectionModel);
+ connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT (onTreeViewSelectionChanged (const QItemSelection&, const QItemSelection&)));
+
+ myTreeViewActions = new MessageModel_Actions (myMainWindow, aModel, aSelectionModel);
+ myTestViewActions = new MessageView_ActionsTest (myMainWindow, aModel, aSelectionModel);
+
+ myTreeView->setContextMenuPolicy (Qt::CustomContextMenu);
+ connect (myTreeView, SIGNAL (customContextMenuRequested (const QPoint&)),
+ this, SLOT (onTreeViewContextMenuRequested (const QPoint&)));
+
+ connect (myTreeView->header(), SIGNAL (sectionResized (int, int, int)),
+ this, SLOT(onHeaderResized (int, int, int)));
+
+ QModelIndex aParentIndex = myTreeView->model()->index (0, 0);
+ myTreeView->setExpanded (aParentIndex, true);
+
+ myMainWindow->setCentralWidget (myTreeView);
+
+ // property view
+ myPropertyView = new ViewControl_PropertyView (myMainWindow);
+ myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow);
+ myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle());
+ myPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
+ myPropertyPanelWidget->setWidget (myPropertyView->GetControl());
+ myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
+ connect (myPropertyPanelWidget->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT (onPropertyPanelShown (bool)));
+ connect (myPropertyView, SIGNAL (propertyViewDataChanged()), this, SLOT (onPropertyViewDataChanged()));
+
+ myCustomView = new QTableView (myMainWindow);
+ myCustomPanelWidget = new QDockWidget (tr ("PropertyPanel (custom)"), myMainWindow);
+ myCustomPanelWidget->setObjectName (myCustomPanelWidget->windowTitle());
+ myCustomPanelWidget->setTitleBarWidget (new QWidget(myMainWindow));
+ myCustomPanelWidget->setWidget (myCustomView);
+ myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myCustomPanelWidget);
+
+ // view
+ myViewWindow = new View_Window (myMainWindow, NULL, false);
+ connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed()));
+ aVisibilityState->SetDisplayer (myViewWindow->Displayer());
+ aVisibilityState->SetPresentationType (View_PresentationType_Main);
+ myViewWindow->ViewWidget()->SetPredefinedSize (MESSAGEVIEW_DEFAULT_VIEW_WIDTH, MESSAGEVIEW_DEFAULT_VIEW_HEIGHT);
+
+ myViewDockWidget = new QDockWidget (tr ("View"), myMainWindow);
+ myViewDockWidget->setObjectName (myViewDockWidget->windowTitle());
+ myViewDockWidget->setWidget (myViewWindow);
+ myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myViewDockWidget);
+
+ myMainWindow->tabifyDockWidget (myCustomPanelWidget, myViewDockWidget);
+
+ myMainWindow->resize (DEFAULT_SHAPE_VIEW_WIDTH, DEFAULT_SHAPE_VIEW_HEIGHT);
+ myMainWindow->move (DEFAULT_SHAPE_VIEW_POSITION_X, DEFAULT_SHAPE_VIEW_POSITION_Y);
+
+ updateVisibleColumns();
+}
+
+// =======================================================================
+// function : SetParent
+// purpose :
+// =======================================================================
+void MessageView_Window::SetParent (void* theParent)
+{
+ QWidget* aParent = (QWidget*)theParent;
+ if (aParent)
+ {
+ QLayout* aLayout = aParent->layout();
+ if (aLayout)
+ aLayout->addWidget (GetMainWindow());
+ }
+ else
+ {
+ GetMainWindow()->setParent (0);
+ GetMainWindow()->setVisible (true);
+ }
+}
+
+// =======================================================================
+// function : FillActionsMenu
+// purpose :
+// =======================================================================
+void MessageView_Window::FillActionsMenu (void* theMenu)
+{
+ QMenu* aMenu = (QMenu*)theMenu;
+ QList<QDockWidget*> aDockwidgets = myMainWindow->findChildren<QDockWidget*>();
+ for (QList<QDockWidget*>::iterator it = aDockwidgets.begin(); it != aDockwidgets.end(); ++it)
+ {
+ QDockWidget* aDockWidget = *it;
+ if (aDockWidget->parentWidget() == myMainWindow)
+ aMenu->addAction (aDockWidget->toggleViewAction());
+ }
+}
+
+// =======================================================================
+// function : GetPreferences
+// purpose :
+// =======================================================================
+void MessageView_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theItem)
+{
+ theItem.Clear();
+ theItem.Bind ("geometry", TreeModel_Tools::ToString (myMainWindow->saveState()).toStdString().c_str());
+
+ QMap<QString, QString> anItems;
+ TreeModel_Tools::SaveState (myTreeView, anItems);
+ for (QMap<QString, QString>::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++)
+ {
+ theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
+ }
+
+ anItems.clear();
+ View_Window::SaveState(myViewWindow, anItems);
+ for (QMap<QString, QString>::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++)
+ {
+ theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
+ }
+}
+
+// =======================================================================
+// function : SetPreferences
+// purpose :
+// =======================================================================
+void MessageView_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem)
+{
+ for (TInspectorAPI_IteratorOfPreferencesDataMap anItemIt (theItem); anItemIt.More(); anItemIt.Next())
+ {
+ if (anItemIt.Key().IsEqual ("geometry"))
+ myMainWindow->restoreState (TreeModel_Tools::ToByteArray (anItemIt.Value().ToCString()));
+ else if (TreeModel_Tools::RestoreState (myTreeView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
+ continue;
+ else if (myViewWindow && View_Window::RestoreState(myViewWindow, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
+ continue;
+ }
+}
+
+// =======================================================================
+// function : UpdateContent
+// purpose :
+// =======================================================================
+void MessageView_Window::UpdateContent()
+{
+ TCollection_AsciiString aName = "TKMessageView";
+ if (myParameters->FindParameters (aName))
+ {
+ NCollection_List<Handle(Standard_Transient)> aParameters = myParameters->Parameters (aName);
+ // Init will remove from parameters those, that are processed only one time (TShape)
+ Init (aParameters);
+ myParameters->SetParameters (aName, aParameters);
+ }
+ Handle(Message_Report) aDefaultReport = Message::DefaultReport();
+ MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ if (!aDefaultReport.IsNull() && !aViewModel->HasReport (aDefaultReport))
+ {
+ addReport (aDefaultReport);
+ }
+
+ updateTreeModel();
+ updateVisibleColumns();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void MessageView_Window::Init (NCollection_List<Handle(Standard_Transient)>& theParameters)
+{
+ Handle(AIS_InteractiveContext) aContext;
+ NCollection_List<Handle(Standard_Transient)> aParameters;
+
+ Handle(Graphic3d_Camera) aViewCamera;
+
+ for (NCollection_List<Handle(Standard_Transient)>::Iterator aParamsIt (theParameters);
+ aParamsIt.More(); aParamsIt.Next())
+ {
+ Handle(Standard_Transient) anObject = aParamsIt.Value();
+ Handle(Message_Report) aMessageReport = Handle(Message_Report)::DownCast (anObject);
+ if (!aMessageReport.IsNull())
+ {
+ addReport (aMessageReport);
+ }
+ else if (!Handle(AIS_InteractiveContext)::DownCast (anObject).IsNull())
+ {
+ aParameters.Append (anObject);
+ if (aContext.IsNull())
+ aContext = Handle(AIS_InteractiveContext)::DownCast (anObject);
+ }
+ else if (!Handle(Graphic3d_Camera)::DownCast (anObject).IsNull())
+ {
+ aViewCamera = Handle(Graphic3d_Camera)::DownCast (anObject);
+ }
+ }
+ MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ if (!aTreeModel)
+ return;
+
+ aTreeModel->EmitLayoutChanged();
+
+ if (!aContext.IsNull())
+ {
+ myViewWindow->SetContext (View_ContextType_External, aContext);
+ }
+ theParameters = aParameters;
+}
+
+// =======================================================================
+// function : updateTreeModel
+// purpose :
+// =======================================================================
+void MessageView_Window::updateTreeModel()
+{
+ MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ if (!aViewModel)
+ return;
+
+ aViewModel->UpdateTreeModel();
+}
+
+// =======================================================================
+// function : addReport
+// purpose :
+// =======================================================================
+void MessageView_Window::addReport (const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription)
+{
+ MessageModel_TreeModel* aModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ aModel->AddReport (theReport, theReportDescription);
+}
+
+// =======================================================================
+// function : onTreeViewVisibilityClicked
+// purpose :
+// =======================================================================
+void MessageView_Window::onTreeViewVisibilityClicked(const QModelIndex& theIndex)
+{
+ MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ TreeModel_VisibilityState* aVisibilityState = aTreeModel->GetVisibilityState();
+ if (!aVisibilityState->IsVisible (theIndex))
+ myPropertyView->ClearActiveTablesSelection();
+}
+
+// =======================================================================
+// function : onTreeViewSelectionChanged
+// purpose :
+// =======================================================================
+void MessageView_Window::onTreeViewSelectionChanged (const QItemSelection&, const QItemSelection&)
+{
+ if (!myPropertyPanelWidget->toggleViewAction()->isChecked())
+ return;
+
+ updatePropertyPanelBySelection();
+ updatePreviewPresentation();
+}
+
+// =======================================================================
+// function : onTreeViewContextMenuRequested
+// purpose :
+// =======================================================================
+void MessageView_Window::onTreeViewContextMenuRequested (const QPoint& thePosition)
+{
+ QMenu* aMenu = new QMenu (GetMainWindow());
+
+ MessageModel_ItemRootPtr aRootItem;
+ MessageModel_ItemReportPtr aReportItem;
+ QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
+
+ for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ aRootItem = itemDynamicCast<MessageModel_ItemRoot> (anItemBase);
+ if (aRootItem)
+ break;
+ aReportItem = itemDynamicCast<MessageModel_ItemReport> (anItemBase);
+ if (aReportItem)
+ break;
+ }
+ if (aRootItem)
+ {
+ aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Create Default Report"),
+ SLOT (onCreateDefaultReport()), myMainWindow, this));
+ }
+ else if (aReportItem)
+ {
+ aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export Report"), SLOT (onExportReport()), myMainWindow, this));
+
+ QAction* anAction = ViewControl_Tools::CreateAction (tr ("WallClock Metric statistic"),
+ SLOT (onMetricStatistic()), myMainWindow, this);
+ anAction->setCheckable (true);
+ aMenu->addAction (anAction);
+ }
+ aMenu->addSeparator();
+
+ aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Preview children presentations"), SLOT (onPreviewChildren()), myMainWindow, this));
+ aMenu->addSeparator();
+
+ myTreeViewActions->AddMenuActions (aSelectedIndices, aMenu);
+ addActivateMetricActions (aMenu);
+
+ aMenu->addSeparator();
+ myTestViewActions->AddMenuActions (aSelectedIndices, aMenu);
+
+ QPoint aPoint = myTreeView->mapToGlobal (thePosition);
+ aMenu->exec (aPoint);
+}
+
+// =======================================================================
+// function : onPropertyPanelShown
+// purpose :
+// =======================================================================
+void MessageView_Window::onPropertyPanelShown (bool isToggled)
+{
+ if (!isToggled)
+ return;
+
+ updatePropertyPanelBySelection();
+}
+
+// =======================================================================
+// function : onPropertyViewDataChanged
+// purpose :
+// =======================================================================
+void MessageView_Window::onPropertyViewDataChanged()
+{
+ QItemSelectionModel* aModel = myTreeView->selectionModel();
+ if (!aModel)
+ return;
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ return;
+
+ updatePropertyPanelBySelection();
+ updatePreviewPresentation();
+}
+
+// =======================================================================
+// function : onHeaderResized
+// purpose :
+// =======================================================================
+void MessageView_Window::onHeaderResized (int theSectionId, int, int)
+{
+ TreeModel_ModelBase* aViewModel = dynamic_cast<TreeModel_ModelBase*> (myTreeView->model());
+
+ TreeModel_HeaderSection* aSection = aViewModel->ChangeHeaderItem (theSectionId);
+ aSection->SetWidth (myTreeView->columnWidth (theSectionId));
+}
+
+// =======================================================================
+// function : onEraseAllPerformed
+// purpose :
+// =======================================================================
+void MessageView_Window::onEraseAllPerformed()
+{
+ MessageModel_TreeModel* aTreeModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+
+ aTreeModel->Reset();
+ aTreeModel->EmitLayoutChanged();
+}
+
+// =======================================================================
+// function : onExportReport
+// purpose :
+// =======================================================================
+void MessageView_Window::onExportReport()
+{
+ QItemSelectionModel* aModel = myTreeView->selectionModel();
+ if (!aModel)
+ return;
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ return;
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(anItemBase);
+ if (!aReportItem)
+ return;
+
+ QString aFilter (tr ("Document file (*.json *)"));
+ QString aSelectedFilter;
+ QString aFileName = QFileDialog::getSaveFileName (0, tr ("Export report to file"), QString(), aFilter, &aSelectedFilter);
+
+ Handle(Message_Report) aReport = aReportItem->GetReport();
+ Standard_SStream aStream;
+ aReport->DumpJson(aStream);
+
+ QFile aLogFile(aFileName);
+ if (!aLogFile.open(QFile::WriteOnly | QFile::Text))
+ {
+ return;
+ }
+ QTextStream anOut( &aLogFile );
+ anOut << Standard_Dump::FormatJson (aStream).ToCString();
+ aLogFile.close();
+}
+
+// =======================================================================
+// function : onCreateDefaultReport
+// purpose :
+// =======================================================================
+void MessageView_Window::onCreateDefaultReport()
+{
+ if (!Message::DefaultReport().IsNull())
+ {
+ return;
+ }
+
+ addReport (Message::DefaultReport (Standard_True));
+}
+
+// =======================================================================
+// function : onPreviewChildren
+// purpose :
+// =======================================================================
+void MessageView_Window::onPreviewChildren()
+{
+ QItemSelectionModel* aModel = myTreeView->selectionModel();
+ if (!aModel)
+ return;
+
+ QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
+ NCollection_List<Handle(Standard_Transient)> aPresentations;
+ TreeModel_ModelBase::SubItemsPresentations (aSelectedIndices, aPresentations);
+
+ displayer()->UpdatePreview (View_DisplayActionType_DisplayId, aPresentations);
+}
+
+// =======================================================================
+// function : onMetricStatistic
+// purpose :
+// =======================================================================
+void MessageView_Window::onMetricStatistic()
+{
+ QItemSelectionModel* aModel = myTreeView->selectionModel();
+ if (!aModel)
+ {
+ return;
+ }
+
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ {
+ return;
+ }
+
+ MessageView_MetricStatisticModel* aUnitByNameModel = new MessageView_MetricStatisticModel (Message_MetricType_WallClock, myCustomView);
+ aUnitByNameModel->Init (anItemBase);
+ myCustomView->setModel (aUnitByNameModel);
+}
+
+// =======================================================================
+// function : addActivateMetricActions
+// purpose :
+// =======================================================================
+void MessageView_Window::addActivateMetricActions (QMenu* theMenu)
+{
+ Handle(Message_Report) aReport = Message::DefaultReport();
+ if (aReport.IsNull())
+ {
+ return;
+ }
+
+ QMenu* aSubMenu = new QMenu ("Activate metric");
+ for (int aMetricId = (int)Message_MetricType_None + 1; aMetricId <= (int)Message_MetricType_MemHeapUsage; aMetricId++)
+ {
+ Message_MetricType aMetricType = (Message_MetricType)aMetricId;
+ QAction* anAction = ViewControl_Tools::CreateAction (Message::MetricToString (aMetricType),
+ SLOT (OnActivateMetric()), parent(), this);
+ anAction->setCheckable (true);
+ anAction->setChecked (aReport->ActiveMetrics().Contains (aMetricType));
+ aSubMenu->addAction (anAction);
+ }
+ aSubMenu->addSeparator();
+ aSubMenu->addAction (ViewControl_Tools::CreateAction ("Deactivate all", SLOT (OnDeactivateAllMetrics()), parent(), this));
+
+ theMenu->addMenu (aSubMenu);
+}
+
+// =======================================================================
+// function : OnActivateMetric
+// purpose :
+// =======================================================================
+void MessageView_Window::OnActivateMetric()
+{
+ QAction* anAction = (QAction*)(sender());
+
+ Message_MetricType aMetricType;
+ if (!Message::MetricFromString (anAction->text().toStdString().c_str(), aMetricType))
+ return;
+
+ Handle(Message_Report) aReport = Message::DefaultReport();
+ const NCollection_IndexedMap<Message_MetricType>& anActiveMetrics = aReport->ActiveMetrics();
+ aReport->SetActiveMetric (aMetricType, !anActiveMetrics.Contains (aMetricType));
+
+ updateVisibleColumns();
+}
+
+// =======================================================================
+// function : OnDeactivateAllMetrics
+// purpose :
+// =======================================================================
+void MessageView_Window::OnDeactivateAllMetrics()
+{
+ Handle(Message_Report) aReport = Message::DefaultReport();
+ if (aReport.IsNull())
+ return;
+ aReport->ClearMetrics();
+
+ updateVisibleColumns();
+}
+
+// =======================================================================
+// function : displayer
+// purpose :
+// =======================================================================
+View_Displayer* MessageView_Window::displayer()
+{
+ return myViewWindow->Displayer();
+}
+
+// =======================================================================
+// function : updatePropertyPanelBySelection
+// purpose :
+// =======================================================================
+void MessageView_Window::updatePropertyPanelBySelection()
+{
+ ViewControl_TableModelValues* aTableValues = 0;
+
+ QItemSelectionModel* aModel = myTreeView->selectionModel();
+ if (!aModel)
+ return;
+
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (anItemBase)
+ {
+ Handle(TreeModel_ItemProperties) anItemProperties = anItemBase->Properties ();
+ if (!anItemProperties.IsNull())
+ {
+ aTableValues = new ViewControl_TableModelValues();
+ aTableValues->SetProperties (anItemProperties);
+ }
+ }
+ myPropertyView->Init (aTableValues);
+}
+
+// =======================================================================
+// function : updatePreviewPresentation
+// purpose :
+// =======================================================================
+void MessageView_Window::updatePreviewPresentation()
+{
+ Handle(AIS_InteractiveContext) aContext = myViewWindow->ViewToolBar()->CurrentContext();
+ if (aContext.IsNull())
+ return;
+
+ NCollection_List<Handle(Standard_Transient)> aPresentations;
+ QModelIndexList aSelectedIndices = myTreeView->selectionModel()->selectedIndexes();
+ for (QModelIndexList::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ QModelIndex anIndex = *aSelIt;
+ if (anIndex.column() != 0)
+ continue;
+
+ TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
+ if (!anItemBase)
+ continue;
+
+ anItemBase->Presentations (aPresentations);
+ }
+
+ displayer()->UpdatePreview (View_DisplayActionType_DisplayId, aPresentations);
+}
+
+// =======================================================================
+// function : updateVisibleColumns
+// purpose :
+// =======================================================================
+void MessageView_Window::updateVisibleColumns()
+{
+ MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+
+ NCollection_IndexedMap<Message_MetricType> anActiveMetrics;
+ for (NCollection_List<MessageModel_ReportInformation>::Iterator anIterator (aViewModel->Reports()); anIterator.More(); anIterator.Next())
+ {
+ Handle(Message_Report) aReport = anIterator.Value().myReport;
+ for (NCollection_IndexedMap<Message_MetricType>::Iterator aMetricsIterator (aReport->ActiveMetrics()); aMetricsIterator.More(); aMetricsIterator.Next())
+ {
+ if (anActiveMetrics.Contains (aMetricsIterator.Value()))
+ continue;
+ anActiveMetrics.Add (aMetricsIterator.Value());
+ }
+ }
+
+ for (int aMetricId = (int)Message_MetricType_None + 1; aMetricId <= (int)Message_MetricType_MemHeapUsage; aMetricId++)
+ {
+ Message_MetricType aMetricType = (Message_MetricType)aMetricId;
+ QList<int> aMetricColumns;
+ aViewModel->GetMetricColumns (aMetricType, aMetricColumns);
+ bool isColumnHidden = !anActiveMetrics.Contains (aMetricType);
+ for (int i = 0; i < aMetricColumns.size(); i++)
+ {
+ int aColumnId = aMetricColumns[i];
+ myTreeView->setColumnHidden (aColumnId, isColumnHidden);
+ TreeModel_HeaderSection* aSection = aViewModel->ChangeHeaderItem (aColumnId);
+ aSection->SetIsHidden (isColumnHidden);
+ }
+ }
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 MessageView_Window_H
+#define MessageView_Window_H
+
+#include <Message_Report.hxx>
+#include <Standard.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <inspector/MessageModel_Actions.hxx>
+#include <inspector/TInspectorAPI_PluginParameters.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QItemSelection>
+#include <QList>
+#include <QModelIndexList>
+#include <QObject>
+#include <QPoint>
+#include <QString>
+#include <QTableView>
+#include <QTreeView>
+#include <Standard_WarningsRestore.hxx>
+
+class View_Displayer;
+class View_Window;
+
+class ViewControl_PropertyView;
+
+class MessageView_ActionsTest;
+
+class QDockWidget;
+class QMainWindow;
+class QMenu;
+class QWidget;
+
+//! \class MessageView_Window
+//! Window that unites all MessageView controls.
+class MessageView_Window : public QObject
+{
+ Q_OBJECT
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageView_Window (QWidget* theParent);
+
+ //! Destructor
+ virtual ~MessageView_Window() {}
+
+ //! Provides the container with a parent where this container should be inserted.
+ //! If Qt implementation, it should be QWidget with QLayout set inside
+ //! \param theParent a parent class
+ Standard_EXPORT void SetParent (void* theParent);
+
+ //! Sets parameters container, it should be used when the plugin is initialized or in update content
+ //! \param theParameters a parameters container
+ void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters)
+ { myParameters = theParameters; myTreeViewActions->SetParameters (theParameters); }
+
+ //! Provide container for actions available in inspector on general level
+ //! \param theMenu if Qt implementation, it is QMenu object
+ Standard_EXPORT virtual void FillActionsMenu (void* theMenu);
+
+ //! Returns plugin preferences: dock widgets state, tree view columns.
+ //! \param theItem container of preference elements
+ Standard_EXPORT void GetPreferences (TInspectorAPI_PreferencesDataMap& theItem);
+
+ //! Applies plugin preferences
+ //! \param theItem container of preference elements
+ Standard_EXPORT void SetPreferences (const TInspectorAPI_PreferencesDataMap& theItem);
+
+ //! Applyes parameters to Init controls, opens files if there are in parameters, updates OCAF tree view model
+ Standard_EXPORT void UpdateContent();
+
+ //! Returns main control
+ QMainWindow* GetMainWindow() const { return myMainWindow; }
+
+ //! Returns current tree view
+ QTreeView* GetTreeView() const { return myTreeView; }
+
+protected:
+ //! Appends shape into tree view model
+ //! \param theShape a shape instance
+ //! \param theReportDescription an additional report information
+ void addReport (const Handle(Message_Report)& theReport,
+ const TCollection_AsciiString& theReportDescription = "");
+
+private:
+
+ //! Fills controls of the plugin by parameters:
+ //! - Fine AIS_InteractiveObject and fills View if it if it differs from the current context
+ //! \param theParameters a parameters container
+ void Init (NCollection_List<Handle(Standard_Transient)>& theParameters);
+
+ //! Updates tree model
+ void updateTreeModel();
+
+protected slots:
+ //! Updates property view selection in table if the item is hidden
+ //! \param theIndex tree view model index
+ void onTreeViewVisibilityClicked(const QModelIndex& theIndex);
+
+ //! Udpates all controls by changed selection in OCAF tree view
+ //! \param theSelected list of selected tree view items
+ //! \param theDeselected list of deselected tree view items
+ void onTreeViewSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
+
+ //! Shows context menu for tree view selected item. It contains expand/collapse actions.
+ //! \param thePosition a clicked point
+ void onTreeViewContextMenuRequested (const QPoint& thePosition);
+
+ //! Display content of selected tree view item if isToggled is true
+ //! \param isToggled true if the property dock widget is shown
+ void onPropertyPanelShown (bool isToggled);
+
+ //! Update tree view item, preview presentation by item value change
+ void onPropertyViewDataChanged();
+
+ //! Update tree view header item width
+ void onHeaderResized (int theSectionId, int, int);
+
+ //! Updates visibility states by erase all in context
+ void onEraseAllPerformed();
+
+ //! Export report into document
+ void onExportReport();
+
+ //! Create default report into document
+ void onCreateDefaultReport();
+
+ //! Iterates by children items of selected items and display its presentations if found
+ void onPreviewChildren();
+
+ //! Creates the table that sums the number of calls and
+ //! the time spent on the functionality inside the value.
+ void onMetricStatistic();
+
+ //! Switch active state in report for clicked type of metric
+ void OnActivateMetric();
+
+ //! Deactivate all types of metrics for the current report
+ void OnDeactivateAllMetrics();
+
+protected:
+ //! Appends items to activate report metrics
+ void addActivateMetricActions (QMenu* theMenu);
+
+ //! Returns displayer where the presentations/preview should be shown/erased
+ //! If default view is created, it returns displayer of this view
+ Standard_EXPORT View_Displayer* displayer();
+
+ //! Updates property panel content by item selected in tree view.
+ void updatePropertyPanelBySelection();
+
+ //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
+ void updatePreviewPresentation();
+
+ //!< Sets reports metric columns visible if used
+ void updateVisibleColumns();
+
+private:
+ QMainWindow* myMainWindow; //!< main control, parent for all MessageView controls
+ QDockWidget* myViewDockWidget; //!< view dock widget to hide/show
+
+ QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget
+ ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
+
+ View_Window* myViewWindow; //!< OCC 3d view to visualize presentations
+ QTreeView* myTreeView; //!< tree view visualized shapes
+ MessageModel_Actions* myTreeViewActions; //!< processing history view actions
+ MessageView_ActionsTest* myTestViewActions; //!< check view actions
+
+ QTableView* myCustomView; //!< table that units messages by name.
+ QDockWidget* myCustomPanelWidget; //!< panel for table that units messages by name.
+
+ Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
+
+ Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+};
+
+#endif
#include <inspector/TInspector_Preferences.hxx>
#include <inspector/TInspector_Window.hxx>
-class TInspector_ReportCallBack;
-
//! \class TInspector_PluginParameters.
//! \brief This is plugin parameters extended by a possibility to activate module during setting new parameters
class TInspector_PluginParameters : public TInspectorAPI_PluginParameters
private:
TInspector_Window* myWindow; //!< the current window
- Handle(TInspector_ReportCallBack) myReportCallBack; //!< inspector report callback for automatic view update
TInspector_Preferences* myPreferences; //!< the preferences loader
};
#include <inspector/TInspector_Communicator.hxx>
+#include <Message.hxx>
+#include <Message_Report.hxx>
#include <OSD_Environment.hxx>
#include <Standard_WarningsDisable.hxx>
if (!strcmp (argv[anArgId], "vinspector"))
aPlugins.insert ("TKVInspector");
+
+ if (!strcmp (argv[anArgId], "messageview"))
+ aPlugins.insert ("TKMessageView");
}
NCollection_List<Handle(Standard_Transient)> aParameters;
aPlugins.insert("TKDFBrowser");
aPlugins.insert("TKShapeView");
aPlugins.insert("TKVInspector");
+ aPlugins.insert("TKMessageView");
anActivatedPluginName = "TKDFBrowser";
}
DFBrowserPane
-DFBrowserPaneXDE
DFBrowser
--- /dev/null
+project(TKMessageModel)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
--- /dev/null
+TKMath
+TKBin
+TKBRep
+TKGeomBase
+TKG3d
+TKTInspectorAPI
+TKService
+TKTopAlgo
+TKTreeModel
+CSF_QT
--- /dev/null
+EXTERNLIB
+PACKAGES
--- /dev/null
+MessageModel
--- /dev/null
+project(TKMessageView)
+
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
+OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool)
--- /dev/null
+TKTInspectorAPI
+TKMath
+TKMessageModel
+TKBin
+TKBRep
+TKGeomBase
+TKG3d
+TKService
+TKTopAlgo
+TKTreeModel
+TKView
+TKXml
+CSF_QT
--- /dev/null
+EXTERNLIB
+PACKAGES
--- /dev/null
+MessageView
if (anArgument == "dfbrowser") { thePluginName = "TKDFBrowser"; return Standard_True; }
else if (anArgument == "shapeview") { thePluginName = "TKShapeView"; return Standard_True; }
else if (anArgument == "vinspector") { thePluginName = "TKVInspector"; return Standard_True; }
+ else if (anArgument == "messageview") { thePluginName = "TKMessageView"; return Standard_True; }
return Standard_False;
}
aPlugins.Append ("TKDFBrowser");
aPlugins.Append ("TKShapeView");
aPlugins.Append ("TKVInspector");
+ aPlugins.Append ("TKMessageView");
}
aPluginNameToActivate = !aPluginNameToActivate.IsEmpty() ? aPluginNameToActivate : aPlugins.First();
}
"\n\t\t: Starts tool of inspection."
"\n\t\t: Options:"
"\n\t\t: -plugins enters plugins that should be added in the inspector."
- "\n\t\t: Available names are: dfbrowser, vinspector and shapeview."
+ "\n\t\t: Available names are: dfbrowser, vinspector, shapeview and messageview."
"\n\t\t: Plugins order will be the same as defined in arguments."
"\n\t\t: 'all' adds all available plugins in the order:"
- "\n\t\t: DFBrowser, VInspector and ShapeView."
+ "\n\t\t: DFBrowser, VInspector, ShapeView and MessageView."
"\n\t\t: If at the first call this option is not used, 'all' option is applied;"
"\n\t\t: -activate activates the plugin in the tool view."
"\n\t\t: If at the first call this option is not used, the first plugin is activated;"
enum TreeModel_ColumnType
{
TreeModel_ColumnType_Name = 0, //! name column
- TreeModel_ColumnType_Visibility //! visibility state column
+ TreeModel_ColumnType_Visibility, //! visibility state column
+ TreeModel_ColumnType_Row //! row of the item column
};
#endif
int aNbSections = aModel->columnCount();
for (int aColumnId = 0; aColumnId < aNbSections; aColumnId++)
{
- QAction* anAction = ViewControl_Tools::CreateAction (aModel->GetHeaderItem (aColumnId).GetName(),
+ QAction* anAction = ViewControl_Tools::CreateAction (aModel->ChangeHeaderItem (aColumnId)->GetName(),
SLOT (onColumnVisibilityChanged()), myTreeView, this);
anAction->setCheckable (true);
anAction->setChecked (!myTreeView->isColumnHidden (aColumnId));
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <inspector/TreeModel_ColumnType.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_ItemRole.hxx>
switch (Column())
{
- case 1: { return Row(); }
+ case TreeModel_ColumnType_Row: { return Row(); }
}
return QVariant();
//! Returns the item properties
const Handle(TreeModel_ItemProperties)& Properties() const { return myProperties; }
+ //! Updates item by the item properties value
+ virtual void StoreItemProperties (const int theRow, const int theColumn, const QVariant& theValue)
+ { (void)theRow, (void)theColumn; (void)theValue; }
+
+ //! Returns presentation of the item to be visualized in the view
+ //! \thePresentations [out] container of presentation handles
Standard_EXPORT virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations);
protected:
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <gp_XYZ.hxx>
+#include <Quantity_ColorRGBA.hxx>
#include <Standard_Dump.hxx>
#include <Standard_WarningsDisable.hxx>
{
myRowValues.Clear();
- const Standard_SStream& aStream = Item()->Stream();
+ InitByStream (Item()->Stream());
+}
+// =======================================================================
+// function : InitByStream
+// purpose :
+// =======================================================================
+void TreeModel_ItemProperties::InitByStream (const Standard_SStream& aStream)
+{
NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue> aValues;
TCollection_AsciiString aStreamText = Standard_Dump::Text (aStream);
Standard_Dump::SplitJson (aStreamText, aValues);
Standard_DumpValue aKeyValue;
if (!aStreamParent)
{
- const Handle(Standard_Transient)& anItemObject = Item()->Object();
- aKey = anItemObject.IsNull() ? "Dump" : anItemObject->DynamicType()->Name();
+ if (!Item() || Item()->Object().IsNull())
+ {
+ aKey = "Dump";
+ }
+ else
+ {
+ const Handle(Standard_Transient)& anItemObject = Item()->Object();
+ aKey = anItemObject.IsNull() ? "Dump" : anItemObject->DynamicType()->Name();
+ }
aKeyValue = Standard_DumpValue (aStreamText, 1);
myKey = aKey;
(int)(aGreen * aDelta), (int)(aBlue * aDelta)));
}
}
+ // in case if the stream alert has empty key avalue, use as the key the first row value
+ if ((myKey.IsEmpty() || myKey.IsEqual ("Dump")) && myRowValues.Size() > 0)
+ {
+ myKey = myRowValues.FindFromIndex (1).Value.toString().toStdString().c_str();
+ }
}
// =======================================================================
if (theColumn == 0)
return ViewControl_EditType_None;
+ Quantity_Color aColor;
+ if (Convert_Tools::ConvertStreamToColor (Item()->Stream(), aColor))
+ {
+ return ViewControl_EditType_Color;
+ }
return ViewControl_EditType_Line;
}
+// =======================================================================
+// function : ReplaceValue
+// purpose :
+// =======================================================================
+Standard_Boolean ReplaceValue (const TCollection_AsciiString& theFromValue,
+ const TCollection_AsciiString& theToValue,
+ Standard_DumpValue& theStreamValue)
+{
+ TCollection_AsciiString aStreamValue = theStreamValue.myValue;
+
+ int aPosition = aStreamValue.FirstLocationInSet (theFromValue, 1, aStreamValue.Length());
+ if (aPosition < 1)
+ return Standard_False;
+
+ aPosition += 2; // due to 'FirstLocationInSet' returns position taking into account '"\' as 1 position
+
+ TCollection_AsciiString aPartStart = aStreamValue.SubString(1, aPosition - 1);
+ TCollection_AsciiString aPartFinal = aStreamValue.SubString(aPosition + theFromValue.Length(),
+ aStreamValue.Length());
+ theStreamValue.myValue = aPartStart + theToValue + aPartFinal;
+
+ return Standard_True;
+}
+
// =======================================================================
// function : SetData
// purpose :
// =======================================================================
-bool TreeModel_ItemProperties::SetData (const int /*theRow*/, const int theColumn, const QVariant& /*theValue*/, int)
+bool TreeModel_ItemProperties::SetData (const int theRow, const int theColumn, const QVariant& theValue, int theRole)
{
if (theColumn == 0)
return false;
- return false;
+
+ if (theRole != Qt::DisplayRole && theRole != Qt::EditRole)
+ return false;
+
+ if (myRowValues.Size() == 1 && theColumn == 1)
+ {
+ TCollection_AsciiString aStreamValue (theValue.toString().toStdString().c_str());
+ NCollection_IndexedDataMap<TCollection_AsciiString, Standard_DumpValue> aKeyToValues;
+ if (Standard_Dump::SplitJson (aStreamValue, aKeyToValues))
+ {
+ Standard_SStream aStream;
+ aStream << aStreamValue.ToCString();
+
+ int aStartPos = 1;
+ Quantity_ColorRGBA aColor;
+ if (aColor.InitFromJson (aStream, aStartPos))
+ {
+ Standard_Real aRed, aGreen, aBlue;
+ aColor.GetRGB().Values (aRed, aGreen, aBlue, Quantity_TOC_sRGB);
+ int aDelta = 255;
+ myRowValues.ChangeFromIndex (1).CustomValues.insert ((int)Qt::BackgroundRole, QColor((int)(aRed * aDelta),
+ (int)(aGreen * aDelta), (int)(aBlue * aDelta)));
+ }
+ Standard_DumpValue aValue = aKeyToValues.FindFromIndex (1);
+ myStreamValue.myValue = aValue.myValue.ToCString();
+ myRowValues.ChangeFromIndex (1).Value = aValue.myValue.ToCString();
+
+ Item()->StoreItemProperties (theRow, theColumn, theValue);
+ return true;
+ }
+ TCollection_AsciiString aFromValue = myRowValues.ChangeFromIndex (1).Value.toString().toStdString().c_str();
+ if (ReplaceValue(aFromValue, aStreamValue, myStreamValue))
+ {
+ aStreamValue = myStreamValue.myValue;
+ if (Standard_Dump::SplitJson (aStreamValue, aKeyToValues))
+ {
+ Standard_DumpValue aValue = aKeyToValues.FindFromIndex (1);
+ myRowValues.ChangeFromIndex (1).Value = aValue.myValue.ToCString();
+
+ Item()->StoreItemProperties (theRow, theColumn, aStreamValue.ToCString());
+ return true;
+ }
+ }
+ }
+
+ myRowValues.ChangeFromIndex (theRow + 1).Value = theValue;
+ Item()->StoreItemProperties (theRow, theColumn, theValue);
+ return true;
}
// =======================================================================
// =======================================================================
void TreeModel_ItemProperties::Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations)
{
+ if (!Item())
+ {
+ return;
+ }
const Standard_SStream& aStream = Item()->Stream();
Convert_Tools::ConvertStreamToPresentations (aStream, 1, -1, thePresentations);
}
//! Sets the current item
void SetItem (const TreeModel_ItemBasePtr& theItem) { myItem = theItem; }
+ //! Fills properties with the stream value
+ Standard_EXPORT void InitByStream (const Standard_SStream& theStream);
+
//! Returns the current item
TreeModel_ItemBasePtr Item() const { return myItem; }
Standard_EXPORT void Init();
//! If the item has internal values, they should be reset here.
- Standard_EXPORT virtual void Reset();
+ Standard_EXPORT void Reset();
//! Returns number of table rows
//! \return an integer value
//! \param theColumn a model index column
//! \param theRole a view role
//! \return true if the value is changed
- Standard_EXPORT virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue,
- int theRole = Qt::DisplayRole);
+ Standard_EXPORT bool SetData (const int theRow, const int theColumn, const QVariant& theValue,
+ int theRole = Qt::DisplayRole);
//! Returns presentation of the attribute to be visualized in the view
//! \thePresentations [out] container of presentation handles to be visualized
- Standard_EXPORT virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations);
+ Standard_EXPORT void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations);
//! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable.
//! Additional flag for the column 1 is Qt::ItemIsEditable.
//! \param theIndex a model index
//! \return flags
- Standard_EXPORT virtual Qt::ItemFlags TableFlags (const int theRow, const int theColumn) const;
+ Standard_EXPORT Qt::ItemFlags TableFlags (const int theRow, const int theColumn) const;
//! Returns stream value of the item to fulfill property panel.
//! \return stream value or dummy
return QVariant();
}
+// =======================================================================
+// function : StoreItemProperties
+// purpose :
+// =======================================================================
+void TreeModel_ItemStream::StoreItemProperties (const int, const int, const QVariant& theValue)
+{
+ Parent()->StoreItemProperties (-1, -1, theValue);
+}
+
// =======================================================================
// function : initStream
// purpose :
//! \return the value
Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+ //! Stores values of the item properties into the item object
+ //! \param theRow the child row position
+ //! \param theColumn the child column position
+ //! \param theValue the cell value
+ Standard_EXPORT virtual void StoreItemProperties (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
protected:
//! Returns stream value of the item to fulfill property panel.
//! \return stream value or dummy
#include <inspector/TreeModel_ModelBase.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <inspector/TreeModel_VisibilityState.hxx>
// =======================================================================
void TreeModel_ModelBase::InitColumns()
{
- SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
- SetHeaderItem (1, TreeModel_HeaderSection ("Visibility", TreeModel_ModelBase::ColumnVisibilityWidth()));
- SetHeaderItem (2, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH));
+ setHeaderItem (TreeModel_ColumnType_Name, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
+ setHeaderItem (TreeModel_ColumnType_Visibility, TreeModel_HeaderSection ("Visibility", TreeModel_ModelBase::ColumnVisibilityWidth()));
+ setHeaderItem (TreeModel_ColumnType_Row, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH));
}
// =======================================================================
if (IsUseVisibilityColumn() && theSection == TreeModel_ColumnType_Visibility)
return QVariant();
- return GetHeaderItem (theSection).GetName();
+ return myHeaderValues[theSection].GetName();
}
// =======================================================================
#endif
}
-// =======================================================================
-// function : SetHeaderItem
-// purpose :
-// =======================================================================
-void TreeModel_ModelBase::SetHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection)
-{
- if (theSection.IsEmpty())
- {
- // remove section
- myHeaderValues.remove (theColumnId);
- myRootItems.remove (theColumnId);
- }
-
- myHeaderValues[theColumnId] = theSection;
- createRoot (theColumnId);
-}
-
// =======================================================================
// function : Selected
// purpose :
return anItems;
}
+// =======================================================================
+// function : SubItemsPresentations
+// purpose :
+// =======================================================================
+void TreeModel_ModelBase::SubItemsPresentations (const QModelIndexList& theIndices,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+ QList<TreeModel_ItemBasePtr> anItems;
+
+ for (QModelIndexList::const_iterator anIndicesIt = theIndices.begin(); anIndicesIt != theIndices.end(); anIndicesIt++)
+ {
+ TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt);
+ if (!anItem || anItems.contains (anItem))
+ continue;
+ subItemsPresentations (anItem, thePresentations);
+ }
+}
+
+// =======================================================================
+// function : subItemPresentations
+// purpose :
+// =======================================================================
+void TreeModel_ModelBase::subItemsPresentations (const TreeModel_ItemBasePtr& theItem,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+ theItem->Presentations (thePresentations);
+
+ QList<TreeModel_ItemBasePtr> anItems;
+ for (int aRowId = 0; aRowId < theItem->rowCount(); aRowId++)
+ {
+ subItemsPresentations (theItem->Child (aRowId, theItem->Column()), thePresentations);
+ }
+}
+
// =======================================================================
// function : createRoot
// purpose :
myRootItems.insert (theColumnId, createRootItem (theColumnId));
}
+// =======================================================================
+// function : setHeaderItem
+// purpose :
+// =======================================================================
+void TreeModel_ModelBase::setHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection)
+{
+ if (theSection.IsEmpty())
+ {
+ // remove section
+ myHeaderValues.remove (theColumnId);
+ myRootItems.remove (theColumnId);
+ }
+
+ myHeaderValues[theColumnId] = theSection;
+ createRoot (theColumnId);
+}
+
// =======================================================================
// function : getIndexValue
// purpose :
//! \return the number of rows
Standard_EXPORT virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE;
- //! Returns whether the column is hidden by default
+ //! Returns header item, that can be modified
//! \param theColumnId a column index
- //! \return header section values container
- TreeModel_HeaderSection GetHeaderItem (const int theColumnId) const { return myHeaderValues[theColumnId]; }
-
- //! Sets header properties item.
- //! \param theColumnId a column index
- //! \param theSection a section value
- Standard_EXPORT void SetHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection);
+ //! \return header section value
+ TreeModel_HeaderSection* ChangeHeaderItem (const int theColumnId) { return &myHeaderValues[theColumnId]; }
//! Returns count of columns in the model
//! \param theParent an index of the parent item
//! \return model items from the list
Standard_EXPORT static QList<TreeModel_ItemBasePtr> SelectedItems (const QModelIndexList& theIndices);
+ //! Returns presentations of sub items
+ //! \param theIndices a container of selected indices
+ //! \thePresentations [out] container of presentations
+ Standard_EXPORT static void SubItemsPresentations (const QModelIndexList& theIndices,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
protected:
//! Creates root item
//! \param theColumnId index of a column
virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) = 0;
+ //! Sets header properties item.
+ //! \param theColumnId a column index
+ //! \param theSection a section value
+ Standard_EXPORT void setHeaderItem (const int theColumnId, const TreeModel_HeaderSection& theSection);
+
//! Converts the item shared pointer to void* type
//! \param theItem
//! \return an item pointer
Standard_EXPORT static void* getIndexValue (const TreeModel_ItemBasePtr& theItem);
+ //! Returns presentations of sub items. Recursive method to get presentations of all children
+ //! \param theItem an item to get own presentations and presentations of children
+ //! \thePresentations [out] container of presentations found
+ static void subItemsPresentations (const TreeModel_ItemBasePtr& theItem,
+ NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
private:
//! Creates root item
//! \param theColumnId index of a column
void TreeModel_Tools::SaveState (QTreeView* theTreeView, QMap<QString, QString>& theItems,
const QString& thePrefix)
{
- QStringList aColumnWidths, aHiddenColumns;
+ QStringList aColumnWidths;
for (int aColumnId = 0; aColumnId < theTreeView->model()->columnCount(); aColumnId++)
{
if (theTreeView->isColumnHidden (aColumnId))
{
- aHiddenColumns.append (QString::number (aColumnId));
aColumnWidths.append (QString());
}
else
aColumnWidths.append (QString::number (theTreeView->columnWidth (aColumnId)));
}
theItems[thePrefix + "columns_width"] = aColumnWidths.join (",");
- theItems[thePrefix + "columns_hidden"] = aHiddenColumns.join (",");
}
// =======================================================================
{
bool isOk;
int aWidth = aValues.at (aColumnId).toInt (&isOk);
- if (isOk && !theTreeView->isColumnHidden (aColumnId)) // do not resize hidden columnsa
+ if (isOk && !theTreeView->isColumnHidden (aColumnId)) // do not resize hidden columns
theTreeView->setColumnWidth (aColumnId, aWidth);
}
}
- else if (theKey == thePrefix + "columns_hidden")
- {
- int aColumnSize = theTreeView->model()->columnCount();
- QStringList aValues = theValue.split (",", QString::SkipEmptyParts);
- QList<int> aColumnIds;
- for (int aValueId = 0; aValueId < aValues.size(); aValueId++)
- {
- if (aValueId < aColumnSize)
- aColumnIds.append (aValues.at (aValueId).toInt());
- }
- for (int aColumnId = 0; aColumnId < aColumnSize; aColumnId++)
- {
- theTreeView->setColumnHidden (aColumnId, aColumnIds.contains(aColumnId) == true);
- }
- }
else
return false;
return true;
for (int aColumnId = 0, aNbColumns = aTreeModel->columnCount(); aColumnId < aNbColumns; aColumnId++)
{
- TreeModel_HeaderSection aSection = aTreeModel->GetHeaderItem (aColumnId);
- theTreeView->setColumnWidth (aColumnId, aSection.GetWidth());
- theTreeView->setColumnHidden (aColumnId, aSection.IsHidden());
+ TreeModel_HeaderSection* aSection = aTreeModel->ChangeHeaderItem (aColumnId);
+ theTreeView->setColumnWidth (aColumnId, aSection->GetWidth());
+ theTreeView->setColumnHidden (aColumnId, aSection->IsHidden());
}
}
aHeader->moveSection (TreeModel_ColumnType_Name, TreeModel_ColumnType_Visibility);
TreeModel_ModelBase* aModel = dynamic_cast<TreeModel_ModelBase*> (theTreeView->model());
- aModel->SetHeaderItem (TreeModel_ColumnType_Visibility,
- TreeModel_HeaderSection ("Visibility", TreeModel_ModelBase::ColumnVisibilityWidth()));
+ TreeModel_HeaderSection* anItem = aModel->ChangeHeaderItem ((int)TreeModel_ColumnType_Visibility);
+ anItem->SetIsHidden (theActive);
+ anItem->SetWidth (TreeModel_ModelBase::ColumnVisibilityWidth());
+
aModel->SetUseVisibilityColumn (theActive);
}
VInspector.qrc
-VInspectorAPI_CallBack.cxx
-VInspectorAPI_CallBack.hxx
-VInspector_CallBack.cxx
-VInspector_CallBack.hxx
-VInspector_CallBackMode.hxx
VInspector_Communicator.cxx
VInspector_Communicator.hxx
VInspector_ItemBase.cxx
VInspector_ItemContext.hxx
VInspector_ItemContextProperties.cxx
VInspector_ItemContextProperties.hxx
-VInspector_ItemHistoryElement.cxx
-VInspector_ItemHistoryElement.hxx
-VInspector_ItemHistoryRoot.cxx
-VInspector_ItemHistoryRoot.hxx
-VInspector_ItemHistoryType.cxx
-VInspector_ItemHistoryType.hxx
-VInspector_ItemHistoryTypeInfo.hxx
+VInspector_ItemGraphic3dCLight.cxx
+VInspector_ItemGraphic3dCLight.hxx
VInspector_ItemPresentableObject.cxx
VInspector_ItemPresentableObject.hxx
VInspector_ItemSelectMgrViewerSelector.cxx
VInspector_Tools.hxx
VInspector_ViewModel.cxx
VInspector_ViewModel.hxx
-VInspector_ViewModelHistory.cxx
-VInspector_ViewModelHistory.hxx
VInspector_Window.cxx
VInspector_Window.hxx
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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/VInspectorAPI_CallBack.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(VInspectorAPI_CallBack, Standard_Transient)
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-VInspectorAPI_CallBack::VInspectorAPI_CallBack()
-{
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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 VInspectorAPI_CallBack_H
-#define VInspectorAPI_CallBack_H
-
-#include <Standard.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Transient.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <TopoDS_Shape.hxx>
-
-class AIS_InteractiveObject;
-class SelectMgr_EntityOwner;
-
-//! \class VInspectorAPI_CallBack
-//! API of AIS_InteractiveContext methods to provide information about the actions
-class VInspectorAPI_CallBack : public Standard_Transient
-{
-
-public:
-
- //! Constructor
- Standard_EXPORT VInspectorAPI_CallBack();
-
- //! Destructor
- virtual ~VInspectorAPI_CallBack() {}
-
- //! Processing method of context
- virtual void Display(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void Redisplay(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void Remove(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void Load(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void ActivatedModes (Handle(AIS_InteractiveObject) thePrs, TColStd_ListOfInteger& theList) = 0;
-
- //! Processing method of context
- virtual void Activate(Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) = 0;
-
- //! Processing method of context
- virtual void Deactivate(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void Deactivate(Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) = 0;
-
- //! Processing method of context
- virtual void AddOrRemoveSelected (const TopoDS_Shape& theShape) = 0;
-
- //! Processing method of context
- virtual void AddOrRemoveSelected (Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) theOwner) = 0;
-
- //! Processing method of context
- virtual void ClearSelected() = 0;
-
- //! Processing method of context
- virtual void ClearSelected(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix) = 0;
-
- //! Processing method of context
- virtual void SetSelected(Handle(AIS_InteractiveObject) thePrs) = 0;
-
- //! Processing method of context
- virtual void Select() = 0;
-
- //! Processing method of context
- virtual void ShiftSelect() = 0;
-
- DEFINE_STANDARD_RTTIEXT(VInspectorAPI_CallBack, Standard_Transient)
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_CallBack.hxx>
-
-#include <AIS_InteractiveContext.hxx>
-#include <AIS_InteractiveObject.hxx>
-
-#include <SelectMgr_EntityOwner.hxx>
-
-#include <inspector/VInspector_CallBackMode.hxx>
-#include <inspector/VInspector_Tools.hxx>
-#include <inspector/VInspector_ViewModelHistory.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(VInspector_CallBack, VInspectorAPI_CallBack)
-
-// =======================================================================
-// function : Activate
-// purpose :
-// =======================================================================
-void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode)
-{
- if (!myHistoryModel)
- return;
-
- QList<QVariant> anInfo;
- if (!thePrs.IsNull())
- anInfo = VInspector_Tools::GetInfo (thePrs);
- else
- {
- anInfo.append ("Activate");
- anInfo.append ("");
- anInfo.append ("");
- }
- anInfo[0] = QString ("%1: %2").arg (anInfo[0].toString()).arg (theMode);
- myHistoryModel->AddElement (VInspector_CallBackMode_Activate, anInfo);
-}
-
-// =======================================================================
-// function : AddOrRemoveSelected
-// purpose :
-// =======================================================================
-void VInspector_CallBack::AddOrRemoveSelected (const TopoDS_Shape& theShape)
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- aValues.append (""); // Name
- aValues.append (""); // Pointer
- aValues.append (VInspector_Tools::GetShapeTypeInfo (theShape.ShapeType()).ToCString()); // Shape Type
- aValues.append (VInspector_Tools::GetSelectedInfoPointers (myContext)); // SelectionInfo
- myHistoryModel->AddElement (VInspector_CallBackMode_AddOrRemoveSelectedShape, aValues);
-}
-
-// =======================================================================
-// function : AddOrRemoveSelected
-// purpose :
-// =======================================================================
-void VInspector_CallBack::AddOrRemoveSelected (Handle(AIS_InteractiveObject) thePrs)
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues = VInspector_Tools::GetInfo (thePrs);
- aValues.append (VInspector_Tools::GetSelectedInfoPointers (myContext)); // SelectionInfo
- myHistoryModel->AddElement (VInspector_CallBackMode_AddOrRemoveSelected, aValues);
-}
-
-// =======================================================================
-// function : AddOrRemoveSelected
-// purpose :
-// =======================================================================
-void VInspector_CallBack::AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) theOwner)
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- aValues.append (""); // Name
- aValues.append (Standard_Dump::GetPointerInfo (theOwner, true).ToCString()); // Pointer
- aValues.append (""); // Shape type
- aValues.append (VInspector_Tools::GetSelectedInfoPointers (myContext)); // SelectionInfo
-
- myHistoryModel->AddElement (VInspector_CallBackMode_AddOrRemoveSelectedOwner, aValues);
-}
-
-// =======================================================================
-// function : ClearSelected
-// purpose :
-// =======================================================================
-void VInspector_CallBack::ClearSelected()
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, aValues);
-}
-
-// =======================================================================
-// function : MoveTo
-// purpose :
-// =======================================================================
-void VInspector_CallBack::MoveTo (const Standard_Integer/* theXPix*/, const Standard_Integer/* theYPix*/)
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- aValues = VInspector_Tools::GetHighlightInfo (myContext);
- myHistoryModel->AddElement (VInspector_CallBackMode_MoveTo, aValues);
-}
-
-// =======================================================================
-// function : Select
-// purpose :
-// =======================================================================
-void VInspector_CallBack::Select()
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- aValues = VInspector_Tools::GetSelectedInfo (myContext);
- myHistoryModel->AddElement (VInspector_CallBackMode_Select, aValues);
-}
-
-// =======================================================================
-// function : ShiftSelect
-// purpose :
-// =======================================================================
-void VInspector_CallBack::ShiftSelect()
-{
- if (!myHistoryModel)
- return;
- QList<QVariant> aValues;
- aValues = VInspector_Tools::GetSelectedInfo (myContext);
- myHistoryModel->AddElement (VInspector_CallBackMode_ShiftSelect, aValues);
-}
-
-// =======================================================================
-// function : GetInfo
-// purpose :
-// =======================================================================
-QString VInspector_CallBack::GetInfo (const VInspector_CallBackMode& theMode)
-{
- switch (theMode)
- {
- case VInspector_CallBackMode_None: return "None";
- case VInspector_CallBackMode_Display: return "Display";
- case VInspector_CallBackMode_Redisplay: return "Redisplay";
- case VInspector_CallBackMode_Remove: return "Remove";
- case VInspector_CallBackMode_Load: return "Load";
- case VInspector_CallBackMode_ActivatedModes: return "ActivatedModes";
- case VInspector_CallBackMode_Activate: return "Activate";
- case VInspector_CallBackMode_Deactivate: return "Deactivate";
- case VInspector_CallBackMode_AddOrRemoveSelectedShape: return "AddOrRemoveSelectedShape";
- case VInspector_CallBackMode_AddOrRemoveSelected: return "AddOrRemoveSelected";
- case VInspector_CallBackMode_AddOrRemoveSelectedOwner: return "AddOrRemoveSelectedOwner";
- case VInspector_CallBackMode_ClearSelected: return "ClearSelected";
- case VInspector_CallBackMode_MoveTo: return "MoveTo";
- case VInspector_CallBackMode_SetSelected: return "SetSelected";
- case VInspector_CallBackMode_Select: return "Select";
- case VInspector_CallBackMode_ShiftSelect: return "ShiftSelect";
- default: break;
- }
- return QString();
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_CallBack_H
-#define VInspector_CallBack_H
-
-#include <AIS_InteractiveContext.hxx>
-#include <Standard.hxx>
-#include <inspector/VInspectorAPI_CallBack.hxx>
-#include <inspector/VInspector_CallBackMode.hxx>
-#include <inspector/VInspector_ViewModelHistory.hxx>
-#include <inspector/VInspector_Tools.hxx>
-
-class AIS_InteractiveObject;
-class SelectMgr_EntityOwner;
-
-//! \class VInspector_CallBack
-//! Updates inspector state on actions in context
-class VInspector_CallBack : public VInspectorAPI_CallBack
-{
-public:
-
- //! Constructor
- VInspector_CallBack() : VInspectorAPI_CallBack() {}
-
- //! Destructor
- virtual ~VInspector_CallBack() {}
-
- //! Appends displayed presentation into history model
- //! \param thePrs the presentation
- virtual void Display (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Display, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends redisplayed presentation into history model
- //! \param thePrs the presentation
- virtual void Redisplay (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Redisplay, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends removed presentation into history model
- //! \param thePrs the presentation
- virtual void Remove (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Remove, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends loaded presentation into history model
- //! \param thePrs the presentation
- virtual void Load (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Load, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends information about modes activation
- //! \param thePrs the presentation
- //! \param theModes the selection modes
- virtual void ActivatedModes (Handle(AIS_InteractiveObject) thePrs, TColStd_ListOfInteger& theModes) Standard_OVERRIDE
- { (void)thePrs; (void)theModes; }
-
- //! Appends information about mode activation
- //! \param thePrs the presentation
- //! \param theModes the selection mode
- Standard_EXPORT virtual void Activate (Handle(AIS_InteractiveObject) thePrs,
- const Standard_Integer theMode) Standard_OVERRIDE;
-
- //! Appends information about modes deactivation
- //! \param thePrs the presentation
- virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends information about modes deactivation
- //! \param thePrs the presentation
- //! \param theMode the selection mode
- virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) Standard_OVERRIDE
- { (void)theMode;
- if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends information about selection change
- //! \param theShape the selected shape
- Standard_EXPORT virtual void AddOrRemoveSelected (const TopoDS_Shape& theShape) Standard_OVERRIDE;
-
- //! Appends information about selection change
- //! \param thePrs the selected presentation
- Standard_EXPORT virtual void AddOrRemoveSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE;
-
- //! Appends information about selection change
- //! \param theOwner the selected owner
- Standard_EXPORT virtual void AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) theOwner) Standard_OVERRIDE;
-
- //! Appends information about selection clear
- Standard_EXPORT virtual void ClearSelected() Standard_OVERRIDE;
-
- //! Appends information about selection clear
- //! \param thePrs the selected presentation
- virtual void ClearSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends information about moving to point
- //! \param theXPix a pixels on horizontal
- //! \param theYPix a pixels on vertical
- Standard_EXPORT virtual void MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix) Standard_OVERRIDE;
-
- //! Appends information about setting selection
- //! \param thePrs the selected presentation
- virtual void SetSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE
- { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_SetSelected, VInspector_Tools::GetInfo (thePrs)); }
-
- //! Appends information about select
- Standard_EXPORT virtual void Select() Standard_OVERRIDE;
-
- //! Appends information about shift select
- Standard_EXPORT virtual void ShiftSelect() Standard_OVERRIDE;
-
- //! Sets history model, it will be filled by actions in context
- //! \param theHistoryModel the view model
- void SetHistoryModel (VInspector_ViewModelHistory* theHistoryModel) { myHistoryModel = theHistoryModel; }
-
- //! Sets context, where actions happen
- //! \param theContext a context instance
- void SetContext (const Handle(AIS_InteractiveContext)& theContext) { myContext = theContext; }
- DEFINE_STANDARD_RTTIEXT(VInspector_CallBack, VInspectorAPI_CallBack)
-
- //! Returns string information of call back mode
- //! \param theMode type of AIS action
- //! \return information text
- static QString GetInfo (const VInspector_CallBackMode& theMode);
-
-private:
- VInspector_ViewModelHistory* myHistoryModel; //!< the current history model, fulfilled by context actions
- Handle(AIS_InteractiveContext) myContext; //!< the listened context
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_CallBackMode_H
-#define VInspector_CallBackMode_H
-
-//! History context modes corresponding to actions in AIS_InteractiveContext
-enum VInspector_CallBackMode
-{
- VInspector_CallBackMode_None, //!< undefined
- VInspector_CallBackMode_Display, //!< Display
- VInspector_CallBackMode_Redisplay, //!< Redisplay
- VInspector_CallBackMode_Remove, //!< Remove
- VInspector_CallBackMode_Load, //!< Load
- VInspector_CallBackMode_ActivatedModes, //!< ActivatedModes
- VInspector_CallBackMode_Activate, //!< Activate
- VInspector_CallBackMode_Deactivate, //!< Deactivate
- VInspector_CallBackMode_AddOrRemoveSelectedShape, //!< AddOrRemoveSelectedShape for TopoDS_Shape
- VInspector_CallBackMode_AddOrRemoveSelected, //!< AddOrRemoveSelectedShape for Presentation
- VInspector_CallBackMode_AddOrRemoveSelectedOwner, //!< AddOrRemoveSelectedShape for Owner
- VInspector_CallBackMode_ClearSelected, //!< ClearSelected
- VInspector_CallBackMode_MoveTo, //!< MoveTo
- VInspector_CallBackMode_SetSelected, //!< SetSelected
- VInspector_CallBackMode_Select, //!< Select
- VInspector_CallBackMode_ShiftSelect //!< ShiftSelect
-};
-
-#endif
#include <inspector/VInspector_Communicator.hxx>
-#include <inspector/VInspector_CallBack.hxx>
#include <inspector/VInspector_Window.hxx>
#include <AIS_InteractiveContext.hxx>
case 3: return Standard_Dump::GetPointerInfo (Object(), true).ToCString();
}
- return QVariant();
+ return TreeModel_ItemBase::initValue (theItemRole);
}
// =======================================================================
//! \return the value
Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
- //! Returns presentation of the attribute to be visualized in the view
- //! \thePresentations [out] container of presentation handles to be visualized
- virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations)
- { (void)thePresentations; }
-
//! Returns transform persistent of the item or NULL
Handle(Graphic3d_TransformPers) TransformPersistence() const { return myTransformPersistence; }
#include <inspector/VInspector_ItemContextProperties.hxx>
#include <inspector/VInspector_ItemContext.hxx>
+#include <inspector/VInspector_ItemGraphic3dCLight.hxx>
#include <inspector/VInspector_ItemV3dViewer.hxx>
#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
+#include <V3d_View.hxx>
+#include <V3d_Viewer.hxx>
+
// =======================================================================
// function : initValue
// purpose :
// =======================================================================
int VInspector_ItemContextProperties::initRowCount() const
{
- return 2; // V3d_Viewer, SelectMgr_ViewerSelector
+ int aLightsCount = 0;
+
+ VInspector_ItemContextPtr aParentContextItem = itemDynamicCast<VInspector_ItemContext>(Parent());
+ if (aParentContextItem)
+ {
+ Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext();
+ Handle(V3d_Viewer) aViewer = aContext->CurrentViewer();
+ if (!aViewer.IsNull())
+ {
+ if (!aViewer->ActiveViews().IsEmpty())
+ {
+ Handle(V3d_View) aView = aViewer->ActiveViews().First();
+ if (!aView.IsNull())
+ aLightsCount = aView->ActiveLights().Extent();
+ }
+ }
+ }
+ return 2 + aLightsCount; // V3d_Viewer, SelectMgr_ViewerSelector
}
// =======================================================================
{
if (theRow == 0)
return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn);
-
- return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn);
+ else if (theRow == 1)
+ return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn);
+ else // lights
+ {
+ return VInspector_ItemGraphic3dCLight::CreateItem (currentItem(), theRow, theColumn);
+ }
}
// =======================================================================
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemGraphic3dCLight.hxx>
+
+#include <AIS.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <inspector/VInspector_ItemContext.hxx>
+#include <inspector/VInspector_ItemContextProperties.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+
+#include <V3d_View.hxx>
+#include <V3d_Viewer.hxx>
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemGraphic3dCLight::initRowCount() const
+{
+ return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemGraphic3dCLight::initValue (const int theItemRole) const
+{
+ QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+ if (aParentValue.isValid())
+ return aParentValue;
+
+ if (theItemRole == Qt::ForegroundRole)
+ {
+ if (GetLight().IsNull())
+ return QVariant();
+
+ if (!GetLight()->IsEnabled())
+ return QColor(Qt::darkGray);
+
+ return QVariant();
+ }
+
+ if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+ return QVariant();
+
+ if (GetLight().IsNull())
+ return Column() == 0 ? "Empty light" : "";
+
+ if (Column() != 0)
+ return QVariant();
+
+ switch (GetLight()->Type())
+ {
+ case Graphic3d_TOLS_AMBIENT: return "Ambient light";
+ case Graphic3d_TOLS_DIRECTIONAL: return "Directional light";
+ case Graphic3d_TOLS_POSITIONAL: return "Positional light";
+ case Graphic3d_TOLS_SPOT: return "Spot light";
+ default: break;
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCLight::Init()
+{
+ VInspector_ItemContextPropertiesPtr aParentItem = itemDynamicCast<VInspector_ItemContextProperties>(Parent());
+ Handle(Graphic3d_CLight) aLight;
+ if (aParentItem)
+ {
+ VInspector_ItemContextPtr aParentContextItem = itemDynamicCast<VInspector_ItemContext>(aParentItem->Parent());
+ if (aParentContextItem)
+ {
+ Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext();
+ Handle(V3d_Viewer) aViewer = aContext->CurrentViewer();
+ if (!aViewer.IsNull())
+ {
+ int aLightId = Row() - 2 /*in parent*/;
+ int aCurrentId = 0;
+ for (V3d_ListOfLightIterator aLightsIt (aViewer->ActiveLightIterator()); aLightsIt.More(); aLightsIt.Next(), aCurrentId++)
+ {
+ if (aCurrentId != aLightId)
+ continue;
+ aLight = aLightsIt.Value();
+ }
+ }
+ }
+ }
+ myLight = aLight;
+ TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCLight::Reset()
+{
+ VInspector_ItemBase::Reset();
+
+ myLight = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCLight::StoreItemProperties (const int theRow, const int theColumn, const QVariant& theValue)
+{
+ if (myLight.IsNull())
+ return;
+
+ const Handle(TreeModel_ItemProperties)& aProperties = Properties();
+ if (theRow == -1 && theColumn == -1) // processing sub-item value
+ {
+ Standard_SStream aStream;
+ aStream << theValue.toString().toStdString().c_str();
+
+ int aStartPos = 1;
+ Quantity_ColorRGBA aColor;
+ if (aColor.InitFromJson (aStream, aStartPos))
+ {
+ myLight->SetColor (aColor.GetRGB());
+ return;
+ }
+
+ // "Direction"
+ gp_Dir aDir;
+ if (aDir.InitFromJson (aStream, aStartPos))
+ {
+ myLight->SetDirection (aDir);
+ return;
+ }
+
+ // "Position"
+ gp_Pnt aPnt;
+ if (aPnt.InitFromJson (aStream, aStartPos))
+ {
+ myLight->SetPosition (aPnt);
+ return;
+ }
+ }
+
+ QString aPropertyName = aProperties->Data(theRow, 0).toString();
+ QVariant aPropertyValue = aProperties->Data(theRow, 1);
+ if (aPropertyName == "Position")
+ {
+ }
+ else if (aPropertyName == "Intensity")
+ {
+ myLight->SetIntensity ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else if (aPropertyName == "ConstAttenuation")
+ {
+ myLight->SetAttenuation ((Standard_ShortReal)aPropertyValue.toReal(),
+ (Standard_ShortReal)aProperties->Data(theRow + 1, 1).toReal());
+ }
+ else if (aPropertyName == "LinearAttenuation")
+ {
+ myLight->SetAttenuation ((Standard_ShortReal)aProperties->Data(theRow - 1, 1).toReal(),
+ (Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else if (aPropertyName == "Angle")
+ {
+ myLight->SetAngle ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else if (aPropertyName == "Concentration")
+ {
+ myLight->SetConcentration ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else if (aPropertyName == "Range")
+ {
+ myLight->SetRange ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else if (aPropertyName == "Smoothness")
+ {
+ if (myLight->Type() == Graphic3d_TOLS_DIRECTIONAL)
+ {
+ myLight->SetSmoothAngle ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ else
+ {
+ myLight->SetSmoothRadius ((Standard_ShortReal)aPropertyValue.toReal());
+ }
+ }
+ else if (aPropertyName == "IsHeadlight")
+ {
+ myLight->SetHeadlight (aPropertyValue.toInt() == 1);
+ }
+ else if (aPropertyName == "IsEnabled")
+ {
+ myLight->SetEnabled (aPropertyValue.toInt() == 1);
+ }
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCLight::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<VInspector_ItemGraphic3dCLight*>(this)->Init();
+}
+
+// =======================================================================
+// function : initStream
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dCLight::initStream (Standard_OStream& theOStream) const
+{
+ Handle(Graphic3d_CLight) aLight = GetLight();
+ if (aLight.IsNull())
+ return;
+
+ aLight->DumpJson (theOStream);
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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_ItemGraphic3dCLight_H
+#define VInspector_ItemGraphic3dCLight_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <Graphic3d_CLight.hxx>
+
+class VInspector_ItemGraphic3dCLight;
+typedef QExplicitlySharedDataPointer<VInspector_ItemGraphic3dCLight> VInspector_ItemGraphic3dCLightPtr;
+
+//! \class VInspector_ItemGraphic3dCLight
+//! Parent item is context properties, that corresponds to AIS_InteractiveContext
+class VInspector_ItemGraphic3dCLight : public VInspector_ItemBase
+{
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ static VInspector_ItemGraphic3dCLightPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return VInspector_ItemGraphic3dCLightPtr (new VInspector_ItemGraphic3dCLight (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~VInspector_ItemGraphic3dCLight() Standard_OVERRIDE {};
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Returns data object of the item.
+ //! \return object
+ virtual const Handle(Standard_Transient)& Object() const { initItem(); return myLight; }
+
+ //! Returns the current light, init item if it was not initialized yet
+ //! \return interactive object
+ Handle(Graphic3d_CLight) GetLight() const { return Handle(Graphic3d_CLight)::DownCast (Object()); }
+
+ //! Updates item by the item properties value
+ virtual void StoreItemProperties (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+protected:
+ //! Initializes the current item. It is empty because Reset() is also empty.
+ 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;
+
+ //! Returns stream value of the item to fulfill property panel.
+ //! \return stream value or dummy
+ Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const 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_ItemGraphic3dCLight(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+protected:
+
+ Handle(Graphic3d_CLight) myLight; //!< the current light
+};
+
+#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryElement.hxx>
-
-#include <inspector/VInspector_ItemHistoryRoot.hxx>
-#include <inspector/VInspector_ItemHistoryType.hxx>
-#include <inspector/VInspector_ItemHistoryElement.hxx>
-#include <inspector/VInspector_Tools.hxx>
-
-// =======================================================================
-// function : data
-// purpose :
-// =======================================================================
-QVariant VInspector_ItemHistoryElement::initValue(const int theRole) const
-{
- QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
- if (aParentValue.isValid())
- return aParentValue;
-
- if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
- return QVariant();
-
- switch (Column())
- {
- case 0: return getName();
- case 2: return QVariant();
- case 3: return GetPointerInfo();
- case 4: return GetShapeTypeInfo();
- default: break;
- }
- return QVariant();
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-void VInspector_ItemHistoryElement::Init()
-{
- VInspector_ItemHistoryTypePtr aParentItem = itemDynamicCast<VInspector_ItemHistoryType>(Parent());
- VInspector_ItemHistoryRootPtr aRootItem = itemDynamicCast<VInspector_ItemHistoryRoot>(aParentItem->Parent());
-
- const VInspector_ItemHistoryTypeInfo& aTypeInfo = aRootItem->GetTypeInfo (aParentItem->Row());
- QList<QList<QVariant>> anElements = aTypeInfo.myElements;
-
- int aRowId = Row();
- QList<QVariant> anInfo = anElements.at(aRowId);
- int anInfoSize = anInfo.size();
-
- myName = anInfoSize > 0 ? anInfo[0].toString() : QString ("Element: %1").arg (aRowId);
- myPointerInfo = anInfoSize > 1 ? anInfo[1].toString() : QString();
- myShapeTypeInfo = anInfoSize > 2 ? anInfo[2].toString() : QString();
-
- TreeModel_ItemBase::Init();
-}
-
-// =======================================================================
-// function : initItem
-// purpose :
-// =======================================================================
-void VInspector_ItemHistoryElement::initItem() const
-{
- if (IsInitialized())
- return;
- const_cast<VInspector_ItemHistoryElement*>(this)->Init();
- // an empty method to don't initialize the main label, as it was not cleared in Reset()
-}
-
-// =======================================================================
-// function : getName
-// purpose :
-// =======================================================================
-QString VInspector_ItemHistoryElement::getName() const
-{
- initItem();
- return myName;
-}
-
-// =======================================================================
-// function : GetPointerInfo
-// purpose :
-// =======================================================================
-QString VInspector_ItemHistoryElement::GetPointerInfo() const
-{
- initItem();
- return myPointerInfo;
-}
-
-// =======================================================================
-// function : GetShapeTypeInfo
-// purpose :
-// =======================================================================
-QString VInspector_ItemHistoryElement::GetShapeTypeInfo() const
-{
- initItem();
- return myShapeTypeInfo;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryElement_H
-#define VInspector_ItemHistoryElement_H
-
-#include <Standard.hxx>
-#include <inspector/VInspector_ItemBase.hxx>
-
-class VInspector_ItemHistoryElement;
-typedef QExplicitlySharedDataPointer<VInspector_ItemHistoryElement> VInspector_ItemHistoryElementPtr;
-
-//! \class VInspector_ItemHistoryElement
-//! Item shows name, pointer and shape type values of item history type information
-//! Parent is item history type, there are no children.
-class VInspector_ItemHistoryElement : public VInspector_ItemBase
-{
-
-public:
-
- //! Creates an item wrapped by a shared pointer
- static VInspector_ItemHistoryElementPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
- { return VInspector_ItemHistoryElementPtr (new VInspector_ItemHistoryElement (theParent, theRow, theColumn)); }
-
- //! Destructor
- virtual ~VInspector_ItemHistoryElement() {}
-
- //! Inits the item, fills internal containers
- Standard_EXPORT virtual void Init() Standard_OVERRIDE;
-
- //! Resets cached values
- virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); }
-
- //! Returns pointer string value
- QString PointerInfo() const { return myPointerInfo; }
-
- //! \return number of children.
- 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;
-
-protected:
-
- //! Initialize the current item. It is empty because Reset() is also empty.
- virtual void initItem() 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
- virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE
- { (void)theRow; (void)theColumn; return TreeModel_ItemBasePtr(); }
-
- //! Returns the item text value, initialize item if it has not been initialized yet
- QString getName() const;
-
- //! Returns the item pointer value, initialize item if it has not been initialized yet
- QString GetPointerInfo() const;
-
- //! Returns the shape type text value, initialize item if it has not been initialized yet
- QString GetShapeTypeInfo() const;
-
-private:
-
- //! Constructor
- //! \param theParent a parent item
- VInspector_ItemHistoryElement(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
- : VInspector_ItemBase(theParent, theRow, theColumn) {}
-
-private:
-
- QString myName; //!< cached text value
- QString myPointerInfo; //!< cached pointer text value
- QString myShapeTypeInfo; //!<cached shape type text value
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryRoot.hxx>
-
-#include <inspector/VInspector_ItemHistoryType.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-VInspector_ItemHistoryRoot::VInspector_ItemHistoryRoot(TreeModel_ItemBasePtr theParent,
- const int theRow, const int theColumn)
-: VInspector_ItemBase (theParent, theRow, theColumn), myFirstIndex (0), myLastIndex (0), myInfoMaxSize (10)
-{
-}
-
-// =======================================================================
-// function : AddElement
-// purpose :
-// =======================================================================
-void VInspector_ItemHistoryRoot::AddElement (const VInspector_CallBackMode& theMode, const QList<QVariant>& theInfo)
-{
- if (!myLastIndex)
- {
- myInfoMap[myLastIndex] = VInspector_ItemHistoryTypeInfo(theMode, theInfo);
- myLastIndex++;
- }
- else
- {
- if (myInfoMap[myLastIndex].myMode == theMode)
- myInfoMap[myLastIndex].AddElement(theInfo);
- else
- {
- myLastIndex++;
- myInfoMap[myLastIndex] = VInspector_ItemHistoryTypeInfo(theMode, theInfo);
- }
- }
-
- // clear cache
- if (myInfoMap.size() >= myInfoMaxSize)
- {
- myInfoMap.remove (myFirstIndex);
- myFirstIndex++;
- }
-}
-
-// =======================================================================
-// function : GetTypeInfo
-// purpose :
-// =======================================================================
-const VInspector_ItemHistoryTypeInfo& VInspector_ItemHistoryRoot::GetTypeInfo (const int theChildRowIndex)
-{
- int anInfoMapIndex = theChildRowIndex + myFirstIndex;
-
- bool aReversed = true;
- if (aReversed)
- anInfoMapIndex = (myInfoMap.size() - myFirstIndex) - 1 - anInfoMapIndex;
-
- return myInfoMap[anInfoMapIndex];
-}
-
-// =======================================================================
-// function : initValue
-// purpose :
-// =======================================================================
-QVariant VInspector_ItemHistoryRoot::initValue (const int theRole) const
-{
- QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
- if (aParentValue.isValid())
- return aParentValue;
-
- if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
- return QVariant();
-
- switch (Column())
- {
- case 0: return "History";
- case 2: return theRole == Qt::ToolTipRole ? QVariant ("Count of children") : QVariant (rowCount());
- default:
- break;
- }
- return QVariant();
-}
-
-// =======================================================================
-// function : createChild
-// purpose :
-// =======================================================================
-TreeModel_ItemBasePtr VInspector_ItemHistoryRoot::createChild (int theRow, int theColumn)
-{
- return VInspector_ItemHistoryType::CreateItem (currentItem(), theRow, theColumn);
-}
-
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryRoot_H
-#define VInspector_ItemHistoryRoot_H
-
-#include <Standard.hxx>
-#include <inspector/VInspector_ItemBase.hxx>
-#include <inspector/VInspector_ItemHistoryTypeInfo.hxx>
-#include <inspector/VInspector_CallBackMode.hxx>
-
-class VInspector_ItemHistoryRoot;
-typedef QExplicitlySharedDataPointer<VInspector_ItemHistoryRoot> VInspector_ItemHistoryRootPtr;
-
-//! \class VInspector_ItemHistoryRoot
-//! Item in history tree model. Has container of VInspector_ItemHistoryTypeInfo. Each element is a child item.
-//! Parent item is NULL, children are ItemHistoryType items
-class VInspector_ItemHistoryRoot : public VInspector_ItemBase
-{
-
-public:
-
- //! Creates an item wrapped by a shared pointer
- static VInspector_ItemHistoryRootPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
- { return VInspector_ItemHistoryRootPtr (new VInspector_ItemHistoryRoot (theParent, theRow, theColumn)); }
-
- //! Destructor
- virtual ~VInspector_ItemHistoryRoot() {}
-
- //! Sets maximum count of history elements in internal container.
- //! \param theSize a size value
- void SetHistoryTypesMaxAmount (const int theSize) { myInfoMaxSize = theSize; }
-
- //! Appends new history element into internal container. If the container already has maximum number
- //! of values, the first container is removed.
- //! \param theMode a type of the element
- //! \param theInfo a history information element
- Standard_EXPORT void AddElement (const VInspector_CallBackMode& theMode, const QList<QVariant>& theInfo);
-
- //! Returns history item information for the child item
- //! \param theChildRowIndex a child index
- Standard_EXPORT const VInspector_ItemHistoryTypeInfo& GetTypeInfo (const int theChildRowIndex);
-
-protected:
-
- //! Return data value for the role. It should be reimplemented in child
- //! \param theRole a value role
- //! \return the value
- virtual QVariant initValue(const int theRole) const;
-
- //! \return number of children. It should be reimplemented in child
- virtual int initRowCount() const Standard_OVERRIDE { return myInfoMap.size(); }
-
- //! 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
- VInspector_ItemHistoryRoot(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn);
-
-private:
-
- QMap<int, VInspector_ItemHistoryTypeInfo> myInfoMap; //!< container of whole callback info, bounded by maximum size value
- int myFirstIndex; //!< the first index in the information map, the first index is incremented if max value of container is achieved
- int myLastIndex; //!< the last index in the information map, is incremented when new element is added
- int myInfoMaxSize; //!< maximum number of elements in information map
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryType.hxx>
-
-#include <inspector/VInspector_CallBack.hxx>
-#include <inspector/VInspector_ItemHistoryRoot.hxx>
-#include <inspector/VInspector_ItemHistoryElement.hxx>
-#include <inspector/VInspector_Tools.hxx>
-
-// =======================================================================
-// function : PointerInfo
-// purpose :
-// =======================================================================
-QString VInspector_ItemHistoryType::PointerInfo() const
-{
- if (rowCount() <= 0)
- return QString();
-
- VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
- const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
- if (aTypeInfo.myElements.size() < rowCount())
- return QString();
- QList<QVariant> anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item
- return anElements.size() > 1 ? anElements[1].toString() : QString();
-}
-
-// =======================================================================
-// function : PointerInfo
-// purpose :
-// =======================================================================
-QString VInspector_ItemHistoryType::OwnerInfo() const
-{
- if (rowCount() <= 0)
- return QString();
-
- VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
- const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
- if ( aTypeInfo.myElements.size() < rowCount())
- return QString();
- QList<QVariant> anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item
- return anElements.size() > 3 ? anElements[3].toString() : QString();
-}
-
-// =======================================================================
-// function : data
-// purpose :
-// =======================================================================
-QVariant VInspector_ItemHistoryType::initValue(const int theRole) const
-{
- QVariant aParentValue = VInspector_ItemBase::initValue (theRole);
- if (aParentValue.isValid())
- return aParentValue;
-
- if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole)
- return QVariant();
-
- VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
- const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
- int aRowCount = rowCount();
- if (aRowCount <= 0 || aTypeInfo.myElements.size() < aRowCount)
- return QVariant();
-
- QList<QVariant> anElements = rowCount() > 0 ? aTypeInfo.myElements[rowCount() - 1] : QList<QVariant>(); // the last item
- int anInfoSize = anElements.size();
- switch (Column())
- {
- case 0: return VInspector_CallBack::GetInfo(aTypeInfo.myMode);
- case 3: return rowCount();
- case 4: return anInfoSize > 1 ? anElements[1].toString() : QVariant(); // pointer info
- case 5: return anInfoSize > 2 ? anElements[2].toString() : QVariant(); // shape type
- case 6: return anInfoSize > 0 ? anElements[0].toString() : QVariant(); // AIS name
- case 7: return anInfoSize > 3 ? anElements[3].toString() : QVariant(); // owner info
- default: break;
- }
- return QVariant();
-}
-
-// =======================================================================
-// function : rowCount
-// purpose :
-// =======================================================================
-int VInspector_ItemHistoryType::initRowCount() const
-{
- VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast<VInspector_ItemHistoryRoot>(Parent());
- const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row());
- return aTypeInfo.myElements.size();
-}
-
-// =======================================================================
-// function : createChild
-// purpose :
-// =======================================================================
-TreeModel_ItemBasePtr VInspector_ItemHistoryType::createChild (int theRow, int theColumn)
-{
- return VInspector_ItemHistoryElement::CreateItem (currentItem(), theRow, theColumn);
-}
-
-// =======================================================================
-// function : initItem
-// purpose :
-// =======================================================================
-void VInspector_ItemHistoryType::initItem() const
-{
- if (IsInitialized())
- return;
- const_cast<VInspector_ItemHistoryType*>(this)->Init();
- // an empty method to don't initialize the main label, as it was not cleared in Reset()
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryType_H
-#define VInspector_ItemHistoryType_H
-
-#include <Standard.hxx>
-#include <inspector/VInspector_ItemBase.hxx>
-
-class VInspector_ItemHistoryType;
-typedef QExplicitlySharedDataPointer<VInspector_ItemHistoryType> VInspector_ItemHistoryTypePtr;
-
-//! \class VInspector_ItemHistoryType
-//! Item to show history type. Also it shows the element information of the first sub-item
-//! Parent is item history root item, children are item history elements
-class VInspector_ItemHistoryType : public VInspector_ItemBase
-{
-
-public:
-
- //! Creates an item wrapped by a shared pointer
- static VInspector_ItemHistoryTypePtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
- { return VInspector_ItemHistoryTypePtr (new VInspector_ItemHistoryType (theParent, theRow, theColumn)); }
-
- //! Destructor
- virtual ~VInspector_ItemHistoryType() {}
-
- //! Returns the pointer info of the first child item, initialize item if it has not been initialized yet.
- Standard_EXPORT QString PointerInfo() const;
-
- //! Returns the owner info of the first child item, initialize item if it has not been initialized yet.
- Standard_EXPORT QString OwnerInfo() const;
-
-protected:
-
- //! Return data value for the role.
- //! \param theRole a value role
- //! \return the value
- virtual QVariant initValue(const int theRole) const;
-
- //! \return number of children.
- virtual int initRowCount() const Standard_OVERRIDE;
-
- //! Initialize the current item. It is empty because Reset() is also empty.
- 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
- VInspector_ItemHistoryType(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
- : VInspector_ItemBase(theParent, theRow, theColumn) {}
-
-};
-
-#endif
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ItemHistoryTypeInfo_H
-#define VInspector_ItemHistoryTypeInfo_H
-
-#include <inspector/VInspector_CallBackMode.hxx>
-
-//! \class VInspector_ItemHistoryTypeInfo
-//! History info for a type item. It contains container of information for the element
-struct VInspector_ItemHistoryTypeInfo
-{
-
- //! Constructor
- VInspector_ItemHistoryTypeInfo() : myMode(VInspector_CallBackMode_None) {}
-
- //! Destructor
- VInspector_ItemHistoryTypeInfo (const VInspector_CallBackMode& theMode, const QList<QVariant>& theInfo)
- : myMode(theMode) { AddElement(theInfo); }
-
- //! Append new element
- //! \param theInfo an information element
- void AddElement (const QList<QVariant>& theInfo) { myElements.append (theInfo); }
-
- VInspector_CallBackMode myMode; //!< history element mode
- QList<QList<QVariant>> myElements; //!< container of elements information
-};
-
-#endif
//! Returns presentation of the attribute to be visualized in the view
//! \thePresentations [out] container of presentation handles to be visualized
- Standard_EXPORT virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations);
+ Standard_EXPORT virtual void Presentations (NCollection_List<Handle(Standard_Transient)>& thePresentations) Standard_OVERRIDE;
protected:
#include <TopLoc_Location.hxx>
#include <TopoDS_Shape.hxx>
-#include <inspector/VInspector_CallBackMode.hxx>
#include <inspector/View_DisplayActionType.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
{
TreeModel_ModelBase::InitColumns();
- SetHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
- SetHeaderItem (4, TreeModel_HeaderSection ("SelectedOwners", -1));
+ setHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
+ setHeaderItem (4, TreeModel_HeaderSection ("SelectedOwners", -1));
}
// =======================================================================
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ViewModelHistory.hxx>
-
-#include <inspector/VInspector_ItemHistoryElement.hxx>
-#include <inspector/VInspector_ItemHistoryRoot.hxx>
-#include <inspector/VInspector_ItemHistoryType.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QStringList>
-#include <Standard_WarningsRestore.hxx>
-
-const int COLUMN_NAME_WIDTH = 230;
-const int COLUMN_SIZE_WIDTH = 30;
-const int COLUMN_POINTER_WIDTH = 70;
-const int COLUMN_SHAPE_TYPE_WIDTH = 75;
-const int COLUMN_AIS_NAME_WIDTH = 75;
-const int COLUMN_SELECTED_WIDTH = 75;
-
-const int COLUMN_5_WIDTH = 120;
-const int COLUMN_6_WIDTH = 65;
-const int COLUMN_7_WIDTH = 70;
-
-const int HISTORY_AIS_NAME_COLUMN_WIDTH = 140;
-
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-VInspector_ViewModelHistory::VInspector_ViewModelHistory (QObject* theParent, const int theHistoryTypesMaxAmount)
-: TreeModel_ModelBase (theParent), myHistoryTypesMaxAmount (theHistoryTypesMaxAmount)
-{
-}
-
-// =======================================================================
-// function : InitColumns
-// purpose :
-// =======================================================================
-void VInspector_ViewModelHistory::InitColumns()
-{
- TreeModel_ModelBase::InitColumns();
-
- SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH));
- SetHeaderItem (1, TreeModel_HeaderSection ("Visibility", COLUMN_SIZE_WIDTH)); // visualization item
- SetHeaderItem (2, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH));
- SetHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH));
- SetHeaderItem (4, TreeModel_HeaderSection ("Shape type", COLUMN_SHAPE_TYPE_WIDTH));
- SetHeaderItem (5, TreeModel_HeaderSection ("AIS Name", COLUMN_AIS_NAME_WIDTH));
- SetHeaderItem (6, TreeModel_HeaderSection ("Selected/Highlighted", -1));
-
- for (int aColumnId = 0, aNbColumns = columnCount(); aColumnId < aNbColumns; aColumnId++)
- {
- VInspector_ItemHistoryRootPtr aRootItem = itemDynamicCast<VInspector_ItemHistoryRoot> (myRootItems[aColumnId]);
- aRootItem->SetHistoryTypesMaxAmount (myHistoryTypesMaxAmount);
- }
-}
-
-// =======================================================================
-// function : createRootItem
-// purpose :
-// =======================================================================
-TreeModel_ItemBasePtr VInspector_ViewModelHistory::createRootItem (const int theColumnId)
-{
- return VInspector_ItemHistoryRoot::CreateItem (TreeModel_ItemBasePtr(), 0, theColumnId);
-}
-
-// =======================================================================
-// function : AddElement
-// purpose :
-// =======================================================================
-void VInspector_ViewModelHistory::AddElement (const VInspector_CallBackMode& theMode, const QList<QVariant>& theInfo)
-{
- // fill root item by the application
- for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++)
- {
- VInspector_ItemHistoryRootPtr aRootItem = itemDynamicCast<VInspector_ItemHistoryRoot>(myRootItems[aColId]);
- aRootItem->AddElement(theMode, theInfo);
- }
- Reset();
- EmitLayoutChanged();
-}
-
-// =======================================================================
-// function : GetSelectedPointers
-// purpose :
-// =======================================================================
-QStringList VInspector_ViewModelHistory::GetSelectedPointers (const QModelIndex& theIndex)
-{
- QStringList aPointers;
- TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (theIndex);
- if (!anItem)
- return aPointers;
-
- VInspector_ItemHistoryTypePtr aHistoryItem = itemDynamicCast<VInspector_ItemHistoryType>(anItem);
- if (aHistoryItem)
- {
- QString aPointerInfo = aHistoryItem->PointerInfo();
- QString anOwnerInfo = aHistoryItem->OwnerInfo();
-
- if (!aPointerInfo.isEmpty())
- aPointers.append (aPointerInfo);
- if (!anOwnerInfo.isEmpty())
- aPointers.append (anOwnerInfo.split (", "));
- }
- else
- {
- VInspector_ItemHistoryElementPtr anElementItem = itemDynamicCast<VInspector_ItemHistoryElement>(anItem);
- if (anElementItem)
- {
- QString aPointerInfo = anElementItem->PointerInfo();
- if (!aPointerInfo.isEmpty())
- aPointers.append (aPointerInfo);
- }
- }
- return aPointers;
-}
+++ /dev/null
-// Created on: 2017-06-16
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2017 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_ViewModelHistory_H
-#define VInspector_ViewModelHistory_H
-
-#include <Standard.hxx>
-#include <inspector/VInspector_ItemBase.hxx>
-#include <inspector/VInspector_CallBackMode.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QByteArray>
-#include <QHash>
-#include <QMap>
-#include <QObject>
-#include <Standard_WarningsRestore.hxx>
-
-#include <inspector/TreeModel_ModelBase.hxx>
-
-//! \class VInspector_ViewModelHistory
-//! The class that visualizes methods called in AIS interactive context.
-class VInspector_ViewModelHistory : public TreeModel_ModelBase
-{
- Q_OBJECT
-
-public:
-
- //! Constructor
- Standard_EXPORT VInspector_ViewModelHistory (QObject* theParent, const int theHistoryTypesMaxAmount = 50);
-
- //! Destructor
- virtual ~VInspector_ViewModelHistory() {}
-
- //! Creates model columns and root items.
- Standard_EXPORT virtual void InitColumns() Standard_OVERRIDE;
-
- //! Append new element under the root item
- Standard_EXPORT void AddElement (const VInspector_CallBackMode& theMode, const QList<QVariant>& theInfo);
-
- //! Returns container of pointer information for selected presentation or owner item
- //! \param theIndex an index of tree view model
- //! \param container of strings
- Standard_EXPORT QStringList GetSelectedPointers (const QModelIndex& theIndex);
-
-protected:
-
- //! Creates root item
- //! \param theColumnId index of a column
- Standard_EXPORT virtual TreeModel_ItemBasePtr createRootItem (const int theColumnId) Standard_OVERRIDE;
-
-private:
- int myHistoryTypesMaxAmount; //!< maximum types in history
-};
-
-#endif
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/VInspector_ViewModel.hxx>
-#include <inspector/VInspector_CallBack.hxx>
#include <inspector/VInspector_Communicator.hxx>
#include <inspector/VInspector_ItemContext.hxx>
+#include <inspector/VInspector_ItemContextProperties.hxx>
+#include <inspector/VInspector_ItemGraphic3dCLight.hxx>
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/VInspector_ViewModel.hxx>
-#include <inspector/VInspector_ViewModelHistory.hxx>
#include <inspector/ViewControl_PropertyView.hxx>
#include <inspector/ViewControl_TreeView.hxx>
const int VINSPECTOR_DEFAULT_VIEW_WIDTH = 400;
const int VINSPECTOR_DEFAULT_VIEW_HEIGHT = 1000;
-const int VINSPECTOR_DEFAULT_HISTORY_VIEW_WIDTH = 400;
-const int VINSPECTOR_DEFAULT_HISTORY_VIEW_HEIGHT = 50;
-
const int VINSPECTOR_DEFAULT_VIEW_POSITION_X = 200 + 900 + 100; // TINSPECTOR_DEFAULT_POSITION_X + TINSPECTOR_DEFAULT_WIDTH + 100
const int VINSPECTOR_DEFAULT_VIEW_POSITION_Y = 60; // TINSPECTOR_DEFAULT_POSITION_Y + 50
aTreeModel->InitColumns();
myTreeView->setModel (aTreeModel);
// hide Visibility column
- TreeModel_HeaderSection anItem = aTreeModel->GetHeaderItem ((int)TreeModel_ColumnType_Visibility);
- anItem.SetIsHidden (true);
- aTreeModel->SetHeaderItem ((int)TreeModel_ColumnType_Visibility, anItem);
+ TreeModel_HeaderSection* anItem = aTreeModel->ChangeHeaderItem ((int)TreeModel_ColumnType_Visibility);
+ anItem->SetIsHidden (true);
connect (myTreeView, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT (onTreeViewContextMenuRequested(const QPoint&)));
myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget);
connect (myPropertyPanelWidget->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT (onPropertyPanelShown (bool)));
- myHistoryView = new ViewControl_TreeView (myMainWindow);
- myHistoryView->setSelectionBehavior (QAbstractItemView::SelectRows);
- ((ViewControl_TreeView*)myHistoryView)->SetPredefinedSize (QSize (VINSPECTOR_DEFAULT_HISTORY_VIEW_WIDTH,
- VINSPECTOR_DEFAULT_HISTORY_VIEW_HEIGHT));
- myHistoryView->setContextMenuPolicy (Qt::CustomContextMenu);
- myHistoryView->header()->setStretchLastSection (true);
- new TreeModel_ContextMenu (myHistoryView);
-
- myHistoryView->setSelectionMode (QAbstractItemView::ExtendedSelection);
- VInspector_ViewModelHistory* aHistoryModel = new VInspector_ViewModelHistory (myHistoryView);
- aHistoryModel->InitColumns();
- myHistoryView->setModel (aHistoryModel);
-
- QItemSelectionModel* aSelectionModel = new QItemSelectionModel (aHistoryModel);
- myHistoryView->setSelectionModel (aSelectionModel);
- connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
- this, SLOT (onHistoryViewSelectionChanged (const QItemSelection&, const QItemSelection&)));
-
- anItem = aHistoryModel->GetHeaderItem (0);
- // hide Visibility column
- TreeModel_Tools::UseVisibilityColumn (myHistoryView, false);
- anItem = aHistoryModel->GetHeaderItem ((int)TreeModel_ColumnType_Visibility);
- anItem.SetIsHidden (true);
- aHistoryModel->SetHeaderItem ((int)TreeModel_ColumnType_Visibility, anItem);
-
- QModelIndex aParentIndex = myHistoryView->model()->index (0, 0);
- myHistoryView->setExpanded (aParentIndex, true);
-
- QDockWidget* aHistoryDockWidget = new QDockWidget (tr ("HistoryView"), myMainWindow);
- aHistoryDockWidget->setObjectName (aHistoryDockWidget->windowTitle());
- aHistoryDockWidget->setTitleBarWidget (new QWidget(myMainWindow));
- aHistoryDockWidget->setWidget (myHistoryView);
- myMainWindow->addDockWidget (Qt::BottomDockWidgetArea, aHistoryDockWidget);
-
myMainWindow->resize (450, 800);
myMainWindow->move (60, 20);
if (theItem.IsEmpty())
{
TreeModel_Tools::SetDefaultHeaderSections (myTreeView);
- TreeModel_Tools::SetDefaultHeaderSections (myHistoryView);
return;
}
myMainWindow->restoreState (TreeModel_Tools::ToByteArray (anItemValue.ToCString()));
else if (TreeModel_Tools::RestoreState (myTreeView, anItemKey.ToCString(), anItemValue.ToCString()))
continue;
- else if (TreeModel_Tools::RestoreState (myHistoryView, anItemKey.ToCString(), anItemValue.ToCString(),
- "history_view_"))
- continue;
else if (View_PreviewParameters::RestoreState (displayer()->DisplayPreview()->GetPreviewParameters(), anItemKey.ToCString(),
anItemValue.ToCString(), "preview_parameters_"))
continue;
myTreeView->scrollTo (aPresentationIndex);
}
}
-
- if (!myCallBack.IsNull())
- {
- VInspector_ViewModelHistory* aHistoryModel = dynamic_cast<VInspector_ViewModelHistory*>
- (myHistoryView->model());
- aHistoryModel->Reset();
- aHistoryModel->EmitLayoutChanged();
- }
}
// =======================================================================
return Standard_False;
Handle(AIS_InteractiveContext) aContext;
- Handle(VInspector_CallBack) aCallBack;
Standard_Boolean isModelUpdated = Standard_False;
for (NCollection_List<Handle(Standard_Transient)>::Iterator aParamsIt (theParameters); aParamsIt.More(); aParamsIt.Next())
if (aContext.IsNull())
aContext = Handle(AIS_InteractiveContext)::DownCast (anObject);
- if (aCallBack.IsNull())
- aCallBack = Handle(VInspector_CallBack)::DownCast (anObject);
}
if (aViewModel->GetContext() != aContext)
SetContext(aContext);
else
isModelUpdated = Standard_True;
- if (!aCallBack.IsNull() && aCallBack != myCallBack)
- {
- myCallBack = aCallBack;
- VInspector_ViewModelHistory* aHistoryModel = dynamic_cast<VInspector_ViewModelHistory*>
- (myHistoryView->model());
- myCallBack->SetContext(aContext);
- myCallBack->SetHistoryModel(aHistoryModel);
- }
-
if (isModelUpdated)
UpdateTreeModel();
aViewModel->SetContext (theContext);
myTreeView->setExpanded (aViewModel->index (0, 0), true);
- if (!myCallBack.IsNull())
- myCallBack->SetContext (theContext);
-
if (myDisplayer)
myDisplayer->SetContext (theContext);
}
{
aContext = createView();
SetContext (aContext);
+
+ const Handle(V3d_Viewer) aViewer = aViewModel->GetContext()->CurrentViewer();
+ if (!aViewer.IsNull())
+ {
+ addLight (Graphic3d_TOLS_POSITIONAL, aViewer);
+ addLight (Graphic3d_TOLS_SPOT, aViewer);
+ }
+
isModelUpdated = true;
}
return isModelUpdated;
Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape);
+ aPresentation->Attributes()->SetAutoTriangulation (Standard_False);
+
View_Displayer* aDisplayer = myViewWindow->Displayer();
aDisplayer->DisplayPresentation (aPresentation);
aContext->UpdateCurrentViewer();
TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex);
if (anItemBase)
{
- if (itemDynamicCast<VInspector_ItemContext> (anItemBase))
+ if (itemDynamicCast<VInspector_ItemContextProperties> (anItemBase))
+ {
+ aMenu->addSeparator();
+ QMenu* anExplodeMenu = aMenu->addMenu ("Add Light");
+
+ anExplodeMenu->addAction (ViewControl_Tools::CreateAction ("Ambient", SLOT (onAddLight()), myMainWindow, this));
+ anExplodeMenu->addAction (ViewControl_Tools::CreateAction ("Directional", SLOT (onAddLight()), myMainWindow, this));
+ anExplodeMenu->addAction (ViewControl_Tools::CreateAction ("Positional", SLOT (onAddLight()), myMainWindow, this));
+ anExplodeMenu->addAction (ViewControl_Tools::CreateAction ("Spot", SLOT (onAddLight()), myMainWindow, this));
+ }
+
+ if (itemDynamicCast<VInspector_ItemGraphic3dCLight> (anItemBase))
{
- aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export to MessageView"), SLOT (onExportToMessageView()), GetMainWindow(), this));
aMenu->addSeparator();
+ aMenu->addAction (ViewControl_Tools::CreateAction ("Remove Light", SLOT (onRemoveLight()), myMainWindow, this));
+ VInspector_ItemGraphic3dCLightPtr anItemLight = itemDynamicCast<VInspector_ItemGraphic3dCLight> (anItemBase);
+ if (!anItemLight->GetLight().IsNull())
+ {
+ bool isOn = anItemLight->GetLight()->IsEnabled();
+ aMenu->addAction (ViewControl_Tools::CreateAction (isOn ? "OFF Light" : "ON Light", SLOT (onOnOffLight()),
+ myMainWindow, this));
+ }
}
}
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand All"), SLOT (onExpandAll()), GetMainWindow(), this));
aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Collapse All"), SLOT (onCollapseAll()), GetMainWindow(), this));
- aMenu->addSeparator();
- aMenu->addAction (ViewControl_Tools::CreateAction ("Test AddChild", SLOT (OnTestAddChild()), GetMainWindow(), this));
-
QPoint aPoint = myTreeView->mapToGlobal (thePosition);
aMenu->exec(aPoint);
}
displayer()->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
}
-// =======================================================================
-// function : onHistoryViewSelectionChanged
-// purpose :
-// =======================================================================
-void VInspector_Window::onHistoryViewSelectionChanged (const QItemSelection& theSelected,
- const QItemSelection&)
-{
- VInspector_ViewModelHistory* aHistoryModel = dynamic_cast<VInspector_ViewModelHistory*> (myHistoryView->model());
- if (!aHistoryModel)
- return;
-
- if (theSelected.size() == 0)
- return;
-
- QModelIndexList aSelectedIndices = theSelected.indexes();
- QStringList aPointers = aHistoryModel->GetSelectedPointers(aSelectedIndices.first());
- selectTreeViewItems (aPointers);
-}
-
// =======================================================================
// function : onExportToShapeView
// purpose :
TCollection_AsciiString aPluginName ("TKShapeView");
NCollection_List<Handle(Standard_Transient)> aParameters;
- if (myParameters->FindParameters (aPluginName))
- aParameters = myParameters->Parameters (aPluginName);
-
NCollection_List<TCollection_AsciiString> anItemNames;
- if (myParameters->FindSelectedNames (aPluginName))
- anItemNames = myParameters->GetSelectedNames (aPluginName);
QStringList anExportedPointers;
if (aSelectedShapes.Extent() > 0)
}
}
- // search for objects to be exported
- QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::SelectedItems (myTreeView->selectionModel()->selectedIndexes());
- for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); ++anItemIt)
- {
- TreeModel_ItemBasePtr anItem = *anItemIt;
- VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
- if (!aVItem)
- continue;
-
- const Handle(Standard_Transient)& anObject = aVItem->Object();
- if (anObject.IsNull())
- continue;
-
- aParameters.Append (anObject);
- anItemNames.Append (anObject->DynamicType()->Name());
- anExportedPointers.append (Standard_Dump::GetPointerInfo (anObject, true).ToCString());
- }
-
if (anExportedPointers.isEmpty())
return;
myParameters->SetParameters (aPluginName, aParameters, myExportToShapeViewDialog->IsAccepted());
}
+// =======================================================================
+// function : onAddLight
+// purpose :
+// =======================================================================
+void VInspector_Window::onAddLight()
+{
+ VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+ if (!aViewModel)
+ return;
+ const Handle(V3d_Viewer) aViewer = aViewModel->GetContext()->CurrentViewer();
+ if (aViewer.IsNull())
+ return;
+
+ QAction* anAction = (QAction*)sender();
+ QString aText = anAction->text();
+
+ Graphic3d_TypeOfLightSource aLightSourceType = Graphic3d_TOLS_AMBIENT;
+
+ if (aText == "Ambient") { aLightSourceType = Graphic3d_TOLS_AMBIENT; }
+ else if (aText == "Directional") { aLightSourceType = Graphic3d_TOLS_DIRECTIONAL; }
+ else if (aText == "Positional") { aLightSourceType = Graphic3d_TOLS_POSITIONAL; }
+ else if (aText == "Spot") { aLightSourceType = Graphic3d_TOLS_SPOT; }
+ else { return; }
+
+ addLight(aLightSourceType, aViewer);
+}
+
+// =======================================================================
+// function : onRemoveLight
+// purpose :
+// =======================================================================
+void VInspector_Window::onRemoveLight()
+{
+ VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+ const Handle(V3d_Viewer) aViewer = aViewModel ? aViewModel->GetContext()->CurrentViewer() : NULL;
+ if (aViewer.IsNull())
+ {
+ return;
+ }
+
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+ VInspector_ItemGraphic3dCLightPtr aLightItem = itemDynamicCast<VInspector_ItemGraphic3dCLight> (
+ TreeModel_ModelBase::GetItemByIndex (anIndex));
+ if (!aLightItem)
+ {
+ return;
+ }
+
+ if (aViewer->ActiveLights().Extent() == 1) // not possible to remove the latest light
+ {
+ return;
+ }
+
+ Handle(Graphic3d_CLight) aLight = aLightItem->GetLight();
+ aViewer->DelLight (aLight);
+ aViewer->UpdateLights();
+
+ aViewer->Invalidate();
+ aViewer->Redraw();
+ UpdateTreeModel();
+}
+
+// =======================================================================
+// function : onOnOffLight
+// purpose :
+// =======================================================================
+void VInspector_Window::onOnOffLight()
+{
+ VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+ const Handle(V3d_Viewer) aViewer = aViewModel ? aViewModel->GetContext()->CurrentViewer() : NULL;
+ if (aViewer.IsNull())
+ {
+ return;
+ }
+
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+
+ VInspector_ItemGraphic3dCLightPtr anItemLight = itemDynamicCast<VInspector_ItemGraphic3dCLight> (
+ TreeModel_ModelBase::GetItemByIndex (anIndex));
+ if (anItemLight->GetLight().IsNull())
+ return;
+
+ bool isOn = anItemLight->GetLight()->IsEnabled();
+ anItemLight->GetLight()->SetEnabled (!isOn);
+
+ aViewer->UpdateLights();
+ aViewer->Invalidate();
+ aViewer->Redraw();
+ UpdateTreeModel();
+}
+
// =======================================================================
// function : onDisplayActionTypeClicked
// purpose :
}
}
-// =======================================================================
-// function : UpdateTreeModel
-// purpose :
-// =======================================================================
-void VInspector_Window::OnTestAddChild()
-{
- Handle(AIS_Shape) aPresentation = new AIS_Shape (BRepBuilderAPI_MakeVertex (gp_Pnt()));
-
- aPresentation->AddChild (new AIS_Shape (BRepBuilderAPI_MakeVertex (gp_Pnt (10., 10., 10.))));
- aPresentation->AddChild (new AIS_Shape (BRepBuilderAPI_MakeVertex (gp_Pnt(20., 10., 10.))));
- aPresentation->AddChild (new AIS_Shape (BRepBuilderAPI_MakeVertex (gp_Pnt(30., 10., 10.))));
-
- displayer()->DisplayPresentation (aPresentation);
-
- UpdateTreeModel();
-}
-
// =======================================================================
// function : UpdateTreeModel
// purpose :
return myDisplayer;
}
+
+// =======================================================================
+// function : addLight
+// purpose :
+// =======================================================================
+void VInspector_Window::addLight (const Graphic3d_TypeOfLightSource& theSourceLight,
+ const Handle(V3d_Viewer)& theViewer)
+{
+ Standard_Boolean aNeedDirection = theSourceLight == Graphic3d_TOLS_DIRECTIONAL ||
+ theSourceLight == Graphic3d_TOLS_SPOT;
+
+ Handle(Graphic3d_CLight) aLight = new Graphic3d_CLight (theSourceLight);
+ if (aNeedDirection)
+ {
+ aLight->SetDirection (gp::DZ());
+ }
+ if (theSourceLight == Graphic3d_TOLS_SPOT)
+ {
+ aLight->SetAngle ((Standard_ShortReal)M_PI - ShortRealEpsilon());
+ aLight->SetPosition (gp_Pnt (-100, -100, -100));
+ }
+
+ theViewer->AddLight (aLight);
+ theViewer->SetLightOn (aLight);
+
+ theViewer->Invalidate();
+ theViewer->Redraw();
+ UpdateTreeModel();
+}
#include <SelectMgr_EntityOwner.hxx>
#include <inspector/TInspectorAPI_PluginParameters.hxx>
-#include <inspector/VInspector_CallBack.hxx>
#include <inspector/View_DisplayActionType.hxx>
#include <Standard_WarningsDisable.hxx>
//! \param isToggled true if the property dock widget is shown
void onPropertyPanelShown (bool isToggled);
- //! Synchronization selection between history and tree view. Selection by history view
- //! \param theSelected a selected items
- //! \param theDeselected a deselected items
- void onHistoryViewSelectionChanged (const QItemSelection& theSelected,
- const QItemSelection& theDeselected);
-
//! Processes selection in tree view: make presentation or owner selected in the context if corresponding
//! check box is checked
//! \param theSelected a selected items
//! Exports the first selected shape into ShapeViewer plugin.
void onExportToShapeView();
+ //! Appends lights into the active V3d view
+ void onAddLight();
+
+ //! Removes selected light from the active V3d view
+ void onRemoveLight();
+
+ //! Switch On/Off for selected light
+ void onOnOffLight();
+
//! Apply activated display action
void onDisplayActionTypeClicked();
//! Collapse all levels for all selected items
void onCollapseAll();
- //! Creates a tree of inherited presentable objects
- void OnTestAddChild();
-
private:
//! Inits the window content by the given context
//! \return a context of created view.
Handle(AIS_InteractiveContext) createView();
+ //! Creates a new default light into V3d viewer
+ //! \param theSourceLight type of light source
+ //! \param theViewer viewer to add the created light
+ void addLight (const Graphic3d_TypeOfLightSource& theSourceLight, const Handle(V3d_Viewer)& theViewer);
+
private:
QWidget* myParent; //!< widget, comes when Init window, the window control lays in the layout, updates window title
ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist
QTreeView* myTreeView; //!< tree view of AIS content
- QTreeView* myHistoryView; //!< history of AIS context calls
- Handle(VInspector_CallBack) myCallBack; //!< AIS context call back, if set
ViewControl_MessageDialog* myExportToShapeViewDialog; //!< dialog about exporting TopoDS_Shape to ShapeView plugin
View_Window* myViewWindow; //!< temporary view window, it is created if Open is called but context is still NULL
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (anIterator.Value());
if (!aPrs.IsNull() && aPrs->GetContext().IsNull()/*is not displayed in another context*/)
{
- myContext->Display (aPrs, aPreviewDisplayMode, -1/*does not participate in selection*/, Standard_True);
+ myContext->Display (aPrs, aPreviewDisplayMode,
+ View_DisplayPreview::PreviewSelectionMode()/*participate only in custom selection*/,
+ Standard_True);
enableGlobalClipping(aPrs, false);
myPreviewReadyPresentations.Append (aPrs);
}
if (myPreviewPresentation.IsNull())
{
myPreviewPresentation = new AIS_Shape (aCompound);
+ myPreviewPresentation->Attributes()->SetAutoTriangulation (Standard_False);
+
Quantity_Color aColor(Quantity_NOC_TOMATO);
myPreviewPresentation->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
- myContext->Display (myPreviewPresentation, aPreviewDisplayMode, -1/*does not participate in selection*/, Standard_True);
+ myContext->Display (myPreviewPresentation, aPreviewDisplayMode,
+ View_DisplayPreview::PreviewSelectionMode()/*participate only in custom selection*/,
+ Standard_True);
enableGlobalClipping(myPreviewPresentation, false);
}
else
//! Returns true if preview presentation is shown
Standard_Boolean HasPreview() const { return !myPreviewPresentation.IsNull(); }
+ //! Custom preview selection mode
+ static Standard_Integer PreviewSelectionMode() { return 100; }
+
private:
//! Returns the current context
#include <inspector/View_DisplayPreview.hxx>
#include <inspector/View_Viewer.hxx>
-#include <inspector/View_Widget.hxx>
// =======================================================================
// function : Constructor
aDisplayed.Append (aPresentation);
}
- if (!myIsKeepPresentations || myFitAllActive)
+ if (myFitAllActive)
fitAllView();
myDisplayed.Bind (theType, aDisplayed);
const NCollection_List<Handle(Standard_Transient)>& thePresentations)
{
myDisplayPreview->UpdatePreview (theType, thePresentations);
- if (!myIsKeepPresentations || myFitAllActive)
+ if (myFitAllActive)
fitAllView();
}
// =======================================================================
Handle(Standard_Transient) View_Displayer::CreatePresentation (const TopoDS_Shape& theShape)
{
- return new AIS_Shape (theShape);
+ Handle(AIS_Shape) aPresentation = new AIS_Shape (theShape);
+ aPresentation->Attributes()->SetAutoTriangulation (Standard_False);
+
+ return aPresentation;
}
// =======================================================================
#include <inspector/View_PreviewParameters.hxx>
#include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_ShadingAspect.hxx>
// function : Constructor
// purpose :
// =======================================================================
-View_PreviewParameters::View_PreviewParameters()
+View_PreviewParameters::View_PreviewParameters (const Standard_Boolean theToTransparent)
{
myDrawer = new Prs3d_Drawer();
Quantity_Color aColor(Quantity_NOC_TOMATO);
- Standard_ShortReal aTransparency = 0.8f;
// point parameters
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
myDrawer->ShadingAspect()->SetColor (aColor);
myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
- myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
- myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
- myDrawer->SetTransparency (aTransparency);
+ myDrawer->SetLineAspect (new Prs3d_LineAspect (aColor, Aspect_TOL_SOLID, 1.));
+ if (theToTransparent)
+ {
+ Standard_ShortReal aTransparency = 0.8f;
+
+ myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
+ myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
+ myDrawer->SetTransparency (aTransparency);
+ }
// common parameters
myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
}
public:
//! Constructor
- Standard_EXPORT View_PreviewParameters ();
+ Standard_EXPORT View_PreviewParameters (const Standard_Boolean theToTransparent = Standard_True);
//! Destructor
virtual ~View_PreviewParameters() {}
#include <QWidget>
#include <Standard_WarningsRestore.hxx>
-//! \class View_Widget
+//! \class View_ToolButton
//! \brief It is a Qt control that implements change checked state for button by double click event
//! Button becomes checked by double click mouse pressed and unchecked by the next press mouse
class View_ToolButton : public QToolButton
// =======================================================================
void View_Widget::mouseMoveEvent (QMouseEvent* theEvent)
{
+ if (myViewer->GetView().IsNull())
+ {
+ return;
+ }
+
myController->UpdateMousePosition (Graphic3d_Vec2i (theEvent->x(), theEvent->y()),
keyMouse (theEvent->button()),
keyFlag (theEvent->modifiers()), Standard_False);
+ViewControl_ColorSelector.cxx
+ViewControl_ColorSelector.hxx
ViewControl_EditType.hxx
ViewControl_MessageDialog.cxx
ViewControl_MessageDialog.hxx
ViewControl_PropertyView.hxx
ViewControl_Table.cxx
ViewControl_Table.hxx
+ViewControl_TableItemDelegate.cxx
+ViewControl_TableItemDelegate.hxx
ViewControl_TableModel.cxx
ViewControl_TableModel.hxx
ViewControl_TableModelValues.cxx
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/ViewControl_ColorSelector.hxx>
+#include <inspector/ViewControl_TableItemDelegate.hxx>
+#include <inspector/ViewControl_TableModel.hxx>
+#include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+#include <inspector/TreeModel_Tools.hxx>
+
+#include <Standard_Dump.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QDialogButtonBox>
+#include <QHeaderView>
+#include <QGridLayout>
+#include <QItemSelectionModel>
+#include <QPainter>
+#include <QPushButton>
+#include <QTableView>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+//! Kinds of delegate cell in OCCT Color model to present a custom presentation (rect bounded by a colored frame)
+enum ViewControl_ColorDelegateKind
+{
+ ViewControl_ColorDelegateKind_None, //!< usual item
+ ViewControl_ColorDelegateKind_Activated, //!< active item
+ ViewControl_ColorDelegateKind_Highlighted, //!< highlighted item
+ ViewControl_ColorDelegateKind_Selected //!< selected item
+};
+
+//! Model for a table of parameters: Current Color, Red, Green, Blue, Alpha, OCCT color name
+class ViewControl_ParametersModel : public ViewControl_TableModelValues
+{
+public:
+ ViewControl_ParametersModel (ViewControl_ColorSelector* theSelector)
+ : ViewControl_TableModelValues(), mySelector (theSelector) {}
+ virtual ~ViewControl_ParametersModel() {}
+
+ //! Inits model by the parameter color
+ //! \param theColor model active color
+ void SetColor (const Quantity_ColorRGBA& theColor, ViewControl_TableModel* theModel)
+ { myColor = theColor; theModel->EmitLayoutChanged(); }
+
+ //! Returns current selected color
+ //! \return color value
+ Quantity_ColorRGBA GetColor() const { return myColor; }
+
+ //! Returns item information(short) for display role.
+ //! \param theIndex a model index
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn,
+ int theRole = Qt::DisplayRole) const Standard_OVERRIDE
+ {
+ //(void)theRow; (void)theColumn; (void) theRole;
+ if (theRole == Qt::BackgroundRole && theColumn == 1 && theRow == 0)
+ return ViewControl_ColorSelector::ColorToQColor (myColor);
+
+ if (theRole == Qt::ForegroundRole && theColumn == 1 && theRow >= 2 && theRow <= 5)
+ return ViewControl_TableModelValues::EditCellColor();
+
+ if (theRole != Qt::DisplayRole)
+ return QVariant();
+
+ bool isFirstColumn = theColumn == 0;
+ switch (theRow)
+ {
+ case 0: return isFirstColumn ? QVariant ("Color") : QVariant ();
+ case 1:
+ {
+ if (isFirstColumn)
+ return QVariant ("Name");
+ Quantity_NameOfColor aColorName;
+ if (ViewControl_ColorSelector::IsExactColorName(myColor, aColorName))
+ return Quantity_Color::StringName(aColorName);
+ }
+ break;
+ case 2: return isFirstColumn ? QVariant ("Red") : ViewControl_Tools::ToVariant (myColor.GetRGB().Red());
+ case 3: return isFirstColumn ? QVariant ("Green") : ViewControl_Tools::ToVariant (myColor.GetRGB().Green());
+ case 4: return isFirstColumn ? QVariant ("Blue") : ViewControl_Tools::ToVariant (myColor.GetRGB().Blue());
+ case 5: return isFirstColumn ? QVariant ("Alpha") : ViewControl_Tools::ToVariant (myColor.Alpha());
+ case 6: return isFirstColumn ? QVariant ("Near Name")
+ : Quantity_Color::StringName(myColor.GetRGB().Name());
+ }
+ return QVariant();
+ }
+
+ //! Sets content of the model index for the given role, it is applyed to internal container of values
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theRole a view role
+ //! \return true if the value is changed
+ virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue, int)
+ {
+ if (theColumn != 1 || theRow < 2 || theRow > 5)
+ return false;
+
+ switch (theRow)
+ {
+ case 2:
+ case 3:
+ case 4:
+ {
+ myColor.ChangeRGB().SetValues (theRow == 2 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Red(),
+ theRow == 3 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Green(),
+ theRow == 4 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Blue(),
+ Quantity_TOC_RGB);
+ }
+ break;
+ case 5: myColor.SetAlpha (ViewControl_Tools::ToShortRealValue (theValue)); break;
+ }
+ mySelector->ParameterColorChanged();
+ return true;
+ }
+
+ //! Returns number of tree level line items = colums in table view
+ virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 2; }
+
+ //! Returns onlly one row in table view
+ virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 7; }
+
+ //! Returns editable flag for color RGB and alpha rows
+ //! \return flags
+ Qt::ItemFlags Flags (const QModelIndex& theIndex) const
+ {
+ Qt::ItemFlags aFlags = ViewControl_TableModelValues::Flags (theIndex);
+
+ if (theIndex.column() == 1 && theIndex.row() >= 2 && theIndex.row() <= 5)
+ aFlags = aFlags | Qt::ItemIsEditable;
+
+ return aFlags;
+ }
+
+ //! Returns type of edit control for the model index. By default, it is an empty control
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \return edit type
+ virtual ViewControl_EditType GetEditType (const int theRow, const int theColumn) const
+ {
+ if (theColumn == 1 && theRow >= 2 && theRow <= 5)
+ return ViewControl_EditType_Double;
+
+ return ViewControl_EditType_None;
+ }
+
+private:
+ Quantity_ColorRGBA myColor;
+ ViewControl_ColorSelector* mySelector;
+};
+
+//! Table of parameters: Red, Green, Blue, Alpha, OCCT color name
+class ViewControl_OCCTColorModel : public QAbstractTableModel
+{
+public:
+ ViewControl_OCCTColorModel (QObject* theParent)
+ : QAbstractTableModel (theParent), myCurrentIndexKind (ViewControl_ColorDelegateKind_None) {}
+ virtual ~ViewControl_OCCTColorModel() {}
+
+ //! Sets current color, that should have custom presented
+ //! \param theColor current color
+ //! \param theKind presentation kind
+ void SetColor (const Quantity_NameOfColor& theColor, const ViewControl_ColorDelegateKind theKind)
+ {
+ int aColorPosition = (int)theColor;
+ int aRow = (int) (aColorPosition / columnCount());
+ int aColumn = aColorPosition - aRow * columnCount();
+ myCurrentIndex = index (aRow, aColumn);
+ myCurrentIndexKind = theKind;
+
+ emit layoutChanged();
+ }
+
+ //! Returns OCCT name of color if index position does not exceed Quantity_NameOfColor elements
+ //! \param theIndex model index
+ //! \param theNameOfColor [out] OCCT color name
+ //! \return true if the color is found
+ bool GetOCCTColor (const QModelIndex& theIndex, Quantity_NameOfColor& theNameOfColor) const
+ {
+ int aNameOfColorId = theIndex.row() * columnCount() + theIndex.column();
+ if (aNameOfColorId > Quantity_NOC_WHITE)
+ return false;
+ theNameOfColor = (Quantity_NameOfColor)aNameOfColorId;
+ return true;
+ }
+
+ //! Returns index that has custom presentation
+ //! \return model index
+ QModelIndex GetCurrentIndex() const { return myCurrentIndex; }
+
+ //! Returns index color kind that has custom presentation
+ //! \return kind
+ ViewControl_ColorDelegateKind GetCurrentIndexKind() const { return myCurrentIndexKind; }
+
+ //! Returns item information(short) for display role.
+ //! \param theIndex a model index
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant data (const QModelIndex& theIndex,
+ int theRole = Qt::DisplayRole) const Standard_OVERRIDE
+ {
+ if (theRole != Qt::ToolTipRole) // background is processed in table item delegate
+ return QVariant();
+
+ Quantity_NameOfColor aNameOfColor;
+ if (!GetOCCTColor (theIndex, aNameOfColor))
+ return QVariant();
+
+ if (theRole == Qt::ToolTipRole)
+ return QString("%1").arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
+ return QVariant();
+ }
+
+ //! Returns number of tree level line items = colums in table view
+ virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 26; }
+
+ //! Returns onlly one row in table view
+ virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { (void)theParent; return 20; }
+
+ //! Returns color for the delegate kind
+ //! \param theKind kind
+ //! \return color
+ static QColor GetKindColor (const ViewControl_ColorDelegateKind theKind)
+ {
+ switch (theKind)
+ {
+ case ViewControl_ColorDelegateKind_Activated:
+ case ViewControl_ColorDelegateKind_Highlighted: return Qt::blue;
+ case ViewControl_ColorDelegateKind_Selected: return Qt::black;
+ default: break;
+ }
+ return QColor();
+ }
+
+private:
+ QModelIndex myCurrentIndex; //!< index to be presented through item delegate
+ ViewControl_ColorDelegateKind myCurrentIndexKind; //!< kind of custom item
+};
+
+//! \class DFBrowser_HighlightDelegate
+//! \brief An item delegate to paint in highlight color the cell when the mouse cursor is over it
+class ViewControl_OCCTColorDelegate : public QItemDelegate
+{
+public:
+
+ //! Constructor
+ ViewControl_OCCTColorDelegate (QObject* theParent = 0) : QItemDelegate (theParent) {}
+
+ //! Destructor
+ virtual ~ViewControl_OCCTColorDelegate() Standard_OVERRIDE {}
+
+ //! Redefine of the parent virtual method to color the cell rectangle in highlight style
+ //! \param thePainter a painter
+ //! \param theOption a paint options
+ //! \param theIndex a view index
+ virtual void paint (QPainter* thePainter, const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex) const Standard_OVERRIDE
+ {
+ QRect aBaseRect = theOption.rect;
+ int aNameOfColorId = theIndex.row() * theIndex.model()->columnCount(theIndex) + theIndex.column();
+ Quantity_NameOfColor aNameOfColor = Quantity_NOC_WHITE;
+ if (aNameOfColorId < (int)Quantity_NOC_WHITE)
+ aNameOfColor = (Quantity_NameOfColor)aNameOfColorId;
+
+ Quantity_Color anOCCTColor (aNameOfColor);
+ QColor aQColor = ViewControl_ColorSelector::ColorToQColor (Quantity_ColorRGBA (anOCCTColor));
+ thePainter->fillRect (aBaseRect, aQColor);
+
+ QColor aColor;
+ // highlight cell
+ if (theOption.state & QStyle::State_MouseOver)
+ aColor = ViewControl_OCCTColorModel::GetKindColor (ViewControl_ColorDelegateKind_Highlighted);
+ else
+ {
+ const ViewControl_OCCTColorModel* aTableModel = dynamic_cast<const ViewControl_OCCTColorModel*> (theIndex.model());
+ QModelIndex anIndex = aTableModel->GetCurrentIndex();
+ if (anIndex.isValid() && anIndex.row() == theIndex.row() && anIndex.column() == theIndex.column())
+ aColor = ViewControl_OCCTColorModel::GetKindColor (aTableModel->GetCurrentIndexKind());
+ }
+
+ if (aColor.isValid())
+ {
+ int aRectSize = 2;
+ thePainter->fillRect (QRect (aBaseRect.topLeft(), QPoint (aBaseRect.bottomLeft().x() + aRectSize, aBaseRect.bottomLeft().y())),
+ aColor);
+ thePainter->fillRect (QRect (QPoint (aBaseRect.topRight().x() - aRectSize, aBaseRect.topRight().y()), aBaseRect.bottomRight()),
+ aColor);
+ thePainter->fillRect (QRect (QPoint (aBaseRect.topLeft().x() + aRectSize, aBaseRect.topLeft().y()),
+ QPoint (aBaseRect.topRight().x() - aRectSize, aBaseRect.topRight().y() + aRectSize)),
+ aColor);
+ thePainter->fillRect (QRect (QPoint (aBaseRect.bottomLeft().x() + aRectSize, aBaseRect.bottomLeft().y() - aRectSize),
+ QPoint (aBaseRect.bottomRight().x() - aRectSize, aBaseRect.bottomRight().y())),
+ aColor);
+ }
+ }
+};
+
+//! Color picker class
+class ViewControl_ColorPicker : public QWidget
+{
+public:
+ ViewControl_ColorPicker (QWidget* theParent) : QWidget (theParent) {}
+ virtual ~ViewControl_ColorPicker() {}
+};
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+ViewControl_ColorSelector::ViewControl_ColorSelector (QWidget* theParent)
+: QDialog (theParent)
+{
+ QGridLayout* aLayout = new QGridLayout (this);
+ aLayout->setContentsMargins (0, 0, 0, 0);
+
+ myParameters = new QTableView (this);
+ ViewControl_TableModel* aTableModel = new ViewControl_TableModel (myParameters);
+ aTableModel->SetModelValues (new ViewControl_ParametersModel (this));
+ myParameters->setModel(aTableModel);
+
+ ViewControl_TableItemDelegate* anItemDelegate = new ViewControl_TableItemDelegate();
+ anItemDelegate->SetModelValues (aTableModel->ModelValues());
+ myParameters->setItemDelegate(anItemDelegate);
+
+ myParameters->verticalHeader()->setDefaultSectionSize (myParameters->verticalHeader()->minimumSectionSize());
+ myParameters->verticalHeader()->setVisible (false);
+ myParameters->horizontalHeader()->setVisible (false);
+ myParameters->setMinimumHeight (myParameters->verticalHeader()->minimumSectionSize() * aTableModel->rowCount() +
+ TreeModel_Tools::HeaderSectionMargin());
+
+ QItemSelectionModel* aSelectionModel = new QItemSelectionModel (myParameters->model());
+ myParameters->setSelectionMode (QAbstractItemView::SingleSelection);
+ myParameters->setSelectionModel (aSelectionModel);
+
+ aLayout->addWidget (myParameters, 0, 0);
+
+ myColorPicker = new ViewControl_ColorPicker (this);
+ aLayout->addWidget (myColorPicker, 0, 1);
+
+ myOCCTColors = new QTableView (this);
+ myOCCTColors->setFixedSize (525, 405);
+ myOCCTColors->verticalHeader()->setDefaultSectionSize (20);
+ myOCCTColors->verticalHeader()->setVisible (false);
+ myOCCTColors->horizontalHeader()->setDefaultSectionSize (20);
+ myOCCTColors->horizontalHeader()->setVisible (false);
+ myOCCTColors->setModel(new ViewControl_OCCTColorModel(myOCCTColors));
+
+ myOCCTColors->viewport()->setAttribute (Qt::WA_Hover);
+ myOCCTColors->setItemDelegate (new ViewControl_OCCTColorDelegate (myOCCTColors));
+
+ aSelectionModel = new QItemSelectionModel (myOCCTColors->model());
+ myOCCTColors->setSelectionMode (QAbstractItemView::SingleSelection);
+ myOCCTColors->setSelectionModel (aSelectionModel);
+ connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT (onOCCTColorsTableSelectionChanged (const QItemSelection&, const QItemSelection&)));
+ aLayout->addWidget (myOCCTColors, 1, 0, 1, 2);
+
+ QWidget* aBtnWidget = new QWidget (this);
+ aLayout->addWidget (aBtnWidget, 2, 0, 1, 2);
+
+ QHBoxLayout* aBtnLayout = new QHBoxLayout (aBtnWidget);
+ myOkButton = new QPushButton ("Ok", aBtnWidget);
+ myCancelButton = new QPushButton ("Cancel", aBtnWidget);
+ connect (myOkButton, SIGNAL (clicked()), this, SLOT (accept()));
+ connect (myCancelButton, SIGNAL (clicked()), this, SLOT (reject()));
+ aBtnLayout->addStretch ();
+ aBtnLayout->addWidget (myOkButton);
+ aBtnLayout->addWidget (myCancelButton);
+}
+
+// =======================================================================
+// function : SetStreamValue
+// purpose :
+// =======================================================================
+void ViewControl_ColorSelector::SetStreamValue (const QString& theValue)
+{
+ Quantity_ColorRGBA aColor = StringToColorRGBA (theValue);
+ // parameters model
+ ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*> (myParameters->model());
+ ViewControl_ParametersModel* aParametersModel = dynamic_cast<ViewControl_ParametersModel*> (aTableModel->ModelValues());
+ aParametersModel->SetColor (aColor, aTableModel);
+
+ // OCCT color model
+ Quantity_NameOfColor aColorName;
+ bool isExactColorName = ViewControl_ColorSelector::IsExactColorName(aColor, aColorName);
+ ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast<ViewControl_OCCTColorModel*>(myOCCTColors->model());
+ anOCCTColorModel->SetColor (aColorName, isExactColorName ? ViewControl_ColorDelegateKind_Selected
+ : ViewControl_ColorDelegateKind_Activated);
+}
+
+// =======================================================================
+// function : GetStreamValue
+// purpose :
+// =======================================================================
+QString ViewControl_ColorSelector::GetStreamValue() const
+{
+ ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*> (myParameters->model());
+ ViewControl_ParametersModel* aParametersModel = dynamic_cast<ViewControl_ParametersModel*> (aTableModel->ModelValues());
+
+ Quantity_ColorRGBA aColor = aParametersModel->GetColor();
+
+ Standard_SStream aStream;
+ aColor.DumpJson (aStream);
+
+ return Standard_Dump::Text (aStream).ToCString();
+}
+
+// =======================================================================
+// function : ParameterColorChanged
+// purpose :
+// =======================================================================
+void ViewControl_ColorSelector::ParameterColorChanged()
+{
+ ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*> (myParameters->model());
+ ViewControl_ParametersModel* aParametersModel = dynamic_cast<ViewControl_ParametersModel*> (aTableModel->ModelValues());
+ Quantity_ColorRGBA aColor = aParametersModel->GetColor();
+
+ // OCCT color model
+ Quantity_NameOfColor aColorName;
+ bool isExactColorName = ViewControl_ColorSelector::IsExactColorName(aColor, aColorName);
+ ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast<ViewControl_OCCTColorModel*>(myOCCTColors->model());
+ anOCCTColorModel->SetColor (aColorName, isExactColorName ? ViewControl_ColorDelegateKind_Selected
+ : ViewControl_ColorDelegateKind_Activated);
+}
+
+// =======================================================================
+// function : ColorToString
+// purpose :
+// =======================================================================
+QString ViewControl_ColorSelector::ColorToString (const Quantity_Color& theColor)
+{
+ Standard_Real aRed, aGreen, aBlue;
+ theColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
+ return QString::number (aRed) + ViewControl_ColorSelector::ColorSeparator() +
+ QString::number (aGreen) + ViewControl_ColorSelector::ColorSeparator() +
+ QString::number (aBlue);
+}
+
+// =======================================================================
+// function : ColorToQColor
+// purpose :
+// =======================================================================
+QColor ViewControl_ColorSelector::ColorToQColor (const Quantity_ColorRGBA& theColor)
+{
+ int aDelta = 255;
+
+ Standard_Real aRed, aGreen, aBlue;
+ theColor.GetRGB().Values (aRed, aGreen, aBlue, Quantity_TOC_RGB);
+
+ return QColor((int)(aRed * aDelta), (int)(aGreen * aDelta), (int)(aBlue * aDelta));
+}
+
+// =======================================================================
+// function : StringToColorRGBA
+// purpose :
+// =======================================================================
+Quantity_ColorRGBA ViewControl_ColorSelector::StringToColorRGBA (const QString& theColor)
+{
+ Quantity_ColorRGBA aColorRGBA;
+ Standard_SStream aStream;
+ aStream << theColor.toStdString();
+ int aStreamPos = 1;
+ aColorRGBA.InitFromJson (aStream, aStreamPos);
+ return aColorRGBA;
+}
+
+// =======================================================================
+// function : IsExactColorName
+// purpose :
+// =======================================================================
+Standard_Boolean ViewControl_ColorSelector::IsExactColorName (const Quantity_ColorRGBA& theColor,
+ Quantity_NameOfColor& theColorName)
+{
+ theColorName = theColor.GetRGB().Name();
+ return Quantity_Color (theColorName).IsEqual (theColor.GetRGB());
+}
+
+// =======================================================================
+// function : onOCCTColorsTableSelectionChanged
+// purpose :
+// =======================================================================
+void ViewControl_ColorSelector::onOCCTColorsTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection&)
+{
+ QModelIndexList aSelectedIndices = theSelected.indexes();
+ if (aSelectedIndices.size() != 1)
+ return;
+
+ ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast<ViewControl_OCCTColorModel*>(myOCCTColors->model());
+ Quantity_NameOfColor aNameOfColor;
+ if (!anOCCTColorModel->GetOCCTColor (aSelectedIndices.first(), aNameOfColor))
+ return;
+
+ anOCCTColorModel->SetColor (aNameOfColor, ViewControl_ColorDelegateKind_Selected);
+
+ // parameters model
+ ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*> (myParameters->model());
+ ViewControl_ParametersModel* aParametersModel = dynamic_cast<ViewControl_ParametersModel*> (aTableModel->ModelValues());
+ Quantity_Color anOCCTColor (aNameOfColor);
+ aParametersModel->SetColor (Quantity_ColorRGBA (anOCCTColor), aTableModel);
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 ViewControl_ColorSelector_H
+#define ViewControl_ColorSelector_H
+
+#include <Quantity_ColorRGBA.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QColor>
+#include <QDialog>
+#include <QItemSelection>
+#include <QString>
+#include <QWidget>
+#include <Standard_WarningsRestore.hxx>
+
+class ViewControl_ColorPicker;
+class QPushButton;
+class QTableView;
+
+//! \class ViewControl_ColorSelector
+//! \brief Selector of OCCT color
+class ViewControl_ColorSelector : public QDialog
+{
+ Q_OBJECT
+public:
+
+ //! Constructor
+ ViewControl_ColorSelector (QWidget* theParent);
+
+ //! Destructor
+ virtual ~ViewControl_ColorSelector() Standard_OVERRIDE {}
+
+ //! Inits control by the color value
+ //! \param theColor text color value
+ void SetStreamValue (const QString& theColor);
+
+ //! Returns current selected color value
+ //! \return text color value
+ QString GetStreamValue() const;
+
+ //! Updates OCCT color model by changing color in parameter model
+ void ParameterColorChanged();
+
+ //! Converts color to string value in form: r;g;b
+ //! \param theColor color value
+ //! \return text value
+ static QString ColorToString (const Quantity_Color& theColor);
+
+ //! Converts color to QColor value in form: r;g;b;a
+ //! \param theColor color value
+ //! \return qt color value
+ static QColor ColorToQColor (const Quantity_ColorRGBA& theColor);
+
+ //! Converts string to color value from a form: r;g;b;a
+ //! \param theColor text color value
+ //! \return color value
+ static Quantity_ColorRGBA StringToColorRGBA (const QString& theColor);
+
+ static Standard_Boolean IsExactColorName (const Quantity_ColorRGBA& theColor,
+ Quantity_NameOfColor& theColorName);
+
+private:
+ //! Returns symbol used as a separtor of color components in string conversion
+ //! \return symbol value
+ static QString ColorSeparator() { return ";"; }
+
+private slots:
+ //! Slots listen selection change and update the current control content by selection
+ //! \param theSelected container of selected items
+ //! \param theDeselected container of items that become deselected
+ void onOCCTColorsTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected);
+
+private:
+ QTableView* myParameters; //!< current color parameters (RGB, alpha, color name)
+ ViewControl_ColorPicker* myColorPicker; //!< color picker
+ QTableView* myOCCTColors; //!< OCCT color values
+ QPushButton* myOkButton; //!< accept button
+ QPushButton* myCancelButton; //!< reject button
+};
+#endif
{
ViewControl_EditType_None, //!< View widget is null
ViewControl_EditType_Bool, //!< check box widget
+ ViewControl_EditType_Color, //!< color selector widget
ViewControl_EditType_Double, //!< line edit widget used double validator
ViewControl_EditType_Line, //!< line edit widget
ViewControl_EditType_Spin, //!< spin box widget
// commercial license or contractual agreement.
#include <inspector/ViewControl_Table.hxx>
+#include <inspector/ViewControl_TableItemDelegate.hxx>
#include <inspector/ViewControl_TableModel.hxx>
#include <inspector/ViewControl_Tools.hxx>
myTableView = new QTableView (myMainWidget);
myTableView->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
+ myTableView->setItemDelegate (new ViewControl_TableItemDelegate (theParent));
+
QHeaderView* aVHeader = myTableView->verticalHeader();
int aDefCellSize = aVHeader->minimumSectionSize();
aVHeader->setDefaultSectionSize (aDefCellSize);
myTableView->horizontalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Horizontal));
+ ViewControl_TableItemDelegate* anItemDelegate = dynamic_cast<ViewControl_TableItemDelegate*>(myTableView->itemDelegate());
+ anItemDelegate->SetModelValues (theModelValues);
+
myTableView->verticalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Vertical));
int aSectionSize;
if (theModelValues->DefaultSectionSize (Qt::Vertical, aSectionSize) )
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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/ViewControl_TableItemDelegate.hxx>
+#include <inspector/ViewControl_ColorSelector.hxx>
+#include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_EditType.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QFont>
+#include <QCheckBox>
+#include <QComboBox>
+#include <QDoubleValidator>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QSpinBox>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+ViewControl_TableItemDelegate::ViewControl_TableItemDelegate (QObject* theParent)
+ : QItemDelegate (theParent), myModelValues (0)
+{
+}
+
+// =======================================================================
+// function : createEditor
+// purpose :
+// =======================================================================
+QWidget* ViewControl_TableItemDelegate::createEditor (QWidget* theParent,
+ const QStyleOptionViewItem&,
+ const QModelIndex& theIndex) const
+{
+ if (!myModelValues)
+ return 0;
+
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
+ ViewControl_EditType anEditType = myModelValues->EditType (aRow, aColumn);
+
+ QWidget* anEditor = createEditorControl (theParent, anEditType);
+ initEditorParameters (anEditor, anEditType, myModelValues, aRow, aColumn);
+ return anEditor;
+}
+
+// =======================================================================
+// function : setEditorData
+// purpose :
+// =======================================================================
+void ViewControl_TableItemDelegate::setEditorData (QWidget* theEditor, const QModelIndex& theIndex) const
+{
+ if (!myModelValues)
+ return;
+
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
+ ViewControl_EditType anEditType = myModelValues->EditType (aRow, aColumn);
+
+ setEditorValue (theEditor, anEditType, theIndex.model()->data(theIndex));
+}
+
+// =======================================================================
+// function : setModelData
+// purpose :
+// =======================================================================
+void ViewControl_TableItemDelegate::setModelData (QWidget* theEditor, QAbstractItemModel* theModel,
+ const QModelIndex& theIndex) const
+{
+ if (!myModelValues)
+ return;
+
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
+ ViewControl_EditType anEditType = myModelValues->EditType (aRow, aColumn);
+ theModel->setData (theIndex, getEditorValue (theEditor, anEditType));
+}
+
+// =======================================================================
+// function : createEditorControl
+// purpose :
+// =======================================================================
+QWidget* ViewControl_TableItemDelegate::createEditorControl (QWidget* theParent, const ViewControl_EditType theEditType)
+{
+ switch (theEditType)
+ {
+ case ViewControl_EditType_None: return 0;
+ case ViewControl_EditType_Bool: return new QComboBox (theParent);
+ case ViewControl_EditType_Color: return new ViewControl_ColorSelector (theParent);
+ case ViewControl_EditType_Double:
+ {
+ QLineEdit* aLineEdit = new QLineEdit (theParent);
+ aLineEdit->setValidator (new QDoubleValidator (theParent));
+ return aLineEdit;
+ }
+ case ViewControl_EditType_Line: return new QLineEdit (theParent);
+ case ViewControl_EditType_Spin:
+ {
+ QSpinBox* aSpinBox = new QSpinBox (theParent);
+ aSpinBox->setRange (IntegerFirst(), IntegerLast());
+ return aSpinBox;
+ }
+ case ViewControl_EditType_DoAction: return new QPushButton (theParent);
+
+ default: return 0;
+ }
+}
+
+// =======================================================================
+// function : initEditorParameters
+// purpose :
+// =======================================================================
+void ViewControl_TableItemDelegate::initEditorParameters (QWidget* theEditor,
+ const ViewControl_EditType theEditType,
+ ViewControl_TableModelValues*,
+ const int, const int)
+{
+ switch (theEditType)
+ {
+ case ViewControl_EditType_Bool:
+ {
+ (qobject_cast<QComboBox*> (theEditor))->insertItem(0, "true");
+ (qobject_cast<QComboBox*> (theEditor))->insertItem(1, "false");
+ break;
+ }
+ case ViewControl_EditType_Double:
+ {
+ }
+ default: break;
+ }
+}
+
+// =======================================================================
+// function : setEditorValue
+// purpose :
+// =======================================================================
+void ViewControl_TableItemDelegate::setEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType,
+ const QVariant& theValue) const
+{
+ switch (theEditType)
+ {
+ case ViewControl_EditType_None: break;
+ case ViewControl_EditType_Bool: (qobject_cast<QComboBox*>(theEditor))->setCurrentIndex (theValue.toBool() ? 0 : 1); break;
+ case ViewControl_EditType_Color:
+ {
+ if (!myModelValues)
+ break;
+
+ const TCollection_AsciiString& aStreamValue = myModelValues->Properties()->StreamValue();
+ (qobject_cast<ViewControl_ColorSelector*>(theEditor))->SetStreamValue (aStreamValue.ToCString());
+ break;
+ }
+ case ViewControl_EditType_Double:
+ case ViewControl_EditType_Line: (qobject_cast<QLineEdit*>(theEditor))->setText (theValue.toString()); break;
+ case ViewControl_EditType_Spin: (qobject_cast<QSpinBox*>(theEditor))->setValue (theValue.toInt()); break;
+ case ViewControl_EditType_DoAction: (qobject_cast<QPushButton*>(theEditor))->setText ("UnSelect"); break;
+ default: break;
+ }
+}
+
+// =======================================================================
+// function : getEditorValue
+// purpose :
+// =======================================================================
+
+QVariant ViewControl_TableItemDelegate::getEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType)
+{
+ switch (theEditType)
+ {
+ case ViewControl_EditType_None: return QVariant();
+ case ViewControl_EditType_Bool: return (qobject_cast<QComboBox*>(theEditor))->currentIndex() == 0 ? true : false;
+ case ViewControl_EditType_Color: return (qobject_cast<ViewControl_ColorSelector*>(theEditor))->GetStreamValue();
+ case ViewControl_EditType_Double:
+ case ViewControl_EditType_Line: return (qobject_cast<QLineEdit*>(theEditor))->text();
+ case ViewControl_EditType_Spin: return (qobject_cast<QSpinBox*>(theEditor))->value();
+ case ViewControl_EditType_DoAction: return QVariant ("Clicked");
+ default: return QVariant();
+ }
+}
--- /dev/null
+// Created on: 2021-04-27
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2021 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 ViewControl_TableItemDelegate_H
+#define ViewControl_TableItemDelegate_H
+
+#include <Standard_Macro.hxx>
+#include <inspector/ViewControl_EditType.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QItemDelegate>
+#include <Standard_WarningsRestore.hxx>
+
+class ViewControl_TableModelValues;
+
+//! \class ViewControl_TableItemDelegate
+//! \brief This is an implementation for table cell editor
+class ViewControl_TableItemDelegate : public QItemDelegate
+{
+public:
+
+ //! Constructor
+ //! \param theParent parent object
+ Standard_EXPORT ViewControl_TableItemDelegate (QObject* theParent = 0);
+
+ //! Destructor
+ virtual ~ViewControl_TableItemDelegate() Standard_OVERRIDE {}
+
+ //! Sets table model values
+ //! \param theModelValues instance of model values
+ void SetModelValues (ViewControl_TableModelValues* theModelValues) { myModelValues = theModelValues; }
+
+ //! Creates widget editor: spin box, combo box or line edit
+ //! \param theParent parent widget
+ //! \param theOption style option
+ //! \param theIndex index of requested widget
+ virtual QWidget* createEditor (QWidget* theParent, const QStyleOptionViewItem& theOption,
+ const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+ //! Sets the data to be displayed and edited by the editor from the data model item specified by the model index
+ //! \param theEditor editor to be filled
+ //! \param theIndex index of requested widget, contains information about model
+ virtual void setEditorData (QWidget* theEditor, const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+ //! Gets data from the editor widget and stores it in the specified model at the item index.
+ //! \param theEditor editor to be filled
+ //! \param theModel data model
+ //! \param theIndex index of requested widget, contains information about model
+ virtual void setModelData (QWidget* theEditor, QAbstractItemModel* theModel,
+ const QModelIndex& theIndex) const Standard_OVERRIDE;
+
+private:
+ //! Creates an editor
+ //! \param theParent parent widget
+ //! \param theEditType edition control type
+ //! \return edit control
+ static QWidget* createEditorControl (QWidget* theParent, const ViewControl_EditType theEditType);
+
+ //! Inits an editor by model values parameters
+ //! \param theEditor editor
+ //! \param theEditType edition control type
+ //! \param theModelValues custom implementation to provide parameters
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \return edit control
+ static void initEditorParameters (QWidget* theEditor, const ViewControl_EditType theEditType,
+ ViewControl_TableModelValues* theModelValues,
+ const int theRow, const int theColumn);
+
+ //! Sets editor value
+ //! \param theEditor editor
+ //! \param theEditType editor typ
+ //! \param theValue new value
+ void setEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType, const QVariant& theValue) const;
+
+ //! Returns value of spin box editor
+ //! \param theEditor editor
+ //! \param theEditType editor typ
+ //! \return current value
+ static QVariant getEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType);
+
+private:
+ ViewControl_TableModelValues* myModelValues; //!< table model values
+};
+
+#endif
virtual ~ViewControl_TableModelValues() {}
//! Returns item table properties builder
- Handle(TreeModel_ItemProperties) Properties() const { return myProperties; }
+ const Handle(TreeModel_ItemProperties)& Properties() const { return myProperties; }
//! Sets item table properties builder
void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
aTableValues->SetProperties (anItemProperties);
return aTableValues;
}
+
+// =======================================================================
+// function : ToVariant
+// purpose :
+// =======================================================================
+QVariant ViewControl_Tools::ToVariant (const Standard_ShortReal theValue)
+{
+ return QVariant (QLocale().toString (theValue));
+}
+
+// =======================================================================
+// function : ToVariant
+// purpose :
+// =======================================================================
+QVariant ViewControl_Tools::ToVariant (const Standard_Real theValue)
+{
+ return QVariant (QLocale().toString (theValue));
+}
+
+// =======================================================================
+// function : ToRealValue
+// purpose :
+// =======================================================================
+Standard_ShortReal ViewControl_Tools::ToShortRealValue (const QVariant& theValue)
+{
+ return QLocale().toFloat (theValue.toString());
+}
+
+// =======================================================================
+// function : ToRealValue
+// purpose :
+// =======================================================================
+Standard_Real ViewControl_Tools::ToRealValue (const QVariant& theValue)
+{
+ return QLocale().toDouble (theValue.toString());
+}
#include <Standard_WarningsDisable.hxx>
#include <QString>
+#include <QVariant>
#include <Standard_WarningsRestore.hxx>
class ViewControl_TableModelValues;
//! It is created if the selection contains only one item and it has a property item
Standard_EXPORT static ViewControl_TableModelValues* CreateTableModelValues (QItemSelectionModel* theSelectionModel);
+ //! Convert real value to string value
+ //! \param theValue a short real value
+ //! \return the string value
+ Standard_EXPORT static QVariant ToVariant (const Standard_ShortReal theValue);
+
+ //! Convert real value to string value
+ //! \param theValue a real value
+ //! \return the string value
+ Standard_EXPORT static QVariant ToVariant (const Standard_Real theValue);
+
+ //! Convert real value to real value
+ //! \param theValue a string value
+ //! \return the real value
+ Standard_EXPORT static Standard_ShortReal ToShortRealValue (const QVariant& theValue);
+
+ //! Convert real value to string value
+ //! \param theValue a string value
+ //! \return the real value
+ Standard_EXPORT static Standard_Real ToRealValue (const QVariant& theValue);
+
};
#endif