Dump/Init implementation in OCCT object and parsing it in MessageView (VInspector later)
#include <BVH_Types.hxx>
#include <Message_Alerts.hxx>
#include <Standard_ShortReal.hxx>
+#include <TCollection.hxx>
#include <limits>
DUMP_VALUES (OS, "BVH_Box", 2);
DUMP_VALUES (OS, "IsValid", IsValid());
- DUMP_VALUES (OS, "Bnd_Box", BVH::ToBndBox (CornerMin(), CornerMax()).ToString());
-
- //DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMin()));
- //DUMP_VALUES (OS, "CornerMin", BVH::ToString (CornerMax()));
+ OS << "Bnd_Box" << TCollection::DumpSeparator();
+ BVH::ToBndBox (CornerMin(), CornerMax()).Dump (OS, Standard_DumpMask_SingleValue);
+ OS << TCollection::DumpSeparator();
}
public:
DUMP_VALUES (OS, "BVH_TreeNode", 2);
DUMP_VALUES (OS, "NodeIndex", theNodeIndex);
- DUMP_VALUES (OS, "MinPoint - MaxPoint", BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).ToString());
+ OS << "Bnd_Box" << TCollection::DumpSeparator();
+ BVH::ToBndBox (MinPoint (theNodeIndex), MaxPoint (theNodeIndex)).Dump (OS, Standard_DumpMask_SingleValue);
+ OS << TCollection::DumpSeparator();
DUMP_VALUES (OS, "BegPrimitive", BegPrimitive (theNodeIndex));
DUMP_VALUES (OS, "EndPrimitive", EndPrimitive (theNodeIndex));
#include <gp_Pln.hxx>
#include <gp_Pnt.hxx>
#include <gp_Trsf.hxx>
+#include <NCollection_List.hxx>
#include <Standard_ConstructionError.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
// set the flag to one
#define ClearVoidFlag() ( Flags &= ~VoidMask )
return " - ";
}
+
+const TCollection_AsciiString Bnd_Box_ClassName = "Bnd_Box";
+
//=======================================================================
-//function : ToString
+//function : Dump
//purpose :
//=======================================================================
-TCollection_AsciiString Bnd_Box::ToString() const
+void Bnd_Box::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
{
- return gp_XYZ (Xmin, Ymin, Zmin).ToString()
- + PointsSeparator()
- + gp_XYZ (Xmax, Ymax, Zmax).ToString();
+ DUMP_START_KEY (OS, Bnd_Box_ClassName);
+
+ DUMP_VALUES (OS, "Xmin", Xmin);
+ DUMP_VALUES (OS, "Ymin", Ymin);
+ DUMP_VALUES (OS, "Zmin", Zmin);
+ DUMP_VALUES (OS, "Xmax", Xmax);
+ DUMP_VALUES (OS, "Ymax", Ymax);
+ DUMP_VALUES (OS, "Zmax", Zmax);
+ DUMP_VALUES (OS, "Gap", Gap);
+ DUMP_VALUES (OS, "Flags", Flags);
+
+ DUMP_STOP_KEY (OS, Bnd_Box_ClassName);
}
//=======================================================================
-//function : FromString
+//function : Init
//purpose :
//=======================================================================
-Standard_Boolean Bnd_Box::FromString (const TCollection_AsciiString& theValue)
+Standard_Boolean Bnd_Box::Init (const Standard_OStream& OS)
{
- TCollection_AsciiString aCurrentString = theValue;
- Standard_Integer aPosition = aCurrentString.Search (PointsSeparator());
- if (aPosition < 0)
- return Standard_False;
+ NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+ Standard_SStream aSStream (OS);
+ TCollection::Split (aSStream, aStreamValues);
+
+ TCollection_AsciiString anXYZValue;
+ if (aStreamValues.Size() == 1)
+ {
+ TCollection_AsciiString aValueStr = aStreamValues.FindFromIndex (1);
+ Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator());
+ if (aPosition < 1)
+ return Standard_False;
+ anXYZValue = aValueStr.Split (aPosition);
+ }
- TCollection_AsciiString aLeftString = aCurrentString;
- TCollection_AsciiString aRightString = aLeftString.Split (aPosition - 1);
- aCurrentString = aRightString;
- aRightString = aCurrentString.Split (PointsSeparator().Length());
+ NCollection_Vector<Standard_Real> aValues;
+ if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+ return Standard_False;
- gp_XYZ aMinPoint, aMaxPoint;
- if (!aMinPoint.FromString (aLeftString) || !aMaxPoint.FromString (aRightString))
+ if (aValues.Size() != 8)
return Standard_False;
- Update (aMinPoint.X(), aMinPoint.Y(), aMinPoint.Z(), aMaxPoint.X(), aMaxPoint.Y(), aMaxPoint.Z());
+ Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6));
+ Gap = aValues.Value (7);
+ Flags = (Standard_Integer)aValues.Value (8);
+
return Standard_True;
}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
&& Xmax >= Xmin;
}
- //! Covers bounding box into string in format: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
- //! \return the string value
- Standard_EXPORT TCollection_AsciiString ToString() const;
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
- //! Converts text value into parameters if possible, the string format is: (Xmin, Ymin, Zmin) - (Xmax, Ymax, Zmax)
- //! \return true if conversion is done
- Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
protected:
#include <Bnd_B3d.hxx>
#include <NCollection_Array1.hxx>
#include <Precision.hxx>
+#include <TCollection.hxx>
#include <TColStd_Array1OfReal.hxx>
class OBBTool
ReBuild(TColgp_Array1OfPnt(aList[0], 0, 15));
}
-// =======================================================================
-// function : Init
-// purpose :
-// =======================================================================
-Standard_Boolean Bnd_OBB::Init (const Standard_OStream&)
+const TCollection_AsciiString Bnd_OBB_ClassName = "Bnd_OBB";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void Bnd_OBB::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
{
- return Standard_False;
+ DUMP_START_KEY (OS, Bnd_OBB_ClassName);
+ {
+ Standard_SStream aTmpStream;
+ myCenter.Dump (aTmpStream);
+ DUMP_VALUES (OS, "Center", TCollection::ToDumpString (aTmpStream));
+ }
+ {
+ Standard_SStream aTmpStream;
+ myAxes[0].Dump (aTmpStream);
+ DUMP_VALUES (OS, "XAxis", TCollection::ToDumpString (aTmpStream));
+ }
+ {
+ Standard_SStream aTmpStream;
+ myAxes[1].Dump (aTmpStream);
+ DUMP_VALUES (OS, "YAxis", TCollection::ToDumpString (aTmpStream));
+ }
+ {
+ Standard_SStream aTmpStream;
+ myAxes[2].Dump (aTmpStream);
+ DUMP_VALUES (OS, "ZAxis", TCollection::ToDumpString (aTmpStream));
+ }
+
+ DUMP_VALUES (OS, "XHSize", XHSize());
+ DUMP_VALUES (OS, "YHSize", YHSize());
+ DUMP_VALUES (OS, "ZHSize", ZHSize());
+ DUMP_VALUES (OS, "IsAABox", myIsAABox);
+
+ DUMP_STOP_KEY (OS, Bnd_OBB_ClassName);
}
-// =======================================================================
-// function : Dump
-// purpose :
-// =======================================================================
-void Bnd_OBB::Dump (Standard_OStream&) const
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+Standard_Boolean Bnd_OBB::Init (const Standard_OStream& /*OS*/)
{
+ //NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+ //Standard_SStream aSStream (OS);
+ //TCollection::Split (aSStream, aStreamValues);
+
+ //TCollection_AsciiString anXYZValue;
+ //if (aStreamValues.Size() == 1)
+ //{
+ // NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator anIterator (aStreamValues);
+ // TCollection_AsciiString aValueStr = anIterator.Value();
+ // Standard_Integer aPosition = aValueStr.Search (Bnd_Box_ClassName + TCollection::ClassNameSeparator());
+ // if (aPosition < 1)
+ // return Standard_False;
+ // anXYZValue = aValueStr.Split (aPosition);
+ //}
+
+ //NCollection_Vector<Standard_Real> aValues;
+ //if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+ // return Standard_False;
+
+ //if (aValues.Size() != 8)
+ // return Standard_False;
+
+ //Update (aValues.Value (1), aValues.Value (2), aValues.Value (3), aValues.Value (4), aValues.Value (5), aValues.Value (6));
+ //Gap = aValues.Value (7);
+ //Flags = (Standard_Integer)aValues.Value (8);
+
+ //return Standard_True;
+
+ return Standard_False;
}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Boolean.hxx>
//! (which it was created from) and theP.
Standard_EXPORT void Add(const gp_Pnt& theP);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
+
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer = Standard_DumpMask_Whole) const;
+
protected:
void ProcessOnePoint(const gp_Pnt& theP)
myCenter = theP.XYZ();
}
- //! Dumps the content of me on the stream <OS>.
- Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
-
- //! Dumps the content of me on the stream <OS>.
- Standard_EXPORT void Dump (Standard_OStream& OS) const;
-
private:
//! Center of the OBB
--- /dev/null
+# Install script for directory: F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/src/DRAWEXE\r
+\r
+# Set the install prefix\r
+if(NOT DEFINED CMAKE_INSTALL_PREFIX)\r
+ set(CMAKE_INSTALL_PREFIX "F:/Projects/DMUReviewer/Deps/3rd-parties_2019-06-18_Rina/occt-vc12-64")\r
+endif()\r
+string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")\r
+\r
+# Set the install configuration name.\r
+if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\r
+ if(BUILD_TYPE)\r
+ string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""\r
+ CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")\r
+ else()\r
+ set(CMAKE_INSTALL_CONFIG_NAME "Release")\r
+ endif()\r
+ message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")\r
+endif()\r
+\r
+# Set the component getting installed.\r
+if(NOT CMAKE_INSTALL_COMPONENT)\r
+ if(COMPONENT)\r
+ message(STATUS "Install component: \"${COMPONENT}\"")\r
+ set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")\r
+ else()\r
+ set(CMAKE_INSTALL_COMPONENT)\r
+ endif()\r
+endif()\r
+\r
+# Is this installation the result of a crosscompile?\r
+if(NOT DEFINED CMAKE_CROSSCOMPILING)\r
+ set(CMAKE_CROSSCOMPILING "FALSE")\r
+endif()\r
+\r
+if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)\r
+ if ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")\r
+ set (OCCT_INSTALL_BIN_LETTER "")\r
+ elseif ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$")\r
+ set (OCCT_INSTALL_BIN_LETTER "i")\r
+ elseif ("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")\r
+ set (OCCT_INSTALL_BIN_LETTER "d")\r
+ endif()\r
+endif()\r
+\r
+if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)\r
+ if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")\r
+ file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bin/DRAWEXE.exe")\r
+ elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Dd][Ee][Bb][Uu][Gg])$")\r
+ file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bind/DRAWEXE.exe")\r
+ elseif("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo])$")\r
+ file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/win64/vc12/bin${OCCT_INSTALL_BIN_LETTER}" TYPE EXECUTABLE FILES "F:/Projects/DMUReviewer/3rd-parties_prepared/occt_CR0_DMUReviewer_5/win64/vc12/bini/DRAWEXE.exe")\r
+ endif()\r
+endif()\r
+\r
Message_Attribute.hxx
Message_AttributeObject.cxx
Message_AttributeObject.hxx
-Message_AttributeVectorOfValues.cxx
-Message_AttributeVectorOfValues.hxx
+Message_AttributeStream.cxx
+Message_AttributeStream.hxx
Message_CompositeAlerts.cxx
Message_CompositeAlerts.hxx
Message_ExecStatus.hxx
#include <Message.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
#include <Message_Gravity.hxx>
#include <Message_Report.hxx>
} \
}
-#define MESSAGE_INFO_OBJECT(Object, Name, Description, PerfMeter, ParentAlert) \
+#define MESSAGE_INFO_OBJECT(Object, 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_AttributeObject (Object, Name, Description), PerfMeter, ParentAlert ); \
+ new Message_AttributeObject (Object, StreamValues, Name, Description), PerfMeter, ParentAlert ); \
} \
}
-#define MESSAGE_INFO_VALUES(StreamValues, Name, Description, PerfMeter, ParentAlert) \
+#define MESSAGE_INFO_STREAM(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 ); \
+ new Message_AttributeStream (StreamValues, Name, Description), PerfMeter, ParentAlert ); \
} \
}
-#define DUMP_VALUE(OS, Value) \
- { \
- OS << Value << Message::DumpSeparator(); \
- }
-
-#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
- { \
- OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
- }
-
-#define DUMP_VALUES(OS, Value1, Value2) \
- { \
- OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
- }
-
-#define DUMP_VEC_COLOR(Values, Value) \
- { \
- Value = Message::ColorVectorToString (aValues); \
- }
-
-#define DUMP_VEC_COLOR_SPLIT(Value, Values) \
- { \
- Message::ColorVectorFromString (Value, Values); \
- }
-
-#define DUMP_VEC_COORD(Values, Value) \
- { \
- Value = Message::CoordVectorToString (aValues); \
- }
-
-#define DUMP_VEC_COORD_SPLIT(Value, Values) \
- { \
- Message::CoordVectorFromString (Value, Values); \
- }
-
-
-#define DUMP_VALUES_SPLIT(OS, ColumnCount, Values) \
- { \
- Message::ConvertStream (OS, aColumnCount, aValues); \
- }
+//#define DUMP_VALUE(OS, Value) \
+// { \
+// OS << Value << Message::DumpSeparator(); \
+// }
+//
+//#define DUMP_VALUES_COLUMNS(OS, ObjectName, ColumnCount) \
+// { \
+// OS << ObjectName << Message::DumpSeparator() << ColumnCount << Message::DumpSeparator(); \
+// }
+//
+//#define DUMP_VALUES(OS, Value1, Value2) \
+// { \
+// OS << Value1 << Message::DumpSeparator() << Value2 << Message::DumpSeparator(); \
+// }
+//
+//#define DUMP_VEC_COLOR(Values, Value) \
+// { \
+// Value = Message::ColorVectorToString (aValues); \
+// }
+//
+//#define DUMP_VEC_COLOR_SPLIT(Value, Values) \
+// { \
+// Message::ColorVectorFromString (Value, Values); \
+// }
+//
+//#define DUMP_VEC_COORD(Values, Value) \
+// { \
+// Value = Message::CoordVectorToString (aValues); \
+// }
+//
+//#define DUMP_VEC_COORD_SPLIT(Value, Values) \
+// { \
+// Message::CoordVectorFromString (Value, Values); \
+// }
+//
+//
+//#define DUMP_VALUES_SPLIT(OS, ColumnCount, Values) \
+// { \
+// Message::ConvertStream (OS, aColumnCount, aValues); \
+// }
#endif // _Message_Alerts_HeaderFile
#include <Message_AttributeObject.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_Attribute)
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
//=======================================================================
//function : Message_AttributeObject
//=======================================================================
Message_AttributeObject::Message_AttributeObject (const Handle(Standard_Transient)& theObject,
+ const Standard_SStream& theStream,
const TCollection_AsciiString& theName,
const TCollection_AsciiString& theDescription)
-: Message_Attribute (theName, theDescription)
+: Message_AttributeStream (theStream, theName, theDescription)
{
myObject = theObject;
}
#ifndef _Message_AttributeObject_HeaderFile
#define _Message_AttributeObject_HeaderFile
-#include <Message_Attribute.hxx>
+#include <Message_AttributeStream.hxx>
#include <TCollection_AsciiString.hxx>
//! Alert object storing Transient object in its field
-class Message_AttributeObject : public Message_Attribute
+class Message_AttributeObject : public Message_AttributeStream
{
public:
//! Constructor with string argument
Standard_EXPORT Message_AttributeObject (const Handle(Standard_Transient)& theObject,
+ const Standard_SStream& theStream,
const TCollection_AsciiString& theName = TCollection_AsciiString(),
const TCollection_AsciiString& theDescription = TCollection_AsciiString());
Handle(Standard_Transient) GetObject() const { return myObject; }
// OCCT RTTI
- DEFINE_STANDARD_RTTIEXT(Message_AttributeObject, Message_Attribute)
+ DEFINE_STANDARD_RTTIEXT(Message_AttributeObject, Message_AttributeStream)
private:
Handle(Standard_Transient) myObject;
--- /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_AttributeStream.hxx>
+
+#include <Message.hxx>
+#include <Message_Msg.hxx>
+#include <Message_PerfMeter.hxx>
+#include <Message_Report.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
+
+//=======================================================================
+//function : SetValues
+//purpose :
+//=======================================================================
+Message_AttributeStream::Message_AttributeStream (const Standard_SStream& theStream,
+ const TCollection_AsciiString& theName,
+ const TCollection_AsciiString& theDescription)
+: Message_Attribute(theName, theDescription)
+{
+ SetStream (theStream);
+}
+
+//=======================================================================
+//function : SetStream
+//purpose :
+//=======================================================================
+
+void Message_AttributeStream::SetStream (const Standard_SStream& theStream)
+{
+ TCollection_AsciiString aStreamStr (theStream.str().c_str());
+ myStream << aStreamStr;
+}
+
--- /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_AttributeStream_HeaderFile
+#define _Message_AttributeStream_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_AttributeStream : public Message_Attribute
+{
+public:
+
+ //! Constructor with string argument
+ Standard_EXPORT Message_AttributeStream (const Standard_SStream& theStream,
+ const TCollection_AsciiString& theName = TCollection_AsciiString(),
+ const TCollection_AsciiString& theDescription = TCollection_AsciiString());
+
+ //! Sets stream value
+ Standard_EXPORT void SetStream (const Standard_SStream& theStream);
+
+ //! Returns stream value
+ const Standard_SStream& GetStream() const { return myStream; }
+
+ // OCCT RTTI
+ DEFINE_STANDARD_RTTIEXT(Message_AttributeStream, Message_Attribute)
+
+private:
+ Standard_SStream myStream; //!< container of values
+};
+
+#endif // _Message_AttributeStream_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_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
#include <Quantity_ColorRGBA.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
#include <TCollection_AsciiString.hxx>
#include <string.h>
}
}
+
+const TCollection_AsciiString Quantity_Color_ClassName = "Quantity_Color";
+
//=======================================================================
-// function : ToString
-// purpose :
+//function : Dump
+//purpose :
//=======================================================================
-TCollection_AsciiString Quantity_Color::ToString() const
-{
- NCollection_Vector<Standard_Real> aValues;
- aValues.Append (MyRed);
- aValues.Append (MyGreen);
- aValues.Append (MyBlue);
- Standard_SStream OS;
+void Quantity_Color::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, Quantity_Color_ClassName);
- TCollection_AsciiString aValue;
- DUMP_VEC_COLOR(aValues, aValue)
+ DUMP_VALUES (OS, "MyRed", MyRed);
+ DUMP_VALUES (OS, "MyGreen", MyGreen);
+ DUMP_VALUES (OS, "MyBlue", MyBlue);
- return aValue;
+ DUMP_STOP_KEY (OS, Quantity_Color_ClassName);
}
//=======================================================================
-// function : FromString
-// purpose :
+//function : Init
+//purpose :
//=======================================================================
-Standard_Boolean Quantity_Color::FromString (const TCollection_AsciiString& theValue)
-{
- NCollection_Vector<Standard_Real> aValues;
- DUMP_VEC_COLOR_SPLIT (theValue, aValues)
- if (aValues.Size() != 3)
- return Standard_False;
-
- MyRed = (Standard_ShortReal)aValues.Value (0);
- MyGreen = (Standard_ShortReal)aValues.Value (1);
- MyBlue = (Standard_ShortReal)aValues.Value (2);
+Standard_Boolean Quantity_Color::Init (const Standard_OStream& OS)
+{
+ //NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+ //Standard_SStream aSStream (OS);
+ //TCollection::Split (aSStream, aStreamValues);
+
+ //TCollection_AsciiString anXYZValue;
+ //if (!aStreamValues.FindFromKey (Quantity_Color_ClassName, anXYZValue))
+ // anXYZValue = anXYZValue;
+ //else if (aStreamValues.Size() == 1)
+ //{
+ // NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator anIterator (aStreamValues);
+ // TCollection_AsciiString aValueStr = anIterator.Value();
+ // Standard_Integer aPosition = aValueStr.Search (Quantity_Color_ClassName + TCollection::ClassNameSeparator());
+ // if (aPosition < 1)
+ // return Standard_False;
+ // anXYZValue = aValueStr.Split (aPosition);
+ //}
+
+ //NCollection_Vector<Standard_Real> aValues;
+ //if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+ // return Standard_False;
+
+ //if (aValues.Size() != 3)
+ // return Standard_False;
+
+ //MyRed = (Standard_ShortReal)aValues.Value (1);
+ //MyGreen = (Standard_ShortReal)aValues.Value (2);
+ //MyBlue = (Standard_ShortReal)aValues.Value (3);
return Standard_True;
}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_ShortReal.hxx>
//! Internal test
Standard_EXPORT static void Test();
- //! Covers point into string in format: (X, Y, Z)
- //! \return the string value
- Standard_EXPORT TCollection_AsciiString ToString() const;
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
- //! Converts text value into parameters if possible, the string format is: (X, Y, Z)
- //! \return true if conversion is done
- Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
private:
#include <Quantity_ColorRGBA.hxx>
#include <Graphic3d_Vec4.hxx>
+#include <TCollection.hxx>
#include <algorithm>
const ColorInteger aColorComponentBase = isShort ? THE_HEX_COLOR_COMPONENT_SHORT_BASE : THE_HEX_COLOR_COMPONENT_BASE;
return convertIntegerToColorRGBA (aHexColorInteger, aColorComponentBase, hasAlphaComponent, theColor);
}
+
+const TCollection_AsciiString Quantity_ColorRGBA_ClassName = "Quantity_ColorRGBA";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void Quantity_ColorRGBA::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
+{
+ DUMP_START_KEY (OS, Quantity_ColorRGBA_ClassName);
+
+ DUMP_VALUES (OS, "Alpha", Alpha());
+ {
+ Standard_SStream aTmpStream;
+ myRgb.Dump (aTmpStream);
+ DUMP_VALUES (OS, "RGB", TCollection::ToDumpString (aTmpStream));
+ }
+
+ DUMP_STOP_KEY (OS, Quantity_ColorRGBA_ClassName);
+}
Quantity_ColorRGBA& theColor,
const bool theAlphaComponentIsOff = false);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
private:
static void myTestSize3() { Standard_STATIC_ASSERT (sizeof(float) * 3 == sizeof(Quantity_Color)); }
{
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
- MESSAGE_INFO_OBJECT (theEntity, "checkOverlap", "", &aPerfMeter, NULL);
+ Standard_SStream aStream;
+ MESSAGE_INFO_OBJECT (theEntity, aStream, "checkOverlap", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
#endif
#ifdef REPORT_SELECTION_BUILD
Message_PerfMeter aPerfMeter;
- MESSAGE_INFO_OBJECT (theObject, "traverseObject", "", &aPerfMeter, NULL);
+ Standard_SStream aStream;
+ MESSAGE_INFO_OBJECT (theObject, aStream, "traverseObject", "", &aPerfMeter, NULL);
Handle(Message_Alert) aParentAlert = OCCT_Message_Alert;
#endif
Standard_SStream aStream;
Dump (aStream);
- MESSAGE_INFO_VALUES (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
+ MESSAGE_INFO_STREAM (aStream, "Parameters", "", &aPerfMeter, aParentAlert);
#endif
mystored.Clear();
#ifdef REPORT_SELECTION_BUILD
Standard_SStream aStreamDone;
Dump (aStreamDone);
- MESSAGE_INFO_VALUES (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
+ MESSAGE_INFO_STREAM (aStreamDone, "Parameters", "", &aPerfMeter, aParentAlert);
#endif
}
Standard_DimensionMismatch.hxx
Standard_DivideByZero.hxx
Standard_DomainError.hxx
+Standard_DumpMask.hxx
Standard_ErrorHandler.cxx
Standard_ErrorHandler.hxx
Standard_ExtCharacter.hxx
--- /dev/null
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Standard_DumpMask_HeaderFile
+#define _Standard_DumpMask_HeaderFile
+
+
+//! Sets how much information should be dumped in Dump of the object
+enum Standard_DumpMask
+{
+ Standard_DumpMask_Empty = 0x0000, //! empty output
+ Standard_DumpMask_Fields = 0x0001, //! only class fields value
+ Standard_DumpMask_Methods = 0x0002, //! only methods result
+ Standard_DumpMask_ClassName = 0x0004, //! the first row of Dump has class name
+ Standard_DumpMask_SingleValue = 0x0008, //! dump is combined in one value
+ Standard_DumpMask_Whole = Standard_DumpMask_Fields | Standard_DumpMask_Methods,
+ Standard_DumpMask_WholeAndClassName = Standard_DumpMask_Whole | Standard_DumpMask_ClassName
+};
+
+#endif // _Standard_DumpMask_HeaderFile
#include <TCollection.hxx>
#include <Standard_OutOfRange.hxx>
+#include <TCollection_AsciiString.hxx>
// The array of prime numbers used as consequtive steps for
// size of array of buckets in the map.
}
throw Standard_OutOfRange ("TCollection::NextPrimeForMap() - requested too big size");
}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+
+TCollection_AsciiString TCollection::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
+{
+ if (thePointer.IsNull())
+ return TCollection_AsciiString();
+
+ return GetPointerInfo(thePointer.operator->(), isShortInfo);
+}
+
+// =======================================================================
+// function : GetPointerInfo
+// purpose :
+// =======================================================================
+
+TCollection_AsciiString TCollection::GetPointerInfo (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(GetPointerPrefix());
+ return anInfoPtr;
+ }
+ }
+ return aPtrStr.str().c_str();
+}
+
+// ----------------------------------------------------------------------------
+// Join
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::Join (const NCollection_List<TCollection_AsciiString>& theValues,
+ const TCollection_AsciiString& theSeparator)
+{
+ TCollection_AsciiString aValue;
+ for (NCollection_List<TCollection_AsciiString>::Iterator anIterator (theValues); anIterator.More(); anIterator.Next())
+ {
+ if (!aValue.IsEmpty())
+ aValue += theSeparator;
+
+ aValue += anIterator.Value();
+ }
+
+ return aValue;
+}
+
+// ----------------------------------------------------------------------------
+// Split
+// ----------------------------------------------------------------------------
+
+void TCollection::Split (const Standard_SStream& theStream,
+ NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues)
+{
+ TCollection_AsciiString aStreamStr (theStream.str().c_str());
+
+ NCollection_List<TCollection_AsciiString> aValues;
+ Split (aStreamStr, DumpSeparator(), aValues);
+
+ for (NCollection_List<TCollection_AsciiString>::Iterator anIterator (aValues); anIterator.More(); anIterator.Next())
+ {
+ TCollection_AsciiString aKey = anIterator.Value();
+ anIterator.Next();
+ if (!anIterator.More())
+ break;
+ theValues.Add (aKey, anIterator.Value());
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// Split
+// ----------------------------------------------------------------------------
+
+void TCollection::Split (const TCollection_AsciiString& theValue,
+ const TCollection_AsciiString& theSeparator,
+ NCollection_List<TCollection_AsciiString>& theValues)
+{
+ TCollection_AsciiString aCurrentString = theValue;
+
+ TCollection_AsciiString aSplitValue, aTailValue, aKey;
+ while (!aCurrentString.IsEmpty())
+ {
+ TCollection_AsciiString aValueString = aCurrentString;
+ if (SplitDumped (aValueString, aSplitValue, aTailValue, aKey))
+ {
+ aValueString = aSplitValue;
+ aCurrentString = aTailValue;
+ }
+ else
+ {
+ Standard_Integer aPosition = aValueString.Search (theSeparator);
+ if (aPosition < 0 )
+ break;
+ aCurrentString = aValueString.Split (aPosition - 1);
+ }
+ theValues.Append (aValueString);
+ if (aCurrentString.IsEmpty())
+ break;
+
+ aCurrentString = aCurrentString.Split (theSeparator.Length());
+ }
+
+ if (theValues.Size() == 1)
+ {
+ TCollection_AsciiString aKey, aValue;
+ if (!SplitKey (theValues.First(), aValue, aKey))
+ return;
+
+ theValues.Clear();
+ Split (aValue, DumpSeparator(), theValues);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// SplitReal
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitReal (const TCollection_AsciiString& theValue,
+ const TCollection_AsciiString& theSeparator,
+ NCollection_Vector<Standard_Real>& theValues)
+{
+ TCollection_AsciiString aCurrentString = theValue;
+
+ while (!aCurrentString.IsEmpty())
+ {
+ TCollection_AsciiString aValueString = aCurrentString;
+ Standard_Integer aPosition = aValueString.Search (theSeparator);
+ if (aPosition < 0 )
+ break;
+
+ aCurrentString = aValueString.Split (aPosition);
+ if (!aValueString.IsRealValue())
+ return Standard_False;
+
+ theValues.Append (aValueString.RealValue());
+ aCurrentString = aCurrentString.Split (theSeparator.Length() + 1);
+ }
+
+ return !theValues.IsEmpty();
+}
+
+// ----------------------------------------------------------------------------
+// ToDumpString
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ToDumpString (const NCollection_List<TCollection_AsciiString>& theValues)
+{
+ return TCollection::Join (theValues, TCollection::VectorSeparator());
+}
+
+// ----------------------------------------------------------------------------
+// ToString
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ToDumpString (const Standard_SStream& theStream)
+{
+ return TCollection_AsciiString (theStream.str().c_str());
+}
+
+// ----------------------------------------------------------------------------
+// ConvertDumpToText
+// ----------------------------------------------------------------------------
+
+TCollection_AsciiString TCollection::ConvertDumpToText (const TCollection_AsciiString& theValue)
+{
+ TCollection_AsciiString aText = theValue;
+
+ //TCollection_AsciiString aCurrentString = theValue;
+ //while (!aCurrentString.IsEmpty())
+ //{
+ // TCollection_AsciiString aValueString = aCurrentString;
+ // Standard_Integer aPosition = aValueString.Search (theSeparator);
+ // if (aPosition < 0 )
+ // break;
+
+ // aCurrentString = aValueString.Split (aPosition);
+ // theValues.Append (aValueString);
+
+ // aCurrentString = aCurrentString.Split (theSeparator.Length() + 1);
+ //}
+
+ //TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); }
+ //TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); }
+ //TCollection_AsciiString XMLFinishKey() { return TCollection_AsciiString ("\\"); }
+
+ return aText;
+}
+
+// ----------------------------------------------------------------------------
+// SplitDumped
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitDumped (const TCollection_AsciiString& theSourceValue,
+ TCollection_AsciiString& theSplitValue,
+ TCollection_AsciiString& theTailValue,
+ TCollection_AsciiString& theKey)
+{
+ Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen());
+ // the first symbol is bracket
+ if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length())
+ return Standard_False;
+
+ TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length());
+
+ aBracketPosition = aValue.Search (XMLBracketClose());
+ if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length())
+ return Standard_False;
+
+ theKey = aValue;
+
+ TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1);
+ aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket
+ TCollection_AsciiString aStopKey = StopKey (theKey);
+
+ aBracketPosition = theSourceValue.Search (aStopKey);
+
+ Standard_Integer aStopKeyLastPosition = aBracketPosition + aStopKey.Length() - 1;
+
+ //aBracketPosition = aTailValue.Search (aStopKey);
+ if (aBracketPosition <= 1 || aStopKeyLastPosition > theSourceValue.Length())
+ return Standard_False;
+
+ theSplitValue = theSourceValue;
+ theTailValue = theSplitValue.Split (aStopKeyLastPosition);
+ //theSplitValue = aTailValue;
+ //aTailValue = theSplitValue.Split (aBracketPosition - 1);
+
+ //if (aTailValue.Length() < aStopKey.Length())
+ // return Standard_False;
+
+ //if (aTailValue.Length() == aStopKey.Length())
+ //{
+ // theTailValue = TCollection_AsciiString();
+ // return Standard_True;
+ //}
+
+ //theTailValue = aTailValue.Split (aStopKey.Length());
+ return Standard_True;
+}
+
+// ----------------------------------------------------------------------------
+// SplitKey
+// ----------------------------------------------------------------------------
+
+Standard_Boolean TCollection::SplitKey (const TCollection_AsciiString& theSourceValue,
+ TCollection_AsciiString& theSplitValue,
+ TCollection_AsciiString& theKey)
+{
+ Standard_Integer aBracketPosition = theSourceValue.Search (XMLBracketOpen());
+ // the first symbol is bracket
+ if (aBracketPosition != 1 || aBracketPosition >= theSourceValue.Length())
+ return Standard_False;
+
+ TCollection_AsciiString aValue = theSourceValue.SubString (aBracketPosition + 1, theSourceValue.Length());
+
+ aBracketPosition = aValue.Search (XMLBracketClose());
+ if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length())
+ return Standard_False;
+
+ theKey = aValue;
+
+ TCollection_AsciiString aTailValue = theKey.Split (aBracketPosition - 1);
+ aTailValue = aTailValue.SubString (2, aTailValue.Length()); // remove close bracket
+ TCollection_AsciiString aStopKey = StopKey (theKey);
+
+ aBracketPosition = theSourceValue.Search (aStopKey);
+ if (aBracketPosition <= 1 || aBracketPosition >= theSourceValue.Length())
+ return Standard_False;
+
+ theSplitValue = aTailValue;
+ aTailValue = theSplitValue.Split (aBracketPosition - 1);
+ return Standard_True;
+}
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
-class TCollection_AsciiString;
+#include <TCollection_AsciiString.hxx>
+
+#include <NCollection_IndexedDataMap.hxx>
+#include <NCollection_List.hxx>
+#include <NCollection_Vector.hxx>
+
class TCollection_ExtendedString;
class TCollection_HAsciiString;
class TCollection_HExtendedString;
DEFINE_STANDARD_ALLOC
+ //! 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
+ //! \return the string value
+ Standard_EXPORT static TCollection_AsciiString GetPointerInfo (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 GetPointerInfo (const void* thePointer,
+ const bool isShortInfo = true);
+
//! Returns a prime number greater than <I> suitable
//! to dimension a Map. When <I> becomes great there
//! is a limit on the result (today the limit is
//! there will be more collisions in the map.
Standard_EXPORT static Standard_Integer NextPrimeForMap (const Standard_Integer I);
+ //! Returns separator symbol of Dump information
+ static Standard_Character DumpSeparator() { return '\\'; }
+
+ //! Returns separator symbol of values vector union
+ static Standard_CString VectorSeparator() { return " ,"; }
+
+ //! Returns separator symbol of class name prefix
+ static inline Standard_CString ClassNameSeparator() { return " ,"; }
+
+ //! Unites list of string into one string using the separator
+ Standard_EXPORT static TCollection_AsciiString Join (const NCollection_List<TCollection_AsciiString>& theValues,
+ const TCollection_AsciiString& theSeparator);
+
+ //! Converts stream to map of values where the key is each odd, value is each even value
+ //! \param theStream stream value
+ //! \param theValues [out] container of split values
+ Standard_EXPORT static void Split (const Standard_SStream& theStream,
+ NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& theValues);
+
+ //! Unites list of string into one string using the separator
+ Standard_EXPORT static void Split (const TCollection_AsciiString& theValue,
+ const TCollection_AsciiString& theSeparator,
+ NCollection_List<TCollection_AsciiString>& theValues);
+
+ //! Unites list of string into one string using the separator
+ Standard_EXPORT static Standard_Boolean SplitReal (const TCollection_AsciiString& theValue,
+ const TCollection_AsciiString& theSeparator,
+ NCollection_Vector<Standard_Real>& theValues);
+
+ //! Unites vector to string value using VectorSeparator.
+ Standard_EXPORT static TCollection_AsciiString ToDumpString (const NCollection_List<TCollection_AsciiString>& theValues);
+ //! Converts stream value to string value
+ Standard_EXPORT static TCollection_AsciiString ToDumpString (const Standard_SStream& theStream);
+
+ //! Converts stream value to string value
+ static TCollection_AsciiString StartKey (const TCollection_AsciiString& theValue)
+ { return XMLBracketOpen() + theValue + XMLBracketClose(); }
+
+ //! Converts stream value to string value
+ static TCollection_AsciiString StopKey (const TCollection_AsciiString& theValue)
+ { return XMLBracketOpen() + XMLFinishKey() + theValue + XMLBracketClose(); }
+
+ Standard_EXPORT static TCollection_AsciiString ConvertDumpToText (const TCollection_AsciiString& theValue);
+
+ //! Splits a AsciiString into two sub-strings using Dump keys.
+ //! Example:
+ //! aString contains "<key>abc</key>defg"
+ //! aString.SplitDumped() gives <me> = "abc" and returns "defg"
+ Standard_EXPORT static Standard_Boolean SplitDumped (const TCollection_AsciiString& theSourceValue,
+ TCollection_AsciiString& theSplitValue,
+ TCollection_AsciiString& theTailValue,
+ TCollection_AsciiString& theKey);
+
+ //! Splits value that contains a key in form: <key>value</key>. In this case the values are:
+ //! theSplitValue = value, theKey = key.
+ Standard_EXPORT static Standard_Boolean SplitKey (const TCollection_AsciiString& theSourceValue,
+ TCollection_AsciiString& theSplitValue,
+ TCollection_AsciiString& theKey);
-
+protected:
+ static TCollection_AsciiString XMLBracketOpen() { return TCollection_AsciiString ("<"); }
+ static TCollection_AsciiString XMLBracketClose() { return TCollection_AsciiString (">"); }
+ static TCollection_AsciiString XMLFinishKey() { return TCollection_AsciiString ("\\"); }
protected:
};
+#define DUMP_VALUES(OS, Value1, Value2) \
+{ \
+ OS << Value1 << TCollection::DumpSeparator() << Value2 << TCollection::DumpSeparator(); \
+}
+
+#define DUMP_START_KEY(OS, Value1) { OS << TCollection::StartKey (Value1); }
+#define DUMP_STOP_KEY(OS, Value1) { OS << TCollection::StopKey (Value1); }
#ifndef _TCollection_AsciiString_HeaderFile
#define _TCollection_AsciiString_HeaderFile
+
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
//! aString contains "abcdefg"
//! aString.Split(3) gives <me> = "abc" and returns "defg"
Standard_EXPORT TCollection_AsciiString Split (const Standard_Integer where);
-
+
//! Creation of a sub-string of the string <me>.
//! The sub-string starts to the index Fromindex and ends
//! to the index ToIndex.
#include <Standard_ConstructionError.hxx>
#include <Standard_Stream.hxx>
#include <Standard_Type.hxx>
+#include <TCollection.hxx>
#include <TopLoc_Datum3D.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopLoc_Datum3D,Standard_Transient)
{
}
+const TCollection_AsciiString TopLoc_Datum3D_ClassName = "TopLoc_Datum3D";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void TopLoc_Datum3D::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, TopLoc_Datum3D_ClassName);
+
+ Standard_SStream aTmpStream;
+ myTrsf.Dump (aTmpStream);
+ DUMP_VALUES (OS, "Transformation", TCollection::ToDumpString (aTmpStream));
+
+ DUMP_START_KEY (OS, TopLoc_Datum3D_ClassName);
+}
+
//=======================================================================
//function : ShallowDump
//purpose :
const gp_Trsf& Transformation() const;
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
//! Writes the contents of this Datum3D to the stream S.
Standard_EXPORT void ShallowDump (Standard_OStream& S) const;
#include <TopLoc_Datum3D.hxx>
+#include <TCollection.hxx>
#include <TopLoc_ItemLocation.hxx>
#include <TopLoc_Location.hxx>
#include <TopLoc_SListOfItemLocation.hxx>
myTrsf (D->Transformation().Powered (P))
{
}
+
+const TCollection_AsciiString TopLoc_ItemLocation_ClassName = "TopLoc_ItemLocation";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void TopLoc_ItemLocation::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, TopLoc_ItemLocation_ClassName);
+
+ DUMP_VALUES (OS, "Power", myPower);
+ {
+ Standard_SStream aTmpStream;
+ myTrsf.Dump (aTmpStream);
+ DUMP_VALUES (OS, "Trsf", TCollection::ToDumpString (aTmpStream));
+ }
+ {
+ Standard_SStream aTmpStream;
+ if (!myDatum.IsNull())
+ myDatum->Dump (aTmpStream);
+ DUMP_VALUES (OS, "Datum", TCollection::ToDumpString (aTmpStream));
+ }
+
+ DUMP_STOP_KEY (OS, TopLoc_ItemLocation_ClassName);
+}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
+#include <Standard_OStream.hxx>
#include <gp_Trsf.hxx>
class TopLoc_Datum3D;
class TopLoc_Location;
//! Sets the exponent to <P>
Standard_EXPORT TopLoc_ItemLocation(const Handle(TopLoc_Datum3D)& D, const Standard_Integer P);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
friend class TopLoc_Location;
friend class TopLoc_SListOfItemLocation;
#include <gp_Trsf.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_NoSuchObject.hxx>
+#include <TCollection.hxx>
#include <TopLoc_Datum3D.hxx>
#include <TopLoc_ItemLocation.hxx>
#include <TopLoc_Location.hxx>
return !IsEqual(Other);
}
+const TCollection_AsciiString TopLoc_Location_ClassName = "TopLoc_Location";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void TopLoc_Location::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, TopLoc_Location_ClassName);
+
+ DUMP_VALUES (OS, "IsIdentity", IsIdentity());
+ {
+ Standard_SStream aTmpStream;
+ Transformation().Dump (aTmpStream);
+ DUMP_VALUES (OS, "Transformation", TCollection::ToDumpString (aTmpStream));
+ }
+
+ TopLoc_SListOfItemLocation items = myItems;
+ if (!items.IsEmpty())
+ {
+ DUMP_VALUES (OS, "Items", "");
+ while (items.More())
+ {
+ Standard_SStream aTmpStream;
+ items.Value().Dump (aTmpStream);
+ DUMP_VALUES (OS, "Item", TCollection::ToDumpString (aTmpStream));
+
+ items.Next();
+ }
+ }
+ DUMP_STOP_KEY (OS, TopLoc_Location_ClassName);
+}
+
//=======================================================================
//function : ShallowDump
//purpose :
#include <TopLoc_SListOfItemLocation.hxx>
#include <Standard_Boolean.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Integer.hxx>
#include <Standard_OStream.hxx>
+
class Standard_NoSuchObject;
class Standard_ConstructionError;
class gp_Trsf;
return IsDifferent(Other);
}
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
//! Prints the contents of <me> on the stream <s>.
Standard_EXPORT void ShallowDump (Standard_OStream& S) const;
#include <Message_Msg.hxx>
IMPLEMENT_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_Attribute)
+
+//=======================================================================
+//function : TopoDS_AlertAttribute
+//purpose :
+//=======================================================================
+
+
+TopoDS_AlertAttribute::TopoDS_AlertAttribute (const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theName,
+ const TCollection_AsciiString& theDescription)
+: Message_AttributeStream (Standard_SStream(), theName, theDescription), myShape (theShape)
+{
+ Standard_SStream aStream;
+ theShape.Dump (aStream);
+
+ SetStream (aStream);
+}
#ifndef _TopoDS_AlertAttribute_HeaderFile
#define _TopoDS_AlertAttribute_HeaderFile
-#include <Message_Attribute.hxx>
+#include <Message_AttributeStream.hxx>
#include <TopoDS_Shape.hxx>
//! Alert attributre object storing TopoDS shape in its field
-class TopoDS_AlertAttribute : public Message_Attribute
+class TopoDS_AlertAttribute : public Message_AttributeStream
{
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; }
// OCCT RTTI
- DEFINE_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_Attribute)
+ DEFINE_STANDARD_RTTIEXT(TopoDS_AlertAttribute, Message_AttributeStream)
private:
TopoDS_Shape myShape;
#include <Standard_DomainError.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_TypeMismatch.hxx>
+#include <TCollection.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS_TShape.hxx>
const Standard_Integer aHL = myLocation.HashCode (theUpperBound);
return ::HashCode (aHS ^ aHL, theUpperBound);
}
+
+const TCollection_AsciiString TopoDS_Shape_ClassName = "TopoDS_Shape";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void TopoDS_Shape::Dump (Standard_OStream& OS, const Standard_Integer /*theMask*/) const
+{
+ DUMP_START_KEY (OS, TopoDS_Shape_ClassName);
+
+ DUMP_VALUES (OS, "TShape", TCollection::GetPointerInfo (myTShape));
+ DUMP_VALUES (OS, "Orientation", TopAbs::ShapeOrientationToString (myOrient));
+ {
+ Standard_SStream aTmpStream;
+ myLocation.Dump (aTmpStream);
+ DUMP_VALUES (OS, "Location", TCollection::ToDumpString (aTmpStream));
+ }
+
+ DUMP_STOP_KEY (OS, TopoDS_Shape_ClassName);
+}
void TShape (const Handle(TopoDS_TShape)& theTShape) { myTShape = theTShape; }
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
private:
Handle(TopoDS_TShape) myTShape;
#include <XCAFPrs_Style.hxx>
+#include <TCollection.hxx>
+
//=======================================================================
//function : XCAFPrs_Style
//purpose :
myHasColorCurv = Standard_False;
myColorCurv.SetValues (Quantity_NOC_YELLOW);
}
+
+const TCollection_AsciiString XCAFPrs_Style_ClassName = "XCAFPrs_Style";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void XCAFPrs_Style::Dump (Standard_OStream& OS) const
+{
+ DUMP_START_KEY (OS, XCAFPrs_Style_ClassName);
+
+ DUMP_VALUES (OS, "HasColorSurf", myHasColorSurf);
+ {
+ Standard_SStream aTmpStream;
+ myColorSurf.Dump (aTmpStream);
+ DUMP_VALUES (OS, "ColorSurf", TCollection::ToDumpString (aTmpStream));
+ }
+ DUMP_VALUES (OS, "HasColorCurv", myHasColorCurv);
+ {
+ Standard_SStream aTmpStream;
+ myColorCurv.Dump (aTmpStream);
+ DUMP_VALUES (OS, "ColorCurv", TCollection::ToDumpString (aTmpStream));
+ }
+ DUMP_VALUES (OS, "IsVisible", myIsVisible);
+
+ DUMP_STOP_KEY (OS, XCAFPrs_Style_ClassName);
+}
return theS1.IsEqual (theS2);
}
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS) const;
+
protected:
Quantity_ColorRGBA myColorSurf;
#include <Message.hxx>
#include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
#include <Message_CompositeAlerts.hxx>
#include <Message_Report.hxx>
+#include <TCollection.hxx>
#include <TDataStd_AsciiString.hxx>
#include <TDataStd_Comment.hxx>
#include <TDataStd_Real.hxx>
TDataStd_Comment::Set (theAlertLabel, anAttribute->GetDescription());
Standard_CString aDynamicTypeName = anAttribute->DynamicType()->Name();
- if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
+ if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeStream)->Name())
{
- Handle(Message_AttributeVectorOfValues) aValuesArrayAlert = Handle(Message_AttributeVectorOfValues)::DownCast (anAttribute);
+ Handle(Message_AttributeStream) aValuesArrayAlert = Handle(Message_AttributeStream)::DownCast (anAttribute);
// store values
- const NCollection_Vector<TCollection_AsciiString>& anArrayValues = aValuesArrayAlert->GetValues();
- // create real list attribute only if there are values in the attribute
- if (anArrayValues.IsEmpty())
+ NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aValues;
+ TCollection::Split (aValuesArrayAlert->GetStream(), aValues);
+ if (aValues.IsEmpty())
return;
- int anArraySize = anArrayValues.Length();
+ int anArraySize = 2 * aValues.Size();
Handle(TDataStd_ExtStringArray) aListAttribute = TDataStd_ExtStringArray::Set (theAlertLabel, 0, anArraySize - 1);
for (int aValueId = 0; aValueId < anArraySize; aValueId++)
- aListAttribute->SetValue (aValueId, anArrayValues.Value (aValueId));
+ {
+ TCollection_AsciiString aKey = aValues.FindKey (aValueId);
+ aListAttribute->SetValue (aValueId * 2, aKey);
+ aListAttribute->SetValue (aValueId * 2 + 1, aValues.FindFromKey (aKey));
+ }
}
}
Handle(Message_Attribute) aMessageAttribute;
if (aDynamicTypeName == STANDARD_TYPE (Message_Attribute)->Name())
aMessageAttribute = new Message_Attribute();
- else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeVectorOfValues)->Name())
+ else if (aDynamicTypeName == STANDARD_TYPE (Message_AttributeStream)->Name())
{
// values
NCollection_Vector<TCollection_AsciiString> anArrayValues;
if (aValuesAttribute.IsNull())
return Handle(Message_Alert)();
- for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
- anArrayValues.Append (aValuesAttribute->Value (aValueId));
-
Standard_SStream aStream;
- Handle(Message_AttributeVectorOfValues) anAlert = new Message_AttributeVectorOfValues (aStream);
- anAlert->SetValues (anArrayValues);
+ for (int aValueId = aValuesAttribute->Lower(); aValueId <= aValuesAttribute->Upper(); aValueId++)
+ {
+ TCollection_AsciiString aKey = aValuesAttribute->Value (aValueId++);
+ if (aValueId > aValuesAttribute->Upper())
+ break;
+ DUMP_VALUES (aStream, aKey, aValuesAttribute->Value (aValueId));
+ }
+ Handle(Message_AttributeStream) anAlert = new Message_AttributeStream (aStream);
aMessageAttribute = anAlert;
}
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
+namespace
+{
+ static Standard_CString gp_Table_PrintTrsfForm[9] =
+ {
+ "IDENTITY", "ROTATION", "TRANSLATION", "PNTMIRROR", "AX1MIRROR", "AX2MIRROR",
+ "SCALE", "COMPOUNDSTRSF", "OTHER2"
+ };
+}
+
//=======================================================================
//function : Origin
//purpose :
return gp_OY2d;
}
+//=======================================================================
+//function : TypeOfTrsfFormToString
+//purpose :
+//=======================================================================
+Standard_CString gp::TrsfFormToString (gp_TrsfForm theType)
+{
+ return gp_Table_PrintTrsfForm[theType];
+}
+
+//=======================================================================
+//function : TrsfFormFromString
+//purpose :
+//=======================================================================
+Standard_Boolean gp::TrsfFormFromString (Standard_CString theTypeString,
+ gp_TrsfForm& theType)
+{
+ TCollection_AsciiString aName (theTypeString);
+ aName.UpperCase();
+ for (Standard_Integer aTypeIter = gp_Identity; aTypeIter <= gp_Other; ++aTypeIter)
+ {
+ Standard_CString aTypeName = gp_Table_PrintTrsfForm[aTypeIter];
+ if (aName == aTypeName)
+ {
+ theType = gp_TrsfForm (aTypeIter);
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
#ifndef _gp_HeaderFile
#define _gp_HeaderFile
+#include <gp_TrsfForm.hxx>
+
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
Standard_EXPORT static const gp_Ax2d& OY2d();
+ //! Returns the string name for a given type.
+ //! @param theType an enumeration type
+ //! @return string identifier from the enumeration list
+ Standard_EXPORT static Standard_CString TrsfFormToString (gp_TrsfForm theType);
+
+ //! Returns the orientation type from the given string identifier (using case-insensitive comparison).
+ //! @param theTypeString string identifier
+ //! @return enumeration type or gp_Identity if string identifier is invalid
+ static gp_TrsfForm TrsfFormFromString (Standard_CString theTypeString)
+ {
+ gp_TrsfForm aType = gp_Identity;
+ TrsfFormFromString (theTypeString, aType);
+ return aType;
+ }
+
+ //! Determines the type from the given string identifier (using case-insensitive comparison).
+ //! @param theTypeString string identifier
+ //! @param theType detected type
+ //! @return TRUE if string identifier is known
+ Standard_EXPORT static Standard_Boolean TrsfFormFromString (const Standard_CString theTypeString,
+ gp_TrsfForm& theType);
protected:
#include <gp_Mat.hxx>
#include <gp_Trsf.hxx>
#include <gp_XYZ.hxx>
+#include <NCollection_List.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
#define M00 ((Standard_Real*)M)[0]
#define M01 ((Standard_Real*)M)[1]
}
}
+const TCollection_AsciiString gp_Map_ClassName = "gp_Mat";
+
+void gp_Mat::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, gp_Map_ClassName);
+
+ DUMP_VALUES (OS, "Mat00", Mat00);
+ DUMP_VALUES (OS, "Mat01", Mat01);
+ DUMP_VALUES (OS, "Mat02", Mat02);
+
+ DUMP_VALUES (OS, "Mat10", Mat10);
+ DUMP_VALUES (OS, "Mat11", Mat11);
+ DUMP_VALUES (OS, "Mat12", Mat12);
+
+ DUMP_VALUES (OS, "Mat20", Mat20);
+ DUMP_VALUES (OS, "Mat21", Mat21);
+ DUMP_VALUES (OS, "Mat22", Mat22);
+
+ DUMP_STOP_KEY (OS, gp_Map_ClassName);
+}
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
//! Transposes the matrix. A(j, i) -> A (i, j)
Standard_NODISCARD gp_Mat Transposed() const;
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
friend class gp_XYZ;
friend class gp_Trsf;
#include <gp_XYZ.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
//=======================================================================
//function : gp_Trsf
matrix = aTM;
}
+
+const TCollection_AsciiString gp_Trsf_ClassName = "gp_Trsf";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void gp_Trsf::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, gp_Trsf_ClassName);
+
+ DUMP_VALUES (OS, "Form", gp::TrsfFormToString (Form()));
+ {
+ Standard_SStream aTmpStream;
+ loc.Dump (aTmpStream);
+ DUMP_VALUES (OS, "TranslationPart", TCollection::ToDumpString (aTmpStream));
+ }
+ DUMP_VALUES (OS, "ScaleFactor", ScaleFactor());
+ {
+ Standard_SStream aTmpStream;
+ matrix.Dump (aTmpStream);
+ DUMP_VALUES (OS, "HVectorialPart", TCollection::ToDumpString (aTmpStream));
+ }
+
+ DUMP_STOP_KEY (OS, gp_Trsf_ClassName);
+}
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_DefineAlloc.hxx>
+#include <Standard_DumpMask.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Handle.hxx>
+#include <Standard_OStream.hxx>
#include <Standard_Real.hxx>
class Standard_ConstructionError;
theMat.SetValue (3, 3, static_cast<T> (1));
}
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
+
friend class gp_GTrsf;
protected:
- //! Covers point into string in format: (X, Y)
- //! \return the string value
- Standard_EXPORT TCollection_AsciiString ToString() const;
-
-
- //! Converts text value into parameters if possible, the string format is: (X, Y)
- //! \return true if conversion is done
- Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
-
-
-
protected:
const gp_XY& Coord1) {
return Coord1.Multiplied(Scalar);
}
-
-inline TCollection_AsciiString gp_XY::ToString() const
-{
- return TCollection_AsciiString ("(") + x + ", " + y + ")";
-}
-
-inline Standard_Boolean gp_XY::FromString (const TCollection_AsciiString& theValue)
-{
- TCollection_AsciiString aCurrentString = theValue, aValueString;
-
- Standard_Integer aPosition = aCurrentString.Search ("(");
- if (aPosition != 1)
- return Standard_False;
-
- aCurrentString = aCurrentString.Split (aPosition);
- Standard_Real aX, anY;
- // x value
- aPosition = aCurrentString.Search (", ");
- if (aPosition < 0)
- return Standard_False;
- aCurrentString = aValueString.Split (aPosition);
- aX = aValueString.RealValue();
- aCurrentString = aCurrentString.Split (2);
-
- // y value
- aPosition = aCurrentString.Search (")");
- if (aPosition < 0)
- return Standard_False;
- aCurrentString = aValueString.Split (aPosition);
- anY = aValueString.RealValue();
-
- x = aX;
- y = anY;
- return Standard_True;
-}
#include <gp_Mat.hxx>
#include <gp_XYZ.hxx>
+#include <NCollection_List.hxx>
#include <Standard_ConstructionError.hxx>
#include <Standard_OutOfRange.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
+
+#include <TCollection_AsciiString.hxx>
Standard_Boolean gp_XYZ::IsEqual (const gp_XYZ& Other,
const Standard_Real Tolerance) const {
return Standard_True;
}
+const TCollection_AsciiString gp_XYZ_ClassName = "gp_XYZ";
+
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+
+void gp_XYZ::Dump (Standard_OStream& OS, const Standard_Integer theMask) const
+{
+ DUMP_START_KEY (OS, gp_XYZ_ClassName);
+
+ DUMP_VALUES (OS, "X", x);
+ DUMP_VALUES (OS, "Y", y);
+ DUMP_VALUES (OS, "Z", z);
+
+ DUMP_STOP_KEY (OS, gp_XYZ_ClassName);
+}
+
+//=======================================================================
+//function : Init
+//purpose :
+//=======================================================================
+
+Standard_Boolean gp_XYZ::Init (const Standard_OStream& OS)
+{
+ /*NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> aStreamValues;
+ Standard_SStream aSStream (OS);
+ TCollection::Split (aSStream, aStreamValues);
+
+ TCollection_AsciiString anXYZValue;
+ if (aStreamValues.FindFromKey (gp_XYZ_ClassName, anXYZValue))
+ anXYZValue = anXYZValue;
+ else if (aStreamValues.Size() == 1)
+ {
+ TCollection_AsciiString aValueStr = aStreamValues.FindFromIndex (1);
+ Standard_Integer aPosition = aValueStr.Search (gp_XYZ_ClassName + TCollection::ClassNameSeparator());
+ if (aPosition < 1)
+ return Standard_False;
+ anXYZValue = aValueStr.Split (aPosition);
+ }
+
+ NCollection_Vector<Standard_Real> aValues;
+ if (!TCollection::SplitReal (anXYZValue, TCollection::VectorSeparator(), aValues))
+ return Standard_False;
+
+ if (aValues.Size() != 3)
+ return Standard_False;
+
+ x = aValues.Value (1);
+ y = aValues.Value (2);
+ z = aValues.Value (3);
+ */
+ return Standard_True;
+}
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
-#include <TCollection_AsciiString.hxx>
+#include <Standard_DumpMask.hxx>
+#include <Standard_OStream.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
void SetLinearForm (const gp_XYZ& XYZ1, const gp_XYZ& XYZ2);
- //! Covers point into string in format: (X, Y, Z)
- //! \return the string value
- Standard_EXPORT TCollection_AsciiString ToString() const;
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT void Dump (Standard_OStream& OS, const Standard_Integer theMask = Standard_DumpMask_Whole) const;
-
- //! Converts text value into parameters if possible, the string format is: (X, Y, Z)
- //! \return true if conversion is done
- Standard_EXPORT Standard_Boolean FromString (const TCollection_AsciiString& theValue);
+ //! Dumps the content of me on the stream <OS>.
+ Standard_EXPORT Standard_Boolean Init (const Standard_OStream& OS);
return Coord1.Multiplied (Scalar);
}
-inline TCollection_AsciiString gp_XYZ::ToString() const
-{
- return TCollection_AsciiString ("(") + x + ", " + y + ", " + z + ")";
-}
-
-inline Standard_Boolean gp_XYZ::FromString (const TCollection_AsciiString& theValue)
-{
- TCollection_AsciiString aCurrentString = theValue, aValueString;
-
- Standard_Integer aPosition = aCurrentString.Search ("(");
- if (aPosition != 1)
- return Standard_False;
-
- aCurrentString = aCurrentString.Split (aPosition);
- Standard_Real aX, anY, aZ;
- // x value
- aPosition = aCurrentString.Search (", ");
- if (aPosition < 0)
- return Standard_False;
- aValueString = aCurrentString;
- aCurrentString = aValueString.Split (aPosition - 1);
- aX = aValueString.RealValue();
- aCurrentString = aCurrentString.Split (2);
-
- // y value
- aPosition = aCurrentString.Search (", ");
- if (aPosition < 0)
- return Standard_False;
- aValueString = aCurrentString;
- aCurrentString = aValueString.Split (aPosition - 1);
- anY = aValueString.RealValue();
- aCurrentString = aCurrentString.Split (2);
-
- // z value
- aPosition = aCurrentString.Search (")");
- if (aPosition < 0)
- return Standard_False;
- aValueString = aCurrentString;
- aCurrentString = aValueString.Split (aPosition);
- aZ = aValueString.RealValue();
-
- x = aX;
- y = anY;
- z = aZ;
- return Standard_True;
-}
-
--- /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/Convert_Tools.hxx>
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <TCollection.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+
+//=======================================================================
+//function : CreateShape
+//purpose :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateShape (const Bnd_Box& theBoundingBox)
+{
+ if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
+ return TopoDS_Shape();
+
+ Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
+ theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
+
+ gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
+ gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
+
+ return CreateBoxShape (aPntMin, aPntMax);
+}
+
+//=======================================================================
+//function : CreateShape
+//purpose :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
+{
+ if (theBoundingBox.IsVoid())
+ return TopoDS_Shape();
+
+ TColgp_Array1OfPnt anArrPnts(0, 8);
+ theBoundingBox.GetVertex(&anArrPnts(0));
+
+ BRep_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound (aCompound);
+
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
+
+ return aCompound;
+}
+
+//=======================================================================
+//function : CreateBoxShape
+//purpose :
+//=======================================================================
+TopoDS_Shape Convert_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
+{
+ Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
+ Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
+ Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
+
+ if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
+ {
+ BRep_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound (aCompound);
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
+ return aCompound;
+ }
+
+ if (aThinOnX || aThinOnY || aThinOnZ)
+ {
+ gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
+ if (aThinOnX)
+ {
+ aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+ aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
+ aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
+ aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
+ }
+ else if (aThinOnY)
+ {
+ aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+ aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+ aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
+ aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
+ }
+ else if (aThinOnZ)
+ {
+ aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
+ aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
+ aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
+ aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
+ }
+ BRep_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound (aCompound);
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
+
+ return aCompound;
+ }
+ else
+ {
+ BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
+ return aBoxBuilder.Shape();
+ }
+}
--- /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 Convert_Tools_H
+#define Convert_Tools_H
+
+#include <gp_Dir.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_XYZ.hxx>
+#include <Bnd_Box.hxx>
+#include <Bnd_OBB.hxx>
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TCollection.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TopLoc_Location.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QString>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class Geom_Transformation;
+
+//! \class Convert_Tools
+//! \brief The tool that gives auxiliary methods for qt elements manipulation
+class Convert_Tools
+{
+public:
+ //! Creates box shape
+ //! \param theBoundingBox box shape parameters
+ //! \return created shape
+ Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
+
+ //! Creates box shape
+ //! \param theBoundingBox box shape parameters
+ //! \return created shape
+ Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
+
+ //! Creates box shape
+ //! \param thePntMin minimum point on the bounding box
+ //! \param thePntMax maximum point on the bounding box
+ //! \return created shape
+ Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
+
+};
+
+#endif
--- /dev/null
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <inspector/Convert_TransientShape.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(Convert_TransientShape, Standard_Transient)
--- /dev/null
+// Created on: 2019-04-15
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef Convert_TransientShape_H
+#define Convert_TransientShape_H
+
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Type.hxx>
+#include <Standard_Transient.hxx>
+
+#include <TopoDS_Shape.hxx>
+
+DEFINE_STANDARD_HANDLE (Convert_TransientShape, Standard_Transient)
+
+//! \class Convert_TransientShape
+//! \brief An interface to create custom panes by transient object name.
+class Convert_TransientShape : public Standard_Transient
+{
+public:
+
+ //! Constructor
+ Convert_TransientShape (const TopoDS_Shape& theShape) { SetShape (theShape); }
+
+ //! Destructor
+ virtual ~Convert_TransientShape() {}
+
+ //! Fills current shape
+ void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
+
+ //! Returns current shape
+ const TopoDS_Shape GetShape() const { return myShape; }
+
+ DEFINE_STANDARD_RTTIEXT (Convert_TransientShape, Standard_Transient)
+
+private:
+ TopoDS_Shape myShape;
+};
+
+#endif
--- /dev/null
+Convert_Tools.cxx
+Convert_Tools.hxx
+Convert_TransientShape.cxx
+Convert_TransientShape.hxx
MessageModel_ItemAlert.hxx
MessageModel_ItemBase.cxx
MessageModel_ItemBase.hxx
+MessageModel_ItemPropertiesAttributeStream.cxx
+MessageModel_ItemPropertiesAttributeStream.hxx
+MessageModel_ItemPropertiesReport.cxx
+MessageModel_ItemPropertiesReport.hxx
MessageModel_ItemReport.cxx
MessageModel_ItemReport.hxx
-MessageModel_ItemReportProperties.cxx
-MessageModel_ItemReportProperties.hxx
MessageModel_ItemRoot.cxx
MessageModel_ItemRoot.hxx
MessageModel_ReportCallBack.cxx
MessageModel_ReportCallBack.hxx
-MessageModel_TableModelValues.cxx
-MessageModel_TableModelValues.hxx
MessageModel_Tools.cxx
MessageModel_Tools.hxx
MessageModel_TreeModel.cxx
ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (OnExportToShapeView()), parent(), this));
#ifdef DEBUG_ALERTS
myActions.insert (MessageModel_ActionType_Test,
- ViewControl_Tools::CreateAction ("Test", SLOT (OnTestAlerts()), parent(), this));
+ ViewControl_Tools::CreateAction ("Test <clock>", SLOT (OnTestClock()), parent(), this));
+ myActions.insert (MessageModel_ActionType_Test,
+ ViewControl_Tools::CreateAction ("Test <PropertyPanel>", SLOT (OnTestPropetyPanel()), parent(), this));
#endif
}
}
// =======================================================================
-// function : OnTestAlerts
+// function : OnTestClock
// purpose :
// =======================================================================
#include <OSD_Chronometer.hxx>
#include <ctime>
-void MessageModel_Actions::OnTestAlerts()
+void MessageModel_Actions::OnTestClock()
{
#ifdef DEBUG_ALERTS
QModelIndex aReportIndex;
aValue = (aValue * 2. + 3.) * 0.5 - 0.3 * 0.5;
Standard_Real aValue3 = aValue + aValue2 * 0.2;
+ (void)aValue3;
//MESSAGE_INFO ("Calculate", aValue, &aPerfMeter, NULL);
}
}
- ((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
+ //((MessageModel_TreeModel*)mySelectionModel->model())->EmitLayoutChanged();
+
+ myTreeModel->UpdateTreeModel();
//Standard_Real aSystemSeconds1, aCurrentSeconds1;
//OSD_Chronometer::GetThreadCPU (aCurrentSeconds1, aSystemSeconds1);
std::cout << "clock() = " << end_time - start_time << std::endl;
#endif
}
+
+// =======================================================================
+// function : OnTestClock
+// purpose :
+// =======================================================================
+void MessageModel_Actions::OnTestPropetyPanel()
+{
+#ifdef DEBUG_ALERTS
+ QModelIndex aReportIndex;
+ Handle(Message_Report) aReport = getSelectedReport (aReportIndex);
+ if (aReport.IsNull())
+ return;
+
+ Message_PerfMeter aPerfMeter;
+ MESSAGE_INFO ("MessageModel_Actions::OnTestAlerts()", "", &aPerfMeter, NULL);
+
+ // gp_XYZ
+ {
+ gp_XYZ aCoords (1.3, 2.3, 3.4);
+ Standard_SStream aStream;
+ aCoords.Dump (aStream, Standard_DumpMask_SingleValue);
+ MESSAGE_INFO_STREAM(aStream, "gp_XYZ", "", &aPerfMeter, NULL);
+ }
+ // Bnd_Box
+ {
+ Bnd_Box aBox(20., 15., 10., 25., 20., 15.);
+ Standard_SStream aStream;
+ aBox.Dump (aStream, Standard_DumpMask_SingleValue);
+ MESSAGE_INFO_STREAM(aStream, "Bnd_Box", "", &aPerfMeter, NULL);
+ }
+ // Bnd_OBB
+ {
+ Bnd_OBB anOBB (gp_Pnt (-10., -15., -10.), gp_Dir (1., 0., 0.), gp_Dir (0., 1., 0.), gp_Dir (0., 0., 1.),
+ 5., 10., 5.);
+ Standard_SStream aStream;
+ anOBB.Dump (aStream, Standard_DumpMask_SingleValue);
+ MESSAGE_INFO_STREAM(aStream, "Bnd_OBB", "", &aPerfMeter, NULL);
+ }
+ myTreeModel->UpdateTreeModel();
+#endif
+}
//! Exports the first selected shape into ShapeViewer plugin.
void OnExportToShapeView();
- //! Sending several alerts to check message-alert-tool mechanizm
- void OnTestAlerts();
+ //! Sending several alerts to check time of message-alert-tool mechanizm
+ void OnTestClock();
+
+ //! Sending several alerts to check property panel/presentations of message-alert-tool mechanizm
+ void OnTestPropetyPanel();
protected:
//! Returns report of selected tree view item if a report item is selected
#include <inspector/MessageModel_ItemAlert.hxx>
+#include <inspector/MessageModel_ItemPropertiesAttributeStream.hxx>
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/MessageModel_Tools.hxx>
#include <inspector/ViewControl_Tools.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
#include <Message_CompositeAlerts.hxx>
#include <Bnd_Box.hxx>
if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
return QIcon (":/icons/item_shape.png");
- else if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+ else if (!Handle(Message_AttributeStream)::DownCast (anAttribute).IsNull())
return QIcon (":/icons/item_vectorOfValues.png");
else
return QVariant();
if (!anExtendedAlert.IsNull() && !anExtendedAlert->Attribute().IsNull())
{
Handle(Message_Attribute) anAttribute = anExtendedAlert->Attribute();
+
if (!anAttribute.IsNull())
{
- if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
- myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
- if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
- myPresentations.Append (new ViewControl_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
+ if (!Handle(Message_AttributeStream)::DownCast(anAttribute).IsNull())
+ {
+ TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
+ SetProperties (new MessageModel_ItemPropertiesAttributeStream (anItem));
+ }
+ //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeObject)))
+ // myPresentations.Append (Handle(Message_AttributeObject)::DownCast (anAttribute)->GetObject());
+ //if (anAttribute->IsKind (STANDARD_TYPE (TopoDS_AlertAttribute)))
+ // myPresentations.Append (new Convert_TransientShape (Handle(TopoDS_AlertAttribute)::DownCast (anAttribute)->GetShape()));
}
- TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
- Bnd_Box aBox;
- if (aBox.FromString (aDescription))
- myPresentations.Append (new ViewControl_TransientShape (ViewControl_Tools::CreateShape (aBox)));
+ //TCollection_AsciiString aDescription = anExtendedAlert->Attribute()->GetDescription();
+ //Bnd_Box aBox;
+ //if (aBox.Init (Standard_SStream (aDescription.ToCString())))
+ // myPresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox)));
}
MessageModel_ItemBase::Init();
}
--- /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/MessageModel_ItemPropertiesAttributeStream.hxx>
+#include <inspector/MessageModel_ItemAlert.hxx>
+
+#include <inspector/ShapeView_ItemShape.hxx>
+#include <inspector/ShapeView_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <BRep_Tool.hxx>
+#include <Message_AlertExtended.hxx>
+#include <TCollection.hxx>
+#include <TopoDS.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+
+void MessageModel_ItemPropertiesAttributeStream::Init()
+{
+ MessageModel_ItemAlertPtr anAlertItem = itemDynamicCast<MessageModel_ItemAlert>(getItem());
+ if (!anAlertItem)
+ return;
+
+ Handle(Message_AlertExtended) anExtendedAlert = Handle(Message_AlertExtended)::DownCast(anAlertItem->GetAlert());
+ if (anExtendedAlert.IsNull() || anExtendedAlert->Attribute().IsNull())
+ return;
+
+ Handle(Message_AttributeStream) anAttributeStream = Handle(Message_AttributeStream)::DownCast (anExtendedAlert->Attribute());
+ if (anAttributeStream.IsNull())
+ return;
+
+ TCollection::Split (anAttributeStream->GetStream(), myValues);
+
+ TreeModel_ItemProperties::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+
+void MessageModel_ItemPropertiesAttributeStream::Reset()
+{
+ myValues.Clear();
+
+ TreeModel_ItemProperties::Reset();
+}
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int MessageModel_ItemPropertiesAttributeStream::GetTableRowCount() const
+{
+ const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
+ return aValues.Size();
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_ItemPropertiesAttributeStream::GetTableData (const int theRow, const int theColumn, int theRole) const
+{
+ const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& aValues = GetValues();
+
+ if (theRole == Qt::DisplayRole)
+ {
+ if (theColumn == 0) return aValues.FindKey (theRow + 1).ToCString();
+ else if (theColumn == 1) return aValues.FindFromIndex (theRow + 1).ToCString();
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType MessageModel_ItemPropertiesAttributeStream::GetTableEditType (const int theRow, const int) const
+{
+ //switch (theRow)
+ //{
+ // case 0: return ViewControl_EditType_Spin;
+ // default: return ViewControl_EditType_None;
+ //}
+ return ViewControl_EditType_None;
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool MessageModel_ItemPropertiesAttributeStream::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+{
+ //Handle(Message_Report) aReport = getItemReport();
+ //switch (theRow)
+ //{
+ // case 0: aReport->SetLimit (theValue.toInt()); break;
+ // default: break;
+ //}
+ return true;
+}
--- /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 MessageModel_ItemReportProperties_H
+#define MessageModel_ItemReportProperties_H
+
+#include <Standard.hxx>
+#include <Message_AttributeStream.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <TCollection_AsciiString.hxx>
+
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+//! \class MessageModel_ItemPropertiesAttributeStream
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class MessageModel_ItemPropertiesAttributeStream : public TreeModel_ItemProperties
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageModel_ItemPropertiesAttributeStream (TreeModel_ItemBasePtr theItem)
+ : TreeModel_ItemProperties (theItem) {}
+
+ //! Destructor
+ virtual ~MessageModel_ItemPropertiesAttributeStream() {}
+
+ //! If me has internal values, it should be initialized here.
+ Standard_EXPORT virtual void Init();
+
+ //! If the item has internal values, there should be reseted here.
+ Standard_EXPORT virtual void Reset();
+
+ //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+ //! Returns content of the model index for the given role, it is obtained from internal container of values
+ //! It returns value only for DisplayRole.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+ //! Returns type of edit control for the model index. By default, it is an empty control
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \return edit type
+ Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
+
+ //! Sets the value into the table cell. Only 1st column value might be modified.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theValue a new cell value
+ Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT (MessageModel_ItemPropertiesAttributeStream, TreeModel_ItemProperties)
+
+protected:
+ //! Returns attribute with stream value
+ const NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString>& GetValues() const
+ {
+ if (!IsInitialized())
+ const_cast<MessageModel_ItemPropertiesAttributeStream*>(this)->Init();
+ return myValues;
+ }
+
+protected:
+ NCollection_IndexedDataMap<TCollection_AsciiString, TCollection_AsciiString> myValues;
+};
+
+#endif
--- /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/MessageModel_ItemPropertiesReport.hxx>
+#include <inspector/MessageModel_ItemReport.hxx>
+#include <inspector/ShapeView_ItemShape.hxx>
+#include <inspector/ShapeView_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QApplication>
+#include <QFont>
+#include <Standard_WarningsRestore.hxx>
+
+IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+// =======================================================================
+// function : RowCount
+// purpose :
+// =======================================================================
+
+int MessageModel_ItemPropertiesReport::GetTableRowCount() const
+{
+ return 1;
+}
+
+// =======================================================================
+// function : Data
+// purpose :
+// =======================================================================
+
+QVariant MessageModel_ItemPropertiesReport::GetTableData (const int theRow, const int theColumn, int theRole) const
+{
+ if (theRole != Qt::DisplayRole)
+ return QVariant();
+
+ Handle(Message_Report) aReport = getItemReport();
+ switch (theRow)
+ {
+ case 0: return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
+ default: break;
+ }
+
+ return QVariant();
+}
+
+// =======================================================================
+// function : GetTableEditType
+// purpose :
+// =======================================================================
+ViewControl_EditType MessageModel_ItemPropertiesReport::GetTableEditType (const int theRow, const int) const
+{
+ switch (theRow)
+ {
+ case 0: return ViewControl_EditType_Spin;
+ default: return ViewControl_EditType_None;
+ }
+}
+
+// =======================================================================
+// function : SetTableData
+// purpose :
+// =======================================================================
+bool MessageModel_ItemPropertiesReport::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
+{
+ Handle(Message_Report) aReport = getItemReport();
+ switch (theRow)
+ {
+ case 0: aReport->SetLimit (theValue.toInt()); break;
+ default: break;
+ }
+ return true;
+}
+
+// =======================================================================
+// function : getItemReport
+// purpose :
+// =======================================================================
+
+Handle(Message_Report) MessageModel_ItemPropertiesReport::getItemReport() const
+{
+ MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
+ if (!aReportItem)
+ return NULL;
+
+ return aReportItem->GetReport();
+}
--- /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 MessageModel_ItemReportProperties_H
+#define MessageModel_ItemReportProperties_H
+
+#include <Standard.hxx>
+#include <Message_Report.hxx>
+
+#include <inspector/TreeModel_ItemProperties.hxx>
+#include <inspector/TreeModel_ItemBase.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QAbstractTableModel>
+#include <QColor>
+#include <QList>
+#include <QModelIndexList>
+#include <QVariant>
+#include <Standard_WarningsRestore.hxx>
+
+class QItemDelegate;
+
+DEFINE_STANDARD_HANDLE (MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+//! \class MessageModel_ItemPropertiesReport
+//! \brief This is an interace for ViewControl_TableModel to give real values of the model
+//! It should be filled or redefined.
+class MessageModel_ItemPropertiesReport : public TreeModel_ItemProperties
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT MessageModel_ItemPropertiesReport (TreeModel_ItemBasePtr theItem)
+ : TreeModel_ItemProperties (theItem) {}
+
+ //! Destructor
+ virtual ~MessageModel_ItemPropertiesReport() {}
+
+ //! Returns number of rows, depending on orientation: myColumnCount or size of values container
+ //! \param theParent an index of the parent item
+ //! \return an integer value
+ Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+ //! Returns content of the model index for the given role, it is obtained from internal container of values
+ //! It returns value only for DisplayRole.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theRole a view role
+ //! \return value intepreted depending on the given role
+ Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
+
+ //! Returns type of edit control for the model index. By default, it is an empty control
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \return edit type
+ Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
+
+ //! Sets the value into the table cell. Only 1st column value might be modified.
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ //! \param theValue a new cell value
+ Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
+
+ DEFINE_STANDARD_RTTIEXT (MessageModel_ItemPropertiesReport, TreeModel_ItemProperties)
+
+protected:
+ //! Returns report
+ Handle(Message_Report) getItemReport() const;
+};
+
+#endif
#include <inspector/MessageModel_ItemReport.hxx>
#include <inspector/MessageModel_ItemAlert.hxx>
-#include <inspector/MessageModel_ItemReportProperties.hxx>
+#include <inspector/MessageModel_ItemPropertiesReport.hxx>
#include <inspector/MessageModel_ItemRoot.hxx>
#include <inspector/MessageModel_Tools.hxx>
myReport = aRootItem ? aRootItem->GetReport (Row(), myDescription) : Handle(Message_Report)();
TreeModel_ItemBasePtr anItem = Parent()->Child (Row(), Column(), false);
- SetProperties (new MessageModel_ItemReportProperties(anItem));
+ SetProperties (new MessageModel_ItemPropertiesReport (anItem));
MessageModel_ItemBase::Init();
}
+++ /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/MessageModel_ItemReportProperties.hxx>
-#include <inspector/MessageModel_ItemReport.hxx>
-#include <inspector/ShapeView_ItemShape.hxx>
-#include <inspector/ShapeView_Tools.hxx>
-
-#include <inspector/ViewControl_Tools.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QApplication>
-#include <QFont>
-#include <Standard_WarningsRestore.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-// =======================================================================
-// function : RowCount
-// purpose :
-// =======================================================================
-
-int MessageModel_ItemReportProperties::GetTableRowCount() const
-{
- return 1;
-}
-
-// =======================================================================
-// function : Data
-// purpose :
-// =======================================================================
-
-QVariant MessageModel_ItemReportProperties::GetTableData (const int theRow, const int theColumn, int theRole) const
-{
- if (theRole != Qt::DisplayRole)
- return QVariant();
-
- Handle(Message_Report) aReport = getItemReport();
- switch (theRow)
- {
- case 0: return theColumn == 0 ? QVariant ("Limit") : QVariant (aReport->GetLimit());
- default: break;
- }
-
- return QVariant();
-}
-
-// =======================================================================
-// function : GetTableEditType
-// purpose :
-// =======================================================================
-ViewControl_EditType MessageModel_ItemReportProperties::GetTableEditType (const int theRow, const int) const
-{
- switch (theRow)
- {
- case 0: return ViewControl_EditType_Spin;
- default: return ViewControl_EditType_None;
- }
-}
-
-// =======================================================================
-// function : SetTableData
-// purpose :
-// =======================================================================
-bool MessageModel_ItemReportProperties::SetTableData (const int theRow, const int theColumn, const QVariant& theValue)
-{
- Handle(Message_Report) aReport = getItemReport();
- switch (theRow)
- {
- case 0: aReport->SetLimit (theValue.toInt()); break;
- default: break;
- }
- return true;
-}
-
-// =======================================================================
-// function : getItemReport
-// purpose :
-// =======================================================================
-
-Handle(Message_Report) MessageModel_ItemReportProperties::getItemReport() const
-{
- MessageModel_ItemReportPtr aReportItem = itemDynamicCast<MessageModel_ItemReport>(getItem());
- if (!aReportItem)
- return NULL;
-
- return aReportItem->GetReport();
-}
+++ /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 MessageModel_ItemReportProperties_H
-#define MessageModel_ItemReportProperties_H
-
-#include <Standard.hxx>
-#include <Message_Report.hxx>
-
-#include <inspector/TreeModel_ItemProperties.hxx>
-#include <inspector/TreeModel_ItemBase.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QAbstractTableModel>
-#include <QColor>
-#include <QList>
-#include <QModelIndexList>
-#include <QVariant>
-#include <Standard_WarningsRestore.hxx>
-
-class QItemDelegate;
-
-DEFINE_STANDARD_HANDLE (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-//! \class MessageModel_ItemReportProperties
-//! \brief This is an interace for ViewControl_TableModel to give real values of the model
-//! It should be filled or redefined.
-class MessageModel_ItemReportProperties : public TreeModel_ItemProperties
-{
-public:
-
- //! Constructor
- Standard_EXPORT MessageModel_ItemReportProperties (TreeModel_ItemBasePtr theItem)
- : TreeModel_ItemProperties (theItem) {}
-
- //! Destructor
- virtual ~MessageModel_ItemReportProperties() {}
-
- //! Returns number of rows, depending on orientation: myColumnCount or size of values container
- //! \param theParent an index of the parent item
- //! \return an integer value
- Standard_EXPORT virtual int GetTableRowCount() const Standard_OVERRIDE;
-
- //! Returns content of the model index for the given role, it is obtained from internal container of values
- //! It returns value only for DisplayRole.
- //! \param theRow a model index row
- //! \param theColumn a model index column
- //! \param theRole a view role
- //! \return value intepreted depending on the given role
- Standard_EXPORT virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole = Qt::DisplayRole) const Standard_OVERRIDE;
-
- //! Returns type of edit control for the model index. By default, it is an empty control
- //! \param theRow a model index row
- //! \param theColumn a model index column
- //! \return edit type
- Standard_EXPORT virtual ViewControl_EditType GetTableEditType (const int theRow, const int theColumn) const Standard_OVERRIDE;
-
- //! Sets the value into the table cell. Only 1st column value might be modified.
- //! \param theRow a model index row
- //! \param theColumn a model index column
- //! \param theValue a new cell value
- Standard_EXPORT virtual bool SetTableData (const int theRow, const int theColumn, const QVariant& theValue) Standard_OVERRIDE;
-
- DEFINE_STANDARD_RTTIEXT (MessageModel_ItemReportProperties, TreeModel_ItemProperties)
-
-protected:
- //! Returns report
- Handle(Message_Report) getItemReport() const;
-};
-
-#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
#include <inspector/MessageModel_Tools.hxx>
#include <inspector/MessageModel_ItemAlert.hxx>
-#include <inspector/MessageModel_TableModelValues.hxx>
#include <inspector/ViewControl_Table.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
#include <BRepTools.hxx>
#include <Message_AlertExtended.hxx>
#include <Message_AttributeObject.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
#include <Precision.hxx>
#include <TopoDS_AlertAttribute.hxx>
if (anAttribute.IsNull())
return;
- if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+ //if (anAttribute->IsKind (STANDARD_TYPE (Message_AttributeStream)))
+ //{
+ //int aSectionSize = 200;
+ //ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
+ //theTableValues.append (aTableValues);
+ //}
+ //else
+ //{
+ if (!anAttribute->GetDescription().IsEmpty())
{
- int aSectionSize = 200;
- ViewControl_TableModelValues* aTableValues = new MessageModel_TableModelValues (anAttribute, aSectionSize);
+ ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
+ QList<TreeModel_HeaderSection> aHeaderValues;
+ QVector<QVariant> aValues;
+ aHeaderValues << TreeModel_HeaderSection ("Description", -2);
+ aValues << anAttribute->GetDescription().ToCString();
+ aTableValues->SetHeaderValues (aHeaderValues, Qt::Horizontal);
+
+ QString aValueStr = anAttribute->GetDescription().ToCString();
+ QStringList aValueStrList = aValueStr.split ("\n");
+ int aNbRows = aValueStrList.size();
+
+ QFontMetrics aFontMetrics (qApp->font());
+ int aHeight = aFontMetrics.boundingRect(aValueStr).height();
+ aHeight = (aHeight + TreeModel_Tools::HeaderSectionMargin()) * aNbRows;
+ aTableValues->SetValues (aValues);
+ aTableValues->SetDefaultSectionSize(Qt::Vertical, aHeight);
+
theTableValues.append (aTableValues);
}
- else
- {
- if (!anAttribute->GetDescription().IsEmpty())
- {
- ViewControl_TableModelValuesDefault* aTableValues = new ViewControl_TableModelValuesDefault();
- QList<TreeModel_HeaderSection> aHeaderValues;
- QVector<QVariant> aValues;
- aHeaderValues << TreeModel_HeaderSection ("Description", -2);
- aValues << anAttribute->GetDescription().ToCString();
- aTableValues->SetHeaderValues (aHeaderValues, Qt::Horizontal);
-
- QString aValueStr = anAttribute->GetDescription().ToCString();
- QStringList aValueStrList = aValueStr.split ("\n");
- int aNbRows = aValueStrList.size();
-
- QFontMetrics aFontMetrics (qApp->font());
- int aHeight = aFontMetrics.boundingRect(aValueStr).height();
- aHeight = (aHeight + TreeModel_Tools::HeaderSectionMargin()) * aNbRows;
- aTableValues->SetValues (aValues);
- aTableValues->SetDefaultSectionSize(Qt::Vertical, aHeight);
-
- theTableValues.append (aTableValues);
- }
- }
+ //}
}
// =======================================================================
#include <inspector/MessageModel_ItemAlert.hxx>
#include <Message_AlertExtended.hxx>
-#include <Message_AttributeVectorOfValues.hxx>
+#include <Message_AttributeStream.hxx>
#include <TopoDS_AlertAttribute.hxx>
if (anAlert.IsNull())
return false;
- if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeVectorOfValues)))
+ if (anAlert->IsKind (STANDARD_TYPE (Message_AttributeStream)))
return true;
return false;
#include <inspector/ViewControl_PropertyView.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
#include <inspector/ViewControl_TreeView.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
#include <inspector/View_Tools.hxx>
#include <inspector/View_Viewer.hxx>
if (!aContext.IsNull())
{
- myContext = aContext;
myViewWindow->SetContext (View_ContextType_External, aContext);
}
// =======================================================================
void MessageView_Window::updatePreviewPresentation (const NCollection_List<Handle(Standard_Transient)>& thePresentations)
{
- if (myContext.IsNull())
+ Handle(AIS_InteractiveContext) aContext = myViewWindow->GetViewToolBar()->GetCurrentContext();
+ if (aContext.IsNull())
return;
- Handle(AIS_InteractiveContext) aContext = myContext;
-
if (!myPreviewPresentations.IsEmpty())
{
for (NCollection_List<Handle(Standard_Transient)>::Iterator aDisplayedIt (myPreviewPresentations); aDisplayedIt.More(); aDisplayedIt.Next())
{
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
- if (!aPrs.IsNull())
+ if (!aPrs.IsNull() && aPrs->GetContext() == aContext)
aContext->Remove (aPrs, Standard_True);
}
}
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (aDisplayedIt.Value());
if (!aPrs.IsNull())
{
+ if (!aPrs->GetContext().IsNull())
+ continue; // not possible to display one object in several contexts
aContext->Display (aPrs, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
}
- else if (!Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
+ else if (!Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value()).IsNull())
{
- Handle(ViewControl_TransientShape) aShapeObject = Handle(ViewControl_TransientShape)::DownCast (aDisplayedIt.Value());
+ Handle(Convert_TransientShape) aShapeObject = Handle(Convert_TransientShape)::DownCast (aDisplayedIt.Value());
aBuilder.Add (aCompound, aShapeObject->GetShape());
}
}
if (aCompound.IsNull())
{
- if (!aContext.IsNull())
+ if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
aContext->Remove (myPreviewPresentation, Standard_True);
myPreviewPresentation = NULL;
return;
if (myPreviewPresentation.IsNull())
{
myPreviewPresentation = new AIS_Shape (aCompound);
- myPreviewPresentation->SetAttributes (GetPreviewAttributes(myContext));
+ myPreviewPresentation->SetAttributes (GetPreviewAttributes(aContext));
//myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
//myPreviewPresentation->SetTransformPersistence(thePersistent);
{
Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
//myPreviewPresentation->SetTransformPersistence(thePersistent);
- if (!aContext.IsNull())
+ if (!aContext.IsNull() && myPreviewPresentation->GetContext() == aContext)
aContext->Redisplay (myPreviewPresentation, Standard_True);
}
}
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
Handle(Message_ReportCallBack) myCallBack; //! < message call back to update content of the view
- Handle(AIS_InteractiveContext) myContext; //! current context
Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
NCollection_List<Handle(Standard_Transient)> myPreviewPresentations;
};
aReport->SetActive (Standard_True);//Standard_False);
aPlugins.insert("TKMessageView");
- anActivatedPluginName = "TKVInspector";
+ //anActivatedPluginName = "TKVInspector";
+ anActivatedPluginName = "TKMessageView";
}
else
anActivatedPluginName = *aPlugins.rbegin();
TKG3d
TKernel
TKLCAF
-TKMath
\ No newline at end of file
+TKMath
+TKBRep
+TKTopAlgo
+TKPrim
TKService
TKOpenGl
TKV3d
+TKTInspectorAPI
CSF_QT
\ No newline at end of file
}
// =======================================================================
-// function : reset
+// function : Reset
// purpose :
// =======================================================================
void TreeModel_ItemBase::Reset()
// =======================================================================
void TreeModel_ItemBase::Reset (int theRole)
{
- if (!myCachedValues.contains (theRole))
+ if (!myCachedValues.contains (theRole))
return;
myCachedValues.remove (theRole);
IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient)
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void TreeModel_ItemProperties::Reset()
+{
+ m_bInitialized = false;
+ myCachedValues.clear();
+}
+
// =======================================================================
// function : GetTableFlags
// purpose :
return aFlags;
}
+
+// =======================================================================
+// function : cachedValueRowCount
+// purpose :
+// =======================================================================
+
+int TreeModel_ItemProperties::cachedDimValue (const TreeModel_DimType theDimType) const
+{
+ if (myCachedDimValues.contains (theDimType))
+ return myCachedDimValues[theDimType].toInt();
+
+ QVariant aValueToCache;
+ switch (theDimType)
+ {
+ case TreeModel_DimType_Rows: aValueToCache = GetTableRowCount(); break;
+ case TreeModel_DimType_Columns: aValueToCache = GetTableColumnCount(); break;
+ }
+
+ const_cast<TreeModel_ItemProperties*>(this)->myCachedDimValues.insert (theDimType, aValueToCache);
+ return myCachedDimValues.contains (theDimType) ? myCachedDimValues[theDimType].toInt() : 0;
+}
+
+// =======================================================================
+// function : cachedValue
+// purpose :
+// =======================================================================
+
+QVariant TreeModel_ItemProperties::cachedValue (const int theRow, const int theColumn, int theRole) const
+{
+ QPair<int, int> aPos = qMakePair (theRow, theColumn);
+ if (myCachedValues.contains (aPos) && myCachedValues[aPos].contains (theRole))
+ return myCachedValues[aPos][theRole];
+
+ QVariant aValueToCache = GetTableData (theRow, theColumn, theRole);
+
+ QMap<int, QVariant> aValuesToCache;
+ if (myCachedValues.contains(aPos))
+ aValuesToCache = myCachedValues[aPos];
+ aValuesToCache.insert (theRole, aValueToCache);
+
+ const_cast<TreeModel_ItemProperties*>(this)->myCachedValues.insert (aPos, aValuesToCache);
+ return aValueToCache;
+}
//! Class to manipulate properties of tree item. The properties are organized in table structure
class TreeModel_ItemProperties : public Standard_Transient
{
+ //! enum defined the dimension type
+ enum TreeModel_DimType
+ {
+ TreeModel_DimType_Rows, //! defines number of rows
+ TreeModel_DimType_Columns //! defines number of columns
+ };
+
public:
//! Constructor
TreeModel_ItemProperties (const TreeModel_ItemBasePtr& theItem) : myItem (theItem) {}
//! Destructor
~TreeModel_ItemProperties() {}
+ //! Returns number of table rows. It uses cached value of GetTableRowCount(), Reset() to reinit it.
+ //! \return an integer value
+ int RowCount() const { return cachedDimValue (TreeModel_DimType_Rows); }
+
+ //! Returns number of table columns. It uses cached value of GetTableColumnCount(), Reset() to reinit it.
+ //! \return an integer value
+ int ColumnCount() const { return cachedDimValue (TreeModel_DimType_Columns); }
+
+ //! Returns content of the model index for the given role, it is obtained from internal container of values
+ //! It uses cached value of GetTableData(), Reset() to reinit it.
+ //! \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
+ QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const
+ { return cachedValue (theRow, theColumn, theRole); }
+
+ //! Gets whether the item is already initialized.The initialized state is thrown down
+ //! by the reset method and get back after the method Init().
+ //! \return if the item is initialized
+ bool IsInitialized() const { return m_bInitialized; }
+
//! If me has internal values, it should be initialized here.
- virtual void Init() {}
+ virtual void Init() { m_bInitialized = true; }
//! If the item has internal values, there should be reseted here.
- Standard_EXPORT virtual void Reset() {}
+ Standard_EXPORT virtual void Reset();
//! Returns number of item children
//! \return an integer value, ZERO by default
//! \return flags
Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const;
-
DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient)
protected:
//! Returns current item
TreeModel_ItemBasePtr getItem() const { return myItem; }
+private:
+ //! Returns the cached value for number of rows. Init the value if it is requested the first time.
+ //! \param theDimType dimension type
+ //! \return the value
+ Standard_EXPORT int cachedDimValue (const TreeModel_DimType theDimType) const;
+
+ //! Returns the cached value for the role. Init the value if it is requested the first time
+ //! By default, it calls initRowCount(TreeModel_ItemRole_RowCountRole) or initValue for the item role
+ //! \param theItemRole a value role
+ //! \return the value
+ Standard_EXPORT QVariant cachedValue (const int theRow, const int theColumn, int theRole) const;
+
private:
TreeModel_ItemBasePtr myItem; //! current item
+
+ QMap<TreeModel_DimType, QVariant> myCachedDimValues; //!< cached values, should be cleared by reset
+ QMap<QPair<int, int>, QMap<int, QVariant> > myCachedValues; //!< cached values, should be cleared by reset
+ QMap<QPair<int, int>, NCollection_List<Handle(Standard_Transient)> > myCachedPresentations; //!< cached values, should be cleared by reset
+
+ bool m_bInitialized; //!< the state whether the item content is already initialized
};
#endif
\ No newline at end of file
VInspector_CallBackMode.hxx
VInspector_Communicator.cxx
VInspector_Communicator.hxx
-VInspector_DisplayActionType.hxx
VInspector_ItemAspectWindow.cxx
VInspector_ItemAspectWindow.hxx
VInspector_ItemBase.cxx
VInspector_ItemV3dView.hxx
VInspector_ItemV3dViewer.cxx
VInspector_ItemV3dViewer.hxx
-VInspector_PreviewParameters.cxx
-VInspector_PreviewParameters.hxx
VInspector_PropertiesCreator.cxx
VInspector_PropertiesCreator.hxx
VInspector_SelectionType.hxx
+++ /dev/null
-// Created on: 2018-08-19
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2018 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef VInspector_DisplayActionType_H
-#define VInspector_DisplayActionType_H
-
-//! \enum VInspector_DisplayActionType
-enum VInspector_DisplayActionType
-{
- VInspector_DisplayActionType_NoneId, //!< No action activated
- VInspector_DisplayActionType_DisplayId, //!< Display action
- VInspector_DisplayActionType_RedisplayId, //!< Redisplay action
- VInspector_DisplayActionType_EraseId, //!< Erase action
- VInspector_DisplayActionType_RemoveId //!< Remove action
-};
-
-#endif
#include <inspector/VInspector_Tools.hxx>
#include <inspector/ViewControl_PropertiesStream.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <Bnd_Box.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
TCollection_AsciiString aValue = aValues.Value (aValueId);
Bnd_Box aBox;
- if (!aBox.FromString (aValue))
+ if (!aBox.Init (Standard_SStream (aValue.ToCString())))
continue;
- TopoDS_Shape aShape = VInspector_Tools::CreateShape (aBox);
+ TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox);
aBuilder.Add (aCompound, aShape);
}
}
//
#include <inspector/VInspector_Tools.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
TCollection_AsciiString aValue = aValues.Value (aValueId);
Bnd_Box aBox;
- if (!aBox.FromString (aValue))
+ if (!aBox.Init (Standard_SStream (aValue.ToCString())))
continue;
- TopoDS_Shape aShape = VInspector_Tools::CreateShape (aBox);
+ TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox);
aBuilder.Add (aCompound, aShape);
}
}
#include <inspector/ViewControl_Table.hxx>
#include <inspector/ViewControl_Tools.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <Graphic3d.hxx>
// =======================================================================
TopoDS_Shape VInspector_ItemPrs3dPresentation::buildPresentationShape()
{
if (!myPresentation.IsNull())
- myPresentationShape = VInspector_Tools::CreateShape (myPresentation->MinMaxValues());
+ myPresentationShape = Convert_Tools::CreateShape (myPresentation->MinMaxValues());
return TopoDS_Shape();
}
//#include <inspector/ViewControl_Table.hxx>
//#include <inspector/ViewControl_Tools.hxx>
//
+
+#include <inspector/Convert_Tools.hxx>
#include <Standard_WarningsDisable.hxx>
//#include <QStringList>
#include <QColor>
//! \param theColumn the child column position
//! \return the created item
virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE
- { return TreeModel_ItemBasePtr(); }
+ { (void)theRow, (void)theColumn; return TreeModel_ItemBasePtr(); }
//! Returns owner of the current sensitive entity
//! \return owner
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <inspector/VInspector_ItemContext.hxx>
#include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
#include <inspector/VInspector_ItemSelectMgrSensitiveEntity.hxx>
if (!myPresentation.IsNull())
return;
- Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (GetSensitiveEntity());
+ Handle(Select3D_SensitiveEntity) aBaseEntity = GetSensitiveEntity();
if (aBaseEntity.IsNull())
return;
case 10: return ViewControl_Table::SeparatorData();
default: return getTableData (theRow, theColumn, theRole, anEntity->DynamicType()->Name());
}
- return QVariant();
}
// =======================================================================
const int,
const TCollection_AsciiString& theEntityKind) const
{
- Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (GetSensitiveEntity());
+ Handle(Select3D_SensitiveEntity) aBaseEntity = GetSensitiveEntity();
if (aBaseEntity.IsNull())
return QVariant();
TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape
(const Handle(SelectBasics_SensitiveEntity)& theEntity)
{
- Handle(Select3D_SensitiveEntity) aBaseEntity = Handle(Select3D_SensitiveEntity)::DownCast (theEntity);
+ Handle(Select3D_SensitiveEntity) aBaseEntity = theEntity;
if (aBaseEntity.IsNull())
return TopoDS_Shape();
if (aTypeName == STANDARD_TYPE (Select3D_SensitiveBox)->Name())
{
Handle(Select3D_SensitiveBox) anEntity = Handle(Select3D_SensitiveBox)::DownCast (aBaseEntity);
- TopoDS_Shape aShape = VInspector_Tools::CreateShape(anEntity->Box());
+ TopoDS_Shape aShape = Convert_Tools::CreateShape(anEntity->Box());
aBuilder.Add (aCompound, aShape);
}
else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveFace)->Name())
+++ /dev/null
-// Created on: 2019-05-03
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <inspector/VInspector_PreviewParameters.hxx>
-
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_PointAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-
-// =======================================================================
-// function : Constructor
-// purpose :
-// =======================================================================
-VInspector_PreviewParameters::VInspector_PreviewParameters()
-{
- myDrawer = new Prs3d_Drawer();
-
- Quantity_Color aColor(Quantity_NOC_TOMATO);//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
- Standard_ShortReal aTransparency = 0.8;
-
- // point parameters
- myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
-
- // shading parameters
- Graphic3d_MaterialAspect aShadingMaterial;
- aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
- aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
-
- myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
- myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
- myDrawer->ShadingAspect()->SetColor (aColor);
- myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
-
- myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
- myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
- myDrawer->SetTransparency (aTransparency);
-
- // common parameters
- myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
-}
-
-// =======================================================================
-// function : SaveState
-// purpose :
-// =======================================================================
-void VInspector_PreviewParameters::SaveState (VInspector_PreviewParameters* theParameters,
- QMap<QString, QString>& theItems,
- const QString& thePrefix)
-{
- Handle(Prs3d_Drawer) aDrawer = theParameters->GetDrawer();
-
- //Quantity_Color aColor = aDrawer->Color();
- //Standard_ShortReal aTransparency = aDrawer->Transparency();
-
- //// point parameters
- //{
- // Standard_Boolean anOwnPointAspect = aDrawer->HasOwnPointAspect();
- // Standard_SStream OS;
- // if (anOwnPointAspect)
- // myDrawer->PointAspect()->Dump (OS);
- // TCollection_AsciiString aStream (OS.str().c_str());
- // theItems[thePrefix + "has_point_aspect"] = anOwnPointAspect;
- // theItems[thePrefix + "point_aspect"] = aStream.ToCString();
- //}
- //// shading parameters
- //{
- // Standard_Boolean anOwnShadingAspect = aDrawer->HasOwnShadingAspect();
- // Standard_SStream OS;
- // if (anOwnShadingAspect)
- // myDrawer->ShadingAspect()->Dump (OS);
- // TCollection_AsciiString aStream (OS.str().c_str());
- // theItems[thePrefix + "has_shading_aspect"] = anOwnShadingAspect;
- // theItems[thePrefix + "shading_aspect"] = aStream.ToCString();
- //}
-}
-
-// =======================================================================
-// function : RestoreState
-// purpose :
-// =======================================================================
-bool VInspector_PreviewParameters::RestoreState (VInspector_PreviewParameters* theParameters,
- const QString& theKey, const QString& theValue,
- const QString& thePrefix)
-{
- //if (theKey == thePrefix + "has_point_aspect") // point parameters
- //{
- // myDrawer->SetOwnPointAspect (theValue.toBool());
- //}
- //else if (theKey == thePrefix + "point_aspect") // point parameters
- //{
- // Standard_SStream aStream;
- // aStream << theValue.ToString().ToStdString();
- // myDrawer->PointAspect()->Init (aStream);
- //}
- //else if (theKey == thePrefix + "has_shading_aspect") // shading parameters
- //{
- // myDrawer->SetOwnShadingAspect (theValue.toBool());
- //}
- //else if (theKey == thePrefix + "shading_aspect") // shading parameters
- //{
- // Standard_SStream aStream;
- // aStream << theValue.ToString().ToStdString();
- // myDrawer->ShadingAspect()->Init (aStream);
- //}
- //else
- // return false;
- return true;
-}
+++ /dev/null
-// Created on: 2019-05-03
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef VInspector_PreviewParameters_H
-#define VInspector_PreviewParameters_H
-
-#include <Standard.hxx>
-#include <Standard_Macro.hxx>
-
-#include <Prs3d_Drawer.hxx>
-
-#include <Standard_WarningsDisable.hxx>
-#include <QMap>
-#include <QString>
-#include <Standard_WarningsRestore.hxx>
-
-//! \class VInspector_PreviewParameters
-//! Container of View tool bar actions
-class VInspector_PreviewParameters
-{
-public:
-
- //! Constructor
- Standard_EXPORT VInspector_PreviewParameters ();
-
- //! Destructor
- virtual ~VInspector_PreviewParameters() {}
-
- //! Returns main control
- const Handle(Prs3d_Drawer)& GetDrawer() const { return myDrawer; }
-
- //! Save state of three view in a container in form: key, value. It saves:
- //! - visibiblity of columns,
- //! - columns width
- //! \param theTreeView a view instance
- //! \param theItems [out] properties
- //! \param thePrefix peference item prefix
- Standard_EXPORT static void SaveState (VInspector_PreviewParameters* theParameters,
- 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 (VInspector_PreviewParameters* theParameters,
- const QString& theKey, const QString& theValue,
- const QString& thePrefix = QString());
-
-private:
-
- Handle(Prs3d_Drawer) myDrawer;
-};
-
-#endif
#include <inspector/VInspector_Tools.hxx>
#include <inspector/ViewControl_TableModelValues.hxx>
+#include <inspector/ViewControl_Tools.hxx>
#include <inspector/VInspector_ItemFolderObject.hxx>
#include <inspector/VInspector_TableModelValues.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <AIS_ListOfInteractive.hxx>
#include <Standard_Version.hxx>
const Handle(SelectBasics_EntityOwner)& theOwner)
{
bool anIsSelected = false;
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (theOwner);
for (theContext->InitSelected(); theContext->MoreSelected() && !anIsSelected; theContext->NextSelected())
- anIsSelected = theContext->SelectedOwner() == anOwner;
+ anIsSelected = theContext->SelectedOwner() == theOwner;
return anIsSelected;
}
for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt (anActiveOwners);
anOwnersIt.More(); anOwnersIt.Next())
{
- anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+ anOwner = anOwnersIt.Value();
if (anOwner.IsNull())
continue;
for (NCollection_List<Handle(SelectBasics_EntityOwner)>::Iterator anOwnersIt(theOwners);
anOwnersIt.More(); anOwnersIt.Next())
{
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast (anOwnersIt.Value());
+ Handle(SelectMgr_EntityOwner) anOwner = anOwnersIt.Value();
#if OCC_VERSION_HEX > 0x060901
theContext->AddOrRemoveSelected (anOwner, Standard_False);
#else
//function : DisplayActionTypeToString
//purpose :
//=======================================================================
-Standard_CString VInspector_Tools::DisplayActionTypeToString (VInspector_DisplayActionType theType)
+Standard_CString VInspector_Tools::DisplayActionTypeToString (View_DisplayActionType theType)
{
return VInspector_Table_PrintDisplayActionType[theType];
}
//purpose :
//=======================================================================
Standard_Boolean VInspector_Tools::DisplayActionTypeFromString (Standard_CString theTypeString,
- VInspector_DisplayActionType& theType)
+ View_DisplayActionType& theType)
{
TCollection_AsciiString aName (theTypeString);
- for (Standard_Integer aTypeIter = 0; aTypeIter <= VInspector_DisplayActionType_RemoveId; ++aTypeIter)
+ for (Standard_Integer aTypeIter = 0; aTypeIter <= View_DisplayActionType_RemoveId; ++aTypeIter)
{
Standard_CString aTypeName = VInspector_Table_PrintDisplayActionType[aTypeIter];
if (aName == aTypeName)
{
- theType = VInspector_DisplayActionType (aTypeIter);
+ theType = View_DisplayActionType (aTypeIter);
return Standard_True;
}
}
.arg (theBoundingBox.CornerMax().x()).arg (theBoundingBox.CornerMax().y()).arg (theBoundingBox.CornerMax().z());
}
-//=======================================================================
-//function : CreateShape
-//purpose :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_Box& theBoundingBox)
-{
- if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
- return TopoDS_Shape();
-
- Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
- theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
-
- gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
- gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
-
- return CreateBoxShape (aPntMin, aPntMax);
-}
-
-//=======================================================================
-//function : CreateShape
-//purpose :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
-{
- if (theBoundingBox.IsVoid())
- return TopoDS_Shape();
-
- TColgp_Array1OfPnt anArrPnts(0, 8);
- theBoundingBox.GetVertex(&anArrPnts(0));
-
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
-
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
-
- return aCompound;
-}
-
//=======================================================================
//function : CreateShape
//purpose :
gp_Pnt aPntMin = gp_Pnt (theBoundingBox.CornerMin().x(), theBoundingBox.CornerMin().y(), theBoundingBox.CornerMin().z());
gp_Pnt aPntMax = gp_Pnt (theBoundingBox.CornerMax().x(), theBoundingBox.CornerMax().y(), theBoundingBox.CornerMax().z());
- return CreateBoxShape (aPntMin, aPntMax);
+ return Convert_Tools::CreateBoxShape (aPntMin, aPntMax);
}
-//=======================================================================
-//function : CreateBoxShape
-//purpose :
-//=======================================================================
-TopoDS_Shape VInspector_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
-{
- Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
- Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
- Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
-
- if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
- {
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
- return aCompound;
- }
-
- if (aThinOnX || aThinOnY || aThinOnZ)
- {
- gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
- if (aThinOnX)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
- }
- else if (aThinOnY)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
- }
- else if (aThinOnZ)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
- }
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
-
- return aCompound;
- }
- else
- {
- BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
- return aBoxBuilder.Shape();
- }
-}
-
-
//=======================================================================
//function : ToVariant
//purpose :
//function : ToVariant
//purpose :
//=======================================================================
-QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_BoundBuffer)& theBoundBuffer)
+QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_BoundBuffer)& /*theBoundBuffer*/)
{
//const Handle(Graphic3d_Buffer)& aBuffer = theBoundBuffer;
//Handle(Graphic3d_Buffer) aBuffer = Handle(Graphic3d_Buffer)::DownCast (theBoundBuffer);
#include <TopoDS_Shape.hxx>
#include <inspector/VInspector_CallBackMode.hxx>
-#include <inspector/VInspector_DisplayActionType.hxx>
+#include <inspector/View_DisplayActionType.hxx>
#include <inspector/VInspector_SelectionType.hxx>
#include <inspector/ViewControl_PaneCreator.hxx>
//! Returns the string name for a given type.
//! @param theType action type
//! @return string identifier from the display action type
- Standard_EXPORT static Standard_CString DisplayActionTypeToString (VInspector_DisplayActionType theType);
+ Standard_EXPORT static Standard_CString DisplayActionTypeToString (View_DisplayActionType theType);
//! Returns the enumeration type from the given string identifier (using case-insensitive comparison).
//! @param theTypeString string identifier
//! @return string identifier from the display action type
- static VInspector_DisplayActionType DisplayActionTypeFromString (Standard_CString theTypeString)
+ static View_DisplayActionType DisplayActionTypeFromString (Standard_CString theTypeString)
{
- VInspector_DisplayActionType aType = VInspector_DisplayActionType_NoneId;
+ View_DisplayActionType aType = View_DisplayActionType_NoneId;
DisplayActionTypeFromString (theTypeString, aType);
return aType;
}
//! @param theType detected action type
//! @return TRUE if string identifier is known
Standard_EXPORT static Standard_Boolean DisplayActionTypeFromString (const Standard_CString theTypeString,
- VInspector_DisplayActionType& theType);
+ View_DisplayActionType& theType);
//! Build string presentation of bounding box information in form: (xmin, ymin, zmin), (xmax, ymax, zmax)
//! \param theBoundingBox bounding box
//! \return string presentation
Standard_EXPORT static QVariant ToVariant (const Select3D_BndBox3d& theBoundingBox);
- //! Creates box shape
- //! \param theBoundingBox box shape parameters
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
-
- //! Creates box shape
- //! \param theBoundingBox box shape parameters
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
-
- //! Creates box shape
- //! \param thePntMin minimum point on the bounding box
- //! \param thePntMax maximum point on the bounding box
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
-
//! Creates box shape
//! \param theBoundingBox box shape parameters
//! \return created shape
#include <AIS_ColoredShape.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Trihedron.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
+//#include <BRep_Builder.hxx>
+//#include <BRepBuilderAPI_MakeVertex.hxx>
+//#include <BRepBuilderAPI_MakeEdge.hxx>
+//#include <BRepBuilderAPI_MakeFace.hxx>
#include <Geom_Axis2Placement.hxx>
-#include <TopoDS_Compound.hxx>
+//#include <TopoDS_Compound.hxx>
#include <TopExp_Explorer.hxx>
+#include <inspector/Convert_Tools.hxx>
+
#include <inspector/TreeModel_ColumnType.hxx>
#include <inspector/TreeModel_ContextMenu.hxx>
#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/ViewControl_MessageDialog.hxx>
#include <inspector/ViewControl_TableModel.hxx>
#include <inspector/ViewControl_Tools.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
+#include <inspector/Convert_TransientShape.hxx>
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/VInspector_Tools.hxx>
#include <inspector/VInspector_ItemSelectBasicsEntityOwner.hxx>
#include <inspector/VInspector_ItemFolderObject.hxx>
#include <inspector/VInspector_ItemPresentableObject.hxx>
-#include <inspector/VInspector_PreviewParameters.hxx>
#include <inspector/VInspector_PropertiesCreator.hxx>
#include <inspector/VInspector_TableModelValues.hxx>
#include <inspector/VInspector_ToolBar.hxx>
#include <inspector/ViewControl_TreeView.hxx>
#include <inspector/View_Displayer.hxx>
+#include <inspector/View_DisplayPreview.hxx >
+#include <inspector/View_PreviewParameters.hxx>
#include <inspector/View_Widget.hxx>
#include <inspector/View_Window.hxx>
VInspector_Window::VInspector_Window()
: myParent (0), myExportToShapeViewDialog (0), myViewWindow (0)
{
- myPreviewParameters = new VInspector_PreviewParameters();
+ myDisplayPreview = new View_DisplayPreview();
myMainWindow = new QMainWindow (0);
theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str());
}
+
anItems.clear();
- VInspector_PreviewParameters::SaveState (myPreviewParameters, anItems, "preview_parameters_");
+ View_PreviewParameters::SaveState (myDisplayPreview->GetPreviewParameters(), anItems, "preview_parameters_");
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());
else if (TreeModel_Tools::RestoreState (myHistoryView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(),
"history_view_"))
continue;
- else if (VInspector_PreviewParameters::RestoreState (myPreviewParameters, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(),
- "preview_parameters_"))
+ else if (View_PreviewParameters::RestoreState (myDisplayPreview->GetPreviewParameters(), anItemIt.Key().ToCString(),
+ anItemIt.Value().ToCString(), "preview_parameters_"))
continue;
}
}
return aSelectedPresentations;
}
+// =======================================================================
+// function : GetSelectedShapes
+// purpose :
+// =======================================================================
+
+void VInspector_Window::GetSelectedShapes (NCollection_List<Handle(Standard_Transient)>& theSelPresentations)
+{
+ QModelIndexList theIndices = myTreeView->selectionModel()->selectedIndexes();
+
+ QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theIndices);
+ for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+ {
+ TreeModel_ItemBasePtr anItem = *anItemIt;
+ VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
+ if (!aVItem /*|| aVItem->Row() == 0*/)
+ continue;
+
+ TopoDS_Shape aShape = aVItem->GetPresentationShape();
+ if (aShape.IsNull())
+ continue;
+
+ theSelPresentations.Append (new Convert_TransientShape (aShape));
+ }
+}
+
// =======================================================================
// function : GetSelectedShapes
// purpose :
// obtain selection from the property panel
{
- QList<ViewControl_Table*> aPropertyTables;
- myPropertyView->GetActiveTables (aPropertyTables);
- if (!aPropertyTables.isEmpty())
- {
- ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+ //QList<ViewControl_Table*> aPropertyTables;
+ //myPropertyView->GetActiveTables (aPropertyTables);
+ //if (!aPropertyTables.isEmpty())
+ //{
+ // ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
- Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
- QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
- GetSelectedPropertyPanelShapes(aTreeViewSelected,
- aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
- aSelectedShapes);
- }
+ // Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+
+ QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr aTreeItem = TreeModel_ModelBase::GetItemByIndex (anIndex);
+
+ //QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+ GetSelectedPropertyPanelShapes(aTreeItem, aSelectedShapes);
+ //}
}
return aSelectedShapes;
// function : GetSelectedPropertyPanelShapes
// purpose :
// =======================================================================
-void VInspector_Window::GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
- const QModelIndexList& thePropertyPanelIndices,
+void VInspector_Window::GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem,
NCollection_List<TopoDS_Shape>& theShapes)
{
- QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
- NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
- for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
- {
- TreeModel_ItemBasePtr anItem = *anItemIt;
- if (!anItem || anItem->Column() != 0)
- continue;
-
- QList<ViewControl_TableModelValues*> aTableValues;
- VInspector_Tools::GetPropertyTableValues (anItem, myPaneCreators, aTableValues);
- if (aTableValues.isEmpty())
- continue;
-
- Handle(TreeModel_ItemProperties) anItemProperties = anItem->GetProperties();
- for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
- {
- VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
- if (!aTableVals)
- continue;
-
- // default shape by NULL selection
- aTableVals->GetPaneShapes (-1, -1, theShapes);
+ QList<ViewControl_Table*> aPropertyTables;
+ myPropertyView->GetActiveTables (aPropertyTables);
+ if (aPropertyTables.isEmpty())
+ return;
- for (QModelIndexList::const_iterator anIndicesIt = thePropertyPanelIndices.begin(); anIndicesIt != thePropertyPanelIndices.end(); anIndicesIt++)
- {
- QModelIndex anIndex = *anIndicesIt;
- aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+ ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+ if (!aFirstTable)
+ return;
- if (!anItemProperties.IsNull())
- {
- anItemProperties->GetPresentations (anIndex.row(), anIndex.column(), aPropertyPresentations);
- }
- }
- }
- }
+ NCollection_List<Handle(Standard_Transient)> theSelPresentations;
+ aFirstTable->GetSelectedPresentations (theTreeItem, theSelPresentations);
- if (!aPropertyPresentations.IsEmpty())
+ for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (theSelPresentations); anIterator.More(); anIterator.Next())
{
- for (NCollection_List<Handle(Standard_Transient)>::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next())
- {
- Handle(ViewControl_TransientShape) aShapePrs = Handle(ViewControl_TransientShape)::DownCast (aPrsIterator.Value());
- if (!aShapePrs.IsNull())
- theShapes.Append (aShapePrs->GetShape());
- }
+ Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
+ if (!aShapePrs.IsNull())
+ theShapes.Append (aShapePrs->GetShape());
}
+
+ //QModelIndexList& thePropertyPanelIndices = aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+
+ //QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices);
+ //NCollection_List<Handle(Standard_Transient)> aPropertyPresentations;
+ //for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+ //{
+ // TreeModel_ItemBasePtr anItem = *anItemIt;
+ // if (!anItem || anItem->Column() != 0)
+ // continue;
+
+ // QList<ViewControl_TableModelValues*> aTableValues;
+ // VInspector_Tools::GetPropertyTableValues (anItem, myPaneCreators, aTableValues);
+ // if (aTableValues.isEmpty())
+ // continue;
+
+ // Handle(TreeModel_ItemProperties) anItemProperties = anItem->GetProperties();
+ // for (int aTableIt = 0; aTableIt < aTableValues.size(); aTableIt++)
+ // {
+ // VInspector_TableModelValues* aTableVals = dynamic_cast<VInspector_TableModelValues*>(aTableValues[aTableIt]);
+ // if (!aTableVals)
+ // continue;
+
+ // // default shape by NULL selection
+ // aTableVals->GetPaneShapes (-1, -1, theShapes);
+
+ // for (QModelIndexList::const_iterator anIndicesIt = thePropertyPanelIndices.begin(); anIndicesIt != thePropertyPanelIndices.end(); anIndicesIt++)
+ // {
+ // QModelIndex anIndex = *anIndicesIt;
+ // aTableVals->GetPaneShapes (anIndex.row(), anIndex.column(), theShapes);
+
+ // if (!anItemProperties.IsNull())
+ // {
+ // anItemProperties->GetPresentations (anIndex.row(), anIndex.column(), aPropertyPresentations);
+ // }
+ // }
+ // }
+ //}
+
+ //if (!aPropertyPresentations.IsEmpty())
+ //{
+ // for (NCollection_List<Handle(Standard_Transient)>::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next())
+ // {
+ // Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (aPrsIterator.Value());
+ // if (!aShapePrs.IsNull())
+ // theShapes.Append (aShapePrs->GetShape());
+ // }
+ //}
}
// =======================================================================
if (!myCallBack.IsNull())
myCallBack->SetContext (theContext);
- myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
+ myDisplayPreview->SetContext (theContext);
if (isFirst)
onExportToMessageView();
}
aMenu->addSeparator();
- for (int aTypeId = (int)VInspector_DisplayActionType_DisplayId; aTypeId <= (int)VInspector_DisplayActionType_RemoveId; aTypeId++)
- aMenu->addAction (ViewControl_Tools::CreateAction (VInspector_Tools::DisplayActionTypeToString ((VInspector_DisplayActionType) aTypeId),
+ for (int aTypeId = (int)View_DisplayActionType_DisplayId; aTypeId <= (int)View_DisplayActionType_RemoveId; aTypeId++)
+ aMenu->addAction (ViewControl_Tools::CreateAction (VInspector_Tools::DisplayActionTypeToString ((View_DisplayActionType) aTypeId),
SLOT (onDisplayActionTypeClicked()), GetMainWindow(), this));
aMenu->addSeparator();
// =======================================================================
void VInspector_Window::onPropertyViewSelectionChanged()
{
+ QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex);
+ if (!aTreeItemSelected)
+ return;
+
QList<ViewControl_Table*> aPropertyTables;
myPropertyView->GetActiveTables (aPropertyTables);
if (aPropertyTables.isEmpty())
return;
ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables
+ NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+ aFirstTable->GetSelectedPresentations (aTreeItemSelected, aSelPresentations);
- QMap<int, QList<int>> aSelectedIndices;
- aFirstTable->GetSelectedIndices (aSelectedIndices);
+ //Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
- ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
- ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
+
+ //QMap<int, QList<int>> aSelectedIndices;
+ //aFirstTable->GetSelectedIndices (aSelectedIndices);
+
+ //ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(aFirstTable->GetTableView()->model());
+ //ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
QStringList aPointers;
- for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ aFirstTable->GetSelectedPointers (aPointers);
+
+ //NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+ /*for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
{
int aRowId = aSelIt.key();
QList<int> aColIds = aSelIt.value();
QString aData = aTableValues->Data (aRowId, aSelectedColId, Qt::DisplayRole).toString();
if (aData.contains (ViewControl_Tools::GetPointerPrefix().ToCString()))
aPointers.append (aData);
+
+ if (anItemProperties)
+ anItemProperties->GetPresentations (aRowId, aColId, aSelPresentations);
}
- }
+ }*/
highlightTreeViewItems (aPointers);
- Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
- QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
- NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
+ //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+ //QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes();
+ //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aTreeViewSelected);
- GetSelectedPropertyPanelShapes(aTreeViewSelected,
- aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
- aSelectedShapes);
+ //GetSelectedPropertyPanelShapes(aTreeViewSelected,
+ // aFirstTable->GetTableView()->selectionModel()->selectedIndexes(),
+ // aSelectedShapes);
+ //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
- updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
+ myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
}
// =======================================================================
if (myPropertyPanelWidget->toggleViewAction()->isChecked())
updatePropertyPanelBySelection();
- Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+ QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0);
+ TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex);
+ if (!aTreeItemSelected)
+ return;
+
+ Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
+ NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+ if (anItemProperties)
+ anItemProperties->GetPresentations (-1, -1, aSelPresentations);
+ else
+ GetSelectedShapes (aSelPresentations);
+ myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations);
- NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
- updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
+ //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers();
+
+ //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes());
+
+ //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent);
QApplication::restoreOverrideCursor();
}
// =======================================================================
void VInspector_Window::onDefaultPreview()
{
- VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
- if (!aViewModel)
- return;
-
- Handle(AIS_InteractiveContext) aContext = aViewModel->GetContext();
- if (aContext.IsNull())
- return;
-
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (gp_Pnt(25., 10., 0.)));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.)));
- //aBuilder.Add (aCompound, BRepBuilderAPI_MakeFace (gp_Pln (gp_Pnt (20., 30., 0.), gp_Dir (1., 0., 0.))).Face());
- aBuilder.Add (aCompound, VInspector_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.)));
-
- Handle(AIS_Shape) aDefaultPreview = new AIS_Shape (aCompound);
- aDefaultPreview->SetAttributes (myPreviewParameters->GetDrawer());
- if (!aContext.IsNull())
- aContext->Display (aDefaultPreview, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+ myDisplayPreview->DisplayDefaultPreview();
UpdateTreeModel();
}
// purpose :
// =======================================================================
-void VInspector_Window::displaySelectedPresentations (const VInspector_DisplayActionType theType)
+void VInspector_Window::displaySelectedPresentations (const View_DisplayActionType theType)
{
VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
if (!aViewModel)
NCollection_List<Handle(AIS_InteractiveObject)> aSelectedPresentations = GetSelectedPresentations (aSelectionModel);
const QModelIndexList& aSelectedIndices = aSelectionModel->selectedIndexes();
- bool aPreviewPresentationShown = !myPreviewPresentation.IsNull();
+ bool aPreviewPresentationShown = myDisplayPreview->HasPreview();
// the order of objects returned by AIS_InteractiveContext is changed because the processed object is moved from
// Erased to Displayed container or back
aSelectionModel->clear();
// redisplay preview presentation if exists
- if (aPreviewPresentationShown && theType == VInspector_DisplayActionType_RedisplayId)
+ if (aPreviewPresentationShown && theType == View_DisplayActionType_RedisplayId)
{
- QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices);
- for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
- {
- TreeModel_ItemBasePtr anItem = *anItemIt;
- VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
- if (aVItem)
- aVItem->UpdatePresentationShape();
- }
- NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aSelectedIndices);
- updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
+ // REDISPLAY preview !
+
+ //QList<TreeModel_ItemBasePtr> anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices);
+ //NCollection_List<Handle(Standard_Transient)> aSelPresentations;
+
+ //for (QList<TreeModel_ItemBasePtr>::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++)
+ //{
+ // TreeModel_ItemBasePtr anItem = *anItemIt;
+ // VInspector_ItemBasePtr aVItem = itemDynamicCast<VInspector_ItemBase>(anItem);
+ // if (!aVItem)
+ // continue;
+ // aVItem->UpdatePresentationShape();
+
+ // Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties();
+ // if (anItemProperties)
+ // anItemProperties->GetPresentations (aRowId, aColId, aSelPresentations);
+ //}
+ //myDisplayPreview->UpdatePreview (theType, aSelPresentations);
+
+ //NCollection_List<TopoDS_Shape> aSelectedShapes = GetSelectedShapes (aSelectedIndices);
+ //updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers());
}
if (aSelectedPresentations.Extent() == 0)
Handle(AIS_InteractiveObject) aPresentation = anIOIt.Value();
switch (theType)
{
- case VInspector_DisplayActionType_DisplayId:
+ case View_DisplayActionType_DisplayId:
{
aContext->Display(aPresentation, false);
aContext->Load(aPresentation, -1);
}
break;
- case VInspector_DisplayActionType_RedisplayId: aContext->Redisplay (aPresentation, false); break;
- case VInspector_DisplayActionType_EraseId: aContext->Erase (aPresentation, false); break;
- case VInspector_DisplayActionType_RemoveId: aContext->Remove (aPresentation, false); break;
+ case View_DisplayActionType_RedisplayId: aContext->Redisplay (aPresentation, false); break;
+ case View_DisplayActionType_EraseId: aContext->Erase (aPresentation, false); break;
+ case View_DisplayActionType_RemoveId: aContext->Remove (aPresentation, false); break;
default: break;
}
}
// function : updatePreviewPresentation
// purpose :
// =======================================================================
-void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
- const Handle(Graphic3d_TransformPers)& thePersistent)
-{
- Handle(AIS_InteractiveContext) aContext;
- VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
- if (aViewModel)
- aContext = aViewModel->GetContext();
-
- if (theShapes.IsEmpty())
- {
- if (!aContext.IsNull())
- aContext->Remove (myPreviewPresentation, Standard_True);
- myPreviewPresentation = NULL;
- return;
- }
-
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- for (NCollection_List<TopoDS_Shape>::Iterator anIterator (theShapes); anIterator.More(); anIterator.Next())
- {
- aBuilder.Add (aCompound, anIterator.Value());
- }
-
- if (myPreviewPresentation.IsNull())
- {
- myPreviewPresentation = new AIS_Shape (aCompound);
- myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
-
- myPreviewPresentation->SetTransformPersistence(thePersistent);
- if (!aContext.IsNull())
- aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
- }
- else
- {
- Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
- myPreviewPresentation->SetTransformPersistence(thePersistent);
- if (!aContext.IsNull())
- aContext->Redisplay (myPreviewPresentation, Standard_True);
- }
-}
+//void VInspector_Window::updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
+// const Handle(Graphic3d_TransformPers)& thePersistent)
+//{
+// Handle(AIS_InteractiveContext) aContext;
+// VInspector_ViewModel* aViewModel = dynamic_cast<VInspector_ViewModel*> (myTreeView->model());
+// if (aViewModel)
+// aContext = aViewModel->GetContext();
+//
+// if (theShapes.IsEmpty())
+// {
+// if (!aContext.IsNull())
+// aContext->Remove (myPreviewPresentation, Standard_True);
+// myPreviewPresentation = NULL;
+// return;
+// }
+//
+// BRep_Builder aBuilder;
+// TopoDS_Compound aCompound;
+// aBuilder.MakeCompound (aCompound);
+// for (NCollection_List<TopoDS_Shape>::Iterator anIterator (theShapes); anIterator.More(); anIterator.Next())
+// {
+// aBuilder.Add (aCompound, anIterator.Value());
+// }
+//
+// if (myPreviewPresentation.IsNull())
+// {
+// myPreviewPresentation = new AIS_Shape (aCompound);
+// myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
+//
+// myPreviewPresentation->SetTransformPersistence(thePersistent);
+// if (!aContext.IsNull())
+// aContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+// }
+// else
+// {
+// Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
+// myPreviewPresentation->SetTransformPersistence(thePersistent);
+// if (!aContext.IsNull())
+// aContext->Redisplay (myPreviewPresentation, Standard_True);
+// }
+//}
#include <inspector/TInspectorAPI_PluginParameters.hxx>
#include <inspector/VInspector_CallBack.hxx>
-#include <inspector/VInspector_DisplayActionType.hxx>
+#include <inspector/View_DisplayActionType.hxx>
#include <inspector/ViewControl_PaneCreator.hxx>
#include <QMainWindow>
#include <Standard_WarningsRestore.hxx>
-class VInspector_PreviewParameters;
-
class ViewControl_MessageDialog;
class ViewControl_PropertyView;
class VInspector_ToolBar;
+class View_DisplayPreview;
class View_Window;
class QAbstractItemModel;
//! \return container of presentations
NCollection_List<Handle(AIS_InteractiveObject)> GetSelectedPresentations (QItemSelectionModel* theModel);
+ void GetSelectedShapes (NCollection_List<Handle(Standard_Transient)>& theSelPresentations);
+
//! Returns selected shapes
//! \param theModel selection model
//! \return container of shapes
//! Returns selected shapes
//! \param theModel selection model
//! \return container of shapes
- void GetSelectedPropertyPanelShapes (const QModelIndexList& theTreeViewIndices,
- const QModelIndexList& thePropertyPanelIndices,
+ void GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem,
NCollection_List<TopoDS_Shape>& theShapes);
//! Returns the first not zero transform persistent of selected elements
//! Set selected in tree view presentations displayed or erased in the current context. Note that erased presentations
//! still belongs to the current context until Remove is called.
//! \param theType display action type
- void displaySelectedPresentations (const VInspector_DisplayActionType theType);
+ void displaySelectedPresentations (const View_DisplayActionType theType);
//! Set items of the pointers highlighted in tree view
//! \param theType display action type
//! \return a context of created view.
Handle(AIS_InteractiveContext) createView();
- //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
- //!< \param theShape container of shapes
- //!< \param thePersistent transform persistent to be used in preview presentation
- void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
- const Handle(Graphic3d_TransformPers)& thePersistent);
-
private:
QWidget* myParent; //!< widget, comes when Init window, the window control lays in the layout, updates window title
View_Window* myViewWindow; //!< temporary view window, it is created if Open is called but context is still NULL
Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container
- VInspector_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
- Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+
+ View_DisplayPreview* myDisplayPreview; //!< class for preview display
#ifdef DEBUG_TWO_VIEWS
Handle(View_CameraPositionPrs) myCameraPrs;
default: return QVariant();
}
- return QVariant();
}
// =======================================================================
// purpose :
// =======================================================================
ViewControl_PaneItem* VInspectorPaneAIS_Shape::GetSelected (const Handle(Standard_Transient)& theObject,
- const int theRow, const int theColumn)
+ const int /*theRow*/, const int /*theColumn*/)
{
Handle(AIS_Shape) aPrs = GetPresentation (theObject);
if (aPrs.IsNull())
View_CameraPositionPrs.cxx
View_CameraPositionPrs.hxx
View_ContextType.hxx
+View_DisplayActionType.hxx
View_Displayer.cxx
View_Displayer.hxx
+View_DisplayPreview.cxx
+View_DisplayPreview.hxx
View_PresentationType.hxx
+View_PreviewParameters.cxx
+View_PreviewParameters.hxx
View_ToolActionType.hxx
View_ToolBar.cxx
View_ToolBar.hxx
--- /dev/null
+// Created on: 2018-08-19
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2018 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 View_DisplayActionType_H
+#define View_DisplayActionType_H
+
+//! \enum View_DisplayActionType
+enum View_DisplayActionType
+{
+ View_DisplayActionType_NoneId, //!< No action activated
+ View_DisplayActionType_DisplayId, //!< Display action
+ View_DisplayActionType_RedisplayId, //!< Redisplay action
+ View_DisplayActionType_EraseId, //!< Erase action
+ View_DisplayActionType_RemoveId //!< Remove action
+};
+
+#endif
--- /dev/null
+// Created on: 2019-07-14
+// 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/View_DisplayPreview.hxx>
+#include <inspector/View_PreviewParameters.hxx>
+#include <inspector/View_Tools.hxx>
+
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <inspector/Convert_Tools.hxx>
+#include <inspector/Convert_TransientShape.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+
+#include <Geom_Axis2Placement.hxx>
+#include <TopoDS_Compound.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+View_DisplayPreview::View_DisplayPreview()
+{
+ myPreviewParameters = new View_PreviewParameters();
+}
+
+// =======================================================================
+// function : SetContext
+// purpose :
+// =======================================================================
+void View_DisplayPreview::SetContext (const Handle(AIS_InteractiveContext)& theContext)
+{
+ if (myContext == theContext)
+ return;
+
+ // remove all preview presentations from the previous context, display it in the new
+
+ myContext = theContext;
+ myPreviewParameters->GetDrawer()->Link (theContext->DefaultDrawer());
+}
+
+// =======================================================================
+// function : UpdatePreview
+// purpose :
+// =======================================================================
+void View_DisplayPreview::UpdatePreview (const View_DisplayActionType theType,
+ const NCollection_List<Handle(Standard_Transient)>& thePresentations)
+{
+ if (myContext.IsNull())
+ return;
+
+ if (thePresentations.IsEmpty())
+ {
+ myContext->Remove (myPreviewPresentation, Standard_True);
+ myPreviewPresentation = NULL;
+ return;
+ }
+
+ BRep_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound (aCompound);
+ for (NCollection_List<Handle(Standard_Transient)>::Iterator anIterator (thePresentations); anIterator.More(); anIterator.Next())
+ {
+ Handle(Convert_TransientShape) aShapePtr = Handle(Convert_TransientShape)::DownCast (anIterator.Value());
+ if (aShapePtr.IsNull())
+ continue;
+
+ aBuilder.Add (aCompound, aShapePtr->GetShape());
+ }
+
+ if (myPreviewPresentation.IsNull())
+ {
+ myPreviewPresentation = new AIS_Shape (aCompound);
+ myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
+
+ //myPreviewPresentation->SetTransformPersistence(thePersistent);
+ myContext->Display (myPreviewPresentation, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+ }
+ else
+ {
+ Handle(AIS_Shape)::DownCast (myPreviewPresentation)->Set (aCompound);
+ //myPreviewPresentation->SetTransformPersistence(thePersistent);
+ myContext->Redisplay (myPreviewPresentation, Standard_True);
+ }
+}
+
+// =======================================================================
+// function : DisplayDefaultPreview
+// purpose :
+// =======================================================================
+
+void View_DisplayPreview::DisplayDefaultPreview()
+{
+ if (myContext.IsNull())
+ return;
+
+ BRep_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound (aCompound);
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (gp_Pnt(25., 10., 0.)));
+ aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt(20., 20., 0.), gp_Pnt(30., 20., 10.)));
+ //aBuilder.Add (aCompound, BRepBuilderAPI_MakeFace (gp_Pln (gp_Pnt (20., 30., 0.), gp_Dir (1., 0., 0.))).Face());
+ aBuilder.Add (aCompound, Convert_Tools::CreateBoxShape (gp_Pnt(20., 40., 0.), gp_Pnt(30., 60., 10.)));
+
+ Handle(AIS_Shape) aDefaultPreview = new AIS_Shape (aCompound);
+ aDefaultPreview->SetAttributes (myPreviewParameters->GetDrawer());
+ myContext->Display (aDefaultPreview, AIS_Shaded, -1/*do not participate in selection*/, Standard_True);
+}
--- /dev/null
+// Created on: 2019-07-14
+// 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 View_DisplayPreview_H
+#define View_DisplayPreview_H
+
+#include <inspector/View_DisplayActionType.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <Standard.hxx>
+#include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
+
+class AIS_InteractiveObject;
+class View_PreviewParameters;
+
+//! \class View_DisplayPreview
+//! \brief It is responsible for communication with AIS Interactive Context to:
+//! - display/erase presentations;
+//! - change display mode of visualized presentations (Shaded or WireFrame mode)
+//!
+//! It contains containers of visualized presentations to obtain presentations relating only to this displayer.
+//! Displayer is connected to AIS Interactive Context
+class View_DisplayPreview
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT View_DisplayPreview();
+
+ //! Destructor
+ virtual ~View_DisplayPreview() {}
+
+ //! Stores the current context where the presentations will be displayed/erased.
+ //! Erases previuously displayd presentations if there were some displayed
+ //! \param theContext a context instance
+ Standard_EXPORT void SetContext (const Handle(AIS_InteractiveContext)& theContext);
+
+ //!< Returns preview parameters
+ View_PreviewParameters* GetPreviewParameters() const { return myPreviewParameters; }
+
+ //!< Updates visibility of the presentations for the display type
+ Standard_EXPORT void UpdatePreview (const View_DisplayActionType theType,
+ const NCollection_List<Handle(Standard_Transient)>& thePresentations);
+
+ //!< Returns true if preview presentation is shown
+ Standard_EXPORT Standard_Boolean HasPreview() const { return !myPreviewPresentation.IsNull(); }
+
+ //!< Displays default preview to set visualization properties
+ Standard_EXPORT void DisplayDefaultPreview();
+
+protected:
+
+ //!< Updates presentation of preview for parameter shapes. Creates a compound of the shapes
+ //!< \param theShape container of shapes
+ //!< \param thePersistent transform persistent to be used in preview presentation
+ //void updatePreviewPresentation (const NCollection_List<TopoDS_Shape>& theShapes,
+ // const Handle(Graphic3d_TransformPers)& thePersistent);
+
+private:
+
+ //! Returns the current context
+ const Handle(AIS_InteractiveContext)& GetContext() const { return myContext; }
+
+private:
+
+ Handle(AIS_InteractiveContext) myContext; //!< context, where the displayer works
+
+ View_PreviewParameters* myPreviewParameters; //!< drawer of preview presentation
+ Handle(AIS_InteractiveObject) myPreviewPresentation; //!< presentation of preview for a selected object
+};
+
+#endif
--- /dev/null
+// Created on: 2019-05-03
+// 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/View_PreviewParameters.hxx>
+
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+
+// =======================================================================
+// function : Constructor
+// purpose :
+// =======================================================================
+View_PreviewParameters::View_PreviewParameters()
+{
+ myDrawer = new Prs3d_Drawer();
+
+ Quantity_Color aColor(Quantity_NOC_TOMATO);//Quantity_NOC_GREENYELLOW));//Quantity_NOC_BLUE1));
+ Standard_ShortReal aTransparency = 0.8;
+
+ // point parameters
+ myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
+
+ // shading parameters
+ Graphic3d_MaterialAspect aShadingMaterial;
+ aShadingMaterial.SetReflectionModeOff (Graphic3d_TOR_SPECULAR);
+ aShadingMaterial.SetMaterialType (Graphic3d_MATERIAL_ASPECT);
+
+ myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+ myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
+ myDrawer->ShadingAspect()->SetColor (aColor);
+ myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
+
+ myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
+ myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
+ myDrawer->SetTransparency (aTransparency);
+
+ // common parameters
+ myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
+}
+
+// =======================================================================
+// function : SaveState
+// purpose :
+// =======================================================================
+void View_PreviewParameters::SaveState (View_PreviewParameters* theParameters,
+ QMap<QString, QString>& theItems,
+ const QString& thePrefix)
+{
+ Handle(Prs3d_Drawer) aDrawer = theParameters->GetDrawer();
+
+ //Quantity_Color aColor = aDrawer->Color();
+ //Standard_ShortReal aTransparency = aDrawer->Transparency();
+
+ //// point parameters
+ //{
+ // Standard_Boolean anOwnPointAspect = aDrawer->HasOwnPointAspect();
+ // Standard_SStream OS;
+ // if (anOwnPointAspect)
+ // myDrawer->PointAspect()->Dump (OS);
+ // TCollection_AsciiString aStream (OS.str().c_str());
+ // theItems[thePrefix + "has_point_aspect"] = anOwnPointAspect;
+ // theItems[thePrefix + "point_aspect"] = aStream.ToCString();
+ //}
+ //// shading parameters
+ //{
+ // Standard_Boolean anOwnShadingAspect = aDrawer->HasOwnShadingAspect();
+ // Standard_SStream OS;
+ // if (anOwnShadingAspect)
+ // myDrawer->ShadingAspect()->Dump (OS);
+ // TCollection_AsciiString aStream (OS.str().c_str());
+ // theItems[thePrefix + "has_shading_aspect"] = anOwnShadingAspect;
+ // theItems[thePrefix + "shading_aspect"] = aStream.ToCString();
+ //}
+}
+
+// =======================================================================
+// function : RestoreState
+// purpose :
+// =======================================================================
+bool View_PreviewParameters::RestoreState (View_PreviewParameters* theParameters,
+ const QString& theKey, const QString& theValue,
+ const QString& thePrefix)
+{
+ //if (theKey == thePrefix + "has_point_aspect") // point parameters
+ //{
+ // myDrawer->SetOwnPointAspect (theValue.toBool());
+ //}
+ //else if (theKey == thePrefix + "point_aspect") // point parameters
+ //{
+ // Standard_SStream aStream;
+ // aStream << theValue.ToString().ToStdString();
+ // myDrawer->PointAspect()->Init (aStream);
+ //}
+ //else if (theKey == thePrefix + "has_shading_aspect") // shading parameters
+ //{
+ // myDrawer->SetOwnShadingAspect (theValue.toBool());
+ //}
+ //else if (theKey == thePrefix + "shading_aspect") // shading parameters
+ //{
+ // Standard_SStream aStream;
+ // aStream << theValue.ToString().ToStdString();
+ // myDrawer->ShadingAspect()->Init (aStream);
+ //}
+ //else
+ // return false;
+ return true;
+}
--- /dev/null
+// Created on: 2019-05-03
+// 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 View_PreviewParameters_H
+#define View_PreviewParameters_H
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+#include <Prs3d_Drawer.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QMap>
+#include <QString>
+#include <Standard_WarningsRestore.hxx>
+
+//! \class View_PreviewParameters
+//! Container of View tool bar actions
+class View_PreviewParameters
+{
+public:
+
+ //! Constructor
+ Standard_EXPORT View_PreviewParameters ();
+
+ //! Destructor
+ virtual ~View_PreviewParameters() {}
+
+ //! Returns main control
+ const Handle(Prs3d_Drawer)& GetDrawer() const { return myDrawer; }
+
+ //! Save state of three view in a container in form: key, value. It saves:
+ //! - visibiblity of columns,
+ //! - columns width
+ //! \param theTreeView a view instance
+ //! \param theItems [out] properties
+ //! \param thePrefix peference item prefix
+ Standard_EXPORT static void SaveState (View_PreviewParameters* theParameters,
+ 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 (View_PreviewParameters* theParameters,
+ const QString& theKey, const QString& theValue,
+ const QString& thePrefix = QString());
+
+private:
+
+ Handle(Prs3d_Drawer) myDrawer;
+};
+
+#endif
{
myViewer->InitViewer (myViewer->CreateStandardViewer());
- Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
- aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
- myViewer->GetContext()->Display (aTrihedron, Standard_True);
+ //Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY()));
+ //aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded);
+ //myViewer->GetContext()->Display (aTrihedron, Standard_True);
}
setAttribute (Qt::WA_PaintOnScreen);
ViewControl_TableModelValuesDefault.hxx
ViewControl_Tools.cxx
ViewControl_Tools.hxx
-ViewControl_TransientShape.cxx
-ViewControl_TransientShape.hxx
ViewControl_TreeView.hxx
// commercial license or contractual agreement.
#include <inspector/ViewControl_PropertiesStream.hxx>
-#include <inspector/ViewControl_TransientShape.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
TCollection_AsciiString aStrValue = aValue.toString().toStdString().c_str();
gp_XYZ aPoint;
- if (!aPoint.FromString (aStrValue))
+ if (!aPoint.Init (Standard_SStream (aStrValue.ToCString())))
return;
- thePresentations.Append (new ViewControl_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
+ //thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint)));
}
#include <inspector/ViewControl_TableModel.hxx>
#include <inspector/ViewControl_Tools.hxx>
+#include <inspector/TreeModel_ItemProperties.hxx>
#include <inspector/TreeModel_Tools.hxx>
#include <Standard_WarningsDisable.hxx>
// purpose :
// =======================================================================
-void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIndices)
+void ViewControl_Table::GetSelectedIndices (QMap<int, QList<int>>& theSelectedIndices) const
{
QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes();
{
return ViewControl_Tools::TableSeparator();
}
+
+// =======================================================================
+// function : GetSelectedPresentations
+// purpose :
+// =======================================================================
+
+void ViewControl_Table::GetSelectedPresentations (const TreeModel_ItemBasePtr& theTreeItem,
+ NCollection_List<Handle(Standard_Transient)>& theSelPresentations) const
+{
+ Handle(TreeModel_ItemProperties) anItemProperties = theTreeItem->GetProperties();
+ if (anItemProperties.IsNull())
+ return;
+
+ QMap<int, QList<int>> aSelectedIndices;
+ GetSelectedIndices (aSelectedIndices);
+
+ for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ int aRowId = aSelIt.key();
+ QList<int> aColIds = aSelIt.value();
+ for (int aColId = 0; aColId < aColIds.size(); aColId++)
+ {
+ int aSelectedColId = aColIds[aColId];
+ if (aSelectedColId != 1)
+ continue;
+
+ if (anItemProperties)
+ anItemProperties->GetPresentations (aRowId, aSelectedColId, theSelPresentations);
+ }
+ }
+}
+
+// =======================================================================
+// function : GetSelectedPointers
+// purpose :
+// =======================================================================
+
+void ViewControl_Table::GetSelectedPointers (QStringList& thePointers) const
+{
+ QMap<int, QList<int>> aSelectedIndices;
+ GetSelectedIndices (aSelectedIndices);
+
+ ViewControl_TableModel* aTableModel = dynamic_cast<ViewControl_TableModel*>(GetTableView()->model());
+ ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues();
+
+ for (QMap<int, QList<int>>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++)
+ {
+ int aRowId = aSelIt.key();
+ QList<int> aColIds = aSelIt.value();
+ for (int aColId = 0; aColId < aColIds.size(); aColId++)
+ {
+ int aSelectedColId = aColIds[aColId];
+ if (aSelectedColId != 1)
+ continue;
+
+ QString aData = aTableValues->Data (aRowId, aSelectedColId, Qt::DisplayRole).toString();
+ if (aData.contains (ViewControl_Tools::GetPointerPrefix().ToCString()))
+ thePointers.append (aData);
+ }
+ }
+}
\ No newline at end of file
#ifndef ViewControl_Table_H
#define ViewControl_Table_H
+#include <NCollection_List.hxx>
+
#include <Standard.hxx>
#include <Standard_Macro.hxx>
+#include <Standard_Transient.hxx>
+
+#include <inspector/TreeModel_ItemBase.hxx>
#include <Standard_WarningsDisable.hxx>
#include <QItemSelection>
//! 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);
+ Standard_EXPORT void GetSelectedIndices (QMap<int, QList<int>>& aSelectedIndices) const;
+
+ //! Returns presentations by the property item of tree item for the selected cells
+ Standard_EXPORT void GetSelectedPresentations (const TreeModel_ItemBasePtr& theTreeItem,
+ NCollection_List<Handle(Standard_Transient)>& theSelPresentations) const;
+
+ //! Returns pointers from selected cells
+ Standard_EXPORT void GetSelectedPointers (QStringList& thePointers) const;
//! Returns text of separation row in table
//! \return string value
int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const
{
if (!GetProperties().IsNull())
- return GetProperties()->GetTableColumnCount();
+ return GetProperties()->ColumnCount();
return 0;
}
int ViewControl_TableModelValues::RowCount (const QModelIndex&) const
{
if (!GetProperties().IsNull())
- return GetProperties()->GetTableRowCount();
+ return GetProperties()->RowCount();
return 0;
}
{
if (!GetProperties().IsNull())
{
- QVariant aValue = GetProperties()->GetTableData (theRow, theColumn, theRole);
+ QVariant aValue = GetProperties()->Data (theRow, theColumn, theRole);
if (aValue.isValid())
return aValue;
}
#include <Geom_Transformation.hxx>
#include <TColgp_Array1OfPnt.hxx>
+#include <TCollection.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
// =======================================================================
TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo)
{
- if (thePointer.IsNull())
+ return TCollection::GetPointerInfo (thePointer);
+ /*if (thePointer.IsNull())
return TCollection_AsciiString();
- return GetPointerInfo(thePointer.operator->(), isShortInfo);
+ return GetPointerInfo(thePointer.operator->(), isShortInfo);*/
}
// =======================================================================
// =======================================================================
TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const void* thePointer, const bool isShortInfo)
{
+ return TCollection::GetPointerInfo (thePointer);
+ /*
std::ostringstream aPtrStr;
aPtrStr << thePointer;
if (!isShortInfo)
return anInfoPtr;
}
}
- return aPtrStr.str().c_str();
+ return aPtrStr.str().c_str();*/
}
// =======================================================================
{
return ToString (theLocation.Transformation());
}
-
-//=======================================================================
-//function : CreateShape
-//purpose :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateShape (const Bnd_Box& theBoundingBox)
-{
- if (theBoundingBox.IsVoid() || theBoundingBox.IsWhole())
- return TopoDS_Shape();
-
- Standard_Real aXmin, anYmin, aZmin, aXmax, anYmax, aZmax;
- theBoundingBox.Get (aXmin, anYmin, aZmin, aXmax, anYmax, aZmax);
-
- gp_Pnt aPntMin = gp_Pnt (aXmin, anYmin, aZmin);
- gp_Pnt aPntMax = gp_Pnt (aXmax, anYmax, aZmax);
-
- return CreateBoxShape (aPntMin, aPntMax);
-}
-
-//=======================================================================
-//function : CreateShape
-//purpose :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateShape (const Bnd_OBB& theBoundingBox)
-{
- if (theBoundingBox.IsVoid())
- return TopoDS_Shape();
-
- TColgp_Array1OfPnt anArrPnts(0, 8);
- theBoundingBox.GetVertex(&anArrPnts(0));
-
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
-
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(1))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(0)), gp_Pnt (anArrPnts.Value(2))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(1)), gp_Pnt (anArrPnts.Value(3))));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Pnt (anArrPnts.Value(2)), gp_Pnt (anArrPnts.Value(3))));
-
- return aCompound;
-}
-
-//=======================================================================
-//function : CreateBoxShape
-//purpose :
-//=======================================================================
-TopoDS_Shape ViewControl_Tools::CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax)
-{
- Standard_Boolean aThinOnX = fabs (thePntMin.X() - thePntMax.X()) < Precision::Confusion();
- Standard_Boolean aThinOnY = fabs (thePntMin.Y() - thePntMax.Y()) < Precision::Confusion();
- Standard_Boolean aThinOnZ = fabs (thePntMin.Z() - thePntMax.Z()) < Precision::Confusion();
-
- if (((int)aThinOnX + (int)aThinOnY + (int)aThinOnZ) > 1) // thin box in several directions is a point
- {
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (thePntMin));
- return aCompound;
- }
-
- if (aThinOnX || aThinOnY || aThinOnZ)
- {
- gp_Pnt aPnt1, aPnt2, aPnt3, aPnt4 ;
- if (aThinOnX)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMax.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
- }
- else if (aThinOnY)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMax.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMax.Z());
- }
- else if (aThinOnZ)
- {
- aPnt1 = gp_Pnt(thePntMin.X(), thePntMin.Y(), thePntMin.Z());
- aPnt2 = gp_Pnt(thePntMax.X(), thePntMin.Y(), thePntMin.Z());
- aPnt3 = gp_Pnt(thePntMax.X(), thePntMax.Y(), thePntMin.Z());
- aPnt4 = gp_Pnt(thePntMin.X(), thePntMax.Y(), thePntMin.Z());
- }
- BRep_Builder aBuilder;
- TopoDS_Compound aCompound;
- aBuilder.MakeCompound (aCompound);
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt1, aPnt2));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt2, aPnt3));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt3, aPnt4));
- aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (aPnt4, aPnt1));
-
- return aCompound;
- }
- else
- {
- BRepPrimAPI_MakeBox aBoxBuilder (thePntMin, thePntMax);
- return aBoxBuilder.Shape();
- }
-}
//! \return text value
Standard_EXPORT static TCollection_AsciiString ToString (const TopLoc_Location& theLocation);
- //! Creates box shape
- //! \param theBoundingBox box shape parameters
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_Box& theBoundingBox);
-
- //! Creates box shape
- //! \param theBoundingBox box shape parameters
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateShape (const Bnd_OBB& theBoundingBox);
-
- //! Creates box shape
- //! \param thePntMin minimum point on the bounding box
- //! \param thePntMax maximum point on the bounding box
- //! \return created shape
- Standard_EXPORT static TopoDS_Shape CreateBoxShape (const gp_Pnt& thePntMin, const gp_Pnt& thePntMax);
-
};
#endif
+++ /dev/null
-// Created on: 2019-04-15
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <inspector/ViewControl_TransientShape.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(ViewControl_TransientShape, Standard_Transient)
+++ /dev/null
-// Created on: 2019-04-15
-// Created by: Natalia ERMOLAEVA
-// Copyright (c) 2019 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef ViewControl_TransientShape_H
-#define ViewControl_TransientShape_H
-
-#include <Standard.hxx>
-#include <Standard_Handle.hxx>
-#include <Standard_Macro.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Transient.hxx>
-
-#include <TopoDS_Shape.hxx>
-
-DEFINE_STANDARD_HANDLE (ViewControl_TransientShape, Standard_Transient)
-
-//! \class ViewControl_TransientShape
-//! \brief An interface to create custom panes by transient object name.
-class ViewControl_TransientShape : public Standard_Transient
-{
-public:
-
- //! Constructor
- ViewControl_TransientShape (const TopoDS_Shape& theShape) { SetShape (theShape); }
-
- //! Destructor
- virtual ~ViewControl_TransientShape() {}
-
- //! Fills current shape
- void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; }
-
- //! Returns current shape
- const TopoDS_Shape GetShape() const { return myShape; }
-
- DEFINE_STANDARD_RTTIEXT (ViewControl_TransientShape, Standard_Transient)
-
-private:
- TopoDS_Shape myShape;
-};
-
-#endif