"DIAGONAL_45", "DIAGONAL_45_WIDE", "DIAGONAL_135", "DIAGONAL_135_WIDE",
"GRID", "GRID_WIDE", "GRID_DIAGONAL", "GRID_DIAGONAL_WIDE", "NB"
};
+
+ static Standard_CString Aspect_Table_PrintTypeOfTriedronPosition[9] =
+ {
+ "CENTER", "TOP", "BOTTOM", "LEFT", "RIGHT", "LEFT_LOWER", "LEFT_UPPER", "RIGHT_LOWER", "RIGHT_UPPER"
+ };
}
//=======================================================================
return Standard_False;
}
+//=======================================================================
+//function : TypeOfTriedronPositionToString
+//purpose :
+//=======================================================================
+Standard_CString Aspect::TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType)
+{
+ return Aspect_Table_PrintTypeOfTriedronPosition[theType];
+ switch (theType)
+ {
+ case Aspect_TOTP_CENTER: return Aspect_Table_PrintTypeOfTriedronPosition[0];
+ case Aspect_TOTP_TOP: return Aspect_Table_PrintTypeOfTriedronPosition[1];
+ case Aspect_TOTP_BOTTOM: return Aspect_Table_PrintTypeOfTriedronPosition[2];
+ case Aspect_TOTP_LEFT: return Aspect_Table_PrintTypeOfTriedronPosition[3];
+ case Aspect_TOTP_RIGHT: return Aspect_Table_PrintTypeOfTriedronPosition[4];
+ case Aspect_TOTP_LEFT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[5];
+ case Aspect_TOTP_LEFT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[6];
+ case Aspect_TOTP_RIGHT_LOWER: return Aspect_Table_PrintTypeOfTriedronPosition[7];
+ case Aspect_TOTP_RIGHT_UPPER: return Aspect_Table_PrintTypeOfTriedronPosition[8];
+ }
+ return "";
+}
+
+//=======================================================================
+//function : TypeOfTriedronPositionFromString
+//purpose :
+//=======================================================================
+Standard_Boolean Aspect::TypeOfTriedronPositionFromString (Standard_CString theTypeString,
+ Aspect_TypeOfTriedronPosition& theType)
+{
+ TCollection_AsciiString aName (theTypeString);
+ aName.UpperCase();
+ if (aName == Aspect_Table_PrintTypeOfTriedronPosition[0]) { theType = Aspect_TOTP_CENTER; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[1]) { theType = Aspect_TOTP_TOP; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[2]) { theType = Aspect_TOTP_BOTTOM; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[3]) { theType = Aspect_TOTP_LEFT; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[4]) { theType = Aspect_TOTP_RIGHT; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[5]) { theType = Aspect_TOTP_LEFT_LOWER; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[6]) { theType = Aspect_TOTP_LEFT_UPPER; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[7]) { theType = Aspect_TOTP_RIGHT_LOWER; return Standard_True; }
+ else if (aName == Aspect_Table_PrintTypeOfTriedronPosition[8]) { theType = Aspect_TOTP_RIGHT_UPPER; return Standard_True; }
+ return Standard_False;
+}
#include <Aspect_TypeOfLine.hxx>
#include <Aspect_TypeOfMarker.hxx>
#include <Aspect_TypeOfStyleText.hxx>
+#include <Aspect_TypeOfTriedronPosition.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Type.hxx>
Standard_EXPORT static Standard_Boolean HatchStyleFromString (const Standard_CString theTypeString,
Aspect_HatchStyle& theType);
+ //! 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 TypeOfTriedronPositionToString (Aspect_TypeOfTriedronPosition theType);
+
+ //! Returns the orientation type from the given string identifier (using case-insensitive comparison).
+ //! @param theTypeString string identifier
+ //! @return enumeration type or Aspect_TOTP_CENTER if string identifier is invalid
+ static Aspect_TypeOfTriedronPosition TypeOfTriedronPositionFromString (Standard_CString theTypeString)
+ {
+ Aspect_TypeOfTriedronPosition aType = Aspect_TOTP_CENTER;
+ TypeOfTriedronPositionFromString (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 TypeOfTriedronPositionFromString (const Standard_CString theTypeString,
+ Aspect_TypeOfTriedronPosition& theType);
+
};
#endif // _Aspect_HeaderFile
{
"USHORT", "UINT", "VEC2", "VEC3", "VEC4", "VEC4UB", "FLOAT"
};
+
+ static Standard_CString Graphic3d_Table_PrintTransModeFlags[6] =
+ {
+ "NONE", "ZOOM_PERS", "ROTATE_PERS", "TRIEDRON_PERS", "2d", "ZOOM_ROTATE_PERS"
+ };
}
//=======================================================================
}
return Standard_False;
}
+
+//=======================================================================
+//function : TransModeFlagsToString
+//purpose :
+//=======================================================================
+Standard_CString Graphic3d::TransModeFlagsToString (Graphic3d_TransModeFlags theType)
+{
+ switch (theType)
+ {
+ case Graphic3d_TMF_None: return Graphic3d_Table_PrintTransModeFlags[0]; break;
+ case Graphic3d_TMF_ZoomPers: return Graphic3d_Table_PrintTransModeFlags[1]; break;
+ case Graphic3d_TMF_RotatePers: return Graphic3d_Table_PrintTransModeFlags[2]; break;
+ case Graphic3d_TMF_TriedronPers: return Graphic3d_Table_PrintTransModeFlags[3]; break;
+ case Graphic3d_TMF_2d: return Graphic3d_Table_PrintTransModeFlags[4]; break;
+ case Graphic3d_TMF_ZoomRotatePers: return Graphic3d_Table_PrintTransModeFlags[5]; break;
+ }
+ return "";
+}
+
+//=======================================================================
+//function : ZLayerIdFromString
+//purpose :
+//=======================================================================
+Standard_Boolean Graphic3d::TransModeFlagsFromString (Standard_CString theTypeString,
+ Graphic3d_TransModeFlags& theType)
+{
+ TCollection_AsciiString aName (theTypeString);
+ aName.UpperCase();
+ for (Standard_Integer aTypeIter = 0; aTypeIter <= 5; ++aTypeIter)
+ {
+ Standard_CString aTypeName = Graphic3d_Table_PrintTransModeFlags[aTypeIter];
+ if (aName == aTypeName)
+ {
+ switch (aTypeIter)
+ {
+ case 0: theType = Graphic3d_TMF_None; break;
+ case 1: theType = Graphic3d_TMF_ZoomPers; break;
+ case 2: theType = Graphic3d_TMF_RotatePers; break;
+ case 3: theType = Graphic3d_TMF_TriedronPers; break;
+ case 4: theType = Graphic3d_TMF_2d; break;
+ case 5: theType = Graphic3d_TMF_ZoomRotatePers; break;
+ }
+ return Standard_True;
+ }
+ }
+ return Standard_False;
+}
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <Graphic3d_TextPath.hxx>
+#include <Graphic3d_TransModeFlags.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Graphic3d_ZLayerId.hxx>
Standard_EXPORT static Standard_Boolean TypeOfDataFromString (const Standard_CString theTypeString,
Graphic3d_TypeOfData& theType);
+ //! 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 TransModeFlagsToString (Graphic3d_TransModeFlags theType);
+
+ //! Returns the orientation type from the given string identifier (using case-insensitive comparison).
+ //! @param theTypeString string identifier
+ //! @return enumeration type or Graphic3d_TOSM_DEFAULT if string identifier is invalid
+ static Graphic3d_TransModeFlags TransModeFlagsFromString (Standard_CString theTypeString)
+ {
+ Graphic3d_TransModeFlags aType = Graphic3d_TMF_None;
+ TransModeFlagsFromString (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 TransModeFlagsFromString (const Standard_CString theTypeString,
+ Graphic3d_TransModeFlags& theType);
};
#endif // _Graphic3d_HeaderFile
VInspector_ItemGraphic3dCStructure.hxx
VInspector_ItemGraphic3dGroup.cxx
VInspector_ItemGraphic3dGroup.hxx
+VInspector_ItemGraphic3dTransformPers.cxx
+VInspector_ItemGraphic3dTransformPers.hxx
VInspector_ItemHistoryElement.cxx
VInspector_ItemHistoryElement.hxx
VInspector_ItemHistoryRoot.cxx
#include <inspector/VInspector_ItemFolderObject.hxx>
#include <inspector/VInspector_ItemContext.hxx>
+#include <inspector/VInspector_ItemGraphic3dTransformPers.hxx>
#include <inspector/VInspector_ItemPresentableObject.hxx>
#include <inspector/VInspector_ItemPrs3dDrawer.hxx>
#include <inspector/VInspector_ItemSelectMgrFilter.hxx>
}
case ParentKind_PresentationItem:
{
- return 3; // Attributes, HilightAttributes and DynamicHilightAttributes
+ return 4; // TransformPers, Attributes, HilightAttributes and DynamicHilightAttributes
}
case ParentKind_FolderItem:
return (GetContext().IsNull() ? 0 : GetContext()->Filters().Extent());
return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn);
}
case ParentKind_PresentationItem:
- return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn);
+ {
+ if (theRow == 0)
+ return VInspector_ItemGraphic3dTransformPers::CreateItem (currentItem(), theRow, theColumn);
+ else
+ return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn);
+ }
case ParentKind_FolderItem:
return VInspector_ItemSelectMgrFilter::CreateItem (currentItem(), theRow, theColumn);
default: return TreeModel_ItemBasePtr();
Handle(AIS_InteractiveObject) aPrs = aParentPrsItem->GetInteractiveObject();
switch (theRow)
{
- case 0: theName = "Attributes"; return aPrs->Attributes();
- case 1: theName = "HilightAttributes"; return aPrs->HilightAttributes();
- case 2: theName = "DynamicHilightAttributes"; return aPrs->DynamicHilightAttributes();
+ case 0: return 0; // "TransformPers"
+ case 1: theName = "Attributes"; return aPrs->Attributes();
+ case 2: theName = "HilightAttributes"; return aPrs->HilightAttributes();
+ case 3: theName = "DynamicHilightAttributes"; return aPrs->DynamicHilightAttributes();
default: break;
}
}
switch (Column())
{
- case 0: return aCStructure->DynamicType()->Name();
+ case 0: return theItemRole == Qt::DisplayRole ? aCStructure->DynamicType()->Name()
+ : STANDARD_TYPE (Graphic3d_CStructure)->Name();
case 1: return rowCount();
default:
break;
switch (Column())
{
- case 0: return aGroup->DynamicType()->Name();
+ case 0: return theItemRole == Qt::DisplayRole ? aGroup->DynamicType()->Name()
+ : STANDARD_TYPE (Graphic3d_Group)->Name();
case 1:
return rowCount();
case 2:
--- /dev/null
+// Created on: 2018-08-16
+// 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.
+
+#include <inspector/VInspector_ItemGraphic3dTransformPers.hxx>
+#include <inspector/VInspector_ItemFolderObject.hxx>
+#include <inspector/VInspector_ItemPresentableObject.hxx>
+
+#include <inspector/VInspector_ItemPrs3dPresentation.hxx>
+#include <inspector/VInspector_Tools.hxx>
+#include <inspector/ViewControl_Tools.hxx>
+
+#include <Aspect.hxx>
+#include <Graphic3d.hxx>
+#include <Graphic3d_TransformPers.hxx>
+#include <Graphic3d_GraphicDriver.hxx>
+
+#include <Standard_WarningsDisable.hxx>
+#include <QStringList>
+#include <Standard_WarningsRestore.hxx>
+
+// =======================================================================
+// function : GetTransformPers
+// purpose :
+// =======================================================================
+Handle(Graphic3d_TransformPers) VInspector_ItemGraphic3dTransformPers::GetTransformPers() const
+{
+ initItem();
+ return myTransformPers;
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dTransformPers::Init()
+{
+ VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast<VInspector_ItemFolderObject>(Parent());
+ if (aParentItem)
+ {
+ VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast<VInspector_ItemPresentableObject>(aParentItem->Parent());
+ if (aParentPrsItem)
+ {
+ Handle(AIS_InteractiveObject) anObject = aParentPrsItem->GetInteractiveObject();
+ myTransformPers = anObject->TransformPersistence();
+ }
+ }
+
+ TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dTransformPers::Reset()
+{
+ VInspector_ItemBase::Reset();
+ myTransformPers = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemGraphic3dTransformPers::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<VInspector_ItemGraphic3dTransformPers*>(this)->Init();
+}
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemGraphic3dTransformPers::initRowCount() const
+{
+ return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemGraphic3dTransformPers::initValue (const int theItemRole) const
+{
+ if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+ return QVariant();
+
+ Handle(Graphic3d_TransformPers) aTransformPers = GetTransformPers();
+ if (aTransformPers.IsNull())
+ return Column() == 0 ? "Graphic3d_TransformPers" : "";
+
+ switch (Column())
+ {
+ case 0: return aTransformPers->DynamicType()->Name();
+ case 1: return rowCount();
+ default:
+ break;
+ }
+ return QVariant();
+}
+
+// =======================================================================
+// function : GetTableRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemGraphic3dTransformPers::GetTableRowCount() const
+{
+ return 5;
+}
+
+// =======================================================================
+// function : GetTableData
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemGraphic3dTransformPers::GetTableData (const int theRow, const int theColumn, const int theRole) const
+{
+ if (theRole != Qt::DisplayRole)
+ return QVariant();
+
+ bool isFirstColumn = theColumn == 0;
+
+ Handle(Graphic3d_TransformPers) aTransformPers = GetTransformPers();
+ if (aTransformPers.IsNull())
+ return QVariant();
+
+ switch (theRow)
+ {
+ case 0: return isFirstColumn ? QVariant ("Mode")
+ : QVariant (Graphic3d::TransModeFlagsToString (aTransformPers->Mode()));
+ case 1: return isFirstColumn ? QVariant ("AnchorPoint")
+ : aTransformPers->IsZoomOrRotate() ? QVariant (ViewControl_Tools::ToString (aTransformPers->AnchorPoint()).ToCString()) : QVariant();
+ case 2: return isFirstColumn ? QVariant ("Corner2d")
+ : aTransformPers->IsTrihedronOr2d() ? QVariant (Aspect::TypeOfTriedronPositionToString (aTransformPers->Corner2d())) : QVariant();
+ case 3: return isFirstColumn ? QVariant ("OffsetX")
+ : aTransformPers->IsTrihedronOr2d() ? QVariant (aTransformPers->Offset2d().x()) : QVariant();
+ case 4: return isFirstColumn ? QVariant ("OffsetY")
+ : aTransformPers->IsTrihedronOr2d() ? QVariant (aTransformPers->Offset2d().y()) : QVariant();
+
+ default: return QVariant();
+ }
+}
+
+// =======================================================================
+// function : createChild
+// purpose :
+// =======================================================================
+TreeModel_ItemBasePtr VInspector_ItemGraphic3dTransformPers::createChild (int, int)
+{
+ return TreeModel_ItemBasePtr();
+}
--- /dev/null
+// Created on: 2018-08-16
+// 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_ItemGraphic3dTransformPers_H
+#define VInspector_ItemGraphic3dTransformPers_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+class Graphic3d_TransformPers;
+
+class VInspector_ItemGraphic3dTransformPers;
+typedef QExplicitlySharedDataPointer<VInspector_ItemGraphic3dTransformPers> VInspector_ItemGraphic3dTransformPersPtr;
+
+//! \class VInspector_ItemGraphic3dTransformPers
+//! Parent item, that corresponds to AIS_InteractiveContext
+//! Children of the item are:
+//! - "Property" item to show context attributes such as selection filters and drawer properties
+//! - presentation items to show all interactive elements displayed/erased in the context
+class VInspector_ItemGraphic3dTransformPers : public VInspector_ItemBase
+{
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ static VInspector_ItemGraphic3dTransformPersPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return VInspector_ItemGraphic3dTransformPersPtr (new VInspector_ItemGraphic3dTransformPers (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~VInspector_ItemGraphic3dTransformPers() Standard_OVERRIDE {};
+
+ //! Returns the current C structure, init item if it was not initialized yet
+ //! \return graphic C structure object
+ Standard_EXPORT Handle(Graphic3d_TransformPers) GetTransformPers() const;
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Returns number of table rows
+ //! \return an integer value
+ virtual int GetTableRowCount() const Standard_OVERRIDE;
+
+ //! Returns table value for the row in form: <function name> <function value>
+ //! \param theRow a model index row
+ //! \param theColumn a model index column
+ virtual QVariant GetTableData (const int theRow, const int theColumn, const int theRole) const Standard_OVERRIDE;
+
+protected:
+
+ //! Initialize the current item. It creates a backup of the specific item information
+ //! Do nothing as context has been already set into item
+ virtual void initItem() const Standard_OVERRIDE;
+
+ //! Returns number of displayed presentations
+ //! \return rows count
+ virtual int initRowCount() const Standard_OVERRIDE;
+
+ //! Returns item information for the given role. Fills internal container if it was not filled yet
+ //! \param theItemRole a value role
+ //! \return the value
+ virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+protected:
+
+ //! Creates a child item in the given position.
+ //! \param theRow the child row position
+ //! \param theColumn the child column position
+ //! \return the created item
+ virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE;
+
+private:
+
+ //! Constructor
+ //! param theParent a parent item
+ //! \param theRow the item row positition in the parent item
+ //! \param theColumn the item column positition in the parent item
+ VInspector_ItemGraphic3dTransformPers(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+private:
+ Handle(Graphic3d_TransformPers) myTransformPers;
+};
+
+#endif
{
case 0:
{
+ if (theItemRole != Qt::ToolTipRole)
+ return "OpenGl_Element";
+
VInspector_ElementKind aKind = GetElementKind();
if (aKind == VInspector_ElementKind_PrimitiveArray) return "OpenGl_PrimitiveArray";
else if (aKind == VInspector_ElementKind_Text) return "OpenGl_Text";