(*fp) (theDI);
}
+//=======================================================================
+//function : ParseOnOff
+//purpose :
+//=======================================================================
+Standard_Boolean Draw::ParseOnOff (Standard_CString theArg,
+ Standard_Boolean& theIsOn)
+{
+ TCollection_AsciiString aFlag(theArg);
+ aFlag.LowerCase();
+ if (aFlag == "on"
+ || aFlag == "1")
+ {
+ theIsOn = Standard_True;
+ return Standard_True;
+ }
+ else if (aFlag == "off"
+ || aFlag == "0")
+ {
+ theIsOn = Standard_False;
+ return Standard_True;
+ }
+ return Standard_False;
+}
//! Defines Draw unit commands
Standard_EXPORT static void UnitCommands (Draw_Interpretor& I);
+ //! Defines Draw message commands
+ Standard_EXPORT static void MessageCommands (Draw_Interpretor& I);
+
+ //! Parses boolean argument.
+ //! Handles either flag specified by 0|1 or on|off.
+ Standard_EXPORT static Standard_Boolean ParseOnOff (Standard_CString theArg,
+ Standard_Boolean& theIsOn);
}
Draw::BasicCommands(theCommands);
+ Draw::MessageCommands(theCommands);
Draw::VariableCommands(theCommands);
Draw::GraphicCommands(theCommands);
Draw::PloadCommands(theCommands);
--- /dev/null
+// Created on: 2018-06-10
+// 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 <Draw.hxx>
+#include <Message.hxx>
+#include <Message_Gravity.hxx>
+#include <Message_Report.hxx>
+#include <TCollection_AsciiString.hxx>
+
+//==============================================================================
+//function : ActivateReport
+//purpose :
+//==============================================================================
+
+static Standard_Integer ActivateReport (Draw_Interpretor&, Standard_Integer theArgsNb, const char** theArgVec)
+{
+ bool isActiveMode = true;
+ bool isGravityDefined = false;
+ Standard_Integer aGravity = -1;
+ for (Standard_Integer anArgIt = 1; anArgIt < theArgsNb; ++anArgIt)
+ {
+ const TCollection_AsciiString anArg = theArgVec[anArgIt];
+ TCollection_AsciiString anArgCase = anArg;
+ anArgCase.LowerCase();
+ if (anArgCase == "-mode")
+ {
+ if (anArgIt + 1 < theArgsNb
+ && Draw::ParseOnOff (theArgVec[anArgIt + 1], isActiveMode))
+ {
+ ++anArgIt;
+ }
+ }
+ else if (anArgCase == "-gravity")
+ {
+ if (anArgIt + 1 < theArgsNb)
+ {
+ Message_Gravity aGravityType;
+ isGravityDefined = Message::GravityFromString (theArgVec[anArgIt + 1], aGravityType);
+ aGravity = (Standard_Integer)aGravityType;
+ ++anArgIt;
+ }
+ }
+ else
+ {
+ std::cout << "Syntax error: unknown argument " << anArg << ".\n";
+ return 1;
+ }
+ }
+
+ Handle(Message_Report) aCurrentReport = Message_Report::CurrentReport (isActiveMode);
+ if (!aCurrentReport.IsNull())
+ aCurrentReport->SetActive(isActiveMode, aGravity);
+
+ return 0;
+}
+
+//==============================================================================
+//function : ClearReport
+//purpose :
+//==============================================================================
+
+static Standard_Integer ClearReport (Draw_Interpretor&, Standard_Integer, const char**)
+{
+ Handle(Message_Report) aCurrentReport = Message_Report::CurrentReport (Standard_False);
+ if (!aCurrentReport.IsNull())
+ aCurrentReport->Clear();
+
+ return 0;
+}
+
+//=======================================================================
+//function : PloadCommands
+//purpose :
+//=======================================================================
+
+void Draw::MessageCommands(Draw_Interpretor& theCommands)
+{
+ static Standard_Boolean Done = Standard_False;
+ if (Done) return;
+ Done = Standard_True;
+
+ const char* g = "DRAW Message Commands";
+
+ theCommands.Add("activateReport" ,
+ "activateReport [-mode {-on|-off}=-on]"
+ "[-gravity {trace|info|warning|alarm|fail}]"
+ "Activates default Message_Report object" ,
+ __FILE__, ActivateReport, g);
+
+ theCommands.Add("clearReport" , "clearReport: Clears content of default Message_Report object" ,
+ __FILE__, ClearReport, g);
+}
--- /dev/null
+// Created on: 2018-06-10
+// 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 <Draw_Report.hxx>
+
+#include <Draw_Display.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Draw_Report,Draw_Drawable3D)
+
+//=======================================================================
+//function : Copy
+//purpose :
+//=======================================================================
+Handle(Draw_Drawable3D) Draw_Report::Copy()const
+{
+ Handle(Draw_Report) aReport = new Draw_Report (myReport);
+ return aReport;
+}
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+void Draw_Report::Dump (Standard_OStream& S)const
+{
+ (void)S;
+ //S << myReport;
+}
+
+
+//=======================================================================
+//function : Whatis
+//purpose :
+//=======================================================================
+void Draw_Report::Whatis (Draw_Interpretor& S)const
+{
+ S << "Draw_Report";
+}
--- /dev/null
+// Created on: 2018-06-10
+// 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 _Draw_Report_HeaderFile
+#define _Draw_Report_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+
+#include <Message_Report.hxx>
+#include <Draw_Drawable3D.hxx>
+#include <Standard_OStream.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <Draw_Display.hxx>
+
+class Draw_Report;
+DEFINE_STANDARD_HANDLE(Draw_Report, Draw_Drawable3D)
+
+//! To store nummbers in variables.
+class Draw_Report : public Draw_Drawable3D
+{
+
+public:
+
+ Standard_EXPORT Draw_Report (const Handle(Message_Report)& theReport) : myReport (theReport) {}
+
+ Standard_EXPORT const Handle(Message_Report)& GetReport() const { return myReport; }
+
+ Standard_EXPORT void SetReport (const Handle(Message_Report)& theReport) { myReport = theReport; }
+
+ //! Does nothhing.
+ Standard_EXPORT void DrawOn (Draw_Display& dis) const Standard_OVERRIDE { (void)dis; }
+
+ //! For variable copy.
+ Standard_EXPORT virtual Handle(Draw_Drawable3D) Copy() const Standard_OVERRIDE;
+
+ //! For variable dump.
+ Standard_EXPORT virtual void Dump (Standard_OStream& S) const Standard_OVERRIDE;
+
+ //! For variable whatis command. Set as a result the
+ //! type of the variable.
+ Standard_EXPORT virtual void Whatis (Draw_Interpretor& I) const Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT(Draw_Report,Draw_Drawable3D)
+
+private:
+ Handle(Message_Report) myReport;
+};
+
+
+
+
+
+
+
+#endif // _Draw_Report_HeaderFile
Draw_Marker3D.cxx
Draw_Marker3D.hxx
Draw_MarkerShape.hxx
+Draw_MessageCommands.cxx
Draw_Number.cxx
Draw_Number.hxx
Draw_PInterp.hxx
Draw_ProgressIndicator.cxx
Draw_ProgressIndicator.hxx
Draw_Replace.tcl
+Draw_Report.cxx
+Draw_Report.hxx
Draw_Segment2D.cxx
Draw_Segment2D.hxx
Draw_Segment3D.cxx
Message_Alert.hxx
Message_AlertExtended.cxx
Message_AlertExtended.hxx
+Message_Alerts.hxx
Message_Algorithm.cxx
Message_Algorithm.hxx
Message_Algorithm.lxx
-Message_Attribute.hxx
Message_Attribute.cxx
-Message_AttributeObject.hxx
+Message_Attribute.hxx
Message_AttributeObject.cxx
-Message_AttributeVectorOfReal.hxx
-Message_AttributeVectorOfReal.cxx
-Message_AttributeVectorOfRealVec3.hxx
-Message_AttributeVectorOfRealVec3.cxx
+Message_AttributeObject.hxx
+Message_AttributeVectorOfValues.cxx
+Message_AttributeVectorOfValues.hxx
Message_CompositeAlerts.cxx
Message_CompositeAlerts.hxx
Message_ExecStatus.hxx
}
return Standard_False;
}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+TCollection_AsciiString Message::TransientToString (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
+{
+ if (thePointer.IsNull())
+ return TCollection_AsciiString();
+
+ return PointerToString(thePointer.operator->(), isShortInfo);
+}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+TCollection_AsciiString Message::PointerToString (const void* thePointer, const bool isShortInfo)
+{
+ std::ostringstream aPtrStr;
+ aPtrStr << thePointer;
+ if (!isShortInfo)
+ return aPtrStr.str().c_str();
+
+ TCollection_AsciiString anInfoPtr (aPtrStr.str().c_str());
+ for (int aSymbolId = 1; aSymbolId < anInfoPtr.Length(); aSymbolId++)
+ {
+ if (anInfoPtr.Value(aSymbolId) != '0')
+ {
+ anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
+ anInfoPtr.Prepend("0x");
+ return anInfoPtr;
+ }
+ }
+ return aPtrStr.str().c_str();
+}
Standard_EXPORT static Standard_Boolean GravityFromString (const Standard_CString theGravityString,
Message_Gravity& theGravity);
-
+ //! Returns separator symbol of Dump information
+ static Standard_Character DumpSeparator() { return '\\'; }
+
+ //! Convert handle pointer to string value
+ //! \param thePointer a pointer
+ //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
+ //! \return the string value
+ Standard_EXPORT static TCollection_AsciiString TransientToString (const Handle(Standard_Transient)& thePointer,
+ const bool isShortInfo = true);
+
+ //! Convert pointer to string value
+ //! \param thePointer a pointer
+ //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped
+ //! \return the string value
+ Standard_EXPORT static TCollection_AsciiString PointerToString (const void* thePointer,
+ const bool isShortInfo = true);
protected:
--- /dev/null
+// Created on: 2018-06-10
+// 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 _Message_Alerts_HeaderFile
+#define _Message_Alerts_HeaderFile
+
+#include <Message.hxx>
+#include <Message_AlertExtended.hxx>
+#include <Message_AttributeObject.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_Gravity.hxx>
+#include <Message_Report.hxx>
+
+static Handle(Message_Alert) OCCT_Message_Alert;
+
+#define MESSAGE_INFO(Name, Description, PerfMeter, ParentAlert) \
+ { \
+ if (!Message_Report::CurrentReport().IsNull() && \
+ Message_Report::CurrentReport()->IsActive (Message_Info)) \
+ { \
+ OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+ new Message_Attribute (Name, Description), PerfMeter, ParentAlert); \
+ } \
+ }
+
+#define MESSAGE_INFO_OBJECT(Object, Name, Description, PerfMeter, ParentAlert) \
+ { \
+ if (!Message_Report::CurrentReport().IsNull() && \
+ Message_Report::CurrentReport()->IsActive (Message_Info)) \
+ { \
+ OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+ new Message_AttributeObject (Object, Name, Description), PerfMeter, ParentAlert ); \
+ } \
+ }
+
+#define MESSAGE_INFO_VALUES(StreamValues, Name, Description, PerfMeter, ParentAlert) \
+ { \
+ if (!Message_Report::CurrentReport().IsNull() && \
+ Message_Report::CurrentReport()->IsActive (Message_Info)) \
+ { \
+ OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+ new Message_AttributeVectorOfValues (StreamValues, Name, Description), PerfMeter, ParentAlert ); \
+ } \
+ }
+
+#define DUMP_VALUE(OS, Value) \
+ { \
+ OS << Value << Message::DumpSeparator(); \
+ }
+
+#define DUMP_VALUES(OS, Value1, Value2) \
+ { \
+ OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
+ }
+
+
+#endif // _Message_Alerts_HeaderFile
+++ /dev/null
-// Created on: 2018-06-10
-// 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 <Message_AttributeVectorOfReal.hxx>
-
-#include <Message_Msg.hxx>
-#include <Message_PerfMeter.hxx>
-
-#include <Message_Report.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
-
-//=======================================================================
-//function : Message_AttributeVectorOfReal
-//purpose :
-//=======================================================================
-
-Message_AttributeVectorOfReal::Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
- const TCollection_AsciiString& theName,
- const TCollection_AsciiString& theDescription)
-: Message_Attribute(theName, theDescription)
-{
- SetValues (theValues);
-}
-
-//=======================================================================
-//function : SetValues
-//purpose :
-//=======================================================================
-
-void Message_AttributeVectorOfReal::SetValues (const NCollection_Vector<Standard_Real>& theValues)
-{
- myValues = theValues;
-
- myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
- if (myValues.Length() < 2)
- return;
-
- myCachedValue += myValues.First();
- myCachedValue += " ... ";
- myCachedValue += myValues.Last();
-}
-
-//=======================================================================
-//function : GetDescription
-//purpose :
-//=======================================================================
-
-const TCollection_AsciiString& Message_AttributeVectorOfReal::GetDescription() const
-{
- if (!Message_Attribute::GetDescription().IsEmpty())
- return Message_Attribute::GetDescription();
-
- return myCachedValue;
-}
-
+++ /dev/null
-// Created on: 2018-06-10
-// 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 _Message_AttributeVectorOfReal_HeaderFile
-#define _Message_AttributeVectorOfReal_HeaderFile
-
-#include <Message_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <NCollection_Vector.hxx>
-
-class Message_PerfMeter;
-class Message_Report;
-
-//! Alert object storing container of Standard_Real values in its field
-class Message_AttributeVectorOfReal : public Message_Attribute
-{
-public:
-
- //! Constructor with string argument
- Standard_EXPORT Message_AttributeVectorOfReal (const NCollection_Vector<Standard_Real>& theValues,
- const TCollection_AsciiString& theName = TCollection_AsciiString(),
- const TCollection_AsciiString& theDescription = TCollection_AsciiString());
-
- //! Sets the values
- //! @param theValues container of values
- Standard_EXPORT void SetValues (const NCollection_Vector<Standard_Real>& theValues);
-
- //! Returns values
- //! @return values
- const NCollection_Vector<Standard_Real>& GetValues() const { return myValues; }
-
- //! Returns description of alert if it is set
- //! @return alert description
- virtual const TCollection_AsciiString& GetDescription() const;
-
-
- // OCCT RTTI
- DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfReal, Message_Attribute)
-
-private:
- NCollection_Vector<Standard_Real> myValues; //!< container of values
- TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
-};
-
-#endif // _Message_AttributeVectorOfReal_HeaderFile
+++ /dev/null
-// Created on: 2018-06-10
-// 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 <Message_AttributeVectorOfRealVec3.hxx>
-
-#include <Message_Msg.hxx>
-#include <Message_PerfMeter.hxx>
-#include <Message_Report.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
-
-//=======================================================================
-//function : Message_AttributeVectorOfRealVec3
-//purpose :
-//=======================================================================
-
-Message_AttributeVectorOfRealVec3::Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
- const TCollection_AsciiString& theName,
- const TCollection_AsciiString& theDescription)
-: Message_Attribute (theName, theDescription)
-{
- SetValues (theValues);
-}
-
-//=======================================================================
-//function : SetValues
-//purpose :
-//=======================================================================
-
-void Message_AttributeVectorOfRealVec3::SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues)
-{
- myValues = theValues;
-
- myCachedValue = TCollection_AsciiString ("[") + (Standard_Integer)myValues.Length() + "] : ";
- if (myValues.Length() < 2)
- return;
-
- NCollection_Vec3<Standard_Real> aValue = myValues.First();
- myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
- myCachedValue += " ... ";
- aValue = myValues.Last();
- myCachedValue = myCachedValue + "(" + aValue.x() + "," + aValue.y() + "," + aValue.z() + ")";
-}
-
-//=======================================================================
-//function : GetDescription
-//purpose :
-//=======================================================================
-
-const TCollection_AsciiString& Message_AttributeVectorOfRealVec3::GetDescription() const
-{
- if (!Message_Attribute::GetDescription().IsEmpty())
- return Message_Attribute::GetDescription();
-
- return myCachedValue;
-}
-
+++ /dev/null
-// Created on: 2018-06-10
-// 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 _Message_AttributeVectorOfRealVec3_HeaderFile
-#define _Message_AttributeVectorOfRealVec3_HeaderFile
-
-#include <Message_Attribute.hxx>
-#include <TCollection_AsciiString.hxx>
-
-#include <NCollection_Vector.hxx>
-#include <NCollection_Vec3.hxx>
-
-//! Alert object storing container of Standard_Real values in its field
-class Message_AttributeVectorOfRealVec3 : public Message_Attribute
-{
-public:
-
- //! Constructor with string argument
- Standard_EXPORT Message_AttributeVectorOfRealVec3 (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues,
- const TCollection_AsciiString& theName = TCollection_AsciiString(),
- const TCollection_AsciiString& theDescription = TCollection_AsciiString());
-
- //! Sets the values
- //! @param theValues container of values
- Standard_EXPORT void SetValues (const NCollection_Vector<NCollection_Vec3<Standard_Real>>& theValues);
-
- //! Returns values
- //! @return values
- const NCollection_Vector<NCollection_Vec3<Standard_Real>>& GetValues() const { return myValues; }
-
- //! Returns description of alert if it is set
- //! @return alert description
- virtual const TCollection_AsciiString& GetDescription() const;
-
- // OCCT RTTI
- DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfRealVec3, Message_Attribute)
-
-private:
- NCollection_Vector<NCollection_Vec3<Standard_Real>> myValues; //!< container of values
- TCollection_AsciiString myCachedValue;
- TCollection_AsciiString myDescription; //!< short description of the values in form: [size] : first ... last
-};
-
-#endif // _Message_AttributeVectorOfRealVec3_HeaderFile
--- /dev/null
+// Created on: 2018-06-10
+// 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 <Message_AttributeVectorOfValues.hxx>
+
+#include <Message.hxx>
+#include <Message_Msg.hxx>
+#include <Message_PerfMeter.hxx>
+#include <Message_Report.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
+
+//=======================================================================
+//function : SetValues
+//purpose :
+//=======================================================================
+Message_AttributeVectorOfValues::Message_AttributeVectorOfValues (const Standard_SStream& theStream,
+ const TCollection_AsciiString& theName,
+ const TCollection_AsciiString& theDescription)
+: Message_Attribute(theName, theDescription)
+{
+ TCollection_AsciiString aStream (theStream.str().c_str());
+ Standard_Character aSeparator = Message::DumpSeparator();
+ Standard_Integer aColumnCount = 0;
+
+ TCollection_AsciiString aCurrentString = aStream;
+ Standard_Integer aPosition = aCurrentString.Search (aSeparator);
+ if (aPosition >= 1)
+ {
+ TCollection_AsciiString aTailString = aCurrentString.Split (aPosition);
+ Standard_Integer aRow = 0;
+ Standard_Boolean aClassNameFound = Standard_False;
+ while (!aCurrentString.IsEmpty())
+ {
+ TCollection_AsciiString aValueString = aCurrentString;
+ aPosition = aValueString.Search (aSeparator);
+ if (aPosition < 0 )
+ break;
+ aCurrentString = aValueString.Split (aPosition - 1);
+
+ if (!aColumnCount)
+ {
+ if (!aClassNameFound)
+ aClassNameFound = Standard_True;
+ else
+ {
+ if (!aValueString.IsIntegerValue())
+ break; // not correct Dump, in correct the first value is number of property columns
+ aColumnCount = aValueString.IntegerValue();
+ }
+ }
+ else
+ myValues.Append (aValueString);
+
+ if (aTailString.IsEmpty())
+ break;
+ aCurrentString = aTailString;
+ aPosition = aCurrentString.Search (aSeparator);
+ if (aPosition < 0 )
+ {
+ aCurrentString = aTailString;
+ aTailString = TCollection_AsciiString();
+ }
+ else
+ aTailString = aCurrentString.Split (aPosition);
+ }
+ }
+ myColumnCount = aColumnCount;
+}
+
+//=======================================================================
+//function : SetValues
+//purpose :
+//=======================================================================
+
+void Message_AttributeVectorOfValues::SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues)
+{
+ myValues = theValues;
+
+ int aLength = (Standard_Integer)myValues.Length();
+ if (aLength < 2)
+ return;
+
+ if (myColumnCount <= 0)
+ myCachedValue = TCollection_AsciiString ("[") + aLength + "] : ";
+ else
+ myCachedValue = TCollection_AsciiString ("[") + (aLength / myColumnCount) + ", " + myColumnCount + "] : ";
+
+ myCachedValue += myValues.First();
+ myCachedValue += " ... ";
+ myCachedValue += myValues.Last();
+}
+
+//=======================================================================
+//function : GetDescription
+//purpose :
+//=======================================================================
+
+const TCollection_AsciiString& Message_AttributeVectorOfValues::GetDescription() const
+{
+ if (!Message_Attribute::GetDescription().IsEmpty())
+ return Message_Attribute::GetDescription();
+
+ return myCachedValue;
+}
+
--- /dev/null
+// Created on: 2018-06-10
+// 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 _Message_AttributeVectorOfValues_HeaderFile
+#define _Message_AttributeVectorOfValues_HeaderFile
+
+#include <Message_Attribute.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <NCollection_Vector.hxx>
+
+class Message_PerfMeter;
+class Message_Report;
+
+//! Alert object storing container of Standard_Real values in its field
+class Message_AttributeVectorOfValues : public Message_Attribute
+{
+public:
+
+ //! Constructor with string argument
+ Standard_EXPORT Message_AttributeVectorOfValues (const Standard_SStream& theStream,
+ const TCollection_AsciiString& theName = TCollection_AsciiString(),
+ const TCollection_AsciiString& theDescription = TCollection_AsciiString());
+
+ //! Sets the values
+ //! @param theValues container of values
+ Standard_EXPORT void SetValues (const NCollection_Vector<TCollection_AsciiString>& theValues);
+
+ //! Returns values
+ //! @return values
+ const NCollection_Vector<TCollection_AsciiString>& GetValues() const { return myValues; }
+
+ //! Returns description of alert if it is set
+ //! @return alert description
+ virtual const TCollection_AsciiString& GetDescription() const;
+
+
+ //! Sets value to present values in a table view
+ //! \param theValue value of division the values on sub-containers
+ void SetColumnCount (const Standard_Integer& theValue) { myColumnCount = theValue; }
+
+ //! Gets value to present values in a table view
+ //! \param theSubSize value of division the values on sub-containers
+ Standard_Integer GetColumnCount() const { return myColumnCount; }
+
+ // OCCT RTTI
+ DEFINE_STANDARD_RTTIEXT(Message_AttributeVectorOfValues, Message_Attribute)
+
+private:
+ NCollection_Vector<TCollection_AsciiString> myValues; //!< container of values
+ Standard_Integer myColumnCount; //!< value to present container of values into table
+
+ TCollection_AsciiString myCachedValue; //!< short description of the values in form: [size] : first ... last
+};
+
+#endif // _Message_AttributeVectorOfValues_HeaderFile
IMPLEMENT_STANDARD_RTTIEXT(Message_Report,Standard_Transient)
+static Handle(Message_Report) MyReport;
+
//=======================================================================
//function : Message_Report
//purpose :
SetActive (Standard_True);
}
+//=======================================================================
+//function : CurrentReport
+//purpose :
+//=======================================================================
+Handle(Message_Report) Message_Report::CurrentReport(const Standard_Boolean theToCreate)
+{
+ if (MyReport.IsNull() && theToCreate)
+ MyReport = new Message_Report();
+
+ return MyReport;
+}
+
//=======================================================================
//function : AddAlert
//purpose :
//! Empty constructor
Standard_EXPORT Message_Report ();
+ //! returns the only one instance of Report
+ //! When theToCreate is true - automatically creates message report when not exist.
+ //! that has been created.
+ Standard_EXPORT static Handle(Message_Report) CurrentReport (const Standard_Boolean theToCreate = Standard_False);
+
//! Add alert with specified gravity.
//! This method is thread-safe, i.e. alerts can be added from parallel threads safely.
Standard_EXPORT void AddAlert (Message_Gravity theGravity, const Handle(Message_Alert)& theAlert);
{
public:
//! Constructor with shape argument
- TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
- const TCollection_AsciiString& theName = TCollection_AsciiString(),
- const TCollection_AsciiString& theDescription = TCollection_AsciiString())
- : Message_Attribute (theName, theDescription), myShape (theShape) {}
+ Standard_EXPORT TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theName = TCollection_AsciiString(),
+ const TCollection_AsciiString& theDescription = TCollection_AsciiString());
//! Returns contained shape
const TopoDS_Shape& GetShape() const { return myShape; }
TopoDS_Shape myShape;
};
+#define MESSAGE_INFO_SHAPE(Shape, Name, Description, PerfMeter, ParentAlert) \
+ { \
+ if (!Message_Report::CurrentReport().IsNull() && \
+ Message_Report::CurrentReport()->IsActive (Message_Info)) \
+ { \
+ OCCT_Message_Alert = Message_AlertExtended::AddAlert (Message_Report::CurrentReport(), \
+ new TopoDS_AlertAttribute (Shape, Name, Description), PerfMeter, ParentAlert); \
+ } \
+ }
#endif // _TopoDS_AlertAttribute_HeaderFile
#include <Message.hxx>
#include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
#include <Message_CompositeAlerts.hxx>
#include <Message_Report.hxx>
#include <TDataStd_Comment.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_Name.hxx>
-#include <TDataStd_RealArray.hxx>
+#include <TDataStd_ExtStringArray.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
TDataStd_Comment::Set (theAlertLabel, anAttribute->GetDescription());
Standard_CString aDynamicTypeName = anAttribute->DynamicType()->Name();
- if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
+ if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
{
- Handle(Message_AttributeVectorOfReal) aRealArrayAlert = Handle(Message_AttributeVectorOfReal)::DownCast (anAttribute);
+ Handle(Message_AttributeVectorOfValues) aValuesArrayAlert = Handle(Message_AttributeVectorOfValues)::DownCast (anAttribute);
// store values
- const NCollection_Vector<double>& anArrayValues = aRealArrayAlert->GetValues();
+ const NCollection_Vector<TCollection_AsciiString>& anArrayValues = aValuesArrayAlert->GetValues();
// create real list attribute only if there are values in the attribute
if (anArrayValues.IsEmpty())
return;
int anArraySize = anArrayValues.Length();
- Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, anArraySize - 1);
+ Handle(TDataStd_ExtStringArray) aListAttribute = TDataStd_ExtStringArray::Set (theAlertLabel, 0, anArraySize - 1);
for (int aValueId = 0; aValueId < anArraySize; aValueId++)
- aRealListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
- }
- else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
- {
- Handle(Message_AttributeVectorOfRealVec3) aRealArrayAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (anAttribute);
- // store values
- const NCollection_Vector<NCollection_Vec3<double>>& anArrayValues = aRealArrayAlert->GetValues();
- // create real list attribute only if there are values in the attribute
- if (anArrayValues.IsEmpty())
- return;
- int anArraySize = anArrayValues.Length();
- Handle(TDataStd_RealArray) aRealListAttribute = TDataStd_RealArray::Set (theAlertLabel, 0, 3 * anArraySize - 1);
- for (int aValueId = 0; aValueId < anArraySize; aValueId++)
- {
- NCollection_Vec3<double> aValue = anArrayValues.Value (aValueId);
- aRealListAttribute->SetValue (3 * aValueId, aValue.x());
- aRealListAttribute->SetValue (3 * aValueId + 1, aValue.y());
- aRealListAttribute->SetValue (3 * aValueId + 2, aValue.z());
- }
+ aListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
}
}
Handle(Message_Attribute) aMessageAttribute;
if (aDynamicTypeName == STANDARD_TYPE (Message_Attribute)->Name())
aMessageAttribute = new Message_Attribute();
- else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfReal)->Name())
+ else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
{
// values
- NCollection_Vector<double> anArrayValues;
- if (!aParametersLabel.FindAttribute (TDataStd_RealArray::GetID(), anAttribute))
+ NCollection_Vector<TCollection_AsciiString> anArrayValues;
+ if (!aParametersLabel.FindAttribute (TDataStd_ExtStringArray::GetID(), anAttribute))
return Handle(Message_Alert)();
- Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
+ Handle(TDataStd_ExtStringArray) aValuesAttribute = Handle(TDataStd_ExtStringArray)::DownCast (anAttribute);
if (aValuesAttribute.IsNull())
return Handle(Message_Alert)();
for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
anArrayValues.Append (aValuesAttribute->Value (aValueId));
- aMessageAttribute = new Message_AttributeVectorOfReal (anArrayValues);
- }
- else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfRealVec3)->Name())
- {
- // values
- NCollection_Vector<NCollection_Vec3<double>> anArrayValues;
- if (!aParametersLabel.FindAttribute(TDataStd_RealArray::GetID(), anAttribute))
- return Handle(Message_Alert)();
-
- Handle(TDataStd_RealArray) aValuesAttribute = Handle(TDataStd_RealArray)::DownCast (anAttribute);
- if (aValuesAttribute.IsNull())
- return Handle(Message_Alert)();
-
- for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper();
- aValueId = aValueId + 3)
- {
- NCollection_Vec3<double> aValue (aValuesAttribute->Value (aValueId),
- aValuesAttribute->Value (aValueId + 1),
- aValuesAttribute->Value (aValueId + 2));
- anArrayValues.Append (aValue);
- }
- aMessageAttribute = new Message_AttributeVectorOfRealVec3 (anArrayValues);
+ Standard_SStream aStream;
+ Handle(Message_AttributeVectorOfValues) anAlert = new Message_AttributeVectorOfValues (aStream);
+ anAlert->SetValues (anArrayValues);
+ aMessageAttribute = anAlert;
}
if (!aMessageAttribute.IsNull())
001 dfbrowser
001 shapeview
001 vinspector
+001 messageview
--- /dev/null
+pload ALL INSPECTOR
+vinit
+
+activateReport -mode on -gravity info
+
+box s 200 100 120
+vdisplay s -dispmode 1
+vfit
+vselmode 2 1
+
+tinspector -plugins shapeview
+tinspector -plugins messageview
MessageModel_ItemRoot.hxx
MessageModel_ReportCallBack.cxx
MessageModel_ReportCallBack.hxx
-MessageModel_TableModelRealValues.cxx
-MessageModel_TableModelRealValues.hxx
-MessageModel_TableModelRealVec3Values.cxx
-MessageModel_TableModelRealVec3Values.hxx
+MessageModel_TableModelValues.cxx
+MessageModel_TableModelValues.hxx
MessageModel_Tools.cxx
MessageModel_Tools.hxx
MessageModel_TreeModel.cxx
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>icons/item_shape.png</file>
- <file>icons/item_vectorOfReal.png</file>
- <file>icons/item_vectorOfRealVec3.png</file>
+ <file>icons/item_vectorOfValues.png</file>
</qresource>
</RCC>
#include <inspector/TInspectorAPI_PluginParameters.hxx>
#include <inspector/ViewControl_Tools.hxx>
+#include <Message_AlertExtended.hxx>
+
#include <TCollection_AsciiString.hxx>
-#include <TopoDS_AlertWithShape.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
return;
aReport->SetActive (Standard_False);
- ((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
+ ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
}
// =======================================================================
return;
aReport->SetActive (Standard_True);
- ((MessageModel_TreeModel*)mySelectionModel)->EmitDataChanged (aReportIndex, aReportIndex);
+ ((MessageModel_TreeModel*)mySelectionModel->model())->EmitDataChanged (aReportIndex, aReportIndex);
}
// =======================================================================
if (anAlert.IsNull())
continue;
- Handle(TopoDS_AlertWithShape) aShapeAlert = Handle(TopoDS_AlertWithShape)::DownCast (anAlert);
- if (aShapeAlert.IsNull() || aShapeAlert->GetShape().IsNull())
+ 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 = aShapeAlert->GetShape();
+ const TopoDS_Shape aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
if (aShape.IsNull())
continue;
aPluginParameters.Append (aShape.TShape());
#ifndef MessageModel_Actions_H
#define MessageModel_Actions_H
-#ifdef _MSC_VER
- #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
#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;
#include <inspector/TreeModel_Tools.hxx>
#include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
#include <Message_CompositeAlerts.hxx>
#include <TCollection_AsciiString.hxx>
-#include <TopoDS_AlertWithShape.hxx>
+#include <TopoDS_AlertAttribute.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QColor>
#include <QIcon>
+#include <Standard_WarningsRestore.hxx>
// =======================================================================
// function : initValue
// if the alert is composite, process the real alert
if (theRole == Qt::DecorationRole && Column() == 0)
{
- if (anAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
+ Handle(Message_AlertExtended) anExtAttribute = Handle(Message_AlertExtended)::DownCast (anAlert);
+ if (anExtAttribute.IsNull())
+ return QVariant();
+
+ Handle(Message_Attribute) anAttribute = anExtAttribute->Attribute();
+
+ if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
return QIcon (":/icons/item_shape.png");
- else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
- return QIcon (":/icons/item_vectorOfReal.png");
- else if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
- return QIcon (":/icons/item_vectorOfRealVec3.png");
+ else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+ return QIcon (":/icons/item_vectorOfValues.png");
else
return QVariant();
}
#include <Standard.hxx>
#include <TopoDS_Shape.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
#include <NCollection_Vector.hxx>
#include <OSD_Path.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QColor>
+#include <Standard_WarningsRestore.hxx>
// =======================================================================
// function : initValue
#include <TCollection_AsciiString.hxx>
#include <Message_Report.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
class MessageModel_ItemReport;
typedef QExplicitlySharedDataPointer<MessageModel_ItemReport> MessageModel_ItemReportPtr;
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 :
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);
+
//! Clears internal container of added reports
void RemoveAllReports() { myReports.Clear(); }
+++ /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/MessageModel_TableModelRealValues.hxx>
-
-#include <inspector/ViewControl_TableModel.hxx>
-
-const int REAL_SIGNS = 16;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-MessageModel_TableModelRealValues::MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute,
- const int theSectionWidth)
- : myAttribute (Handle(Message_AttributeVectorOfReal)::DownCast (theAttribute))
-{
- SetUseTableProperties (true);
- SetUseTablePropertiesXStep (true, -1);
-
- SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
-}
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int MessageModel_TableModelRealValues::ColumnCount (const QModelIndex&) const
-{
- return myAttribute->GetValues().Length();
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_TableModelRealValues::Data (const int, const int theColumn, int theRole) const
-{
- if (theRole == Qt::DisplayRole && theColumn < myAttribute->GetValues().Length())
- {
- return myAttribute->GetValues().Value(theColumn);
- }
-
- return QVariant();
-}
-
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-void MessageModel_TableModelRealValues::GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
-{
- double aMinValue, aMaxValue;
- aMinValue = DBL_MAX;
- aMaxValue = DBL_MIN;
-
- NCollection_Vector<double> aValues = myAttribute->GetValues();
- int aValuesSize = aValues.Length();
- if (aValuesSize < 1)
- return;
-
- if (theSelected.isEmpty())
- {
- aMinValue = aMaxValue = aValues.First();
- for (int i = 1; i < aValuesSize; i++)
- {
- double aValue = aValues.Value (i);
- if (aValue < aMinValue) aMinValue = aValue;
- if (aValue > aMaxValue) aMaxValue = aValue;
- }
- }
- else
- {
- ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
- int aRow, aColumn;
- for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
- {
- aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
- if (aColumn >= aValuesSize)
- continue;
-
- double aValue = aValues.Value (aColumn);
- if (aValue < aMinValue) aMinValue = aValue;
- if (aValue > aMaxValue) aMaxValue = aValue;
- }
- }
-
- theMinValue = QString::number(aMinValue, 'g', REAL_SIGNS);
- theMaxValue = QString::number(aMaxValue, 'g', REAL_SIGNS);
-}
+++ /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 MessageModel_TableModelRealValues_H
-#define MessageModel_TableModelRealValues_H
-
-#ifdef _MSC_VER
- #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <Message_AttributeVectorOfReal.hxx>
-
-//! \class MessageModel_TableModelRealValues
-//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfReal object
-class MessageModel_TableModelRealValues : public ViewControl_TableModelValues
-{
-public:
-
- //! Constructor
- Standard_EXPORT MessageModel_TableModelRealValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
-
- //! Destructor
- virtual ~MessageModel_TableModelRealValues() Standard_OVERRIDE {}
-
- //! Returns number of columns, size of header values
- //! \param theParent an index of the parent item
- //! \return an integer value
- Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
-
- //! Returns number of rows, depending on orientation: myColumnCount or size of values container
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
-
- //! 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 int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
-
- //! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
- //! \param theMinValue minimum
- //! \param theMaxValue maximum
- //! \param theSelected selected cells
- virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
-
-private:
- Handle(Message_AttributeVectorOfReal) myAttribute; //!< alert attribute, container of table values
-};
-
-#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/MessageModel_TableModelRealVec3Values.hxx>
-
-#include <inspector/ViewControl_TableModel.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-MessageModel_TableModelRealVec3Values::MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute,
- const int theSectionWidth)
- : myAttribute (Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAttribute))
-{
- SetUseTableProperties (true);
-
- SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
-}
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int MessageModel_TableModelRealVec3Values::ColumnCount (const QModelIndex&) const
-{
- return myAttribute->GetValues().Length();
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_TableModelRealVec3Values::Data (const int, const int theColumn, int theRole) const
-{
- if (theRole != Qt::DisplayRole || theColumn > myAttribute->GetValues().Length())
- return QVariant();
-
- NCollection_Vec3<double> aValue = myAttribute->GetValues().Value(theColumn);
- return QString ("%1, %2, %3").arg (aValue.x()).arg (aValue.y()).arg (aValue.z());
-}
-
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-void MessageModel_TableModelRealVec3Values::GetRangeValues (QString& theMinValue, QString& theMaxValue,
- const QModelIndexList& theSelected) const
-{
- theMinValue = DBL_MAX;
- theMaxValue = DBL_MIN;
-
- QList<int> aValuePositions;
- if (!theSelected.isEmpty())
- {
- ViewControl_TableModel* aModel = (ViewControl_TableModel*)theSelected[0].model();
- int aRow, aColumn;
- for (QModelIndexList::const_iterator aSelIt = theSelected.begin(); aSelIt != theSelected.end(); aSelIt++)
- {
- aModel->GetSourcePosition (*aSelIt, aRow, aColumn);
- aValuePositions.append (aColumn);
- }
- }
-
- NCollection_Vector<NCollection_Vec3<double>> aValues = myAttribute->GetValues();
- int aValuesSize = aValues.Length();
- if (aValuesSize < 1)
- return;
-
- double aXMinValue = aValues.First().x(), aXMaxValue = aValues.First().x();
- NCollection_Vec3<double> aValue;
- for (int i = 1; i < aValuesSize; i++)
- {
- if (!aValuePositions.empty() && !aValuePositions.contains (i))
- continue;
-
- aValue = aValues.Value (i);
- if (aValue.x() < aXMinValue) aXMinValue = aValue.x();
- if (aValue.x() > aXMaxValue) aXMaxValue = aValue.x();
- }
-
- double anYMinValue = aValues.First().y(), anYMaxValue = aValues.First().y();
- for (int i = 1; i < aValuesSize; i++)
- {
- if (!aValuePositions.empty() && !aValuePositions.contains (i))
- continue;
-
- aValue = aValues.Value (i);
- if (aValue.x() == aXMinValue && aValue.y() < anYMinValue) anYMinValue = aValue.y();
- if (aValue.x() == aXMaxValue && aValue.y() > anYMaxValue) anYMaxValue = aValue.y();
- }
-
- double aZMinValue = aValues.First().z(), aZMaxValue = aValues.First().z();
- for (int i = 1; i < aValuesSize; i++)
- {
- if (!aValuePositions.empty() && !aValuePositions.contains (i))
- continue;
- aValue = aValues.Value (i);
- if (aValue.x() == aXMinValue && aValue.y() == anYMinValue && aValue.z() < aZMinValue) aZMinValue = aValue.z();
- if (aValue.x() == aXMaxValue && aValue.y() == anYMaxValue && aValue.z() > aZMaxValue) aZMaxValue = aValue.z();
- }
-
- theMinValue = QString ("%1, %2, %3").arg (aXMinValue).arg (anYMinValue).arg (aZMinValue);
- theMaxValue = QString ("%1, %2, %3").arg (aXMaxValue).arg (anYMaxValue).arg (aZMaxValue);
-}
+++ /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 MessageModel_TableModelRealVec3Values_H
-#define MessageModel_TableModelRealVec3Values_H
-
-#ifdef _MSC_VER
- #pragma warning(disable : 4127 4718) // conditional expression is constant, recursive call has no side effects
-#endif
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <Message_AttributeVectorOfRealVec3.hxx>
-
-//! \class MessageModel_TableModelRealVec3Values
-//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfRealVec3 object
-class MessageModel_TableModelRealVec3Values : public ViewControl_TableModelValues
-{
-public:
-
- //! Constructor
- Standard_EXPORT MessageModel_TableModelRealVec3Values (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
-
- //! Destructor
- virtual ~MessageModel_TableModelRealVec3Values() Standard_OVERRIDE {}
-
- //! Returns number of columns, size of header values
- //! \param theParent an index of the parent item
- //! \return an integer value
- Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
-
- //! Returns number of rows, depending on orientation: myColumnCount or size of values container
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const { (void)theParent; return 1; }
-
- //! 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 int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
-
- //! Returns minimum and maximum values of selected items or the table content (if selected list is empty)
- //! It finds firstly Xmax, then Ymax, after that Zmax. The same for min values.
- //! \param theMinValue minimum
- //! \param theMaxValue maximum
- //! \param theSelected selected cells
- virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const;
-
-private:
- Handle(Message_AttributeVectorOfRealVec3) myAttribute; //!< alert attribute, container of table values
-};
-
-#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/MessageModel_TableModelValues.hxx>
+
+#include <inspector/ViewControl_TableModel.hxx>
+
+#include <Message_AttributeVectorOfValues.hxx>
+
+const int REAL_SIGNS = 16;
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+
+MessageModel_TableModelValues::MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute,
+ const int theSectionWidth)
+ : myAttribute (Handle(Message_AttributeVectorOfValues)::DownCast (theAttribute))
+{
+ SetDefaultSectionSize (Qt::Horizontal, theSectionWidth);
+}
+
+// =======================================================================
+// function : ColumnCount
+// purpose :
+// =======================================================================
+
+int MessageModel_TableModelValues::ColumnCount (const QModelIndex&) const
+{
+ return myAttribute->GetColumnCount();
+}
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+int MessageModel_TableModelValues::RowCount (const QModelIndex& theParent) const
+{
+ int aColumnCount = ColumnCount (theParent);
+ if (!aColumnCount)
+ return 0;
+
+ return myAttribute->GetValues().Length() / aColumnCount;
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
+{
+ int aColumnCount = ColumnCount (QModelIndex());
+ int anIndex = theRow * aColumnCount + theColumn;
+
+ if (theRole == Qt::DisplayRole && anIndex < myAttribute->GetValues().Length())
+ {
+ return myAttribute->GetValues().Value(anIndex).ToCString();
+ }
+
+ return 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 MessageModel_TableModelValues_H
+#define MessageModel_TableModelValues_H
+
+#include <inspector/ViewControl_TableModelValues.hxx>
+
+#include <Message_Attribute.hxx>
+class Message_AttributeVectorOfValues;
+
+//! \class MessageModel_TableModelValues
+//! \brief This is an implementation for ViewControl_TableModel to present Message_AttributeVectorOfValues object
+class MessageModel_TableModelValues : public ViewControl_TableModelValues
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageModel_TableModelValues (const Handle(Message_Attribute)& theAttribute, const int theSectionWidth);
+
+ //! Destructor
+ virtual ~MessageModel_TableModelValues() Standard_OVERRIDE {}
+
+ //! Returns number of columns, size of header values
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const;
+
+ //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int RowCount (const QModelIndex& theParent) const;
+
+ //! 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 int theRow, const int theColumn, int theRole = Qt::DisplayRole) const;
+
+private:
+ Handle(Message_AttributeVectorOfValues) myAttribute; //!< alert attribute, container of table values
+};
+
+#endif
// commercial license or contractual agreement.
#include <inspector/MessageModel_Tools.hxx>
-#include <inspector/MessageModel_TableModelRealValues.hxx>
-#include <inspector/MessageModel_TableModelRealVec3Values.hxx>
+#include <inspector/MessageModel_TableModelValues.hxx>
#include <inspector/ViewControl_Table.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_TableModelValuesDefault.hxx>
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
+
#include <Precision.hxx>
-#include <TopoDS_AlertWithShape.hxx>
+#include <TopoDS_AlertAttribute.hxx>
#include <TopoDS_Edge.hxx>
// =======================================================================
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetPointerAlertInfo (const Handle(Message_Alert)& theAlert)
{
- if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
- return GetPointerInfo (Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape());
- else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
- return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject());
+ Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+ if (anExtAlert.IsNull())
+ return TCollection_AsciiString();
+
+ Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+ if (anAttribute.IsNull())
+ return TCollection_AsciiString();
+
+ if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ return GetPointerInfo (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape());
+ else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+ return GetPointerInfo (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
return TCollection_AsciiString();
}
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetShapeTypeAlertInfo (const Handle(Message_Alert)& theAlert)
{
- TopoDS_Shape aShape;
+ Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+ if (anExtAlert.IsNull())
+ return TCollection_AsciiString();
- if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
- aShape = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape();
+ Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+ if (anAttribute.IsNull())
+ return TCollection_AsciiString();
+
+ TopoDS_Shape aShape;
+ if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ aShape = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape();
if (aShape.IsNull())
return TCollection_AsciiString();
// =======================================================================
TCollection_AsciiString MessageModel_Tools::GetStandardTypeAlertInfo (const Handle(Message_Alert)& theAlert)
{
+ Handle(Message_AlertExtended) anExtAlert = Handle(Message_AlertExtended)::DownCast (theAlert);
+ if (anExtAlert.IsNull())
+ return TCollection_AsciiString();
+
+ Handle(Message_Attribute) anAttribute = anExtAlert->Attribute();
+ if (anAttribute.IsNull())
+ return TCollection_AsciiString();
+
Handle(Standard_Transient) aPointer;
- if (theAlert->IsKind (STANDARD_TYPE (TopoDS_AlertWithShape)))
- aPointer = Handle(TopoDS_AlertWithShape)::DownCast (theAlert)->GetShape().TShape();
- else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeObject)))
- aPointer = Handle(Message_AttributeObject)::DownCast (theAlert)->GetObject();
+ if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ aPointer = Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape().TShape();
+ else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+ aPointer = Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject();
if (aPointer.IsNull())
return TCollection_AsciiString();
void MessageModel_Tools::GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
QList<ViewControl_TableModelValues*>& theTableValues)
{
- ViewControl_TableModelValues* aTableValues = 0;
-
Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(theAlert);
if (anExtendedAlert.IsNull())
return;
if (anAttribute.IsNull())
return;
- if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
- {
- int aSectionSize = 60;
- aTableValues = new MessageModel_TableModelRealValues (anAttribute, aSectionSize);
- theTableValues.append (aTableValues);
- }
- else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
+ if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
{
- int aSectionSize = 160;
- aTableValues = new MessageModel_TableModelRealVec3Values (anAttribute, aSectionSize);
+ int aSectionSize = 200;
+ ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
theTableValues.append (aTableValues);
}
else
{
if (!anAttribute->GetDescription().IsEmpty())
{
- aTableValues = new ViewControl_TableModelValues();
+ ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
QList<TreeModel_HeaderSection> aHeaderValues;
QVector<QVariant> aValues;
aHeaderValues << TreeModel_HeaderSection ("Description", -2);
}
}
}
-
-// =======================================================================
-// function : BuildShape
-// purpose :
-// =======================================================================
-TopoDS_Shape MessageModel_Tools::BuildShape (const Handle(Message_Alert)& theAlert, QList<int> theSelectedIndices, ViewControl_Table* theTable)
-{
- if (theAlert.IsNull())
- return TopoDS_Shape();
-
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound(aCompound);
-
- if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)))
- {
- Handle(Message_AttributeVectorOfReal) aValuesAlert = Handle(Message_AttributeVectorOfReal)::DownCast (theAlert);
- NCollection_Vector<double> aValues = aValuesAlert->GetValues();
- int aValuesSize = aValues.Size();
-
- gp_Pnt aPreviousPoint(0, 0, 0), aCurrentPoint(0, 0, 0);
- double aXStep = theTable->GetProperty()->GetXStep();
- if (aXStep < 0)
- aXStep = 1;
- double aCurrentXValue = 0;
- for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
- {
- if (*anIt >= aValuesSize)
- continue;
-
- if (aCurrentXValue == 0)
- { //just define the previous point
- aPreviousPoint.SetX (aCurrentXValue);
- aPreviousPoint.SetY (aValues.Value (*anIt));
- aCurrentXValue = aCurrentXValue + aXStep;
- continue;
- }
- aCurrentPoint.SetX (aCurrentXValue);
- aCurrentPoint.SetY (aValues.Value (*anIt));
- if (aPreviousPoint.Distance (aCurrentPoint) < Precision::Confusion())
- continue;
-
- TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge (aPreviousPoint, aCurrentPoint);
- aBuilder.Add (aCompound, anEdge);
- aPreviousPoint = aCurrentPoint;
- aCurrentXValue = aCurrentXValue + aXStep;
- }
- }
- else if (theAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
- {
- Handle(Message_AttributeVectorOfRealVec3) aValuesAlert = Handle(Message_AttributeVectorOfRealVec3)::DownCast (theAlert);
- NCollection_Vector<NCollection_Vec3<double>> aValues = aValuesAlert->GetValues();
- int aValuesSize = aValues.Size();
-
- gp_Pnt aCurrentPoint(0, 0, 0);
- NCollection_Vec3<double> aValue;
- for (QList<int>::const_iterator anIt = theSelectedIndices.begin(); anIt != theSelectedIndices.end(); anIt++)
- {
- if (*anIt >= aValuesSize)
- continue;
-
- aValue = aValues.Value (*anIt);
- aCurrentPoint.SetX (aValue.x());
- aCurrentPoint.SetY (aValue.y());
- aCurrentPoint.SetZ (aValue.z());
-
- TopoDS_Vertex aVertex = BRepBuilderAPI_MakeVertex (aCurrentPoint);
- aBuilder.Add (aCompound, aVertex);
- }
- }
-
- return aCompound;
-}
#include <Standard_Transient.hxx>
#include <TopoDS_Shape.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QList>
-//#include <QColor>
+#include <Standard_WarningsRestore.hxx>
class Message_Alert;
class ViewControl_TableModelValues;
//! \param theTableValue container of values
Standard_EXPORT static void GetPropertyTableValues (const Handle(Message_Alert)& theAlert,
QList<ViewControl_TableModelValues*>& theTableValues);
-
- //! Creates TopoDS_Compound with TopoDS_Edge/Vertex on alert data
- //! \param theAlert a message alert
- //! \parm theSelectedIndices a container of indices
- //! \param theTableView source view
- Standard_EXPORT TopoDS_Shape static BuildShape (const Handle(Message_Alert)& theAlert, QList<int> aSelectedIndices,
- ViewControl_Table* theTableView);
};
#endif
m_pRootItem = myRootItems[0];
}
+// =======================================================================
+// function : HasShape
+// 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 : AddShape
// purpose :
#include <Message_Report.hxx>
#include <inspector/TreeModel_ModelBase.hxx>
+#include <Standard_WarningsDisable.hxx>
#include <QMap>
#include <QObject>
+#include <Standard_WarningsRestore.hxx>
class MessageModel_TreeModel;
//! Destructor
virtual ~MessageModel_TreeModel() Standard_OVERRIDE {};
+ //! 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
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="20"
+ height="20"
+ viewBox="0 0 5.2916664 5.2916666"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
+ sodipodi:docname="item_vectorOfReal.svg"
+ inkscape:export-filename="D:\OCCT\master_CR29451_1\tools\MessageModel\icons\item_vectorOfRealVec3.png"
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96">
+ <defs
+ id="defs2">
+ <linearGradient
+ id="linearGradient4578"
+ osb:paint="solid">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop4576" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="-2.6544163 : -0.28690906 : 1"
+ inkscape:vp_y="0 : 1028.295 : 0"
+ inkscape:vp_z="9.504499 : -1.1228559 : 1"
+ inkscape:persp3d-origin="2.7661607 : -1.3768436 : 1"
+ id="perspective3711" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="-10.548151"
+ inkscape:cy="10.279721"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:window-width="1446"
+ inkscape:window-height="838"
+ inkscape:window-x="1733"
+ inkscape:window-y="67"
+ inkscape:window-maximized="0"
+ units="px" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(71.966667,-93.642022)">
+ <rect
+ id="rect3769"
+ width="4.660512"
+ height="4.443356"
+ x="-71.632576"
+ y="94.056023"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.26458332;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ id="rect3769-3"
+ width="4.7041783"
+ height="2.2966287"
+ x="-71.676239"
+ y="96.202751"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.19110738;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ <rect
+ id="rect3769-9"
+ width="2.3560426"
+ height="4.4502382"
+ x="-71.617508"
+ y="94.071091"
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#8c8c8c;stroke-width:0.18826659;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+</svg>
#include <inspector/MessageModel_ItemAlert.hxx>
#include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfReal.hxx>
-#include <Message_AttributeVectorOfRealVec3.hxx>
+#include <Message_AttributeVectorOfValues.hxx>
#include <TopoDS_AlertAttribute.hxx>
if (anAlert.IsNull())
return false;
- if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfReal)) || anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfRealVec3)))
+ if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
return true;
return false;
#include <inspector/ViewControl_PropertyView.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
-#include <inspector/ViewControl_TableProperty.hxx>
#include <inspector/ViewControl_TreeView.hxx>
#include <inspector/View_Tools.hxx>
((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (MESSAGEVIEW_DEFAULT_TREE_VIEW_WIDTH,
MESSAGEVIEW_DEFAULT_TREE_VIEW_HEIGHT));
MessageModel_TreeModel* aModel = new MessageModel_TreeModel (myTreeView);
+ //aModel->SetReversed (Standard_True);
for (int i = 5; i <= 7; i++) // hide shape parameters columns
{
TreeModel_HeaderSection anItem = aModel->GetHeaderItem (i);
QMap<QString, QString> anItems;
TreeModel_Tools::SaveState (myTreeView, anItems);
View_Tools::SaveState (myViewWindow, anItems);
- ViewControl_PropertyView::SaveState (myPropertyView, 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());
continue;
else if (View_Tools::RestoreState (myViewWindow, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
continue;
- else if (ViewControl_PropertyView::RestoreState (myPropertyView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString()))
- continue;
}
}
myParameters->SetFileNames (aName, aNames);
isUpdated = true;
}
+ Handle(Message_Report) aDefaultReport = Message_Report::CurrentReport( Standard_False);
+ MessageModel_TreeModel* aViewModel = dynamic_cast<MessageModel_TreeModel*> (myTreeView->model());
+ if (!aDefaultReport.IsNull() && !aViewModel->HasReport (aDefaultReport))
+ {
+ aDefaultReport->SetCallBack (myCallBack);
+ addReport (aDefaultReport);
+ }
// reload report of selected item
onReloadReport();
return;
}
- TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
+ /*TopoDS_Shape aShapeOfSelection = MessageModel_Tools::BuildShape (anAlertItem->GetAlert(), aSelectedIndices[0], aFirstTable);
if (aShapeOfSelection.IsNull())
return;
{
anAlertItem->SetCustomShape (aShapeOfSelection);
aVisibilityState->SetVisible (anIndex, true);
- }
+ }*/
}
// =======================================================================
TreeModel_HeaderSection.hxx
TreeModel_ItemBase.cxx
TreeModel_ItemBase.hxx
+TreeModel_ItemProperties.cxx
+TreeModel_ItemProperties.hxx
TreeModel_ItemRole.hxx
TreeModel_ModelBase.cxx
TreeModel_ModelBase.hxx
#include <Standard.hxx>
#include <Standard_Macro.hxx>
#include <inspector/TreeModel_ItemRole.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QExplicitlySharedDataPointer>
//! \return the row count
int rowCount() const { return cachedValue(TreeModel_ItemRole_RowCountRole).toInt(); }
+ //! Sets item table properties builder
+ void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
+
+ //! Returns item table properties builder
+ Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; }
+
protected:
//! \param theParent the parent item
int m_iRow; //!< the item row position in the parent item
int m_iColumn; //!< the item column position in the parent item
bool m_bInitialized; //!< the state whether the item content is already initialized
+
+ Handle(TreeModel_ItemProperties) myProperties; //!< item properties
};
//! Returns an explicitly shared pointer to the pointer held by other, using a
--- /dev/null
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
--- /dev/null
+// Created on: 2019-02-25
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef TreeModel_ItemProperties_H
+#define TreeModel_ItemProperties_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/ViewControl_EditType.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+DEFINE_STANDARD_HANDLE (TreeModel_ItemProperties, Standard_Transient)
+
+//! \class TreeModel_ItemProperties
+//! Class to manipulate properties of tree item. The properties are organized in table structure
+class TreeModel_ItemProperties : public Standard_Transient
+{
+public:
+ //! Constructor
+ TreeModel_ItemProperties() {}
+
+ //! Destructor
+ ~TreeModel_ItemProperties() {}
+
+ //! Returns number of table rows
+ //! \return an integer value
+ virtual int GetTableColumnCount() const { return 2; }
+
+ //! Returns number of table rows
+ //! \return an integer value
+ virtual int GetTableRowCount() const { return 0; }
+
+ //! 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 GetTableEditType (const int theRow, const int theColumn) const
+ { (void)theRow; (void)theColumn; return ViewControl_EditType_None; }
+
+ //! Returns container of string values for enumeration in the model row
+ //! \param theRow table model row index
+ //! \param theColumn a model index column
+ //! \return string values for the enumeration presented in the row or an empty container
+ virtual QList<QVariant> GetTableEnumValues (const int theRow, const int theColumn) const
+ { (void)theRow; (void)theColumn; return QList<QVariant>(); }
+
+ //! Returns table value for the row in form: <function name> <function value>
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const
+ { (void)theRow; (void)theColumn; (void)theRole; return QVariant(); }
+
+ //! Sets the value into the table cell. Only 1st column value might be modified.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theValue a new cell value
+ virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+ { (void)theRow; (void)theColumn; (void)theValue; return false; }
+
+ DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
+};
+
+#endif
\ No newline at end of file
: QAbstractItemModel (theParent), m_pRootItem (0), m_pUseVisibilityColumn (false),
myVisibilityState (0)
{
+ myVisibleIcon = QIcon (":/icons/item_visible.png");
+ myInvisibleIcon = QIcon (":/icons/item_invisible.png");
}
// =======================================================================
if (!myVisibilityState || !myVisibilityState->CanBeVisible (theIndex))
return QVariant();
- QVariant aValue = QIcon (myVisibilityState->IsVisible (theIndex) ? ":/icons/item_visible.png"
- : ":/icons/item_invisible.png");
+ QVariant aValue = myVisibilityState->IsVisible (theIndex) ? myVisibleIcon : myInvisibleIcon;
anItem->SetCustomData (aValue, theRole);
return aValue;
}
TreeModel_ItemBasePtr anItem = GetItemByIndex (theIndex);
- return anItem->data (theIndex, theRole);
+ QVariant anItemData = anItem->data (theIndex, theRole);
+
+ if (anItemData.isNull() && theRole == Qt::BackgroundRole && myHighlightedIndices.contains (theIndex))
+ anItemData = TreeModel_Tools::LightHighlightColor();
+
+ return anItemData;
}
// =======================================================================
//!< \return the checker interface
TreeModel_VisibilityState* GetVisibilityState () const { return myVisibilityState; }
+ //! Returns true if the tree view model contains highlighted items. This highlight is set manually.
+ bool HasHighlighted() { return !myHighlightedIndices.isEmpty(); }
+
+ //! Sets items of the indices highlighted in the model.
+ //! \param theIndices a list of tree model indices
+ void SetHighlighted (const QModelIndexList& theIndices = QModelIndexList()) { myHighlightedIndices = theIndices; }
+
//! Returns the index of the item in the model specified by the given row, column and parent index.
//! Saves an internal pointer at the createIndex. This pointer is a shared pointer to the class,
//! that realizes a base item interface. If the parent is invalid, a root item is used, otherwise a new item
bool m_pUseVisibilityColumn; //!< the state whether column=0 is reserved for Visibility state
TreeModel_VisibilityState* myVisibilityState; //!< the interface of item visibility
+ QIcon myVisibleIcon; //!< icon of visible state
+ QIcon myInvisibleIcon; //!< icon of invisible state
+
+ QModelIndexList myHighlightedIndices; //!< tree model indices that should be visualized as highlighted
};
#endif
return aLength < theText.length() ? theText.mid (0, aLength) + theTail : theText;
}
+
+// =======================================================================
+// function : LightHighlightColor
+// purpose :
+// =======================================================================
+QColor TreeModel_Tools::LightHighlightColor()
+{
+ QWidget aWidget;
+ QPalette aPalette = aWidget.palette();
+ return aPalette.highlight().color().lighter();
+}
+
+// =======================================================================
+// function : SetExpandedTo
+// purpose :
+// =======================================================================
+void TreeModel_Tools::SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex)
+{
+ QAbstractItemModel* aModel = theTreeView->model();
+
+ QModelIndex aParent = aModel->parent (theIndex);
+ while (aParent.isValid())
+ {
+ theTreeView->setExpanded (aParent, true);
+ aParent = aModel->parent (aParent);
+ }
+}
+
+// =======================================================================
+// function : setExpanded
+// purpose :
+// =======================================================================
+void TreeModel_Tools::SetExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded,
+ int& theLevels)
+{
+ bool isToExpand = theLevels == -1 || theLevels > 0;
+ if (!isToExpand)
+ return;
+
+ theTreeView->setExpanded (theIndex, isExpanded);
+ if (theLevels != -1)
+ theLevels--;
+
+ QAbstractItemModel* aModel = theTreeView->model();
+ for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++)
+ {
+ int aLevels = theLevels;
+ SetExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels);
+ }
+}
#include <Standard_WarningsDisable.hxx>
#include <QApplication>
#include <QByteArray>
+#include <QColor>
#include <QMap>
#include <QString>
#include <QStyle>
//! \param theWidth width value, if -1, default value is used
//! \param theTail symbols added to the end of the cut string
Standard_EXPORT static QString CutString (const QString& theText, const int theWidth = -1, const QString& theTail = "...");
+
+ //! Returns light highlight color
+ //! \returns Qt color
+ Standard_EXPORT static QColor LightHighlightColor();
+
+ //! Makes the view expanded fron the root till the index
+ Standard_EXPORT static void SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex);
+
+ //! Recursive items expanding in tree view staring from the index
+ //! \param theTreeView an OCAF tree view
+ //! \param theParentIndex an index which children should be expanded
+ //! \param isExpanded a boolean state if the item should be expanded or collapsed
+ //! \param theLevels a number of levels to be expanded, or -1 for all levels
+ Standard_EXPORT static void SetExpanded (QTreeView* theTreeView,
+ const QModelIndex& theIndex,
+ const bool isExpanded,
+ int& theLevels);
+
};
#endif
#include <inspector/ViewControl_Pane.hxx>
#include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/ViewControl_PaneCreator.hxx>
SetHeaderVisible(Qt::Horizontal, Standard_False);
SetHeaderVisible(Qt::Vertical, Standard_False);
-
- SetUseTableSeparateSize (false);
- SetUseTableProperties (false);
- SetUseTablePropertiesXStep (false, -1);
}
// =======================================================================
return aFlags;
}
-// =======================================================================
-// function : GetRangeValues
-// purpose :
-// =======================================================================
-
-int VInspector_TableModelValues::GetValuesCount () const
-{
- VInspector_ItemBasePtr anItem = GetItem();
-
- int aRowCount = anItem->GetTableRowCount();
- Handle(Standard_Transient) anObject = anItem->GetObject();
- if (anObject.IsNull())
- return aRowCount * 2;
-
- for (NCollection_List<Handle(ViewControl_PaneCreator)>::Iterator anIterator (myCreators); anIterator.More(); anIterator.Next())
- {
- Handle(ViewControl_PaneCreator) aCreator = anIterator.Value();
- ViewControl_Pane* aPane = aCreator->GetPane (anObject->DynamicType()->Name());
- if (!aPane)
- continue;
- aRowCount += aPane->GetTableRowCount (anObject);
- }
- return aRowCount * 2;
-}
-
// =======================================================================
// function : GetEditType
// purpose :
#define VInspector_TableModelValues_H
#include <inspector/ViewControl_TableModelValues.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
#include <inspector/VInspector_ItemBase.hxx>
#include <inspector/TreeModel_ItemBase.hxx>
//! \return flags
virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const Standard_OVERRIDE;
- //! Returns number of rows, depending on orientation: myColumnCount or size of values container
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int GetValuesCount () const Standard_OVERRIDE;
-
//! Returns type of edit control for the model index. By default, it is an empty control
//! \param theRow a model index row
//! \param theColumn a model index column
ViewControl_TableItemDelegate.hxx
ViewControl_TableModel.cxx
ViewControl_TableModel.hxx
-ViewControl_TableModelFilter.cxx
-ViewControl_TableModelFilter.hxx
ViewControl_TableModelValues.cxx
ViewControl_TableModelValues.hxx
-ViewControl_TableProperty.cxx
-ViewControl_TableProperty.hxx
+ViewControl_TableModelValuesDefault.cxx
+ViewControl_TableModelValuesDefault.hxx
ViewControl_Tools.cxx
ViewControl_Tools.hxx
ViewControl_TreeView.hxx
#include <inspector/ViewControl_Tools.hxx>
#include <inspector/TreeModel_Tools.hxx>
-#include <Quantity.hxx>
+//#include <Quantity.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QAbstractTableModel>
return QVariant ("Name");
Quantity_NameOfColor aColorName;
if (ViewControl_ColorSelector::IsExactColorName(myColor, aColorName))
- return Quantity::NameOfColorToString (aColorName);
+ return "";//Quantity::NameOfColorToString (aColorName);
}
break;
case 2: return isFirstColumn ? QVariant ("Red") : ViewControl_Tools::ToVariant (myColor.GetRGB().Red());
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::NameOfColorToString (myColor.GetRGB().Name());
+ : "";//Quantity::NameOfColorToString (myColor.GetRGB().Name());
}
return QVariant();
}
return QVariant();
if (theRole == Qt::ToolTipRole)
- return QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
- .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
+ return "";//QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor))
+ // .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor)));
return QVariant();
}
ViewControl_EditType_Double, //!< line edit widget used double validator
ViewControl_EditType_Line, //!< line edit widget
ViewControl_EditType_Spin, //!< spin box widget
- ViewControl_EditType_DoubleVec3 //!< control to enter three double values
+ ViewControl_EditType_DoubleVec3, //!< control to enter three double values
+ ViewControl_EditType_DoAction //!< control to perform the row action
};
#endif
connect (aTable->GetTableView()->selectionModel(),
SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)),
this, SLOT(onTableSelectionChanged (const QItemSelection&, const QItemSelection&)));
- connect (aTable->GetProperty(), SIGNAL (propertyChanged()), this, SIGNAL (propertyViewSelectionChanged()));
-
- if (myXStepValues.size() > theTableId)
- aTable->GetProperty()->SetXStep (myXStepValues[theTableId]);
-
- if (myDivideValues.size() > theTableId)
- aTable->GetProperty()->SetDivideSize (myDivideValues[theTableId]);
myTableWidgetLayout->addWidget (aTable->GetControl());
emit propertyViewSelectionChanged();
}
-
-// =======================================================================
-// function : SaveState
-// purpose :
-// =======================================================================
-void ViewControl_PropertyView::SaveState (ViewControl_PropertyView* theView,
- QMap<QString, QString>& theItems,
- const QString& thePrefix)
-{
- QList<ViewControl_Table*> anActiveTables;
- theView->GetActiveTables(anActiveTables);
-
- if (anActiveTables.size() == 0)
- return;
-
- anActiveTables[0]->GetProperty()->GetXStep();
- QStringList aDivideSizes, aXSteps;
- for (int i = 0; i < anActiveTables.size(); i++)
- {
- aXSteps.append (QString::number (anActiveTables[i]->GetProperty()->GetXStep()));
- aDivideSizes.append (QString::number (anActiveTables[i]->GetProperty()->GetDivideSize()));
- }
- theItems[thePrefix + "property_view_xstep_value"] = aXSteps.join (",");
- theItems[thePrefix + "property_view_divide_value"] = aDivideSizes.join (",");
-}
-
-// =======================================================================
-// function : RestoreState
-// purpose :
-// =======================================================================
-bool ViewControl_PropertyView::RestoreState (ViewControl_PropertyView* theView,
- const QString& theKey,
- const QString& theValue,
- const QString& thePrefix)
-{
- if (theKey == thePrefix + "property_view_xstep_value")
- {
- QList<double> aXStepValues;
- QStringList aValues = theValue.split (",", QString::SkipEmptyParts);
- for (int aValueId = 0; aValueId < aValues.size(); aValueId++)
- aXStepValues.append (aValues.at (aValueId).toDouble());
- theView->SetXSteps (aXStepValues);
- }
- else if (theKey == thePrefix + "property_view_divide_value")
- {
- QList<int> aDivideValues;
- QStringList aValues = theValue.split (",", QString::SkipEmptyParts);
- for (int aValueId = 0; aValueId < aValues.size(); aValueId++)
- aDivideValues.append (aValues.at (aValueId).toInt());
- theView->SetDivideValues (aDivideValues);
- }
- else
- return false;
- return true;
-}
//! Clears selection in active tables
Standard_EXPORT void ClearActiveTablesSelection();
- //! Sets X steps values for table properties
- //! \param container of values
- void SetXSteps (const QList<double>& theValues) { myXStepValues = theValues; }
-
- //! Sets divide values for table properties
- //! \param container of values
- void SetDivideValues (const QList<int>& theValues) { myDivideValues = theValues; }
-
- //! Save state of three view in a container in form: key, value. It saves:
- //! - XStep of property table
- //! - divide values of property table
- //! \param theTreeView a view instance
- //! \param theItems [out] properties
- //! \param thePrefix peference item prefix
- Standard_EXPORT static void SaveState (ViewControl_PropertyView* theView, QMap<QString, QString>& theItems,
- const QString& thePrefix = QString());
- //! Restore state of three view by a container
- //! \param theTreeView a view instance
- //! \param theKey property key
- //! \param theValue property value
- //! \param thePrefix peference item prefix
- //! \return boolean value whether the property is applyed to the tree view
- Standard_EXPORT static bool RestoreState (ViewControl_PropertyView* theView, const QString& theKey, const QString& theValue,
- const QString& thePrefix = QString());
-
signals:
void propertyViewSelectionChanged();
QVBoxLayout* myTableWidgetLayout; //! main view layout where tables or custom widgets are presented
QList<ViewControl_Table*> myTables; //!< table view, shown only first tables filled in Init method
QWidget* myCustomWidget; //!< custom view widget
-
- QList<double> myXStepValues; //! predefined values for XStep in ViewControl_TableProperty
- QList<int> myDivideValues; //! predefined values for divide value in ViewControl_TableProperty
};
#endif
#include <inspector/ViewControl_Table.hxx>
#include <inspector/ViewControl_TableItemDelegate.hxx>
#include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableProperty.hxx>
+#include <inspector/ViewControl_Tools.hxx>
#include <inspector/TreeModel_Tools.hxx>
QGridLayout* aLayout = new QGridLayout (myMainWidget);
aLayout->setContentsMargins (0, 0, 0, 0);
- myProperty = new ViewControl_TableProperty(myMainWidget, this);
- aLayout->addWidget (myProperty->GetControl());
-
myTableView = new QTableView (myMainWidget);
myTableView->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel);
aVHeader->setDefaultSectionSize (aDefCellSize);
aLayout->addWidget (myTableView);
- aLayout->addWidget (myProperty->GetInformationControl());
}
// =======================================================================
myTableView->setSelectionMode(QAbstractItemView::ExtendedSelection);
QItemSelectionModel* aSelectionModel = new QItemSelectionModel(theModel);
myTableView->setSelectionModel (aSelectionModel);
- connect(aSelectionModel, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
- this, SLOT(onTableSelectionChanged(const QItemSelection&, const QItemSelection&)));
}
// =======================================================================
ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (myTableView->model());
aModel->SetModelValues (theModelValues);
- myProperty->SetActive (theModelValues->UseTableProperties());
- myProperty->Init();
-
ViewControl_TableItemDelegate* aDelegate = dynamic_cast<ViewControl_TableItemDelegate*>(myTableView->itemDelegate());
aDelegate->SetModelValues (theModelValues);
int aRow, aColumn;
for (QModelIndexList::const_iterator anIt = aSelected.begin(); anIt != aSelected.end(); anIt++)
{
- aModel->GetSourcePosition (*anIt, aRow, aColumn);
-
if (!theSelectedIndices.contains (aRow))
theSelectedIndices.insert (aRow, QList<int>());
theSelectedIndices[aRow].append (aColumn);
}
// =======================================================================
-// function : onTableSelectionChanged
+// function : SeparatorData
// purpose :
// =======================================================================
-void ViewControl_Table::onTableSelectionChanged(const QItemSelection&, const QItemSelection&)
+QString ViewControl_Table::SeparatorData()
{
- QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes();
-
- myProperty->UpdateOnTableSelectionChanged();
+ return ViewControl_Tools::TableSeparator();
}
#include <Standard.hxx>
#include <Standard_Macro.hxx>
-#include <inspector/ViewControl_TableProperty.hxx>
-
#include <Standard_WarningsDisable.hxx>
#include <QItemSelection>
#include <QObject>
//! \return the table view
QTableView* GetTableView() const { return myTableView; }
- //! Returns instance of table property control
- //! \return property
- ViewControl_TableProperty* GetProperty() const { return myProperty; }
-
//! Retuns model indices of the selected cells in table view
//! \param theSelectedIndices [out] a container of indices: row to list of columns
Standard_EXPORT void GetSelectedIndices (QMap<int, QList<int>>& aSelectedIndices);
//! Returns text of separation row in table
//! \return string value
- static QString SeparatorData() { return "---------------------------"; }
-
-protected slots:
-
- //! Updates controls by selection change in table view
- //! \param theSelected container of selected table cells
- //! \param theDeselected container of selected table cells
- void onTableSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
+ Standard_EXPORT static QString SeparatorData();
private:
bool myIsActive; //!< true if the table is used in property view and visible
QWidget* myMainWidget; //!< parent of all controls
bool myIsUseProperty; //!< boolean value whether the property control should be shown/hidden
QTableView* myTableView; //!< table view
-
- ViewControl_TableProperty* myProperty; //!< modifier of the table visual properties
};
#endif
#include <QComboBox>
#include <QDoubleValidator>
#include <QLineEdit>
+#include <QPushButton>
#include <QSpinBox>
#include <Standard_WarningsRestore.hxx>
if (!myModelValues)
return 0;
- int aRow, aColumn;
- myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
QWidget* anEditor = createEditorControl (theParent, anEditType);
if (!myModelValues)
return;
- int aRow, aColumn;
- myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
setEditorValue (theEditor, anEditType, theIndex.model()->data(theIndex));
if (!myModelValues)
return;
- int aRow, aColumn;
- myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), aRow, aColumn);
+ int aRow = theIndex.row();
+ int aColumn = theIndex.column();
ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn);
theModel->setData (theIndex, getEditorValue (theEditor, anEditType));
return aLineEdit;
}
case ViewControl_EditType_Line: return new QLineEdit (theParent);
- case ViewControl_EditType_Spin: return new QSpinBox (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;
}
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;
}
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();
}
delete myModelValues;
myModelValues = theModelValues;
- SetFilter(0);
}
// =======================================================================
if (!myModelValues)
return 0;
- int aColumnCount = myModelValues->ColumnCount (theParent);
- return isFilterActive() ? myFilter->ColumnCount (aColumnCount) : aColumnCount;
+ return myModelValues->ColumnCount (theParent);
}
// =======================================================================
if (!myModelValues)
return 0;
- return isFilterActive() ? myFilter->RowCount (myModelValues->ColumnCount (theParent))
- : myModelValues->RowCount (theParent);
+ return myModelValues->RowCount (theParent);
}
// =======================================================================
return QVariant();
int aRow = theIndex.row(), aColumn = theIndex.column();
- if (isFilterActive())
- myFilter->GetSourcePosition (theIndex, aRow, aColumn);
-
return myModelValues->Data (aRow, aColumn, theRole);
}
return false;
int aRow = theIndex.row(), aColumn = theIndex.column();
- if (isFilterActive())
- myFilter->GetSourcePosition (theIndex, aRow, aColumn);
-
return myModelValues->SetData (aRow, aColumn, theValue, theRole);
}
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-void ViewControl_TableModel::GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn)
-{
- if (isFilterActive())
- myFilter->GetSourcePosition (theIndex, theRow, theColumn);
- else
- myModelValues->GetSourcePosition (theIndex.row(), theIndex.column(), theRow, theColumn);
-}
#include <Standard.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
#include <Standard_WarningsDisable.hxx>
public:
//! Constructor
- ViewControl_TableModel (QObject* theParent = 0) : myModelValues (0), myFilter (0) { (void)theParent; }
+ ViewControl_TableModel (QObject* theParent = 0) : myModelValues (0) { (void)theParent; }
//! Destructor
virtual ~ViewControl_TableModel() {}
//! \return interface or NULL
ViewControl_TableModelValues* GetModelValues() const { return myModelValues; }
- //! Sets table values filter to rearrange values presentation
- //! \param filter instance
- void SetFilter (ViewControl_TableModelFilter* theFilter) { myFilter = theFilter; }
-
//! Emits the layoutChanged signal from outside of this class
void EmitLayoutChanged() { emit layoutChanged(); }
Qt::ItemFlags flags (const QModelIndex& theIndex) const
{ return myModelValues ? myModelValues->Flags (theIndex) : Qt::NoItemFlags; }
- //! Returns source row and column values peforming conversion back from filter
- //! \param theIndex a model index
- //! \param theRow a model row
- //! \param theColumn a model column
- Standard_EXPORT void GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn);
-
-protected:
- //! Returns true if the filter is not NULL and active
- //! \return true if active
- Standard_Boolean isFilterActive() const { return myFilter && myFilter->IsActive(); }
-
private:
ViewControl_TableModelValues* myModelValues; //! interface to table values
- ViewControl_TableModelFilter* myFilter; //! filter of values
};
#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/ViewControl_TableModelFilter.hxx>
-
-// =======================================================================
-// function : ColumnCount
-// purpose :
-// =======================================================================
-
-int ViewControl_TableModelFilter::ColumnCount (const int theSourceColumnCount) const
-{
- return myColumnCount <= 0 ? theSourceColumnCount : myColumnCount;
-}
-
-// =======================================================================
-// function : RowCount
-// purpose :
-// =======================================================================
-
-int ViewControl_TableModelFilter::RowCount (const int theSourceColumnCount) const
-{
- if (myColumnCount <= 0)
- return 1;
-
- int aRows = (int) (theSourceColumnCount / myColumnCount);
- if (myColumnCount > 0 && aRows * myColumnCount < theSourceColumnCount)
- aRows++; /// row with left values, not fully filled
-
- return aRows;
-}
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-
-void ViewControl_TableModelFilter::GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn) const
-{
- GetSourcePosition (theIndex.row(), theIndex.column(), theRow, theColumn);
-}
-
-// =======================================================================
-// function : GetSourcePosition
-// purpose :
-// =======================================================================
-
-void ViewControl_TableModelFilter::GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow,
- int& theColumn) const
-{
- theRow = 0;
- theColumn = myColumnCount * theSourceRow + theSourceColumn;
-}
+++ /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 ViewControl_TableModelFilter_H
-#define ViewControl_TableModelFilter_H
-
-#include <Standard.hxx>
-
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-//! \class ViewControl_TableModelFilter
-//! \brief It provides separation of 1D container of values in 2D presentation depending on number of column value
-class ViewControl_TableModelFilter
-{
-public:
-
- //! Constructor
- Standard_EXPORT ViewControl_TableModelFilter(const Standard_Integer theColumnCount = -1)
- : myIsActive (Standard_True), myColumnCount (theColumnCount) {}
-
- //! Destructor
- virtual ~ViewControl_TableModelFilter() {}
-
- //! Activate/Deactivate filter
- //! \param theActive state is the filter to be active or not
- virtual void SetActive (const Standard_Boolean theActive) { myIsActive = theActive; }
-
- //! Returns boolean state whether the filter is activated
- //! \return true if active
- virtual Standard_Boolean IsActive() const { return myIsActive; }
-
- //! Sets number of columns
- //! \param theColumnCount a column count
- void SetColumnCount (const int theColumnCount) { myColumnCount = theColumnCount; }
-
- //! Returns number of columns: parameter value
- //! \param theSourceColumnCount number of columns in the source table
- //! \return an integer value
- Standard_EXPORT int ColumnCount (const int theSourceColumnCount) const;
-
- //! Returns number of rows: whole number of columns is divided to the current column value
- //! \param theSourceColumnCount number of columns in the source table
- //! \return an integer value
- Standard_EXPORT int RowCount (const int theSourceColumnCount) const;
-
- //! Returns source row/column indices for the filtered model index
- //! \param theIndex a model index
- //! \param theRow [out] row number value
- //! \param theColumn [out] column value
- Standard_EXPORT void GetSourcePosition (const QModelIndex& theIndex, int& theRow, int& theColumn) const;
-
- //! Returns source row/column indices for the filtered model index
- //! \param theSourceRow model row index
- //! \param theSourceColumn model column index
- //! \param theRow [out] row number value
- //! \param theColumn [out] column value
- Standard_EXPORT void GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow, int& theColumn) const;
-
-private:
- Standard_Boolean myIsActive; //!< active state of the filter
- Standard_Integer myColumnCount; //!< number of table columns
-};
-
-#endif
int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
{
- Qt::Orientation anAdditionalOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical;
- if (myHeaderValues[anAdditionalOrientation].size() > 0)
- return myHeaderValues[anAdditionalOrientation].size();
+ if (!GetProperties().IsNull())
+ return GetProperties()->GetTableColumnCount();
- return myValues.size();
+ return 0;
+}
+
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int ViewControl_TableModelValues::RowCount (const QModelIndex&) const
+{
+ if (!GetProperties().IsNull())
+ return GetProperties()->GetTableRowCount();
+
+ return 0;
}
// =======================================================================
QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const
{
- if (theRole == Qt::DisplayRole)
- return myValues.at ((int)getPosition (theRow, theColumn));
+ if (!GetProperties().IsNull())
+ {
+ QVariant aValue = GetProperties()->GetTableData (theRow, theColumn, theRole);
+ if (aValue.isValid())
+ return aValue;
+ }
if (theRole == Qt::TextAlignmentRole) // for multi-lines text, align it to the top
return Qt::AlignTop;
return QVariant();
}
+// =======================================================================
+// function : SetData
+// purpose :
+// =======================================================================
+
+bool ViewControl_TableModelValues::SetData (const int theRow, const int theColumn, const QVariant& theValue, int)
+{
+ if (!GetProperties().IsNull())
+ return GetProperties()->SetTableData (theRow, theColumn, theValue);
+
+ return false;
+}
+
// =======================================================================
// function : HeaderData
// purpose :
int aCell = anOrientation == Qt::Horizontal ? theColumn : theRow;
return GetHeaderItem (anOrientation, aCell).IsItalic();
-}
\ No newline at end of file
+}
#include <Standard.hxx>
#include <inspector/TreeModel_HeaderSection.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/ViewControl_EditType.hxx>
#include <Standard_WarningsDisable.hxx>
//! Constructor
Standard_EXPORT ViewControl_TableModelValues (const Qt::Orientation& theOrientation = Qt::Vertical)
- : myUseTableProperties (false), myUseTableSeparateSize (true), myUseTablePropertiesXStep (false),
- myUseTablePropertiesXStepValue (-1)
{ SetOrientation (theOrientation); }
//! Destructor
virtual ~ViewControl_TableModelValues() {}
+ //! Sets item table properties builder
+ void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; }
+
+ //! Returns item table properties builder
+ Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; }
+
//! Sets direction of the values applying, whether it should be placed by rows or by columns
//! \param theOrientation if horizontal, the values are applyed by rows, otherwise by columns
void SetOrientation (const Qt::Orientation& theOrientation) { myOrientation = theOrientation; }
- //! Fills the model values.
- //! \param theValues a container of table model values
- void SetValues (const QVector<QVariant>& theValues) { myValues = theValues; }
-
//! Fills the model header values for orientation.
//! \param theValues a container of header text values
//! \param theOrientation an orientation of header
return myDefaultSectionSize.contains (theOrientation);
}
- //! Stores whether the properties control of the table visible or not
- //! \param theUseProperties boolean state
- void SetUseTableProperties (const bool theUseProperties) { myUseTableProperties = theUseProperties; }
-
- //! Returns true if the properties control of the table visible or not
- //! \return boolean value
- bool UseTableProperties() const { return myUseTableProperties; }
-
- //! Stores whether the properties control of the table visible or not
- //! \param theUseProperties boolean state
- void SetUseTableSeparateSize (const bool theUseSize)
- { myUseTableSeparateSize = theUseSize; }
-
- //! Returns true if the properties control of the table visible or not
- //! \return boolean value
- bool UseTableSeparateSize() const
- { return myUseTableSeparateSize; }
-
- //! Stores whether the properties control of the table visible or not
- //! \param theUseProperties boolean state
- void SetUseTablePropertiesXStep (const bool theUseStep, const double theStep)
- { myUseTablePropertiesXStep = theUseStep; myUseTablePropertiesXStepValue = theStep; }
-
- //! Returns true if the properties control of the table visible or not
- //! \return boolean value
- double UseTablePropertiesXStep(bool& theUseStep) const
- { theUseStep = myUseTablePropertiesXStep; return myUseTablePropertiesXStepValue; }
-
//! Returns number of columns, size of header values
//! \param theParent an index of the parent item
//! \return an integer value
//! Returns number of rows, depending on orientation: myColumnCount or size of values container
//! \param theParent an index of the parent item
//! \return an integer value
- virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const
- { return ColumnCount (theParent) > 0 ? GetValuesCount() / ColumnCount (theParent) : 0; }
+ Standard_EXPORT virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const;
//! 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 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)
- { (void)theRow; (void)theColumn; (void)theValue; (void)theRole; return false; }
+ int theRole = Qt::DisplayRole);
//! Returns content of the model index for the given role, it is obtainer from internal container of header values
//! It returns value only for DisplayRole.
virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const
{ return theIndex.isValid() ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::NoItemFlags; }
- //! Returns minimum and maximum values of the table content
- //! \param theMinValue minimum
- //! \param theMaxValue maximum
- virtual void GetRangeValues (QString& theMinValue, QString& theMaxValue, const QModelIndexList& theSelected) const
- { (void)theMinValue; (void)theMaxValue; (void)theSelected; }
-
- //! Returns additional info
- virtual QString AdditionalInformation() const { return QString(); }
-
- //! Returns number of rows, depending on orientation: myColumnCount or size of values container
- //! \param theParent an index of the parent item
- //! \return an integer value
- virtual int GetValuesCount () const { return myValues.size(); }
-
- //! Returns source row/column indices for the filtered model index for the given role
- //! \param theSourceRow model row index
- //! \param theSourceColumn model column index
- //! \param theRow [out] row number value
- //! \param theColumn [out] column value
- Standard_EXPORT virtual void GetSourcePosition (const int theSourceRow, const int theSourceColumn, int& theRow, int& theColumn) const
- { theRow = theSourceRow; theColumn = theSourceColumn; }
-
//! Returns item delegate to provide cell editors. By default, it is empty
//! \return delegate
virtual QItemDelegate* GetItemDelegate() { return 0; }
static QColor EditCellColor() { return QColor (Qt::darkBlue); }
protected:
- //! Finds position in internal vector of values using the table column/row count
- //! \param theRow a row of a table cell
- //! \param theColumn a column of a table cell
- size_t getPosition (const int theRow, const int theColumn) const { return ColumnCount() * theRow + theColumn; }
-
//! Returns true if the header item is italic of the parameter index
//! \param theRow a model index row
//! \param theColumn a model index column
QMap<Qt::Orientation, QList<TreeModel_HeaderSection> > myHeaderValues; //!< table header values
QMap<Qt::Orientation, bool> myVisibleHeader; //! table header visibility
QMap<Qt::Orientation, int> myDefaultSectionSize; //! table section default size
- QVector<QVariant> myValues; //! cached container of table values
- bool myUseTableProperties; //! state whether the table property control is visible
- bool myUseTableSeparateSize; //! state whether table custom column size is possible
- bool myUseTablePropertiesXStep; //! true if XStep value is used
- double myUseTablePropertiesXStepValue; //! value to define OX step for 1D table, Z = 0
+
+ Handle(TreeModel_ItemProperties) myProperties; //!< item properties
};
#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/ViewControl_TableModelValuesDefault.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : ColumnCount
+// purpose :
+// =======================================================================
+
+int ViewControl_TableModelValuesDefault::ColumnCount (const QModelIndex&) const
+{
+ Qt::Orientation anAdditionalOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical;
+ if (myHeaderValues[anAdditionalOrientation].size() > 0)
+ return myHeaderValues[anAdditionalOrientation].size();
+
+ return myValues.size();
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant ViewControl_TableModelValuesDefault::Data (const int theRow, const int theColumn, int theRole) const
+{
+ if (theRole == Qt::DisplayRole)
+ return myValues.at ((int)getPosition (theRow, theColumn));
+
+ return ViewControl_TableModelValues::Data (theRow, theColumn, theRole);
+}
--- /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 ViewControl_TableModelValuesDefault_H
+#define ViewControl_TableModelValuesDefault_H
+
+#include <Standard.hxx>
+
+#include <inspector/ViewControl_TableModelValues.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+//! \class ViewControl_TableModelValuesDefault
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class ViewControl_TableModelValuesDefault : public ViewControl_TableModelValues
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT ViewControl_TableModelValuesDefault (const Qt::Orientation& theOrientation = Qt::Vertical)
+ : ViewControl_TableModelValues (theOrientation) {}
+
+ //! Destructor
+ virtual ~ViewControl_TableModelValuesDefault() {}
+
+ //! Fills the model values.
+ //! \param theValues a container of table model values
+ void SetValues (const QVector<QVariant>& theValues) { myValues = theValues; }
+
+ //! Returns number of columns, size of header values
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE;
+
+ //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE
+ { return ColumnCount (theParent) > 0 ? GetValuesCount() / ColumnCount (theParent) : 0; }
+
+ //! Returns content of the model index for the given role, it is obtained from internal container of values
+ //! It returns value only for DisplayRole.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+ //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ virtual int GetValuesCount () const { return myValues.size(); }
+
+protected:
+ //! Finds position in internal vector of values using the table column/row count
+ //! \param theRow a row of a table cell
+ //! \param theColumn a column of a table cell
+ size_t getPosition (const int theRow, const int theColumn) const { return ColumnCount() * theRow + theColumn; }
+
+ //! Returns true if the header item is italic of the parameter index
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param boolean value
+ bool isItalicHeader (const int theRow, const int theColumn) const;
+
+protected:
+
+ QVector<QVariant> myValues; //! cached container of table values
+};
+
+#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/ViewControl_TableProperty.hxx>
-#include <inspector/ViewControl_Table.hxx>
-#include <inspector/ViewControl_TableModel.hxx>
-#include <inspector/ViewControl_TableModelFilter.hxx>
-#include <inspector/ViewControl_TableModelValues.hxx>
-
-#include <inspector/TreeModel_Tools.hxx>
-
-#include <QAbstractItemModel>
-#include <QAction>
-#include <QGridLayout>
-#include <QHeaderView>
-#include <QLabel>
-#include <QLineEdit>
-#include <QMenu>
-#include <QPlainTextEdit>
-#include <QPushButton>
-#include <QSpinBox>
-#include <QTableView>
-#include <QWidget>
-
-#include <limits>
-
-const int DEFAULT_COLUMN_WIDTH = 60;
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-
-ViewControl_TableProperty::ViewControl_TableProperty (QWidget* theParent, ViewControl_Table* theTable)
-: QObject (theParent), myTable (theTable), myIsActive (false)
-{
- myFilter = new ViewControl_TableModelFilter();
-
- myMainWidget = new QWidget (theParent);
- QGridLayout* aMainLayout = new QGridLayout (myMainWidget);
-
- QWidget* aProperties = new QWidget (myMainWidget);
- aMainLayout->addWidget (aProperties);
- QHBoxLayout* aPropertiesLayout = new QHBoxLayout (aProperties);
- aPropertiesLayout->setContentsMargins (0, 0, 0, 0);
-
- mySize = new QLabel ("", myMainWidget);
- myDivideSize = new QLabel("Divide:", myMainWidget);
- mySeparateSize = new QSpinBox (myMainWidget);
- mySeparateSize->setRange (0, 100000);
- myVisualizedSize = new QLabel ("", myMainWidget);
-
- aPropertiesLayout->addWidget (mySize);
- aPropertiesLayout->addWidget (myDivideSize);
- aPropertiesLayout->addWidget (mySeparateSize);
- aPropertiesLayout->addWidget (myVisualizedSize);
-
- myXStepLabel = new QLabel ("XStep:");
- myXStep = new QDoubleSpinBox (myMainWidget);
- myXStep->setRange(1.e-12, 1.e+7);
- myXStep->setDecimals (8);
- myXStep->setValue(1.);
-
- setXStepActive (false);
-
- connect (myXStep, SIGNAL(editingFinished()), this, SIGNAL (propertyChanged()));
-
- aPropertiesLayout->addWidget (myXStepLabel);
- aPropertiesLayout->addWidget (myXStep);
-
- myInformationWidget = new QWidget (theParent);
- QGridLayout* anInfoLayout = new QGridLayout (myInformationWidget);
-
- myModelInformation = new QPlainTextEdit (myInformationWidget);
- myModelInformation->setVisible (false);
- anInfoLayout->addWidget (myModelInformation, 2, 0, 1, 4);
-
- myMinValue = new QPushButton ("Min", myInformationWidget);
- myMaxValue = new QPushButton ("Max", myInformationWidget);
- myMinSelectedValue = new QPushButton ("Min of selected", myInformationWidget);
- myMaxSelectedValue = new QPushButton ("Max of selected", myInformationWidget);
-
- anInfoLayout->addWidget (myMinValue, 3, 0);
- anInfoLayout->addWidget (myMinSelectedValue, 3, 1);
- anInfoLayout->addWidget (myMaxValue, 4, 0);
- anInfoLayout->addWidget (myMaxSelectedValue, 4, 1);
-
- connect (mySeparateSize, SIGNAL (valueChanged (int)),
- this, SLOT (onSeparateSizeChanged (int)));
-}
-
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::Init()
-{
- ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
- ViewControl_TableModelValues* aModelValues = aViewModel->GetModelValues();
-
- bool aUseXStep;
- double aXStep = aModelValues->UseTablePropertiesXStep (aUseXStep);
- setXStepActive (aUseXStep, aXStep);
-
- QString aMinValue = QString::number (DBL_MIN), aMaxValue = QString::number (DBL_MAX);
- aModelValues->GetRangeValues (aMinValue, aMaxValue, QModelIndexList());
- QString anInfo = aModelValues->AdditionalInformation();
-
- bool aUseSeparateSize = aModelValues->UseTableSeparateSize();
- mySize->setVisible (aUseSeparateSize);
- myDivideSize->setVisible (aUseSeparateSize);
- mySeparateSize->setVisible (aUseSeparateSize);
- myVisualizedSize->setVisible (aUseSeparateSize);
- myFilter->SetActive (aUseSeparateSize);
- if (aUseSeparateSize && mySeparateSize->value() != 0)
- myFilter->SetColumnCount(mySeparateSize->value());
-
- mySize->setText (QString("[ %1, %2 ]").arg (aViewModel->rowCount()).arg (aViewModel->columnCount()));
-
- myVisualizedSize->setText (mySize->text());
- myVisualizedSize->setToolTip (QString ("sqrt: (%1, %2)").arg (sqrt (aViewModel->rowCount())).arg (sqrt (aViewModel->columnCount())));
- myModelInformation->setVisible(!anInfo.isEmpty());
- if (!anInfo.isEmpty())
- myModelInformation->setPlainText (anInfo);
-
- myMinValue->setText (QString ("Min: ") + aMinValue);
- myMaxValue->setText (QString ("Max: ") + aMaxValue);
- myMinSelectedValue->setText (QString("Min of selected: ") + QString::number(0));
- myMaxSelectedValue->setText (QString("Max of selected: ") + QString::number(0));
-}
-
-// =======================================================================
-// function : SetActive
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::SetActive (const bool theActive)
-{
- GetControl()->setVisible (theActive);
- GetInformationControl()->setVisible (theActive);
-
- ViewControl_TableModel* aModel = dynamic_cast<ViewControl_TableModel*> (myTable->GetTableView()->model());
- aModel->SetFilter (theActive ? GetFilter() : 0);
-}
-
-// =======================================================================
-// function : onSeparateSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::onSeparateSizeChanged (int theValue)
-{
- myFilter->SetColumnCount(theValue);
-
- myTable->GetTableView()->selectionModel()->clearSelection();
-
- ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
- aViewModel->EmitLayoutChanged();
-
- myVisualizedSize->setText (QString ("[ %1, %2 ]").arg (aViewModel->rowCount()).arg (aViewModel->columnCount()));
-}
-
-// =======================================================================
-// function : onToleranceSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::onToleranceSizeChanged (int theValue)
-{
- (void)theValue;
-}
-
-// =======================================================================
-// function : onSeparateSizeChanged
-// purpose :
-// =======================================================================
-
-void ViewControl_TableProperty::UpdateOnTableSelectionChanged()
-{
- QModelIndexList aSelected = myTable->GetTableView()->selectionModel()->selectedIndexes();
- if (aSelected.isEmpty())
- {
- myMinSelectedValue->setText(QString("Min of selected:") + QString::number(0));
- myMaxSelectedValue->setText(QString("Max of selected:") + QString::number(0));
- return;
- }
-
- ViewControl_TableModel* aViewModel = dynamic_cast<ViewControl_TableModel*>(myTable->GetTableView()->model());
- ViewControl_TableModelValues* aModelValues = aViewModel->GetModelValues();
-
- QString aMinValue = QString::number (DBL_MIN), aMaxValue = QString::number (DBL_MAX);
- aModelValues->GetRangeValues (aMinValue, aMaxValue, aSelected);
-
- myMinSelectedValue->setText (QString ("Min of selected:") + aMinValue);
- myMaxSelectedValue->setText (QString ("Max of selected:") + aMaxValue);
-}
-
-// =======================================================================
-// function : createAction
-// purpose :
-// =======================================================================
-void ViewControl_TableProperty::setXStepActive (const bool theState, const double theValue)
-{
- myXStepActive = theState;
-
- myXStepLabel->setVisible (myXStepActive);
- myXStep->setVisible (myXStepActive);
-
- if (theValue > 0)
- myXStep->setValue (theValue);
-}
+++ /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 ViewControl_TableProperty_H
-#define ViewControl_TableProperty_H
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#ifdef _MSC_VER
-#pragma warning(disable : 4127) // conditional expression is constant
-#endif
-
-#include <QDoubleSpinBox>
-#include <QObject>
-#include <QSpinBox>
-
-class ViewControl_Table;
-class ViewControl_TableModelFilter;
-
-class QContextMenuEvent;
-class QLabel;
-class QItemSelection;
-class QPlainTextEdit;
-class QPushButton;
-class QSpinBox;
-class QWidget;
-
-//! \class ViewControl_TableProperty
-//! \brief View to display table values with possibility to change table columns
-//! if the table has 1D dimension and Horizontal orientation
-class ViewControl_TableProperty : public QObject
-{
- Q_OBJECT
-public:
-
- //! Constructor
- Standard_EXPORT ViewControl_TableProperty (QWidget* theParent, ViewControl_Table* theTable);
-
- //! Destructor
- virtual ~ViewControl_TableProperty() Standard_OVERRIDE {}
-
- //! Fills table view and table size control by the model
- Standard_EXPORT void Init();
-
- //! Sets whether the properties pane is visible or not
- //! \param theUseProperty boolean state
- Standard_EXPORT void SetActive (const bool theActive);
-
- //! Returns main control
- //! \return widget
- QWidget* GetControl() const { return myMainWidget; }
-
- //! Returns information control
- //! \return widget
- QWidget* GetInformationControl() { return myInformationWidget; }
-
- //! Returns table values filter to apply separation size
- //! \return filter instance
- ViewControl_TableModelFilter* GetFilter() { return myFilter; }
-
- //! Returns X step or -1 if it is not used
- //! \return double value
- double GetXStep() const { return myXStepActive ? myXStep->value() : -1;};
-
- //! Sets X step
- //! \param theValue value
- void SetXStep(const double theValue) const { myXStep->setValue (theValue); };
-
- //! Returns divide valid
- //! \return control value
- int GetDivideSize() const { return mySeparateSize->value(); }
-
- //! Sets separate size value
- //! \param theValue new value
- void SetDivideSize (const int theValue) { mySeparateSize->setValue (theValue); }
-
-signals:
- //! Signals about header cell is clicked
- //! \param theEvent context menu event
- void headerContextMenuRequsted (QContextMenuEvent* theEvent);
-
- //! Signals about the following properties are changed: XStep.
- void propertyChanged();
-
-protected slots:
- //! Reacts to the spin box value change, it divides table model values to has given number of columns
- //! \param theValue a new value of spin box
- void onSeparateSizeChanged (int theValue);
-
- //! Reacts to the tolerance value change, it sets it into table model
- //! \param theValue a new value of spin box
- void onToleranceSizeChanged (int theValue);
-
-public:
- //! Updates controls by selection change in table view
- //! \param theSelected container of selected table cells
- //! \param theDeselected container of selected table cells
- void UpdateOnTableSelectionChanged();
-
-private:
- //! Changes visibility of XStep control, if visible, set parameter value
- //! \param theState if true, the control is visible
- //! \param theValue the current for the control
- void setXStepActive (const bool theState, const double theValue = -1);
-
-private:
- bool myIsActive; //!< state whether the control is visible and used
- QWidget* myMainWidget; //!< parent of all controls
- QLabel* mySize; //!< control to visualize initial values size
- QLabel* myDivideSize; //!< size of division table values to rows
- QSpinBox* mySeparateSize; //!< control to divide table by given size if thable has only 1 dimension
- QLabel* myVisualizedSize; //!< control to visualize current table size
-
- bool myXStepActive; //!< state whether the XStep control is visible
- QLabel* myXStepLabel; //!< label of X step
- QDoubleSpinBox* myXStep; //!< control to enter X step
-
- QWidget* myInformationWidget; //!< parent of all controls
- QPlainTextEdit* myModelInformation; //!< control to visualize current table size
- QPushButton* myMinValue; //!< minimum table value
- QPushButton* myMaxValue; //!< maximum table value
- QPushButton* myMinSelectedValue; //!< minimum value of selected table cells
- QPushButton* myMaxSelectedValue; //!< maximum value of selected table cells
-
- ViewControl_Table* myTable; //!< table control
- ViewControl_TableModelFilter* myFilter; //!< table values filter to apply separation size
-};
-#endif
if (anInfoPtr.Value(aSymbolId) != '0')
{
anInfoPtr = anInfoPtr.SubString(aSymbolId, anInfoPtr.Length());
- anInfoPtr.Prepend("0x");
+ anInfoPtr.Prepend(GetPointerPrefix());
return anInfoPtr;
}
}
class ViewControl_Tools
{
public:
+ //! Returns text of separation row in table
+ //! \return string value
+ static QString TableSeparator() { return "---------------------------"; }
//! Creates an action with the given text connected to the slot
//! \param theText an action text value
//! \param theOrientation header orientation
Standard_EXPORT static void SetDefaultHeaderSections (QTableView* theTableView, const Qt::Orientation theOrientation);
+ //! Returns default prefix added for each pointer info string
+ Standard_EXPORT static TCollection_AsciiString GetPointerPrefix() { return "0x"; }
+
//! Convert handle pointer to string value
//! \param thePointer a pointer
//! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped