SelectMgr_Frustum() : SelectMgr_BaseFrustum() {};
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
protected:
// SAT Tests for different objects
return Standard_True;
}
+
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+template <int N>
+void SelectMgr_Frustum<N>::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
+
+ const Standard_Integer anIncFactor = (myIsOrthographic && N == 4) ? 2 : 1;
+ for (Standard_Integer aPlaneIdx = 0; aPlaneIdx < N + 1; aPlaneIdx += anIncFactor)
+ {
+ const gp_Vec& aPlane = myPlanes[aPlaneIdx];
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aPlane)
+
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMaxVertsProjections[aPlaneIdx])
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinVertsProjections[aPlaneIdx])
+ }
+
+ for (Standard_Integer aVertIdx = 0; aVertIdx < N * 2; ++aVertIdx)
+ {
+ const gp_Pnt& aVertex = myVertices[aVertIdx];
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &aVertex)
+ }
+
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPixelTolerance)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOrthographic)
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myBuilder)
+ OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myCamera)
+
+ for (Standard_Integer anIndex = 0; anIndex < 3; anIndex++)
+ {
+ Standard_Real aMaxOrthoVertsProjections = myMaxOrthoVertsProjections[anIndex];
+ Standard_Real aMinOrthoVertsProjections = myMinOrthoVertsProjections[anIndex];
+
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aMaxOrthoVertsProjections)
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aMinOrthoVertsProjections)
+ }
+
+ for (Standard_Integer anIndex = 0; anIndex < 6; anIndex++)
+ {
+ gp_Vec anEdgeDir = myEdgeDirs[anIndex];
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &anEdgeDir)
+ }
+}
thePlaneEquations.Append (anEquation);
}
}
+
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void SelectMgr_RectangularFrustum::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_RectangularFrustum)
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_Frustum)
+
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myNearPickedPnt)
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myFarPickedPnt)
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myViewRayDir)
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myMousePos)
+
+ OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myScale)
+}
//! Ax + By + Cz + D = 0) to the given vector
Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
protected:
Standard_EXPORT void segmentSegmentDistance (const gp_Pnt& theSegPnt1,
for (Standard_Integer anIdx = 0; anIdx < VolumeTypesNb; ++anIdx)
{
const Handle(SelectMgr_BaseFrustum)& aSelectingVolume = mySelectingVolumes[anIdx];
- OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aSelectingVolume.get())
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aSelectingVolume.get())
}
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myViewClipPlanes.get())
//! Return the Selector.
const Handle(SelectMgr_ViewerSelector)& Selector() const { return mySelector; }
+
+ //! Return the Selector.
+ void SetSelector (const Handle(SelectMgr_ViewerSelector)& theSelector) { mySelector = theSelector; }
//! Returns true if the manager contains the selectable object theObject.
Standard_EXPORT Standard_Boolean Contains (const Handle(SelectMgr_SelectableObject)& theObject) const;
thePlaneEquations.Append (aPlaneEquation);
}
}
+
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void SelectMgr_TriangularFrustum::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustum)
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_Frustum)
+}
\ No newline at end of file
//! Ax + By + Cz + D = 0) to the given vector
Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
private:
void cacheVertexProjections (SelectMgr_TriangularFrustum* theFrustum) const;
}
}
+//=======================================================================
+//function : DumpJson
+//purpose :
+//=======================================================================
+void SelectMgr_TriangularFrustumSet::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+ OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_TriangularFrustumSet)
+ OCCT_DUMP_BASE_CLASS (theOStream, theDepth, SelectMgr_BaseFrustum)
+
+ for (SelectMgr_TriangFrustumsIter anIter (myFrustums); anIter.More(); anIter.Next())
+ {
+ const Handle(SelectMgr_TriangularFrustum)& aFrustum = anIter.Value();
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aFrustum.get())
+ }
+}
+
#undef MEMORY_BLOCK_SIZE
//! Ax + By + Cz + D = 0) to the given vector
Standard_EXPORT virtual void GetPlanes (NCollection_Vector<SelectMgr_Vec4>& thePlaneEquations) const Standard_OVERRIDE;
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
+
private:
SelectMgr_TriangFrustums myFrustums;
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToUpdateTolerance)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mystored.Extent())
- OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectingVolumeMgr)
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mySelectingVolumeMgr)
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, &mySelectableObjects)
Standard_Integer aNbOfSelectableObjects = 0;
VInspector_ItemHistoryTypeInfo.hxx
VInspector_ItemPresentableObject.cxx
VInspector_ItemPresentableObject.hxx
+VInspector_ItemSelectMgrViewerSelector.cxx
+VInspector_ItemSelectMgrViewerSelector.hxx
VInspector_ItemV3dViewer.cxx
VInspector_ItemV3dViewer.hxx
VInspector_ToolActionType.hxx
#include <inspector/VInspector_ItemContext.hxx>
#include <inspector/VInspector_ItemV3dViewer.hxx>
+#include <inspector/VInspector_ItemSelectMgrViewerSelector.hxx>
// =======================================================================
// function : initValue
// =======================================================================
int VInspector_ItemContextProperties::initRowCount() const
{
- return 1; // V3d_Viewer
+ return 2; // V3d_Viewer, SelectMgr_ViewerSelector
}
// =======================================================================
// =======================================================================
TreeModel_ItemBasePtr VInspector_ItemContextProperties::createChild (int theRow, int theColumn)
{
- return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn);
+ if (theRow == 0)
+ return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn);
+
+ return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn);
}
// =======================================================================
--- /dev/null
+// Created on: 2020-02-10
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2020 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_ItemSelectMgrViewerSelector.hxx>
+
+#include <AIS.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <inspector/VInspector_ItemContext.hxx>
+#include <inspector/VInspector_ItemContextProperties.hxx>
+
+// =======================================================================
+// function : initRowCount
+// purpose :
+// =======================================================================
+int VInspector_ItemSelectMgrViewerSelector::initRowCount() const
+{
+ return 0;
+}
+
+// =======================================================================
+// function : initValue
+// purpose :
+// =======================================================================
+QVariant VInspector_ItemSelectMgrViewerSelector::initValue (const int theItemRole) const
+{
+ QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole);
+ if (aParentValue.isValid())
+ return aParentValue;
+
+ if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole)
+ return QVariant();
+
+ if (GetViewerSelector().IsNull())
+ return Column() == 0 ? "Empty viewer selector" : "";
+
+ return Column() == 0 ? GetViewerSelector()->DynamicType()->Name() : QVariant();
+}
+
+// =======================================================================
+// function : Init
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrViewerSelector::Init()
+{
+ VInspector_ItemContextPropertiesPtr aParentItem = itemDynamicCast<VInspector_ItemContextProperties>(Parent());
+ Handle(SelectMgr_ViewerSelector) aViewerSelector;
+ if (aParentItem)
+ {
+ VInspector_ItemContextPtr aParentContextItem = itemDynamicCast<VInspector_ItemContext>(aParentItem->Parent());
+ if (aParentContextItem)
+ {
+ Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext();
+ aViewerSelector = aContext->MainSelector();
+ }
+ }
+ myViewerSelector = aViewerSelector;
+ TreeModel_ItemBase::Init();
+}
+
+// =======================================================================
+// function : Reset
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrViewerSelector::Reset()
+{
+ VInspector_ItemBase::Reset();
+
+ myViewerSelector = NULL;
+}
+
+// =======================================================================
+// function : initItem
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrViewerSelector::initItem() const
+{
+ if (IsInitialized())
+ return;
+ const_cast<VInspector_ItemSelectMgrViewerSelector*>(this)->Init();
+}
+
+// =======================================================================
+// function : initStream
+// purpose :
+// =======================================================================
+void VInspector_ItemSelectMgrViewerSelector::initStream (Standard_OStream& theOStream) const
+{
+ Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector();
+ if (aViewerSelector.IsNull())
+ return;
+
+ aViewerSelector->DumpJson (theOStream);
+}
--- /dev/null
+// Created on: 2020-02-10
+// Created by: Natalia ERMOLAEVA
+// Copyright (c) 2020 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_ItemSelectMgrViewerSelector_H
+#define VInspector_ItemSelectMgrViewerSelector_H
+
+#include <Standard.hxx>
+#include <inspector/VInspector_ItemBase.hxx>
+
+#include <SelectMgr_ViewerSelector.hxx>
+
+class VInspector_ItemSelectMgrViewerSelector;
+typedef QExplicitlySharedDataPointer<VInspector_ItemSelectMgrViewerSelector> VInspector_ItemSelectMgrViewerSelectorPtr;
+
+//! \class VInspector_ItemSelectMgrViewerSelector
+//! Parent item is context properties, that corresponds to SelectMgr_ViewerSelector
+class VInspector_ItemSelectMgrViewerSelector : public VInspector_ItemBase
+{
+public:
+
+ //! Creates an item wrapped by a shared pointer
+ static VInspector_ItemSelectMgrViewerSelectorPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ { return VInspector_ItemSelectMgrViewerSelectorPtr (new VInspector_ItemSelectMgrViewerSelector (theParent, theRow, theColumn)); }
+
+ //! Destructor
+ virtual ~VInspector_ItemSelectMgrViewerSelector() Standard_OVERRIDE {};
+
+ //! Inits the item, fills internal containers
+ Standard_EXPORT virtual void Init() Standard_OVERRIDE;
+
+ //! Resets cached values
+ Standard_EXPORT virtual void Reset() Standard_OVERRIDE;
+
+ //! Returns data object of the item.
+ //! \return object
+ virtual const Handle(Standard_Transient)& Object() const { initItem(); return myViewerSelector; }
+
+ //! Returns the current viewer, init item if it was not initialized yet
+ //! \return interactive object
+ Handle(SelectMgr_ViewerSelector) GetViewerSelector() const { return Handle(SelectMgr_ViewerSelector)::DownCast (Object()); }
+
+protected:
+ //! Initializes the current item. It is empty because Reset() is also empty.
+ virtual void initItem() const Standard_OVERRIDE;
+
+ //! Returns number of displayed presentations
+ //! \return rows count
+ Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE;
+
+ //! Returns item information for the given role. Fills internal container if it was not filled yet
+ //! \param theItemRole a value role
+ //! \return the value
+ Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE;
+
+ //! Returns stream value of the item to fulfill property panel.
+ //! \return stream value or dummy
+ Standard_EXPORT virtual void initStream (Standard_OStream& theOStream) const Standard_OVERRIDE;
+
+private:
+
+ //! Constructor
+ //! param theParent a parent item
+ //! \param theRow the item row positition in the parent item
+ //! \param theColumn the item column positition in the parent item
+ VInspector_ItemSelectMgrViewerSelector (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn)
+ : VInspector_ItemBase(theParent, theRow, theColumn) {}
+
+protected:
+
+ Handle(SelectMgr_ViewerSelector) myViewerSelector; //!< the current viewer selector
+};
+
+#endif