From 62e59942c9fc700d33328752a5153cd123d3045f Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 15 Oct 2019 11:06:54 +0300 Subject: [PATCH] Revert "0030268: Inspectors - improvements in VInspector plugin" This reverts commit 22f35b2166a10305ddb8f2255922f211f17200d9. # Conflicts: # src/Graphic3d/Graphic3d_ClipPlane.cxx --- src/AIS/AIS_Shape.cxx | 20 - src/AIS/AIS_Shape.hxx | 3 - src/AIS/AIS_Trihedron.cxx | 30 - src/AIS/AIS_Trihedron.hxx | 3 - src/BVH/BVH_Box.hxx | 19 +- src/Geom/Geom_Transformation.cxx | 7 - src/Geom/Geom_Transformation.hxx | 3 - src/Graphic3d/Graphic3d_CStructure.cxx | 26 - src/Graphic3d/Graphic3d_CStructure.hxx | 3 - src/Graphic3d/Graphic3d_ClipPlane.cxx | 23 - src/Graphic3d/Graphic3d_ClipPlane.hxx | 3 - .../Graphic3d_PresentationAttributes.cxx | 17 - .../Graphic3d_PresentationAttributes.hxx | 3 - .../Graphic3d_SequenceOfHClipPlane.cxx | 15 - .../Graphic3d_SequenceOfHClipPlane.hxx | 3 - src/Graphic3d/Graphic3d_Structure.cxx | 21 - src/Graphic3d/Graphic3d_Structure.hxx | 3 - src/Graphic3d/Graphic3d_TransformPers.cxx | 12 - src/Graphic3d/Graphic3d_TransformPers.hxx | 3 - src/OpenGl/OpenGl_Aspects.cxx | 1 - src/OpenGl/OpenGl_Aspects.hxx | 2 +- src/OpenGl/OpenGl_Element.hxx | 4 - src/OpenGl/OpenGl_Flipper.cxx | 19 - src/OpenGl/OpenGl_Flipper.hxx | 4 - src/OpenGl/OpenGl_FrameStatsPrs.cxx | 24 - src/OpenGl/OpenGl_FrameStatsPrs.hxx | 3 - src/OpenGl/OpenGl_GraduatedTrihedron.cxx | 23 - src/OpenGl/OpenGl_GraduatedTrihedron.hxx | 3 - src/OpenGl/OpenGl_Group.cxx | 5 - src/OpenGl/OpenGl_LayerList.cxx | 9 + src/OpenGl/OpenGl_LayerList.hxx | 5 +- src/OpenGl/OpenGl_PrimitiveArray.cxx | 23 - src/OpenGl/OpenGl_PrimitiveArray.hxx | 3 - src/OpenGl/OpenGl_StencilTest.cxx | 13 - src/OpenGl/OpenGl_StencilTest.hxx | 3 - src/OpenGl/OpenGl_Structure.cxx | 18 - src/OpenGl/OpenGl_Structure.hxx | 3 - src/OpenGl/OpenGl_Text.cxx | 27 - src/OpenGl/OpenGl_Text.hxx | 3 - src/Poly/Poly_Triangulation.cxx | 17 - src/Poly/Poly_Triangulation.hxx | 3 - src/PrsMgr/PrsMgr_PresentableObject.cxx | 33 +- src/PrsMgr/PrsMgr_Presentation.cxx | 19 - src/PrsMgr/PrsMgr_Presentation.hxx | 3 - .../Select3D_InteriorSensitivePointSet.cxx | 16 - .../Select3D_InteriorSensitivePointSet.hxx | 3 - src/Select3D/Select3D_SensitiveBox.cxx | 12 - src/Select3D/Select3D_SensitiveBox.hxx | 3 - src/Select3D/Select3D_SensitiveEntity.cxx | 12 - src/Select3D/Select3D_SensitiveEntity.hxx | 3 - src/Select3D/Select3D_SensitiveFace.cxx | 12 - src/Select3D/Select3D_SensitiveFace.hxx | 3 - src/Select3D/Select3D_SensitiveGroup.cxx | 24 - src/Select3D/Select3D_SensitiveGroup.hxx | 3 - src/Select3D/Select3D_SensitivePoint.cxx | 11 - src/Select3D/Select3D_SensitivePoint.hxx | 3 - src/Select3D/Select3D_SensitivePoly.cxx | 17 - src/Select3D/Select3D_SensitivePoly.hxx | 3 - .../Select3D_SensitivePrimitiveArray.cxx | 41 - .../Select3D_SensitivePrimitiveArray.hxx | 3 - src/Select3D/Select3D_SensitiveSegment.cxx | 12 - src/Select3D/Select3D_SensitiveSegment.hxx | 3 - src/Select3D/Select3D_SensitiveSet.cxx | 11 - src/Select3D/Select3D_SensitiveSet.hxx | 3 - src/Select3D/Select3D_SensitiveTriangle.cxx | 16 - src/Select3D/Select3D_SensitiveTriangle.hxx | 5 - .../Select3D_SensitiveTriangulation.cxx | 21 - .../Select3D_SensitiveTriangulation.hxx | 3 - src/Select3D/Select3D_SensitiveWire.cxx | 19 - src/Select3D/Select3D_SensitiveWire.hxx | 3 - src/SelectMgr/SelectMgr_SelectableObject.cxx | 11 - src/SelectMgr/SelectMgr_Selection.cxx | 23 - src/SelectMgr/SelectMgr_Selection.hxx | 3 - src/SelectMgr/SelectMgr_SensitiveEntity.cxx | 12 - src/SelectMgr/SelectMgr_SensitiveEntity.hxx | 3 - src/SelectMgr/SelectMgr_ViewerSelector.hxx | 6 - src/Standard/Standard_Dump.cxx | 367 -------- src/Standard/Standard_Dump.hxx | 110 +-- src/StdSelect/StdSelect_BRepOwner.cxx | 14 - src/StdSelect/StdSelect_BRepOwner.hxx | 3 - src/StdSelect/StdSelect_Shape.cxx | 7 - src/StdSelect/StdSelect_Shape.hxx | 3 - src/TCollection/TCollection_AsciiString.cxx | 16 - src/TCollection/TCollection_AsciiString.hxx | 8 - src/gp/gp_Ax1.cxx | 7 - src/gp/gp_Ax1.hxx | 2 - src/gp/gp_Ax2.cxx | 9 - src/gp/gp_Ax2.hxx | 3 - src/gp/gp_Ax2d.cxx | 9 - src/gp/gp_Ax2d.hxx | 3 +- src/gp/gp_Ax3.cxx | 8 - src/gp/gp_Ax3.hxx | 2 - src/gp/gp_Dir.cxx | 5 - src/gp/gp_Dir.hxx | 2 - src/gp/gp_GTrsf.cxx | 16 - src/gp/gp_GTrsf.hxx | 2 - src/gp/gp_Pln.cxx | 5 - src/gp/gp_Pln.hxx | 3 - src/gp/gp_Pnt.cxx | 5 - src/gp/gp_Pnt.hxx | 2 - src/gp/gp_XYZ.cxx | 32 - src/gp/gp_XYZ.hxx | 3 - tools/Convert/Convert_Tools.cxx | 126 --- tools/Convert/Convert_Tools.hxx | 63 -- tools/Convert/Convert_TransientShape.cxx | 18 - tools/Convert/Convert_TransientShape.hxx | 53 -- tools/Convert/FILES | 4 - tools/DFBrowser/DFBrowser_Window.cxx | 34 +- tools/DFBrowser/DFBrowser_Window.hxx | 7 + tools/ShapeView/FILES | 1 - tools/ShapeView/ShapeView_ItemBase.cxx | 35 - tools/ShapeView/ShapeView_ItemBase.hxx | 5 - tools/ShapeView/ShapeView_ItemShape.cxx | 259 +++++- tools/ShapeView/ShapeView_ItemShape.hxx | 18 +- tools/ShapeView/ShapeView_Tools.cxx | 97 +- tools/ShapeView/ShapeView_Tools.hxx | 37 - tools/ShapeView/ShapeView_TreeModel.cxx | 22 +- tools/ShapeView/ShapeView_Window.cxx | 170 +--- tools/ShapeView/ShapeView_Window.hxx | 21 - tools/TInspector/TInspector_Window.cxx | 2 +- tools/TInspectorEXE/TInspectorEXE.cxx | 14 +- tools/TKTInspectorAPI/EXTERNLIB | 5 +- tools/TKTInspectorAPI/PACKAGES | 2 - tools/TKTreeModel/CMakeLists.txt | 2 - tools/TKTreeModel/EXTERNLIB | 5 - tools/TKView/EXTERNLIB | 1 - tools/ToolsDraw/ToolsDraw.cxx | 9 - tools/ToolsDraw/ToolsDraw.hxx | 4 - tools/TreeModel/FILES | 4 - tools/TreeModel/TreeModel_HeaderSection.hxx | 5 - tools/TreeModel/TreeModel_ItemBase.cxx | 64 +- tools/TreeModel/TreeModel_ItemBase.hxx | 26 +- tools/TreeModel/TreeModel_ItemProperties.cxx | 143 --- tools/TreeModel/TreeModel_ItemProperties.hxx | 110 --- tools/TreeModel/TreeModel_ItemStream.cxx | 166 ---- tools/TreeModel/TreeModel_ItemStream.hxx | 112 --- tools/TreeModel/TreeModel_ModelBase.cxx | 58 +- tools/TreeModel/TreeModel_ModelBase.hxx | 27 - tools/TreeModel/TreeModel_Tools.cxx | 50 -- tools/TreeModel/TreeModel_Tools.hxx | 19 - tools/VInspector/FILES | 69 +- tools/VInspector/VInspector_CallBack.cxx | 27 +- tools/VInspector/VInspector_CallBack.hxx | 17 +- .../VInspector_ItemAspectWindow.cxx | 101 --- .../VInspector_ItemAspectWindow.hxx | 103 --- tools/VInspector/VInspector_ItemBVHTree.cxx | 198 ----- tools/VInspector/VInspector_ItemBVHTree.hxx | 105 --- .../VInspector/VInspector_ItemBVHTreeNode.cxx | 167 ---- .../VInspector/VInspector_ItemBVHTreeNode.hxx | 96 -- tools/VInspector/VInspector_ItemBase.cxx | 44 - tools/VInspector/VInspector_ItemBase.hxx | 36 +- tools/VInspector/VInspector_ItemContainer.cxx | 96 -- tools/VInspector/VInspector_ItemContainer.hxx | 87 -- .../VInspector_ItemContainerAPI.hxx | 50 -- tools/VInspector/VInspector_ItemContext.cxx | 19 +- tools/VInspector/VInspector_ItemContext.hxx | 4 - ...ner.cxx => VInspector_ItemEntityOwner.cxx} | 90 +- ...ner.hxx => VInspector_ItemEntityOwner.hxx} | 36 +- .../VInspector_ItemFolderObject.cxx | 150 +--- .../VInspector_ItemFolderObject.hxx | 29 +- .../VInspector_ItemGraphic3dCStructure.cxx | 146 --- .../VInspector_ItemGraphic3dCStructure.hxx | 99 --- .../VInspector_ItemGraphic3dCView.cxx | 164 ---- .../VInspector_ItemGraphic3dCView.hxx | 104 --- .../VInspector_ItemGraphic3dCamera.cxx | 146 --- .../VInspector_ItemGraphic3dCamera.hxx | 101 --- .../VInspector_ItemGraphic3dClipPlane.cxx | 122 --- .../VInspector_ItemGraphic3dClipPlane.hxx | 98 --- .../VInspector_ItemGraphic3dGroup.cxx | 127 --- .../VInspector_ItemGraphic3dGroup.hxx | 99 --- .../VInspector_ItemGraphic3dTransformPers.cxx | 114 --- .../VInspector_ItemGraphic3dTransformPers.hxx | 94 -- .../VInspector_ItemHistoryElement.cxx | 10 +- .../VInspector/VInspector_ItemHistoryRoot.cxx | 11 +- .../VInspector/VInspector_ItemHistoryType.cxx | 22 +- .../VInspector_ItemOpenGlContext.cxx | 121 --- .../VInspector_ItemOpenGlContext.hxx | 98 --- .../VInspector/VInspector_ItemOpenGlLayer.cxx | 121 --- .../VInspector/VInspector_ItemOpenGlLayer.hxx | 98 --- .../VInspector_ItemOpenGlLayerList.cxx | 164 ---- .../VInspector_ItemOpenGlLayerList.hxx | 93 -- .../VInspector_ItemOpenGlLayerStructure.cxx | 124 --- .../VInspector_ItemOpenGlLayerStructure.hxx | 97 -- .../VInspector_ItemOpenGlWindow.cxx | 122 --- .../VInspector_ItemOpenGlWindow.hxx | 98 --- .../VInspector_ItemPresentableObject.cxx | 176 ++-- .../VInspector_ItemPresentableObject.hxx | 24 +- .../VInspector_ItemPresentations.cxx | 154 ---- .../VInspector_ItemPresentations.hxx | 81 -- .../VInspector/VInspector_ItemPrs3dAspect.cxx | 257 ------ .../VInspector/VInspector_ItemPrs3dAspect.hxx | 110 --- .../VInspector/VInspector_ItemPrs3dDrawer.cxx | 203 ----- .../VInspector/VInspector_ItemPrs3dDrawer.hxx | 107 --- .../VInspector_ItemPrs3dPresentation.cxx | 145 --- .../VInspector_ItemPrs3dPresentation.hxx | 104 --- ...Inspector_ItemSelect3DSensitiveSetItem.cxx | 166 ---- ...Inspector_ItemSelect3DSensitiveSetItem.hxx | 109 --- ...pector_ItemSelectBasicsSensitiveEntity.cxx | 305 ------- ...pector_ItemSelectBasicsSensitiveEntity.hxx | 119 --- .../VInspector_ItemSelectMgrBaseFrustum.cxx | 135 --- .../VInspector_ItemSelectMgrBaseFrustum.hxx | 100 --- .../VInspector_ItemSelectMgrFilter.cxx | 15 +- .../VInspector_ItemSelectMgrFilter.hxx | 7 +- ...ector_ItemSelectMgrSelectableObjectSet.cxx | 152 ---- ...ector_ItemSelectMgrSelectableObjectSet.hxx | 93 -- ...or_ItemSelectMgrSelectingVolumeManager.cxx | 136 --- ...or_ItemSelectMgrSelectingVolumeManager.hxx | 92 -- ...pector_ItemSelectMgrSensitiveEntitySet.cxx | 157 ---- ...pector_ItemSelectMgrSensitiveEntitySet.hxx | 112 --- ...VInspector_ItemSelectMgrViewerSelector.cxx | 265 ------ ...VInspector_ItemSelectMgrViewerSelector.hxx | 148 ---- ...ctor_ItemSelectMgrViewerSelectorPicked.cxx | 166 ---- ...ctor_ItemSelectMgrViewerSelectorPicked.hxx | 102 --- ...ction.cxx => VInspector_ItemSelection.cxx} | 61 +- ...ction.hxx => VInspector_ItemSelection.hxx} | 27 +- ...cxx => VInspector_ItemSensitiveEntity.cxx} | 88 +- ...hxx => VInspector_ItemSensitiveEntity.hxx} | 37 +- tools/VInspector/VInspector_ItemV3dView.cxx | 155 ---- tools/VInspector/VInspector_ItemV3dView.hxx | 110 --- tools/VInspector/VInspector_ItemV3dViewer.cxx | 148 ---- tools/VInspector/VInspector_ItemV3dViewer.hxx | 103 --- tools/VInspector/VInspector_Tools.cxx | 249 +----- tools/VInspector/VInspector_Tools.hxx | 94 +- tools/VInspector/VInspector_ViewModel.cxx | 87 +- tools/VInspector/VInspector_ViewModel.hxx | 11 +- .../VInspector_ViewModelHistory.cxx | 11 +- tools/VInspector/VInspector_Window.cxx | 829 ++---------------- tools/VInspector/VInspector_Window.hxx | 87 +- tools/View/FILES | 5 - tools/View/View_DisplayActionType.hxx | 29 - tools/View/View_DisplayPreview.cxx | 127 --- tools/View/View_DisplayPreview.hxx | 85 -- tools/View/View_Displayer.cxx | 32 +- tools/View/View_Displayer.hxx | 12 - tools/View/View_PreviewParameters.cxx | 120 --- tools/View/View_PreviewParameters.hxx | 68 -- tools/View/View_Tools.cxx | 42 +- tools/View/View_Tools.hxx | 8 - tools/View/View_Viewer.cxx | 47 +- tools/View/View_Viewer.hxx | 6 +- tools/View/View_Widget.cxx | 19 +- tools/View/View_Widget.hxx | 19 +- tools/View/View_Window.cxx | 6 +- tools/View/View_Window.hxx | 5 +- tools/ViewControl/FILES | 24 +- tools/ViewControl/ViewControl.hxx | 33 - .../ViewControl/ViewControl_ColorSelector.cxx | 593 ------------- .../ViewControl/ViewControl_ColorSelector.hxx | 120 --- tools/ViewControl/ViewControl_EditType.hxx | 32 - tools/ViewControl/ViewControl_Pane.hxx | 78 -- tools/ViewControl/ViewControl_PaneCreator.cxx | 18 - tools/ViewControl/ViewControl_PaneCreator.hxx | 49 -- tools/ViewControl/ViewControl_PaneItem.hxx | 53 -- .../ViewControl/ViewControl_PropertyView.cxx | 219 ----- .../ViewControl/ViewControl_PropertyView.hxx | 99 --- tools/ViewControl/ViewControl_Table.cxx | 200 ----- tools/ViewControl/ViewControl_Table.hxx | 96 -- .../ViewControl_TableDoubleVector.cxx | 264 ------ .../ViewControl_TableDoubleVector.hxx | 76 -- .../ViewControl_TableItemDelegate.cxx | 198 ----- .../ViewControl_TableItemDelegate.hxx | 98 --- tools/ViewControl/ViewControl_TableModel.cxx | 78 -- tools/ViewControl/ViewControl_TableModel.hxx | 100 --- .../ViewControl_TableModelValues.cxx | 146 --- .../ViewControl_TableModelValues.hxx | 168 ---- .../ViewControl_TableModelValuesDefault.cxx | 48 - .../ViewControl_TableModelValuesDefault.hxx | 92 -- tools/ViewControl/ViewControl_Tools.cxx | 228 ----- tools/ViewControl/ViewControl_Tools.hxx | 99 --- 269 files changed, 879 insertions(+), 16168 deletions(-) delete mode 100644 tools/Convert/Convert_Tools.cxx delete mode 100644 tools/Convert/Convert_Tools.hxx delete mode 100644 tools/Convert/Convert_TransientShape.cxx delete mode 100644 tools/Convert/Convert_TransientShape.hxx delete mode 100644 tools/Convert/FILES delete mode 100644 tools/ShapeView/ShapeView_ItemBase.cxx delete mode 100644 tools/TreeModel/TreeModel_ItemProperties.cxx delete mode 100644 tools/TreeModel/TreeModel_ItemProperties.hxx delete mode 100644 tools/TreeModel/TreeModel_ItemStream.cxx delete mode 100644 tools/TreeModel/TreeModel_ItemStream.hxx delete mode 100644 tools/VInspector/VInspector_ItemAspectWindow.cxx delete mode 100644 tools/VInspector/VInspector_ItemAspectWindow.hxx delete mode 100644 tools/VInspector/VInspector_ItemBVHTree.cxx delete mode 100644 tools/VInspector/VInspector_ItemBVHTree.hxx delete mode 100644 tools/VInspector/VInspector_ItemBVHTreeNode.cxx delete mode 100644 tools/VInspector/VInspector_ItemBVHTreeNode.hxx delete mode 100644 tools/VInspector/VInspector_ItemContainer.cxx delete mode 100644 tools/VInspector/VInspector_ItemContainer.hxx delete mode 100644 tools/VInspector/VInspector_ItemContainerAPI.hxx rename tools/VInspector/{VInspector_ItemSelectBasicsEntityOwner.cxx => VInspector_ItemEntityOwner.cxx} (67%) rename tools/VInspector/{VInspector_ItemSelectBasicsEntityOwner.hxx => VInspector_ItemEntityOwner.hxx} (60%) delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCStructure.hxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCView.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCView.hxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCamera.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dCamera.hxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dClipPlane.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dClipPlane.hxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dGroup.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dGroup.hxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dTransformPers.cxx delete mode 100644 tools/VInspector/VInspector_ItemGraphic3dTransformPers.hxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlContext.cxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlContext.hxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayer.cxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayer.hxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayerList.cxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayerList.hxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlWindow.cxx delete mode 100644 tools/VInspector/VInspector_ItemOpenGlWindow.hxx delete mode 100644 tools/VInspector/VInspector_ItemPresentations.cxx delete mode 100644 tools/VInspector/VInspector_ItemPresentations.hxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dAspect.cxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dAspect.hxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dDrawer.cxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dDrawer.hxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dPresentation.cxx delete mode 100644 tools/VInspector/VInspector_ItemPrs3dPresentation.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx delete mode 100644 tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx rename tools/VInspector/{VInspector_ItemSelectMgrSelection.cxx => VInspector_ItemSelection.cxx} (75%) rename tools/VInspector/{VInspector_ItemSelectMgrSelection.hxx => VInspector_ItemSelection.hxx} (67%) rename tools/VInspector/{VInspector_ItemSelectMgrSensitiveEntity.cxx => VInspector_ItemSensitiveEntity.cxx} (60%) rename tools/VInspector/{VInspector_ItemSelectMgrSensitiveEntity.hxx => VInspector_ItemSensitiveEntity.hxx} (62%) delete mode 100644 tools/VInspector/VInspector_ItemV3dView.cxx delete mode 100644 tools/VInspector/VInspector_ItemV3dView.hxx delete mode 100644 tools/VInspector/VInspector_ItemV3dViewer.cxx delete mode 100644 tools/VInspector/VInspector_ItemV3dViewer.hxx delete mode 100644 tools/View/View_DisplayActionType.hxx delete mode 100644 tools/View/View_DisplayPreview.cxx delete mode 100644 tools/View/View_DisplayPreview.hxx delete mode 100644 tools/View/View_PreviewParameters.cxx delete mode 100644 tools/View/View_PreviewParameters.hxx delete mode 100644 tools/ViewControl/ViewControl.hxx delete mode 100644 tools/ViewControl/ViewControl_ColorSelector.cxx delete mode 100644 tools/ViewControl/ViewControl_ColorSelector.hxx delete mode 100644 tools/ViewControl/ViewControl_EditType.hxx delete mode 100644 tools/ViewControl/ViewControl_Pane.hxx delete mode 100644 tools/ViewControl/ViewControl_PaneCreator.cxx delete mode 100644 tools/ViewControl/ViewControl_PaneCreator.hxx delete mode 100644 tools/ViewControl/ViewControl_PaneItem.hxx delete mode 100644 tools/ViewControl/ViewControl_PropertyView.cxx delete mode 100644 tools/ViewControl/ViewControl_PropertyView.hxx delete mode 100644 tools/ViewControl/ViewControl_Table.cxx delete mode 100644 tools/ViewControl/ViewControl_Table.hxx delete mode 100644 tools/ViewControl/ViewControl_TableDoubleVector.cxx delete mode 100644 tools/ViewControl/ViewControl_TableDoubleVector.hxx delete mode 100644 tools/ViewControl/ViewControl_TableItemDelegate.cxx delete mode 100644 tools/ViewControl/ViewControl_TableItemDelegate.hxx delete mode 100644 tools/ViewControl/ViewControl_TableModel.cxx delete mode 100644 tools/ViewControl/ViewControl_TableModel.hxx delete mode 100644 tools/ViewControl/ViewControl_TableModelValues.cxx delete mode 100644 tools/ViewControl/ViewControl_TableModelValues.hxx delete mode 100644 tools/ViewControl/ViewControl_TableModelValuesDefault.cxx delete mode 100644 tools/ViewControl/ViewControl_TableModelValuesDefault.hxx diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 396214a471..82d8a9907d 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -987,23 +987,3 @@ Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle, aPreviousAngle = myDrawer->PreviousHLRDeviationAngle (); return myDrawer->HasOwnHLRDeviationAngle(); } - - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void AIS_Shape::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_Shape); - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myshape); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBB); - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUVOrigin); - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUVRepeat); - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myUVScale); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myInitAng); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCompBB); -} diff --git a/src/AIS/AIS_Shape.hxx b/src/AIS/AIS_Shape.hxx index 20b15c4be9..f648228c3c 100644 --- a/src/AIS/AIS_Shape.hxx +++ b/src/AIS/AIS_Shape.hxx @@ -325,9 +325,6 @@ public: const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: TopoDS_Shape myshape; //!< shape to display diff --git a/src/AIS/AIS_Trihedron.cxx b/src/AIS/AIS_Trihedron.cxx index d7a2b768fd..7a2936dc30 100644 --- a/src/AIS/AIS_Trihedron.cxx +++ b/src/AIS/AIS_Trihedron.cxx @@ -995,33 +995,3 @@ Handle(Prs3d_PointAspect) AIS_Trihedron::getHighlightPointAspect() return myHighlightPointAspect; } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void AIS_Trihedron::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_Trihedron); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, AIS_InteractiveObject); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSize); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextColor); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowColor); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTrihDispMode); - - //Handle(Geom_Axis2Placement) myComponent; - //NCollection_DataMap mySelectionPriority; - //NCollection_DataMap myLabel; - - //NCollection_DataMap myPartToGroup; - //NCollection_List mySelectedParts; - - OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myHighlightAspect.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHighlightLineAspect.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHighlightPointAspect.get()); - - //NCollection_DataMap myPrimitives; -} diff --git a/src/AIS/AIS_Trihedron.hxx b/src/AIS/AIS_Trihedron.hxx index 1a6fbcef00..e50a34b5da 100644 --- a/src/AIS/AIS_Trihedron.hxx +++ b/src/AIS/AIS_Trihedron.hxx @@ -222,9 +222,6 @@ protected: Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer theMode) Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: //! Creates a sensitive entity for the datum part that will be used in selection owner creation. diff --git a/src/BVH/BVH_Box.hxx b/src/BVH/BVH_Box.hxx index 5d584604e0..a5388232a1 100644 --- a/src/BVH/BVH_Box.hxx +++ b/src/BVH/BVH_Box.hxx @@ -114,24 +114,7 @@ public: { (void)theDepth; OCCT_DUMP_CLASS_BEGIN (theOStream, BVH_Box); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsInited); - - int n = Min (N, 3); - if (n == 1) - { - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinPoint[0]); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinPoint[0]); - } - if (n == 2) - { - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MinPoint", n, myMinPoint[0], myMinPoint[1]); - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MaxPoint", n, myMaxPoint[0], myMaxPoint[1]); - } - if (n == 3) - { - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MinPoint", n, myMinPoint[0], myMinPoint[1], myMinPoint[2]); - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "MaxPoint", n, myMaxPoint[0], myMaxPoint[1], myMaxPoint[2]); - } + OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, IsValid()); } public: diff --git a/src/Geom/Geom_Transformation.cxx b/src/Geom/Geom_Transformation.cxx index 5ebb09166a..480717b5b0 100644 --- a/src/Geom/Geom_Transformation.cxx +++ b/src/Geom/Geom_Transformation.cxx @@ -16,8 +16,6 @@ #include -#include - IMPLEMENT_STANDARD_RTTIEXT(Geom_Transformation, Standard_Transient) Geom_Transformation::Geom_Transformation () { } @@ -58,8 +56,3 @@ void Geom_Transformation::PreMultiply (const Handle(Geom_Transformation)& Other) gpTrsf.PreMultiply (Other->Trsf()); } - -void Geom_Transformation::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &gpTrsf); -} diff --git a/src/Geom/Geom_Transformation.hxx b/src/Geom/Geom_Transformation.hxx index 113e98c644..69c261a3ab 100644 --- a/src/Geom/Geom_Transformation.hxx +++ b/src/Geom/Geom_Transformation.hxx @@ -192,9 +192,6 @@ public: //! Creates a new object which is a copy of this transformation. Standard_EXPORT Handle(Geom_Transformation) Copy() const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: gp_Trsf gpTrsf; diff --git a/src/Graphic3d/Graphic3d_CStructure.cxx b/src/Graphic3d/Graphic3d_CStructure.cxx index 85a2d5f5d9..2cd2928db4 100644 --- a/src/Graphic3d/Graphic3d_CStructure.cxx +++ b/src/Graphic3d/Graphic3d_CStructure.cxx @@ -18,7 +18,6 @@ #include #include #include -#include IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) @@ -45,28 +44,3 @@ Graphic3d_CStructure::Graphic3d_CStructure (const Handle(Graphic3d_StructureMana { Id = myGraphicDriver->NewIdentification(); } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Graphic3d_CStructure::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_CStructure); - - for (Graphic3d_SequenceOfGroup::Iterator anIterator (myGroups); anIterator.More(); anIterator.Next()) - { - Handle(Graphic3d_Group) aGroup = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get()); - } - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTrsf.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTrsfPers.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myClipPlanes.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHighlightStyle.get()); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsCulled); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBndBoxClipCheck); -} diff --git a/src/Graphic3d/Graphic3d_CStructure.hxx b/src/Graphic3d/Graphic3d_CStructure.hxx index bcbbd256fb..d7c9f7caa0 100644 --- a/src/Graphic3d/Graphic3d_CStructure.hxx +++ b/src/Graphic3d/Graphic3d_CStructure.hxx @@ -194,9 +194,6 @@ public: //! Update render transformation matrix. virtual void updateLayerTransformation() {} - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - public: int Id; diff --git a/src/Graphic3d/Graphic3d_ClipPlane.cxx b/src/Graphic3d/Graphic3d_ClipPlane.cxx index c9922ba826..b2f580226f 100755 --- a/src/Graphic3d/Graphic3d_ClipPlane.cxx +++ b/src/Graphic3d/Graphic3d_ClipPlane.cxx @@ -274,26 +274,3 @@ void Graphic3d_ClipPlane::SetChainNextPlane (const Handle(Graphic3d_ClipPlane)& } updateChainLen(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Graphic3d_ClipPlane::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySectionStyle.get()); - - //OCCT_DUMP_FIELD_VALUE_STRING (theOStream, myId); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPlane); - - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Equation", 4, myEquation.x(), myEquation.y(), myEquation.z(), myEquation.w()) - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "EquationRev", 4, myEquationRev.x(), myEquationRev.y(), myEquationRev.z(), myEquationRev.w()) - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myChainLenFwd); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myFlags); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEquationMod); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAspectMod); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsOn); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsCapping); -} diff --git a/src/Graphic3d/Graphic3d_ClipPlane.hxx b/src/Graphic3d/Graphic3d_ClipPlane.hxx index f9c04837b8..b70da6308a 100755 --- a/src/Graphic3d/Graphic3d_ClipPlane.hxx +++ b/src/Graphic3d/Graphic3d_ClipPlane.hxx @@ -319,9 +319,6 @@ public: return !IsPointOutHalfspace (aMinPnt); } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - public: // @name modification counters //! @return modification counter for equation. diff --git a/src/Graphic3d/Graphic3d_PresentationAttributes.cxx b/src/Graphic3d/Graphic3d_PresentationAttributes.cxx index 515fbbeb21..69ce5ae07e 100644 --- a/src/Graphic3d/Graphic3d_PresentationAttributes.cxx +++ b/src/Graphic3d/Graphic3d_PresentationAttributes.cxx @@ -15,21 +15,4 @@ #include -#include - IMPLEMENT_STANDARD_RTTIEXT (Graphic3d_PresentationAttributes, Standard_Transient) - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Graphic3d_PresentationAttributes::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBasicFillAreaAspect.get()); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBasicColor); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHiMethod); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myZLayer); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDispMode); -} diff --git a/src/Graphic3d/Graphic3d_PresentationAttributes.hxx b/src/Graphic3d/Graphic3d_PresentationAttributes.hxx index c1ee87da25..0e7a76913c 100644 --- a/src/Graphic3d/Graphic3d_PresentationAttributes.hxx +++ b/src/Graphic3d/Graphic3d_PresentationAttributes.hxx @@ -90,9 +90,6 @@ public: //! Sets basic presentation fill area aspect. virtual void SetBasicFillAreaAspect (const Handle(Graphic3d_AspectFillArea3d)& theAspect) { myBasicFillAreaAspect = theAspect; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: Handle(Graphic3d_AspectFillArea3d) myBasicFillAreaAspect; //!< presentation fill area aspect diff --git a/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.cxx b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.cxx index ac3f404d8c..e8cb10c32d 100644 --- a/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.cxx +++ b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.cxx @@ -58,18 +58,3 @@ bool Graphic3d_SequenceOfHClipPlane::Remove (const Handle(Graphic3d_ClipPlane)& } return false; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Graphic3d_SequenceOfHClipPlane::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToOverrideGlobal); - - for (NCollection_Sequence::Iterator anIterator (myItems); anIterator.More(); anIterator.Next()) - { - Handle(Graphic3d_ClipPlane) aClipPlane = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aClipPlane.get()); - } -} diff --git a/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx index 36d2941a67..014aaebc71 100755 --- a/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx +++ b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx @@ -94,9 +94,6 @@ public: //! Return the first item in sequence. const Handle(Graphic3d_ClipPlane)& First() const { return myItems.First(); } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: NCollection_Sequence myItems; diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 0fedf8c5f6..e8a48295f3 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -30,8 +30,6 @@ #include "Graphic3d_Structure.pxx" -#include - #include IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Structure,Standard_Transient) @@ -1029,22 +1027,3 @@ void Graphic3d_Structure::SetZLayer (const Graphic3d_ZLayerId theLayerId) myStructureManager->ChangeZLayer (this, theLayerId); myCStructure->SetZLayer (theLayerId); } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Graphic3d_Structure::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Graphic3d_Structure); - - //Graphic3d_StructureManager* myStructureManager; - //NCollection_IndexedMap myAncestors; - //NCollection_IndexedMap myDescendants; - //Standard_Address myOwner; - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCStructure.get()); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisual); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myComputeVisual); -} diff --git a/src/Graphic3d/Graphic3d_Structure.hxx b/src/Graphic3d/Graphic3d_Structure.hxx index fe6f0197af..3854a4389a 100644 --- a/src/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Graphic3d/Graphic3d_Structure.hxx @@ -432,9 +432,6 @@ public: //! Returns the low-level structure const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; } - //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Transforms boundaries with transformation. diff --git a/src/Graphic3d/Graphic3d_TransformPers.cxx b/src/Graphic3d/Graphic3d_TransformPers.cxx index 4fe9e7cac6..d171a7d890 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.cxx +++ b/src/Graphic3d/Graphic3d_TransformPers.cxx @@ -51,15 +51,3 @@ Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (G } return aTrsfPers; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const -{ - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode) - - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Params3d", 3, myParams.Params3d.PntX, myParams.Params3d.PntY, myParams.Params3d.PntZ) - OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "Params2d", 3, myParams.Params2d.OffsetX, myParams.Params2d.OffsetY, myParams.Params2d.Corner) -} diff --git a/src/Graphic3d/Graphic3d_TransformPers.hxx b/src/Graphic3d/Graphic3d_TransformPers.hxx index 24d267e0af..cdc832a7f4 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Graphic3d/Graphic3d_TransformPers.hxx @@ -283,9 +283,6 @@ public: const Standard_Integer theViewportWidth, const Standard_Integer theViewportHeight) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: //! 3D anchor point for zoom/rotate transformation persistence. diff --git a/src/OpenGl/OpenGl_Aspects.cxx b/src/OpenGl/OpenGl_Aspects.cxx index c4443d5e6d..b1c683357c 100644 --- a/src/OpenGl/OpenGl_Aspects.cxx +++ b/src/OpenGl/OpenGl_Aspects.cxx @@ -118,7 +118,6 @@ void OpenGl_Aspects::Release (OpenGl_Context* theContext) void OpenGl_Aspects::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const { OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Aspects); - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); diff --git a/src/OpenGl/OpenGl_Aspects.hxx b/src/OpenGl/OpenGl_Aspects.hxx index 7d69d120c7..d767038689 100644 --- a/src/OpenGl/OpenGl_Aspects.hxx +++ b/src/OpenGl/OpenGl_Aspects.hxx @@ -90,7 +90,7 @@ public: virtual void SynchronizeAspects() Standard_OVERRIDE { SetAspect (myAspect); } //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; + Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; protected: diff --git a/src/OpenGl/OpenGl_Element.hxx b/src/OpenGl/OpenGl_Element.hxx index fe2c4e7f60..8a14275a1a 100644 --- a/src/OpenGl/OpenGl_Element.hxx +++ b/src/OpenGl/OpenGl_Element.hxx @@ -63,10 +63,6 @@ public: //! Update parameters of the drawable elements. virtual void SynchronizeAspects() {} - //! Dumps the content of me into the stream - virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const - { (void)theOStream; (void)theDepth; } - protected: Standard_EXPORT virtual ~OpenGl_Element(); diff --git a/src/OpenGl/OpenGl_Flipper.cxx b/src/OpenGl/OpenGl_Flipper.cxx index 7c5da27e71..3a5a0673b1 100755 --- a/src/OpenGl/OpenGl_Flipper.cxx +++ b/src/OpenGl/OpenGl_Flipper.cxx @@ -135,22 +135,3 @@ void OpenGl_Flipper::Render (const Handle(OpenGl_Workspace)& theWorkspace) const aContext->WorldViewState.SetCurrent (aMatrixMV); aContext->ApplyWorldViewMatrix(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_Flipper::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Flipper); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); - //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); - //OpenGl_Vec4 myReferenceOrigin; - //OpenGl_Vec4 myReferenceX; - //OpenGl_Vec4 myReferenceY; - //OpenGl_Vec4 myReferenceZ; - //Standard_Boolean myIsEnabled; -} diff --git a/src/OpenGl/OpenGl_Flipper.hxx b/src/OpenGl/OpenGl_Flipper.hxx index fabaf98384..7f159c5db9 100755 --- a/src/OpenGl/OpenGl_Flipper.hxx +++ b/src/OpenGl/OpenGl_Flipper.hxx @@ -42,9 +42,6 @@ public: Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; Standard_EXPORT virtual void Release (OpenGl_Context* theCtx); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - public: DEFINE_STANDARD_ALLOC @@ -57,7 +54,6 @@ protected: OpenGl_Vec4 myReferenceZ; Standard_Boolean myIsEnabled; - }; #endif // OpenGl_Flipper_Header diff --git a/src/OpenGl/OpenGl_FrameStatsPrs.cxx b/src/OpenGl/OpenGl_FrameStatsPrs.cxx index e94e6acc6b..86949791c7 100644 --- a/src/OpenGl/OpenGl_FrameStatsPrs.cxx +++ b/src/OpenGl/OpenGl_FrameStatsPrs.cxx @@ -454,27 +454,3 @@ void OpenGl_FrameStatsPrs::Render (const Handle(OpenGl_Workspace)& theWorkspace) glDepthMask (wasEnabledDepth ? GL_TRUE : GL_FALSE); } } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_FrameStatsPrs::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_FrameStatsPrs); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); - //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); - //Handle(OpenGl_FrameStats) myStatsPrev; //!< currently displayed stats - //Handle(Graphic3d_TransformPers) myCountersTrsfPers; //!< transformation persistence for counters presentation - //OpenGl_Text myCountersText; //!< counters presentation - //OpenGl_Aspects myTextAspect; //!< text aspect - //Handle(Graphic3d_TransformPers) myChartTrsfPers; //!< transformation persistence for chart presentation - //Handle(Graphic3d_ArrayOfTriangles) myChartArray; //!< array of chart triangles - //Handle(OpenGl_VertexBuffer) myChartVertices; //!< VBO with chart triangles - //Handle(OpenGl_IndexBuffer) myChartIndices; //!< VBO with chart triangle indexes - //Handle(OpenGl_VertexBuffer) myChartLines; //!< array of chart lines - //OpenGl_Text myChartLabels[3]; //!< chart labels -} diff --git a/src/OpenGl/OpenGl_FrameStatsPrs.hxx b/src/OpenGl/OpenGl_FrameStatsPrs.hxx index 8f5115046e..1366879bab 100644 --- a/src/OpenGl/OpenGl_FrameStatsPrs.hxx +++ b/src/OpenGl/OpenGl_FrameStatsPrs.hxx @@ -45,9 +45,6 @@ public: //! Assign text aspect. void SetTextAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect.SetAspect (theAspect); } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: //! Update chart presentation. diff --git a/src/OpenGl/OpenGl_GraduatedTrihedron.cxx b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx index c5128615a2..c2d5b3dc54 100755 --- a/src/OpenGl/OpenGl_GraduatedTrihedron.cxx +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.cxx @@ -838,26 +838,3 @@ void OpenGl_GraduatedTrihedron::Axis::Release (OpenGl_Context* theCtx) Line .Release (theCtx); Arrow .Release (theCtx); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_GraduatedTrihedron::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_GraduatedTrihedron); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); - //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); - //OpenGl_Vec3 myMin; - //OpenGl_Vec3 myMax; - //mutable Axis myAxes[3]; //!< Axes for trihedron - //mutable Graphic3d_GraduatedTrihedron myData; - //mutable OpenGl_Aspects myGridLineAspect; //!< Color grid properties - //mutable OpenGl_Text myLabelValues; - //mutable OpenGl_Aspects myAspectLabels; - //mutable OpenGl_Aspects myAspectValues; - //mutable Standard_Boolean myIsInitialized; -} diff --git a/src/OpenGl/OpenGl_GraduatedTrihedron.hxx b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx index 22e15872ba..b047728f84 100755 --- a/src/OpenGl/OpenGl_GraduatedTrihedron.hxx +++ b/src/OpenGl/OpenGl_GraduatedTrihedron.hxx @@ -61,9 +61,6 @@ public: void SetMinMax (const OpenGl_Vec3& theMin, const OpenGl_Vec3& theMax); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - private: //! Axis of trihedron. It incapsulates geometry and style. diff --git a/src/OpenGl/OpenGl_Group.cxx b/src/OpenGl/OpenGl_Group.cxx index 93a9f91997..95f0b3c3c4 100644 --- a/src/OpenGl/OpenGl_Group.cxx +++ b/src/OpenGl/OpenGl_Group.cxx @@ -365,9 +365,4 @@ void OpenGl_Group::DumpJson (Standard_OStream& theOStream, const Standard_Intege OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_Group); OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspects); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRaytracable); - - for (OpenGl_ElementNode* aNodeIter = myFirst; aNodeIter != NULL; aNodeIter = aNodeIter->next) - { - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aNodeIter->elem); - } } diff --git a/src/OpenGl/OpenGl_LayerList.cxx b/src/OpenGl/OpenGl_LayerList.cxx index aaefd64dd5..0e46b233e1 100644 --- a/src/OpenGl/OpenGl_LayerList.cxx +++ b/src/OpenGl/OpenGl_LayerList.cxx @@ -159,6 +159,15 @@ OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities) // } +//======================================================================= +//function : ~OpenGl_LayerList +//purpose : Destructor +//======================================================================= + +OpenGl_LayerList::~OpenGl_LayerList() +{ +} + //======================================================================= //function : SetFrustumCullingBVHBuilder //purpose : diff --git a/src/OpenGl/OpenGl_LayerList.hxx b/src/OpenGl/OpenGl_LayerList.hxx index 2d8c9024ff..d85d871745 100644 --- a/src/OpenGl/OpenGl_LayerList.hxx +++ b/src/OpenGl/OpenGl_LayerList.hxx @@ -25,7 +25,6 @@ #include #include -class OpenGl_FrameBuffer; class OpenGl_Structure; class OpenGl_Workspace; struct OpenGl_GlobalLayerSettings; @@ -36,10 +35,10 @@ class OpenGl_LayerList public: //! Constructor - Standard_EXPORT OpenGl_LayerList (const Standard_Integer theNbPriorities); + OpenGl_LayerList (const Standard_Integer theNbPriorities); //! Destructor - virtual ~OpenGl_LayerList() {}; + virtual ~OpenGl_LayerList(); //! Method returns the number of available priorities Standard_Integer NbPriorities() const { return myNbPriorities; } diff --git a/src/OpenGl/OpenGl_PrimitiveArray.cxx b/src/OpenGl/OpenGl_PrimitiveArray.cxx index 5af53c0b6c..cec64bbe38 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.cxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.cxx @@ -1115,26 +1115,3 @@ void OpenGl_PrimitiveArray::InitBuffers (const Handle(OpenGl_Context)& th setDrawMode (theType); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_PrimitiveArray::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_PrimitiveArray); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); - //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); - //mutable Handle(OpenGl_VertexBuffer) myVboIndices; - //mutable Handle(OpenGl_VertexBuffer) myVboAttribs; - //mutable Handle(Graphic3d_IndexBuffer) myIndices; - //mutable Handle(Graphic3d_Buffer) myAttribs; - //mutable Handle(Graphic3d_BoundBuffer) myBounds; - //GLshort myDrawMode; - //mutable Standard_Boolean myIsFillType; - //mutable Standard_Boolean myIsVboInit; - //Standard_Size myUID; //!< Unique ID of primitive array. -} diff --git a/src/OpenGl/OpenGl_PrimitiveArray.hxx b/src/OpenGl/OpenGl_PrimitiveArray.hxx index 62e760a090..dc4a066010 100644 --- a/src/OpenGl/OpenGl_PrimitiveArray.hxx +++ b/src/OpenGl/OpenGl_PrimitiveArray.hxx @@ -99,9 +99,6 @@ public: //! Returns attributes VBO. const Handle(OpenGl_VertexBuffer)& AttributesVbo() const { return myVboAttribs; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: //! VBO initialization procedures diff --git a/src/OpenGl/OpenGl_StencilTest.cxx b/src/OpenGl/OpenGl_StencilTest.cxx index 4e04794ab5..ba5dab14a4 100755 --- a/src/OpenGl/OpenGl_StencilTest.cxx +++ b/src/OpenGl/OpenGl_StencilTest.cxx @@ -15,7 +15,6 @@ #include #include -#include OpenGl_StencilTest::OpenGl_StencilTest() { @@ -65,15 +64,3 @@ OpenGl_StencilTest::~OpenGl_StencilTest() { // } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_StencilTest::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_StencilTest); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsEnabled); -} diff --git a/src/OpenGl/OpenGl_StencilTest.hxx b/src/OpenGl/OpenGl_StencilTest.hxx index be85518736..f540c199e9 100755 --- a/src/OpenGl/OpenGl_StencilTest.hxx +++ b/src/OpenGl/OpenGl_StencilTest.hxx @@ -32,9 +32,6 @@ public: void SetOptions (const Standard_Boolean theIsEnabled); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: //! Destructor diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index ec0f6282d9..927a4a0eac 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -639,21 +639,3 @@ Handle(Graphic3d_CStructure) OpenGl_Structure::ShadowLink (const Handle(Graphic3 { return new OpenGl_StructureShadow (theManager, this); } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void OpenGl_Structure::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Structure); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_CStructure); - - OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myInstancedStructure); - //Graphic3d_Mat4 myRenderTrsf; //!< transformation, actually used for rendering (includes Local Origin shift) - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRaytracable); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myModificationState); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsMirrored); -} diff --git a/src/OpenGl/OpenGl_Structure.hxx b/src/OpenGl/OpenGl_Structure.hxx index 0c0c9e0b42..58c3a0e29f 100644 --- a/src/OpenGl/OpenGl_Structure.hxx +++ b/src/OpenGl/OpenGl_Structure.hxx @@ -128,9 +128,6 @@ public: //! Update render transformation matrix. Standard_EXPORT virtual void updateLayerTransformation() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: Standard_EXPORT virtual ~OpenGl_Structure(); diff --git a/src/OpenGl/OpenGl_Text.cxx b/src/OpenGl/OpenGl_Text.cxx index bfa7c54897..784cdc74d2 100644 --- a/src/OpenGl/OpenGl_Text.cxx +++ b/src/OpenGl/OpenGl_Text.cxx @@ -843,30 +843,3 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx, theCtx->WorldViewState.Pop(); theCtx->ApplyModelViewMatrix(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void OpenGl_Text::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, OpenGl_Text); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, OpenGl_Element); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myAspect.get()); - //OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myShadingModel); - //Handle(Graphic3d_Text) myText; //!< text parameters - //mutable Handle(OpenGl_Font) myFont; - //mutable NCollection_Vector myTextures; //!< textures' IDs - //mutable NCollection_Vector myVertsVbo; //!< VBOs of vertices - //mutable NCollection_Vector myTCrdsVbo; //!< VBOs of texture coordinates - //mutable Handle(OpenGl_VertexBuffer) myBndVertsVbo;//!< VBOs of vertices for bounding box - //mutable Font_Rect myBndBox; - //mutable OpenGl_Mat4d myProjMatrix; - //mutable OpenGl_Mat4d myModelMatrix; - //mutable OpenGl_Mat4d myOrientationMatrix; - //mutable OpenGl_Vec3d myWinXYZ; - //mutable GLdouble myScaleHeight; - //Standard_Boolean myIs2d; -} diff --git a/src/OpenGl/OpenGl_Text.hxx b/src/OpenGl/OpenGl_Text.hxx index 362bccb26d..47b12d11ec 100755 --- a/src/OpenGl/OpenGl_Text.hxx +++ b/src/OpenGl/OpenGl_Text.hxx @@ -100,9 +100,6 @@ public: //! @name methods for compatibility with layers const OpenGl_Aspects& theTextAspect, unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - //! @name obsolete methods public: diff --git a/src/Poly/Poly_Triangulation.cxx b/src/Poly/Poly_Triangulation.cxx index 3fa87b7323..3a361d076a 100644 --- a/src/Poly/Poly_Triangulation.cxx +++ b/src/Poly/Poly_Triangulation.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -310,19 +309,3 @@ gp_Dir Poly_Triangulation::Normal (const Standard_Integer theIndex) const return N; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Poly_Triangulation::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Poly_Triangulation); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDeflection); - - //TColgp_Array1OfPnt myNodes; - //Handle(TColgp_HArray1OfPnt2d) myUVNodes; - //Poly_Array1OfTriangle myTriangles; - //Handle(TShort_HArray1OfShortReal) myNormals; -} \ No newline at end of file diff --git a/src/Poly/Poly_Triangulation.hxx b/src/Poly/Poly_Triangulation.hxx index f680d26410..a92e85ddca 100644 --- a/src/Poly/Poly_Triangulation.hxx +++ b/src/Poly/Poly_Triangulation.hxx @@ -196,9 +196,6 @@ public: Standard_EXPORT void SetNormal (const Standard_Integer theIndex, const gp_Dir& theNormal); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: Standard_Real myDeflection; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index 97a236d502..1322d5c8b4 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -842,41 +842,12 @@ void PrsMgr_PresentableObject::PolygonOffsets (Standard_Integer& theMode, // function : DumpJson // purpose : // ======================================================================= -void PrsMgr_PresentableObject::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const +void PrsMgr_PresentableObject::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const { OCCT_DUMP_CLASS_BEGIN (theOStream, PrsMgr_PresentableObject); OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myParent); - for (PrsMgr_Presentations::Iterator anIterator (myPresentations); anIterator.More(); anIterator.Next()) - { - Handle(PrsMgr_Presentation) aPresentation = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aPresentation.get()); - } - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myClipPlanes.get()); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDrawer.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHilightDrawer.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myDynHilightDrawer.get()); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTransformPersistence.get()); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myLocalTransformation.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTransformation.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCombinedParentTransform.get()); - - for (PrsMgr_ListOfPresentableObjects::Iterator anIterator (myChildren); anIterator.More(); anIterator.Next()) - { - Handle(PrsMgr_PresentableObject) aPresentableObject = anIterator.Value(); - OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, aPresentableObject.get()); - } - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInvTransformation); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTypeOfPresentation3d); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurrentFacingModel); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOwnWidth); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, hasOwnColor); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, hasOwnMaterial); @@ -884,6 +855,4 @@ void PrsMgr_PresentableObject::DumpJson (Standard_OStream& theOStream, const Sta OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myInfiniteState); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsMutable); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnPresentations); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToPropagateVisualState); } diff --git a/src/PrsMgr/PrsMgr_Presentation.cxx b/src/PrsMgr/PrsMgr_Presentation.cxx index ada3a3ae1b..190fc3b7e3 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cxx +++ b/src/PrsMgr/PrsMgr_Presentation.cxx @@ -263,22 +263,3 @@ PrsMgr_Presentation::~PrsMgr_Presentation() { Erase(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void PrsMgr_Presentation::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, PrsMgr_Presentation); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Graphic3d_Structure); - - //Handle(PrsMgr_PresentationManager) myPresentationManager; - - OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myPresentableObject); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBeforeHighlightState); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMustBeUpdated); -} diff --git a/src/PrsMgr/PrsMgr_Presentation.hxx b/src/PrsMgr/PrsMgr_Presentation.hxx index 5ba1eda540..b91c2802c5 100644 --- a/src/PrsMgr/PrsMgr_Presentation.hxx +++ b/src/PrsMgr/PrsMgr_Presentation.hxx @@ -80,9 +80,6 @@ public: //! Compute structure using presentation manager. Standard_EXPORT virtual void Compute() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Main constructor. diff --git a/src/Select3D/Select3D_InteriorSensitivePointSet.cxx b/src/Select3D/Select3D_InteriorSensitivePointSet.cxx index 0b457f469b..bc7d0a9edf 100644 --- a/src/Select3D/Select3D_InteriorSensitivePointSet.cxx +++ b/src/Select3D/Select3D_InteriorSensitivePointSet.cxx @@ -323,19 +323,3 @@ Standard_Integer Select3D_InteriorSensitivePointSet::NbSubElements() { return myPlanarPolygons.Length(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_InteriorSensitivePointSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_InteriorSensitivePointSet); - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - //Select3D_VectorOfHPoly myPlanarPolygons; //!< Vector of planar polygons - //Handle(TColStd_HArray1OfInteger) myPolygonsIdxs; //!< Indexes array for BVH calculation - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCOG); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); -} diff --git a/src/Select3D/Select3D_InteriorSensitivePointSet.hxx b/src/Select3D/Select3D_InteriorSensitivePointSet.hxx index 0cb2fe615a..b9c7d658f2 100644 --- a/src/Select3D/Select3D_InteriorSensitivePointSet.hxx +++ b/src/Select3D/Select3D_InteriorSensitivePointSet.hxx @@ -70,9 +70,6 @@ public: //! Returns the amount of points in set Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - DEFINE_STANDARD_RTTIEXT(Select3D_InteriorSensitivePointSet,Select3D_SensitiveSet) protected: diff --git a/src/Select3D/Select3D_SensitiveBox.cxx b/src/Select3D/Select3D_SensitiveBox.cxx index 81f0bdb085..d5f169599b 100644 --- a/src/Select3D/Select3D_SensitiveBox.cxx +++ b/src/Select3D/Select3D_SensitiveBox.cxx @@ -120,15 +120,3 @@ Select3D_BndBox3d Select3D_SensitiveBox::BoundingBox() { return myBox; } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveBox::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveBox); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBox); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCenter3d); -} diff --git a/src/Select3D/Select3D_SensitiveBox.hxx b/src/Select3D/Select3D_SensitiveBox.hxx index 36515f2b41..06f91d02c6 100644 --- a/src/Select3D/Select3D_SensitiveBox.hxx +++ b/src/Select3D/Select3D_SensitiveBox.hxx @@ -70,9 +70,6 @@ public: //! transformation is set, it will be applied Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: Select3D_BndBox3d myBox; //!< 3d coordinates of box corners diff --git a/src/Select3D/Select3D_SensitiveEntity.cxx b/src/Select3D/Select3D_SensitiveEntity.cxx index 43804bad69..c9550a6b24 100644 --- a/src/Select3D/Select3D_SensitiveEntity.cxx +++ b/src/Select3D/Select3D_SensitiveEntity.cxx @@ -30,15 +30,3 @@ Select3D_SensitiveEntity::Select3D_SensitiveEntity (const Handle(SelectMgr_Entit { // } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveEntity::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveEntity); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myOwnerId.get()); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySFactor); -} diff --git a/src/Select3D/Select3D_SensitiveEntity.hxx b/src/Select3D/Select3D_SensitiveEntity.hxx index 277a9d87de..506acd5166 100644 --- a/src/Select3D/Select3D_SensitiveEntity.hxx +++ b/src/Select3D/Select3D_SensitiveEntity.hxx @@ -91,9 +91,6 @@ public: //! Otherwise, returns identity matrix. virtual gp_GTrsf InvInitLocation() const { return gp_GTrsf(); } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: Standard_EXPORT Select3D_SensitiveEntity (const Handle(SelectMgr_EntityOwner)& theOwnerId); diff --git a/src/Select3D/Select3D_SensitiveFace.cxx b/src/Select3D/Select3D_SensitiveFace.cxx index 4ad62a1044..0ae25aed5b 100644 --- a/src/Select3D/Select3D_SensitiveFace.cxx +++ b/src/Select3D/Select3D_SensitiveFace.cxx @@ -143,15 +143,3 @@ Standard_Integer Select3D_SensitiveFace::NbSubElements() { return myFacePoints->NbSubElements(); } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveFace::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveFace); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myFacePoints.get()); -} diff --git a/src/Select3D/Select3D_SensitiveFace.hxx b/src/Select3D/Select3D_SensitiveFace.hxx index 5fdf9f27b5..5567c9f07a 100644 --- a/src/Select3D/Select3D_SensitiveFace.hxx +++ b/src/Select3D/Select3D_SensitiveFace.hxx @@ -73,9 +73,6 @@ public: //! Returns the amount of sub-entities (points or planar convex polygons) Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: Select3D_TypeOfSensitivity mySensType; //!< Type of sensitivity: interior or boundary diff --git a/src/Select3D/Select3D_SensitiveGroup.cxx b/src/Select3D/Select3D_SensitiveGroup.cxx index b3571adcbf..d01499d6c3 100644 --- a/src/Select3D/Select3D_SensitiveGroup.cxx +++ b/src/Select3D/Select3D_SensitiveGroup.cxx @@ -361,27 +361,3 @@ Standard_Real Select3D_SensitiveGroup::distanceToCOG (SelectBasics_SelectingVolu { return theMgr.DistToGeometryCenter (CenterOfGeometry()); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_SensitiveGroup::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveGroup); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - for (Select3D_IndexedMapOfEntity::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next()) - { - Handle(Select3D_SensitiveEntity) anEntity = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEntity.get()); - } - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMustMatchAll); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToCheckOverlapAll); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCenter); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); - - //NCollection_Vector myBVHPrimIndexes; //!< Vector of sub-entities indexes for BVH tree build -} diff --git a/src/Select3D/Select3D_SensitiveGroup.hxx b/src/Select3D/Select3D_SensitiveGroup.hxx index 3b6f28a239..37efcf6cb0 100644 --- a/src/Select3D/Select3D_SensitiveGroup.hxx +++ b/src/Select3D/Select3D_SensitiveGroup.hxx @@ -143,9 +143,6 @@ public: //! Returns the length of vector of sensitive entities Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Checks whether the entity with index theIdx overlaps the current selecting volume diff --git a/src/Select3D/Select3D_SensitivePoint.cxx b/src/Select3D/Select3D_SensitivePoint.cxx index a995296a88..39bca11760 100644 --- a/src/Select3D/Select3D_SensitivePoint.cxx +++ b/src/Select3D/Select3D_SensitivePoint.cxx @@ -85,14 +85,3 @@ Standard_Integer Select3D_SensitivePoint::NbSubElements() { return 1; } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitivePoint::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoint); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoint); -} diff --git a/src/Select3D/Select3D_SensitivePoint.hxx b/src/Select3D/Select3D_SensitivePoint.hxx index c45c129ddb..a8c6e8c249 100644 --- a/src/Select3D/Select3D_SensitivePoint.hxx +++ b/src/Select3D/Select3D_SensitivePoint.hxx @@ -50,9 +50,6 @@ public: //! transformation is set, it will be applied Standard_EXPORT virtual Select3D_BndBox3d BoundingBox() Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: gp_Pnt myPoint; //!< 3d coordinates of the point diff --git a/src/Select3D/Select3D_SensitivePoly.cxx b/src/Select3D/Select3D_SensitivePoly.cxx index 37c79bcde6..61a02bf94b 100644 --- a/src/Select3D/Select3D_SensitivePoly.cxx +++ b/src/Select3D/Select3D_SensitivePoly.cxx @@ -310,20 +310,3 @@ gp_Pnt Select3D_SensitivePoly::CenterOfGeometry() const return myCOG; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_SensitivePoly::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePoly); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - //Select3D_PointData myPolyg; //!< Points of the poly - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCOG); - //Handle(TColStd_HArray1OfInteger) mySegmentIndexes; //!< Segment indexes for BVH tree build - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsComputed); -} diff --git a/src/Select3D/Select3D_SensitivePoly.hxx b/src/Select3D/Select3D_SensitivePoly.hxx index 120db6a2d2..e530093d11 100644 --- a/src/Select3D/Select3D_SensitivePoly.hxx +++ b/src/Select3D/Select3D_SensitivePoly.hxx @@ -92,9 +92,6 @@ public: Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1, const Standard_Integer theIdx2) Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Checks whether the segment with index theIdx overlaps the current selecting volume diff --git a/src/Select3D/Select3D_SensitivePrimitiveArray.cxx b/src/Select3D/Select3D_SensitivePrimitiveArray.cxx index 220c9a429f..0671d58690 100644 --- a/src/Select3D/Select3D_SensitivePrimitiveArray.cxx +++ b/src/Select3D/Select3D_SensitivePrimitiveArray.cxx @@ -1218,44 +1218,3 @@ Standard_Boolean Select3D_SensitivePrimitiveArray::elementIsInside (SelectBasics } } } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_SensitivePrimitiveArray::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitivePrimitiveArray); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - //Handle(Select3D_PrimArraySubGroupArray) myGroups; //!< sub-groups of sensitive entities - //Handle(Graphic3d_Buffer) myVerts; //!< source data - nodes position - //Handle(Graphic3d_IndexBuffer) myIndices; //!< source data - primitive indexes - //const Standard_Byte* myPosData; //!< position vertex attribute data - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPosStride); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPrimType); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndexLower); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIndexUpper); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPatchSizeMax); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPatchDistance); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIs3d); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInitLocation); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCDG3D); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); - //Handle(TColStd_HPackedMapOfInteger) myDetectedElemMap; //!< index map of last detected elements - //Handle(TColStd_HPackedMapOfInteger) myDetectedNodeMap; //!< index map of last detected nodes - - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinDepthElem); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinDepthNode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMinDepthEdge); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedElem); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedNode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedEdgeNode1); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedEdgeNode2); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDetectElem); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDetectNode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToDetectEdge); -} diff --git a/src/Select3D/Select3D_SensitivePrimitiveArray.hxx b/src/Select3D/Select3D_SensitivePrimitiveArray.hxx index a78ac80337..f579d7dc7a 100644 --- a/src/Select3D/Select3D_SensitivePrimitiveArray.hxx +++ b/src/Select3D/Select3D_SensitivePrimitiveArray.hxx @@ -197,9 +197,6 @@ public: //! Return the second node of last topmost detected edge or -1 if undefined (axis picking). Standard_Integer LastDetectedEdgeNode2() const { return myDetectedEdgeNode2; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - public: //! Checks whether the sensitive entity is overlapped by current selecting volume. diff --git a/src/Select3D/Select3D_SensitiveSegment.cxx b/src/Select3D/Select3D_SensitiveSegment.cxx index 24b19e4d0a..8d51376315 100644 --- a/src/Select3D/Select3D_SensitiveSegment.cxx +++ b/src/Select3D/Select3D_SensitiveSegment.cxx @@ -102,15 +102,3 @@ Standard_Integer Select3D_SensitiveSegment::NbSubElements() { return 2; } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveSegment::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSegment); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myStart); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myEnd); -} diff --git a/src/Select3D/Select3D_SensitiveSegment.hxx b/src/Select3D/Select3D_SensitiveSegment.hxx index e4bf0a7990..3aefcca48f 100644 --- a/src/Select3D/Select3D_SensitiveSegment.hxx +++ b/src/Select3D/Select3D_SensitiveSegment.hxx @@ -70,9 +70,6 @@ public: //! changes the end point of the segment void EndPoint (const gp_Pnt& thePnt) { myEnd = thePnt; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: gp_Pnt myStart; //!< Start point diff --git a/src/Select3D/Select3D_SensitiveSet.cxx b/src/Select3D/Select3D_SensitiveSet.cxx index f9ff7ff171..e5e40aacd0 100644 --- a/src/Select3D/Select3D_SensitiveSet.cxx +++ b/src/Select3D/Select3D_SensitiveSet.cxx @@ -232,14 +232,3 @@ void Select3D_SensitiveSet::Clear() { // } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveSet::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveSet); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDetectedIdx); -} diff --git a/src/Select3D/Select3D_SensitiveSet.hxx b/src/Select3D/Select3D_SensitiveSet.hxx index 6cf1b03ec1..029880ab8d 100644 --- a/src/Select3D/Select3D_SensitiveSet.hxx +++ b/src/Select3D/Select3D_SensitiveSet.hxx @@ -96,9 +96,6 @@ public: //! Returns a number of nodes in 1 BVH leaf Standard_Integer GetLeafNodeSize() const { return myContent.Builder()->LeafNodeSize(); } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Checks whether one or more entities of the set overlap current selecting volume. diff --git a/src/Select3D/Select3D_SensitiveTriangle.cxx b/src/Select3D/Select3D_SensitiveTriangle.cxx index 6eaa8243b1..e5828bc9bc 100644 --- a/src/Select3D/Select3D_SensitiveTriangle.cxx +++ b/src/Select3D/Select3D_SensitiveTriangle.cxx @@ -93,19 +93,3 @@ Select3D_BndBox3d Select3D_SensitiveTriangle::BoundingBox() Max (myPoints[0].Z(), Max (myPoints[1].Z(), myPoints[2].Z()))); return Select3D_BndBox3d (aMinPnt, aMaxPnt); } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void Select3D_SensitiveTriangle::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangle); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCentroid); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoints[0]); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoints[1]); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myPoints[2]); -} diff --git a/src/Select3D/Select3D_SensitiveTriangle.hxx b/src/Select3D/Select3D_SensitiveTriangle.hxx index e6ad159dcf..a9e04da030 100644 --- a/src/Select3D/Select3D_SensitiveTriangle.hxx +++ b/src/Select3D/Select3D_SensitiveTriangle.hxx @@ -67,11 +67,6 @@ public: virtual gp_Pnt CenterOfGeometry() const Standard_OVERRIDE { return myCentroid; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - -public: - DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveTriangle,Select3D_SensitiveEntity) private: diff --git a/src/Select3D/Select3D_SensitiveTriangulation.cxx b/src/Select3D/Select3D_SensitiveTriangulation.cxx index 4f9ed23327..859019a739 100644 --- a/src/Select3D/Select3D_SensitiveTriangulation.cxx +++ b/src/Select3D/Select3D_SensitiveTriangulation.cxx @@ -443,24 +443,3 @@ gp_GTrsf Select3D_SensitiveTriangulation::InvInitLocation() const { return myInvInitLocation; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_SensitiveTriangulation::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveTriangulation); - - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myTriangul.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myInitLocation); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCDG3D); - //Handle(TColStd_HArray1OfInteger) myFreeEdges; - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensType); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myPrimitivesNb); - //Handle(TColStd_HArray1OfInteger) myBVHPrimIndexes; //!< Indexes of edges or triangles for BVH build - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); - //gp_GTrsf myInvInitLocation; -} diff --git a/src/Select3D/Select3D_SensitiveTriangulation.hxx b/src/Select3D/Select3D_SensitiveTriangulation.hxx index 752504a318..2d384f344d 100644 --- a/src/Select3D/Select3D_SensitiveTriangulation.hxx +++ b/src/Select3D/Select3D_SensitiveTriangulation.hxx @@ -93,9 +93,6 @@ public: const TopLoc_Location& GetInitLocation() const { return myInitLocation; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: //! Inner function for transformation application to bounding diff --git a/src/Select3D/Select3D_SensitiveWire.cxx b/src/Select3D/Select3D_SensitiveWire.cxx index 410ee06483..6f0128b3e5 100644 --- a/src/Select3D/Select3D_SensitiveWire.cxx +++ b/src/Select3D/Select3D_SensitiveWire.cxx @@ -226,22 +226,3 @@ gp_Pnt Select3D_SensitiveWire::CenterOfGeometry() const { return myCenter; } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void Select3D_SensitiveWire::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, Select3D_SensitiveWire); - OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Select3D_SensitiveSet); - - for (NCollection_Vector::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next()) - { - Handle(Select3D_SensitiveEntity) anEntity = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEntity.get()); - } - //NCollection_Vector myEntityIndexes; //!< Indexes of entities for BVH build - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myCenter); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myBndBox); -} diff --git a/src/Select3D/Select3D_SensitiveWire.hxx b/src/Select3D/Select3D_SensitiveWire.hxx index 55463188ab..3b4f76e95a 100644 --- a/src/Select3D/Select3D_SensitiveWire.hxx +++ b/src/Select3D/Select3D_SensitiveWire.hxx @@ -68,9 +68,6 @@ public: Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1, const Standard_Integer theIdx2) Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - DEFINE_STANDARD_RTTIEXT(Select3D_SensitiveWire,Select3D_SensitiveSet) protected: diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cxx b/src/SelectMgr/SelectMgr_SelectableObject.cxx index fdab61b557..cedd1c00d3 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.cxx @@ -558,17 +558,6 @@ void SelectMgr_SelectableObject::DumpJson (Standard_OStream& theOStream, const S OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_SelectableObject); OCCT_DUMP_BASE_CLASS (theOStream, theDepth, PrsMgr_PresentableObject); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySelectionPrs.get()); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myHilightPrs.get()); - - for (SelectMgr_SequenceOfSelection::Iterator anIterator (myselections); anIterator.More(); anIterator.Next()) - { - Handle(SelectMgr_Selection) aSelection = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aSelection.get()); - } - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myGlobalSelMode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mycurrent); OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAutoHilight); } diff --git a/src/SelectMgr/SelectMgr_Selection.cxx b/src/SelectMgr/SelectMgr_Selection.cxx index 7a1cef72f1..b42881df73 100644 --- a/src/SelectMgr/SelectMgr_Selection.cxx +++ b/src/SelectMgr/SelectMgr_Selection.cxx @@ -116,26 +116,3 @@ void SelectMgr_Selection::SetSensitivity (const Standard_Integer theNewSens) anEntity->BaseSensitive()->SetSensitivityFactor (theNewSens); } } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void SelectMgr_Selection::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_Selection); - - for (NCollection_Vector::Iterator anIterator (myEntities); anIterator.More(); anIterator.Next()) - { - Handle(SelectMgr_SensitiveEntity) anEntity = anIterator.Value(); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEntity.get()); - } - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myEntityIter); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myUpdateStatus); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySelectionState); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myBVHUpdateStatus); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySensFactor); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsCustomSens); -} diff --git a/src/SelectMgr/SelectMgr_Selection.hxx b/src/SelectMgr/SelectMgr_Selection.hxx index e5ec664251..1287306fb0 100644 --- a/src/SelectMgr/SelectMgr_Selection.hxx +++ b/src/SelectMgr/SelectMgr_Selection.hxx @@ -139,9 +139,6 @@ public: //! proper updates use SelectMgr_SelectionManager::SetSelectionSensitivity method. Standard_EXPORT void SetSensitivity (const Standard_Integer theNewSens); - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - private: NCollection_Vector myEntities; diff --git a/src/SelectMgr/SelectMgr_SensitiveEntity.cxx b/src/SelectMgr/SelectMgr_SensitiveEntity.cxx index 2adad2af04..bad38d0619 100644 --- a/src/SelectMgr/SelectMgr_SensitiveEntity.cxx +++ b/src/SelectMgr/SelectMgr_SensitiveEntity.cxx @@ -39,15 +39,3 @@ void SelectMgr_SensitiveEntity::Clear() mySensitive->Clear(); mySensitive.Nullify(); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void SelectMgr_SensitiveEntity::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, SelectMgr_SensitiveEntity); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, mySensitive.get()); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActiveForSelection); -} diff --git a/src/SelectMgr/SelectMgr_SensitiveEntity.hxx b/src/SelectMgr/SelectMgr_SensitiveEntity.hxx index 24f183f114..02e084f857 100644 --- a/src/SelectMgr/SelectMgr_SensitiveEntity.hxx +++ b/src/SelectMgr/SelectMgr_SensitiveEntity.hxx @@ -47,9 +47,6 @@ public: //! Marks entity as active for selection void SetActiveForSelection() const { myIsActiveForSelection = Standard_True; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - DEFINE_STANDARD_RTTIEXT(SelectMgr_SensitiveEntity,Standard_Transient) // Type definition private: diff --git a/src/SelectMgr/SelectMgr_ViewerSelector.hxx b/src/SelectMgr/SelectMgr_ViewerSelector.hxx index 4ecce78207..b23098ff74 100644 --- a/src/SelectMgr/SelectMgr_ViewerSelector.hxx +++ b/src/SelectMgr/SelectMgr_ViewerSelector.hxx @@ -201,12 +201,6 @@ public: //! Returns instance of selecting volume manager of the viewer selector SelectMgr_SelectingVolumeManager& GetManager() { return mySelectingVolumeMgr; } - //! Returns container of sensitives - const SelectMgr_MapOfObjectSensitives& GetObjectSensitives() const { return myMapOfObjectSensitives; } - - //! Returns container of selectable objects - const SelectMgr_SelectableObjectSet& GetSelectableObjects() const { return mySelectableObjects; } - //! Marks all added sensitive entities of all objects as non-selectable Standard_EXPORT void ResetSelectionActivationStatus(); diff --git a/src/Standard/Standard_Dump.cxx b/src/Standard/Standard_Dump.cxx index 4a36e19b8f..c440561a24 100644 --- a/src/Standard/Standard_Dump.cxx +++ b/src/Standard/Standard_Dump.cxx @@ -93,66 +93,6 @@ void Standard_Dump::DumpRealValues (Standard_OStream& theOStream, int theCount, va_end(vl); } -//======================================================================= -//function : ProcessStreamName -//purpose : -//======================================================================= -Standard_Boolean Standard_Dump::ProcessStreamName (const Standard_SStream& theStream, - const TCollection_AsciiString& theName, - Standard_Integer& theStreamPos) -{ - TCollection_AsciiString aText = Text (theStream); - if (aText.IsEmpty()) - return Standard_False; - TCollection_AsciiString aSubText = aText.SubString (theStreamPos, aText.Length()); - - TCollection_AsciiString aKeyName = theName + JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue); - Standard_Boolean aResult = aSubText.StartsWith (aKeyName); - if (aResult) - theStreamPos += aKeyName.Length(); - - return aResult; -} - -//======================================================================= -//function : InitRealValues -//purpose : -//======================================================================= -Standard_Boolean Standard_Dump::InitRealValues (const Standard_SStream& theStream, - Standard_Integer& theStreamPos, - int theCount, ...) -{ - Standard_Integer aStreamPos = theStreamPos + JsonKeyLength (Standard_JsonKey_OpenContainer) + 1; - - TCollection_AsciiString aText = Text (theStream); - TCollection_AsciiString aSubText = aText.SubString (aStreamPos, aText.Length()); - Standard_Integer aClosePos = aSubText.Location (JsonKeyToString (Standard_JsonKey_CloseContainer), aStreamPos, aSubText.Length()); - - va_list vl; - va_start(vl, theCount); - for(int i = 0; i < theCount; ++i) - { - //if (i < theCount -1) - // theOStream << ", "; - Standard_Integer aNextPos = (i < theCount-1) ? aSubText.Location (JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aStreamPos, aSubText.Length()) - : aClosePos; - - TCollection_AsciiString aValueText = aSubText.SubString (aStreamPos, aNextPos - 1); - - if (!aValueText.IsRealValue()) - return Standard_False; - - va_arg(vl, Standard_Real) = aValueText.RealValue(); - - aStreamPos = aNextPos + 1; - //theOStream << va_arg(vl, Standard_Real); - } - va_end(vl); - - - return Standard_True; -} - // ======================================================================= // function : GetPointerInfo // purpose : @@ -172,9 +112,6 @@ TCollection_AsciiString Standard_Dump::GetPointerInfo (const Handle(Standard_Tra // ======================================================================= TCollection_AsciiString Standard_Dump::GetPointerInfo (const void* thePointer, const bool isShortInfo) { - if (!thePointer) - return TCollection_AsciiString(); - std::ostringstream aPtrStr; aPtrStr << thePointer; if (!isShortInfo) @@ -285,307 +222,3 @@ TCollection_AsciiString Standard_Dump::FormatJson (const Standard_SStream& theSt } return aText; } - -// ---------------------------------------------------------------------------- -// SplitJson -// ---------------------------------------------------------------------------- -Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStreamStr, - NCollection_IndexedDataMap& theValues) -{ - Standard_Integer /*anIndex = 1, */aNextIndex = 1; - while (aNextIndex < theStreamStr.Length()) - { - Standard_JsonKey aKey; - //Standard_Integer aNextIndex = 0; - if (!jsonKey (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, aKey)) - return Standard_False; - - Standard_Boolean aProcessed = Standard_False; - switch (aKey) - { - case Standard_JsonKey_Quote: - { - aProcessed = splitKeyToValue (theStreamStr, aNextIndex/*anIndex*/, aNextIndex, theValues); - //anIndex = aNextIndex; - } - break; - case Standard_JsonKey_OpenChild: - { - Standard_Integer aStartIndex = aNextIndex; - //Standard_Integer aNextIndex = anIndex; - - Standard_Integer aClosePos = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_OpenChild, Standard_JsonKey_CloseChild); - if (!aClosePos) - return Standard_False; - - TCollection_AsciiString aSubStreamStr = theStreamStr.SubString (aStartIndex + JsonKeyLength (aKey), aNextIndex - 2); - if (!SplitJson (aSubStreamStr, theValues)) - return Standard_False; - - aNextIndex/*anIndex*/ = aClosePos + Standard_Integer (JsonKeyLength (Standard_JsonKey_CloseChild)); - } - break; - case Standard_JsonKey_SeparatorValueToValue: - { - //anIndex = aNextIndex; - continue; - } - default: - break; - } - if (!aProcessed) - return Standard_False; - } - return Standard_True; -} - -// ---------------------------------------------------------------------------- -// JoinJson -// ---------------------------------------------------------------------------- -void Standard_Dump::JoinJson (Standard_OStream& theOStream, - const NCollection_IndexedDataMap& theValues) -{ - -} - -// ---------------------------------------------------------------------------- -// HierarchicalValueIndices -// ---------------------------------------------------------------------------- -NCollection_List Standard_Dump::HierarchicalValueIndices ( - const NCollection_IndexedDataMap& theValues) -{ - NCollection_List anIndices; - - for (Standard_Integer anIndex = 1; anIndex <= theValues.Extent(); anIndex++) - { - if (HasChildKey (theValues.FindFromIndex (anIndex))) - anIndices.Append (anIndex); - } - return anIndices; -} - -// ---------------------------------------------------------------------------- -// splitKeyToValue -// ---------------------------------------------------------------------------- -Standard_Boolean Standard_Dump::splitKeyToValue (const TCollection_AsciiString& theStreamStr, - Standard_Integer theStartIndex, - Standard_Integer& theNextIndex, - NCollection_IndexedDataMap& theValues) -{ - // find key value: "key" - Standard_Integer aStartIndex = theStartIndex; - Standard_Integer aCloseIndex = nextClosePosition (theStreamStr, aStartIndex + 1, Standard_JsonKey_None, Standard_JsonKey_Quote); - if (!aCloseIndex) - return Standard_False; - - TCollection_AsciiString aSplitKey = theStreamStr.SubString (aStartIndex/* + 1*/, aCloseIndex - 1); - - // key to value - aStartIndex = aCloseIndex + 1; - Standard_JsonKey aKey; - if (!jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKey)) - return Standard_False; - - // find value - aStartIndex = aCloseIndex;// + 1; - /*Standard_JsonKey */aKey = Standard_JsonKey_None; - if (jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKey)) - { - //if (aKey == Standard_JsonKey_Quote && aCloseIndex - aStartIndex == 1) - { - //aKey = Standard_JsonKey_None; - //aStartIndex = aCloseIndex + 1; - } - //else - // aStartIndex = aCloseIndex;// + 1; - //Standard_JsonKey aKey; - //if (!jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKey)) - // return Standard_False; - - //aStartIndex = aCloseIndex; - //aStartIndex = aCloseIndex + JsonKeyLength (Standard_JsonKey_Quote); - } - else - { - //aStartIndex = aCloseIndex; - } - - //Standard_JsonKey aKey; - //if (!jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKey)) - // return Standard_False; - - //Standard_Integer aValueLength = (aCloseIndex - 1) - aStartIndex; - aStartIndex = aCloseIndex; - //if (!jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKey)) - // return Standard_False; - - TCollection_AsciiString aSplitValue; - theNextIndex = -1; - switch (aKey) - { - case Standard_JsonKey_OpenChild: - { - aCloseIndex = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_OpenChild, Standard_JsonKey_CloseChild); - if (aCloseIndex > aStartIndex) - aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex); - theNextIndex = aCloseIndex + 1; - } - break; - case Standard_JsonKey_OpenContainer: - { - aCloseIndex = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_OpenContainer, Standard_JsonKey_CloseContainer); - if (aCloseIndex > aStartIndex) - aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex - 1); - theNextIndex = aCloseIndex + 1; - } - break; - case Standard_JsonKey_Quote: - { - Standard_JsonKey aKeyTmp; - if (jsonKey (theStreamStr, aStartIndex, aCloseIndex, aKeyTmp) && aKeyTmp == Standard_JsonKey_Quote) // emptyValue - { - aSplitValue = ""; - theNextIndex = aCloseIndex; - } - else - { - aCloseIndex = nextClosePosition (theStreamStr, aStartIndex + 1, Standard_JsonKey_None, Standard_JsonKey_Quote); - aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex - 1); - theNextIndex = aCloseIndex + 1; - } - } - break; - case Standard_JsonKey_None: - { - Standard_Integer aCloseIndex1 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_CloseChild) - 1; - Standard_Integer aCloseIndex2 = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_None, Standard_JsonKey_SeparatorValueToValue) - 1; - aCloseIndex = aCloseIndex1 < aCloseIndex2 ? aCloseIndex1 : aCloseIndex2; - - aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex); - theNextIndex = aCloseIndex + 1; - } - break; - default: - return Standard_False; - } - - //TCollection_AsciiString aSplitValue = theStreamStr.SubString (aStartIndex, aCloseIndex - 1); - //theNextIndex = aCloseIndex + 1; - - TCollection_AsciiString aValue; - if (theValues.FindFromKey (aSplitKey, aValue)) - { - Standard_Integer anIndex = 1; - // increment key until the new key does not exist in the container - TCollection_AsciiString anIndexedSuffix = TCollection_AsciiString ("_") + TCollection_AsciiString (anIndex); - while (theValues.FindFromKey (TCollection_AsciiString (aSplitKey + anIndexedSuffix), aValue)) - { - anIndex++; - anIndexedSuffix = TCollection_AsciiString ("_") + TCollection_AsciiString (anIndex); - } - aSplitKey = aSplitKey + anIndexedSuffix; - } - - theValues.Add (aSplitKey, aSplitValue); - return Standard_True; -} - -// ---------------------------------------------------------------------------- -// jsonKey -// ---------------------------------------------------------------------------- -Standard_Boolean Standard_Dump::jsonKey (const TCollection_AsciiString& theStreamStr, - Standard_Integer theStartIndex, - Standard_Integer& theNextIndex, - Standard_JsonKey& theKey) -{ - TCollection_AsciiString aSubStreamStr = theStreamStr.SubString (theStartIndex, theStreamStr.Length()); - for (Standard_Integer aKeyId = (Standard_Integer)Standard_JsonKey_OpenChild; aKeyId <= Standard_JsonKey_SeparatorValueToValue; aKeyId++) - { - Standard_JsonKey aKey = (Standard_JsonKey)aKeyId; - const Standard_CString aKeyToStr = JsonKeyToString (aKey); - if (!aSubStreamStr.StartsWith (aKeyToStr)) - continue; - - theNextIndex = theStartIndex + Standard_Integer (JsonKeyLength (aKey)); - theKey = aKey; - return Standard_True; - } - return Standard_False; -} - -// ---------------------------------------------------------------------------- -// HasChildKey -// ---------------------------------------------------------------------------- -Standard_Boolean Standard_Dump::HasChildKey (const TCollection_AsciiString& theSourceValue) -{ - return theSourceValue.Search (JsonKeyToString (Standard_JsonKey_SeparatorKeyToValue)) >= 0; -} - -// ---------------------------------------------------------------------------- -// JsonKeyToString -// ---------------------------------------------------------------------------- -const Standard_CString Standard_Dump::JsonKeyToString (const Standard_JsonKey theKey) -{ - switch (theKey) - { - case Standard_JsonKey_None: return ""; - case Standard_JsonKey_OpenChild: return "{"; - case Standard_JsonKey_CloseChild: return "}"; - case Standard_JsonKey_OpenContainer: return "["; - case Standard_JsonKey_CloseContainer: return "]"; - case Standard_JsonKey_Quote: return "\""; - case Standard_JsonKey_SeparatorKeyToValue: return ": "; - case Standard_JsonKey_SeparatorValueToValue: return ", "; - default: break; - } - - return ""; -} - -// ---------------------------------------------------------------------------- -// JsonKeyLength -// ---------------------------------------------------------------------------- -Standard_Integer Standard_Dump::JsonKeyLength (const Standard_JsonKey theKey) -{ - return (Standard_Integer)strlen (JsonKeyToString (theKey)); -} - -// ---------------------------------------------------------------------------- -// nextClosePosition -// ---------------------------------------------------------------------------- -Standard_Integer Standard_Dump::nextClosePosition (const TCollection_AsciiString& theSourceValue, - const Standard_Integer theStartPosition, - const Standard_JsonKey theOpenKey, - const Standard_JsonKey theCloseKey) -{ - const Standard_CString anOpenKey = JsonKeyToString (theOpenKey); - const Standard_CString aCloseKeyStr = JsonKeyToString (theCloseKey); - - Standard_Integer aStartPos = theStartPosition; - Standard_Integer aDepthKey = 0; - - while (aStartPos < theSourceValue.Length()) - { - Standard_Integer anOpenKeyPos = theSourceValue.Location (anOpenKey, aStartPos, theSourceValue.Length()); - Standard_Integer aCloseKeyPos = theSourceValue.Location (aCloseKeyStr, aStartPos, theSourceValue.Length()); - if (!aCloseKeyPos) - break; - - if (anOpenKeyPos && anOpenKeyPos <= aCloseKeyPos) - { - aDepthKey++; - aStartPos = anOpenKeyPos + 1; - } - else - { - if (!aDepthKey) - return aCloseKeyPos; - else - { - aDepthKey--; - aStartPos = aCloseKeyPos + 1; - } - } - } - return theSourceValue.Length(); -} diff --git a/src/Standard/Standard_Dump.hxx b/src/Standard/Standard_Dump.hxx index c4f46ef4f0..ba5d4ae878 100644 --- a/src/Standard/Standard_Dump.hxx +++ b/src/Standard/Standard_Dump.hxx @@ -14,8 +14,6 @@ #ifndef _Standard_Dump_HeaderFile #define _Standard_Dump_HeaderFile -#include -#include #include #include @@ -132,8 +130,10 @@ class Standard_DumpSentry; { \ if (theDepth != 0) \ { \ - Standard_Dump::AddValuesSeparator (theOStream); \ - theField::DumpJson (theOStream, theDepth - 1); \ + Standard_SStream aFieldStream; \ + theField::DumpJson (aFieldStream, theDepth - 1); \ + const char* aName = Standard_Dump::DumpFieldToName (#theField); \ + Standard_Dump::DumpKeyToClass (theOStream, aName, Standard_Dump::Text (aFieldStream)); \ } \ } @@ -148,18 +148,6 @@ class Standard_DumpSentry; theOStream << "]"; \ } -//! @def OCCT_DUMP_VECTOR_CLASS -//! Append vector values into output value: "Name": [value_1, value_2, ...] -//! This macro is intended to have only one row for dumped object in Json. -//! It's possible to use it without necessity of OCCT_DUMP_CLASS_BEGIN call, but pay attention that it should be only one row in the object dump. -#define OCCT_INIT_VECTOR_CLASS(theOStream, theName, theStreamPos, theCount, ...) \ -{ \ - if (!Standard_Dump::ProcessStreamName (theOStream, OCCT_CLASS_NAME(theName), theStreamPos)) \ - return Standard_False; \ - if (!Standard_Dump::InitRealValues (theOStream, theStreamPos, theCount, __VA_ARGS__)) \ - return Standard_False; \ -} - //! @brief Simple sentry class providing convenient interface to dump. //! Appends start and last rows in dump with class name key. //! An example of the using: for ClassName, the result is: "ClassName" { ... } @@ -177,19 +165,6 @@ private: Standard_OStream* myOStream; //!< modified stream }; -//! Kind of key in Json string -enum Standard_JsonKey -{ - Standard_JsonKey_None, //!< no key - Standard_JsonKey_OpenChild, //!< "{" - Standard_JsonKey_CloseChild, //!< "}" - Standard_JsonKey_OpenContainer, //!< "[" - Standard_JsonKey_CloseContainer, //!< "]" - Standard_JsonKey_Quote, //!< "\"" - Standard_JsonKey_SeparatorKeyToValue, //!< ": " - Standard_JsonKey_SeparatorValueToValue //!< ", " -}; - //! This interface has some tool methods for stream (in JSON format) processing. class Standard_Dump { @@ -208,38 +183,7 @@ public: //! @return text presentation Standard_EXPORT static TCollection_AsciiString FormatJson (const Standard_SStream& theStream, const Standard_Integer theIndent = 3); - //! Converts stream into map of values. Values are not empty if the stream contains at least two values. - //! - //! The one level stream example: key_1\value_1\key_2\value_2 - //! In output: theStreamKey equals class_name, theValues contains key_1, value_1, key_2, and value_2. - //! - //! Two level stream example: key_1\value_1\key_2\value_2\key_3subclass_key_1\subclass_value1 - //! In output: theStreamKey equals class_name, theValues contains key_1, value_1, key_2, and value_2, key_3 and - //! subclass_key_1\subclass_value1. - //! The last value might be processed later using the same method. - //! - //! \param theStream stream value - //! \param theValues [out] container of split values - Standard_EXPORT static Standard_Boolean SplitJson (const TCollection_AsciiString& theStreamStr, - NCollection_IndexedDataMap& theValues); - - //! Unites container of values into Json output in form: key_1 : value_1, key_2: value_2, ... key_n: value_n - Standard_EXPORT static void JoinJson (Standard_OStream& theOStream, - const NCollection_IndexedDataMap& theValues); - - //! Returns container of indices in values, that has hierarchical value - Standard_EXPORT static NCollection_List HierarchicalValueIndices ( - const NCollection_IndexedDataMap& theValues); - - //! Returns true if the value has bracket key - Standard_EXPORT static Standard_Boolean HasChildKey (const TCollection_AsciiString& theSourceValue); - - //! Returns key value for enum type - Standard_EXPORT static const Standard_CString JsonKeyToString (const Standard_JsonKey theKey); - - //! Returns length value for enum type - Standard_EXPORT static Standard_Integer JsonKeyLength (const Standard_JsonKey theKey); - + //! Add Json values separator if the stream last symbol is not an open brace. //! @param theStream source value static Standard_EXPORT void AddValuesSeparator (Standard_OStream& theOStream); @@ -278,55 +222,11 @@ public: //! @param theCount numer of values Standard_EXPORT static void DumpRealValues (Standard_OStream& theOStream, int theCount, ...); - //! Check whether the parameter name is equal to the name in the stream at position - //! @param theSStream stream with values - //! @param theName stream key value - //! @param theStreamPos current position in the stream - Standard_EXPORT static Standard_Boolean ProcessStreamName (const Standard_SStream& theStream, - const TCollection_AsciiString& theName, - Standard_Integer& theStreamPos); - - //! Unite values in one value using template: value_1, value_2, ..., value_n - //! @param theSStream stream with values - //! @param theStreamPos current position in the stream - //! @param theCount numer of values - Standard_EXPORT static Standard_Boolean InitRealValues (const Standard_SStream& theStream, - Standard_Integer& theStreamPos, - int theCount, ...); - //! Convert field name into dump text value, removes "&" and "my" prefixes //! An example, for field myValue, theName is Value, for &myCLass, the name is Class //! @param theField a source value //! @param theName [out] an updated name Standard_EXPORT static const char* DumpFieldToName (const char* theField); - -private: - //! Extracts from the string value a pair (key, value), add it into output container, update index value - //! Example: - //! stream string starting the index position contains: ..."key": ... - //! a pair key, value will be added into theValues - //! at beginning theIndex is the position of the quota before , after the index is the next position after the value - //! splitDumped(aString) gives theSplitValue = "abc", theTailValue = "defg", theKey = "key" - Standard_EXPORT static Standard_Boolean splitKeyToValue (const TCollection_AsciiString& theStreamStr, - Standard_Integer theStartIndex, - Standard_Integer& theNextIndex, - NCollection_IndexedDataMap& theValues); - - - //! Returns key of json in the index position. Incement the index position to the next symbol in the row - Standard_EXPORT static Standard_Boolean jsonKey (const TCollection_AsciiString& theStreamStr, - Standard_Integer theStartIndex, - Standard_Integer& theNextIndex, - Standard_JsonKey& theKey); - - //! Find position in the source string of the symbol close after the start position. - //! Ignore combination ... between the close symbol. - //! Example, for case ... { ... { ... } ...} ... } it returns the position of the forth brace - Standard_EXPORT static Standard_Integer nextClosePosition (const TCollection_AsciiString& theSourceValue, - const Standard_Integer theStartPosition, - const Standard_JsonKey theCloseKey, - const Standard_JsonKey theOpenKey); - }; #endif // _Standard_Dump_HeaderFile diff --git a/src/StdSelect/StdSelect_BRepOwner.cxx b/src/StdSelect/StdSelect_BRepOwner.cxx index 2d5977665e..d601d2080c 100644 --- a/src/StdSelect/StdSelect_BRepOwner.cxx +++ b/src/StdSelect/StdSelect_BRepOwner.cxx @@ -182,17 +182,3 @@ void StdSelect_BRepOwner::UpdateHighlightTrsf (const Handle(V3d_Viewer)& theView theManager->UpdateHighlightTrsf (theViewer, Selectable(), theDispMode, myPrsSh); } - -// ======================================================================= -// function : DumpJson -// purpose : -// ======================================================================= -void StdSelect_BRepOwner::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, StdSelect_BRepOwner); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myShape); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myPrsSh.get()); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myCurMode); -} diff --git a/src/StdSelect/StdSelect_BRepOwner.hxx b/src/StdSelect/StdSelect_BRepOwner.hxx index 4f69952462..3e52352418 100644 --- a/src/StdSelect/StdSelect_BRepOwner.hxx +++ b/src/StdSelect/StdSelect_BRepOwner.hxx @@ -117,9 +117,6 @@ public: const Handle(PrsMgr_PresentationManager3d)& theManager, const Standard_Integer theDispMode) Standard_OVERRIDE; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - protected: TopoDS_Shape myShape; diff --git a/src/StdSelect/StdSelect_Shape.cxx b/src/StdSelect/StdSelect_Shape.cxx index 0a94438e63..5293d3706a 100644 --- a/src/StdSelect/StdSelect_Shape.cxx +++ b/src/StdSelect/StdSelect_Shape.cxx @@ -71,10 +71,3 @@ void StdSelect_Shape::Compute(const Handle(Prs3d_Projector)& aProjector, { PrsMgr_PresentableObject::Compute(aProjector,aPresentation); } - -void StdSelect_Shape::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, StdSelect_Shape); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &mysh); -} diff --git a/src/StdSelect/StdSelect_Shape.hxx b/src/StdSelect/StdSelect_Shape.hxx index b71fc725a3..f6ebdd44c4 100644 --- a/src/StdSelect/StdSelect_Shape.hxx +++ b/src/StdSelect/StdSelect_Shape.hxx @@ -46,9 +46,6 @@ public: void Shape (const TopoDS_Shape& theShape) { mysh = theShape; } - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const Standard_OVERRIDE; - private: Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; diff --git a/src/TCollection/TCollection_AsciiString.cxx b/src/TCollection/TCollection_AsciiString.cxx index fc74af4f0b..5cd1b13a38 100644 --- a/src/TCollection/TCollection_AsciiString.cxx +++ b/src/TCollection/TCollection_AsciiString.cxx @@ -1192,22 +1192,6 @@ void TCollection_AsciiString::Split(const Standard_Integer where, return ; } -// ---------------------------------------------------------------------------- -// Split -// ---------------------------------------------------------------------------- -void TCollection_AsciiString::Split (const TCollection_AsciiString& theSeparator, - NCollection_IndexedMap& theValues) -{ - Standard_Integer aStartPosition = 1, aSeparatorPosition = -1; - - aSeparatorPosition = Location (theSeparator, aStartPosition, Length()); - while (aSeparatorPosition) - { - theValues.Add (SubString (aStartPosition, aSeparatorPosition - 1)); - aStartPosition = aSeparatorPosition + theSeparator.Length(); - } -} - // ---------------------------------------------------------------------------- // Split // ---------------------------------------------------------------------------- diff --git a/src/TCollection/TCollection_AsciiString.hxx b/src/TCollection/TCollection_AsciiString.hxx index cfa89ee636..4f7df1a6fe 100644 --- a/src/TCollection/TCollection_AsciiString.hxx +++ b/src/TCollection/TCollection_AsciiString.hxx @@ -21,8 +21,6 @@ #include #include -#include - #include #include #include @@ -627,12 +625,6 @@ friend Standard_EXPORT Standard_IStream& operator >> (Standard_IStream& astream, //! aString.Split(3) gives = "abc" and returns "defg" Standard_EXPORT TCollection_AsciiString Split (const Standard_Integer where); - //! Splits a AsciiString into list of sub-strings. - //! Example: - //! aString contains "value_1, value_2, ..., value_n" - //! aString.Split(", ") gives container of strings: "value_1", "value_2" - Standard_EXPORT void Split (const TCollection_AsciiString& theSeparator, NCollection_IndexedMap& theValues); - //! Creation of a sub-string of the string . //! The sub-string starts to the index Fromindex and ends //! to the index ToIndex. diff --git a/src/gp/gp_Ax1.cxx b/src/gp/gp_Ax1.cxx index af08f0b87d..65290c0d21 100644 --- a/src/gp/gp_Ax1.cxx +++ b/src/gp/gp_Ax1.cxx @@ -28,8 +28,6 @@ #include #include -#include - Standard_Boolean gp_Ax1::IsCoaxial (const gp_Ax1& Other, const Standard_Real AngularTolerance, @@ -86,8 +84,3 @@ gp_Ax1 gp_Ax1::Mirrored (const gp_Ax2& A2) const return A1; } -void gp_Ax1::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir); -} diff --git a/src/gp/gp_Ax1.hxx b/src/gp/gp_Ax1.hxx index be14617419..8fea4a4e42 100644 --- a/src/gp/gp_Ax1.hxx +++ b/src/gp/gp_Ax1.hxx @@ -205,8 +205,6 @@ public: Standard_NODISCARD gp_Ax1 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; protected: diff --git a/src/gp/gp_Ax2.cxx b/src/gp/gp_Ax2.cxx index 4c1fc2a130..bcecdca6fd 100644 --- a/src/gp/gp_Ax2.cxx +++ b/src/gp/gp_Ax2.cxx @@ -28,7 +28,6 @@ #include #include #include -#include gp_Ax2::gp_Ax2 (const gp_Pnt& P, const gp_Dir& V) : axis(P,V) @@ -114,11 +113,3 @@ gp_Ax2 gp_Ax2::Mirrored(const gp_Ax2& A2) const return Temp; } -void gp_Ax2::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &axis); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vydir); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vxdir); -} diff --git a/src/gp/gp_Ax2.hxx b/src/gp/gp_Ax2.hxx index 6984cd8252..c11aafdf9e 100644 --- a/src/gp/gp_Ax2.hxx +++ b/src/gp/gp_Ax2.hxx @@ -323,9 +323,6 @@ public: Standard_NODISCARD gp_Ax2 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: diff --git a/src/gp/gp_Ax2d.cxx b/src/gp/gp_Ax2d.cxx index 084e5645fe..ab24a561a9 100644 --- a/src/gp/gp_Ax2d.cxx +++ b/src/gp/gp_Ax2d.cxx @@ -26,8 +26,6 @@ #include #include -#include - Standard_Boolean gp_Ax2d::IsCoaxial (const gp_Ax2d& Other, const Standard_Real AngularTolerance, const Standard_Real LinearTolerance) const @@ -77,10 +75,3 @@ gp_Ax2d gp_Ax2d::Mirrored (const gp_Ax2d& A) const return AA; } -void gp_Ax2d::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, gp_Ax2d); - - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc); - //OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vdir); -} diff --git a/src/gp/gp_Ax2d.hxx b/src/gp/gp_Ax2d.hxx index cdcac03fbe..20a30cc2f1 100644 --- a/src/gp/gp_Ax2d.hxx +++ b/src/gp/gp_Ax2d.hxx @@ -168,8 +168,7 @@ public: //! point . Standard_NODISCARD gp_Ax2d Translated (const gp_Pnt2d& P1, const gp_Pnt2d& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; + protected: diff --git a/src/gp/gp_Ax3.cxx b/src/gp/gp_Ax3.cxx index 7ae671a26a..2a9a065c24 100644 --- a/src/gp/gp_Ax3.cxx +++ b/src/gp/gp_Ax3.cxx @@ -23,7 +23,6 @@ #include #include #include -#include //======================================================================= //function : gp_Ax3 @@ -106,10 +105,3 @@ gp_Ax3 gp_Ax3::Mirrored(const gp_Ax2& A2)const return Temp; } - -void gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &axis); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vydir); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &vxdir); -} diff --git a/src/gp/gp_Ax3.hxx b/src/gp/gp_Ax3.hxx index 49268f3eb1..2d09566fbb 100644 --- a/src/gp/gp_Ax3.hxx +++ b/src/gp/gp_Ax3.hxx @@ -290,8 +290,6 @@ public: Standard_NODISCARD gp_Ax3 Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; protected: diff --git a/src/gp/gp_Dir.cxx b/src/gp/gp_Dir.cxx index a6c679ccc9..228e23db09 100644 --- a/src/gp/gp_Dir.cxx +++ b/src/gp/gp_Dir.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include Standard_Real gp_Dir::Angle (const gp_Dir& Other) const @@ -140,7 +139,3 @@ gp_Dir gp_Dir::Mirrored (const gp_Ax2& A2) const return V; } -void gp_Dir::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord); -} diff --git a/src/gp/gp_Dir.hxx b/src/gp/gp_Dir.hxx index de1944db5e..ae492722ef 100644 --- a/src/gp/gp_Dir.hxx +++ b/src/gp/gp_Dir.hxx @@ -263,8 +263,6 @@ public: Standard_NODISCARD gp_Dir Transformed (const gp_Trsf& T) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; protected: diff --git a/src/gp/gp_GTrsf.cxx b/src/gp/gp_GTrsf.cxx index 7b8bbd2540..0196ec7fe9 100644 --- a/src/gp/gp_GTrsf.cxx +++ b/src/gp/gp_GTrsf.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include void gp_GTrsf::SetTranslationPart (const gp_XYZ& Coord) @@ -158,18 +157,3 @@ void gp_GTrsf::SetForm() return; } } - -//======================================================================= -//function : DumpJson -//purpose : -//======================================================================= -void gp_GTrsf::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_CLASS_BEGIN (theOStream, gp_GTrsf); - - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &matrix); - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &loc); - - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, shape); - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, scale); -} diff --git a/src/gp/gp_GTrsf.hxx b/src/gp/gp_GTrsf.hxx index 9f012fd873..068aa81826 100644 --- a/src/gp/gp_GTrsf.hxx +++ b/src/gp/gp_GTrsf.hxx @@ -244,8 +244,6 @@ public: gp_Trsf Trsf() const; - //! Dumps the content of me into the stream - Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; diff --git a/src/gp/gp_Pln.cxx b/src/gp/gp_Pln.cxx index f965c07a7a..27a9a35717 100644 --- a/src/gp/gp_Pln.cxx +++ b/src/gp/gp_Pln.cxx @@ -30,7 +30,6 @@ #include #include #include -#include gp_Pln::gp_Pln (const gp_Pnt& P, const gp_Dir& V) @@ -131,7 +130,3 @@ gp_Pln gp_Pln::Mirrored (const gp_Ax2& A2) const return Pl; } -void gp_Pln::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &pos); -} diff --git a/src/gp/gp_Pln.hxx b/src/gp/gp_Pln.hxx index f4d5914076..7306114afa 100644 --- a/src/gp/gp_Pln.hxx +++ b/src/gp/gp_Pln.hxx @@ -241,9 +241,6 @@ public: Standard_NODISCARD gp_Pln Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - protected: diff --git a/src/gp/gp_Pnt.cxx b/src/gp/gp_Pnt.cxx index a3543dd7b1..ac82fb208a 100644 --- a/src/gp/gp_Pnt.cxx +++ b/src/gp/gp_Pnt.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include void gp_Pnt::Transform (const gp_Trsf& T) @@ -86,7 +85,3 @@ gp_Pnt gp_Pnt::Mirrored (const gp_Ax2& A2) const return P; } -void gp_Pnt::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) const -{ - OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &coord); -} diff --git a/src/gp/gp_Pnt.hxx b/src/gp/gp_Pnt.hxx index 58894f45e7..509600961c 100644 --- a/src/gp/gp_Pnt.hxx +++ b/src/gp/gp_Pnt.hxx @@ -174,8 +174,6 @@ public: Standard_NODISCARD gp_Pnt Translated (const gp_Pnt& P1, const gp_Pnt& P2) const; - //! Dumps the content of me into the stream - Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; protected: diff --git a/src/gp/gp_XYZ.cxx b/src/gp/gp_XYZ.cxx index aaf9a3e536..a02fbed913 100644 --- a/src/gp/gp_XYZ.cxx +++ b/src/gp/gp_XYZ.cxx @@ -42,35 +42,3 @@ void gp_XYZ::DumpJson (Standard_OStream& theOStream, const Standard_Integer) con { OCCT_DUMP_VECTOR_CLASS (theOStream, gp_XYZ, 3, x, y, z) } - -//======================================================================= -//function : InitJson -//purpose : -//======================================================================= -Standard_Boolean gp_XYZ::InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos) -{ - OCCT_INIT_VECTOR_CLASS (theSStream, gp_XYZ, theStreamPos, 3, &x, &y, &z) - - //NCollection_IndexedDataMap aValues; - //if (!Standard_Dump::SplitJson (Standard_Dump::Text (theSStream), aValues) || aValues.Size() > 1) - // return Standard_False; - - //if (aValues.FindKey (1).IsEqual (OCCT_CLASS_NAME(gp_XYZ))) - // return Standard_False; - - //NCollection_IndexedMap aValuesList; - - //TCollection_AsciiString aValue = aValues.FindFromIndex (1); - //aValue.Split (Standard_Dump::JsonKeyToString (Standard_JsonKey_SeparatorValueToValue), aValuesList); - - //if (aValuesList.Size() != 3 || - // !aValuesList.FindKey(1).IsRealValue() || !aValuesList.FindKey(2).IsRealValue() || !aValuesList.FindKey(3).IsRealValue()) - // return Standard_False; - - //x = aValuesList.FindKey(1).RealValue(); - //y = aValuesList.FindKey(2).RealValue(); - //z = aValuesList.FindKey(3).RealValue(); - - return Standard_True; -} - diff --git a/src/gp/gp_XYZ.hxx b/src/gp/gp_XYZ.hxx index da45bc41d1..bc2ebdb135 100644 --- a/src/gp/gp_XYZ.hxx +++ b/src/gp/gp_XYZ.hxx @@ -24,7 +24,6 @@ #include #include -#include class Standard_ConstructionError; class Standard_OutOfRange; @@ -331,8 +330,6 @@ public: //! Dumps the content of me into the stream Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = -1) const; - //! Inits the content of me into the stream - Standard_EXPORT Standard_Boolean InitJson (Standard_SStream& theSStream, Standard_Integer& theStreamPos); protected: diff --git a/tools/Convert/Convert_Tools.cxx b/tools/Convert/Convert_Tools.cxx deleted file mode 100644 index e455a7cbeb..0000000000 --- a/tools/Convert/Convert_Tools.cxx +++ /dev/null @@ -1,126 +0,0 @@ -// 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 - -#include -#include -#include -#include -#include -#include -#include - -//======================================================================= -//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(); - } -} diff --git a/tools/Convert/Convert_Tools.hxx b/tools/Convert/Convert_Tools.hxx deleted file mode 100644 index ecce1fdc5f..0000000000 --- a/tools/Convert/Convert_Tools.hxx +++ /dev/null @@ -1,63 +0,0 @@ -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -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 diff --git a/tools/Convert/Convert_TransientShape.cxx b/tools/Convert/Convert_TransientShape.cxx deleted file mode 100644 index 88b41fad41..0000000000 --- a/tools/Convert/Convert_TransientShape.cxx +++ /dev/null @@ -1,18 +0,0 @@ -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(Convert_TransientShape, Standard_Transient) diff --git a/tools/Convert/Convert_TransientShape.hxx b/tools/Convert/Convert_TransientShape.hxx deleted file mode 100644 index b9aaae1d7d..0000000000 --- a/tools/Convert/Convert_TransientShape.hxx +++ /dev/null @@ -1,53 +0,0 @@ -// 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 -#include -#include -#include -#include - -#include - -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 diff --git a/tools/Convert/FILES b/tools/Convert/FILES deleted file mode 100644 index bbcae4a01e..0000000000 --- a/tools/Convert/FILES +++ /dev/null @@ -1,4 +0,0 @@ -Convert_Tools.cxx -Convert_Tools.hxx -Convert_TransientShape.cxx -Convert_TransientShape.hxx diff --git a/tools/DFBrowser/DFBrowser_Window.cxx b/tools/DFBrowser/DFBrowser_Window.cxx index cad3f7c1d4..5801326f84 100644 --- a/tools/DFBrowser/DFBrowser_Window.cxx +++ b/tools/DFBrowser/DFBrowser_Window.cxx @@ -420,11 +420,6 @@ void DFBrowser_Window::Init (const NCollection_List& } return; } - else - { - if (anApplication.IsNull() && CDF_Session::Exists()) - anApplication = Handle(TDocStd_Application)::DownCast (CDF_Session::CurrentSession()->CurrentApplication()); - } myModule = new DFBrowser_Module(); myModule->CreateViewModel (myMainWindow); @@ -664,7 +659,7 @@ void DFBrowser_Window::onExpand() for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) { int aLevels = 2; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); + setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); } QApplication::restoreOverrideCursor(); } @@ -682,7 +677,7 @@ void DFBrowser_Window::onExpandAll() for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) { int aLevels = -1; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); + setExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); } QApplication::restoreOverrideCursor(); } @@ -697,7 +692,7 @@ void DFBrowser_Window::onCollapseAll() QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes(); for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) { int aLevels = -1; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels); + setExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels); } } @@ -993,3 +988,26 @@ void DFBrowser_Window::findPresentations (const QModelIndexList& theIndices, AIS thePresentations.Append (aPresentation); } } + +// ======================================================================= +// function : setExpanded +// purpose : +// ======================================================================= +void DFBrowser_Window::setExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded, + int& theLevels) +{ + bool isToExpand = theLevels == -1 || theLevels > 0; + if (!isToExpand) + return; + + theTreeView->setExpanded (theIndex, isExpanded); + if (theLevels != -1) + theLevels--; + + QAbstractItemModel* aModel = theTreeView->model(); + for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++) + { + int aLevels = theLevels; + setExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels); + } +} diff --git a/tools/DFBrowser/DFBrowser_Window.hxx b/tools/DFBrowser/DFBrowser_Window.hxx index 66f3479735..93fb3d7e0c 100644 --- a/tools/DFBrowser/DFBrowser_Window.hxx +++ b/tools/DFBrowser/DFBrowser_Window.hxx @@ -206,6 +206,13 @@ protected: //! \return container of presentations or NULL void findPresentations (const QModelIndexList& theIndices, AIS_ListOfInteractive& thePresentations); + //! Recursive items expanding in tree view staring from the index + //! \param theTreeView an OCAF tree view + //! \param theParentIndex an index which children should be expanded + //! \param isExpanded a boolean state if the item should be expanded or collapsed + //! \param theLevels a number of levels to be expanded, or -1 for all levels + static void setExpanded (QTreeView* theTreeView, const QModelIndex& theParentIndex, const bool isExpanded, int& theLevels); + private: DFBrowser_Module* myModule; //!< current module diff --git a/tools/ShapeView/FILES b/tools/ShapeView/FILES index 04e8cf77b3..895416efc1 100644 --- a/tools/ShapeView/FILES +++ b/tools/ShapeView/FILES @@ -1,7 +1,6 @@ ShapeView.qrc ShapeView_Communicator.cxx ShapeView_Communicator.hxx -ShapeView_ItemBase.cxx ShapeView_ItemBase.hxx ShapeView_ItemRoot.cxx ShapeView_ItemRoot.hxx diff --git a/tools/ShapeView/ShapeView_ItemBase.cxx b/tools/ShapeView/ShapeView_ItemBase.cxx deleted file mode 100644 index c660eab22b..0000000000 --- a/tools/ShapeView/ShapeView_ItemBase.cxx +++ /dev/null @@ -1,35 +0,0 @@ -// 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 - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant ShapeView_ItemBase::initValue (const int theItemRole) const -{ - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - switch (Column()) - { - case 2: { return rowCount(); } - //case 3: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString(); - case 4: { return Row(); } - } - - return QVariant(); -} diff --git a/tools/ShapeView/ShapeView_ItemBase.hxx b/tools/ShapeView/ShapeView_ItemBase.hxx index 27b09eb925..3e0559c501 100644 --- a/tools/ShapeView/ShapeView_ItemBase.hxx +++ b/tools/ShapeView/ShapeView_ItemBase.hxx @@ -32,11 +32,6 @@ public: //! Resets cached values virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); } - //! Return data value for the role. - //! \param theRole a value role - //! \return the value - Standard_EXPORT virtual QVariant initValue(const int theRole) const; - protected: //! Initialize the current item. It creates a backup of the specific item information diff --git a/tools/ShapeView/ShapeView_ItemShape.cxx b/tools/ShapeView/ShapeView_ItemShape.cxx index 1783cb5115..952534ba4a 100644 --- a/tools/ShapeView/ShapeView_ItemShape.cxx +++ b/tools/ShapeView/ShapeView_ItemShape.cxx @@ -15,17 +15,21 @@ #include -#include -#include +#include +#include +#include -#include +#include +#include +#include -#include +#include +#include #include +#include +#include #include - -#include -#include +#include #include #include @@ -33,32 +37,166 @@ #include // ======================================================================= -// function : GetShape +// function : ToString // purpose : // ======================================================================= -TopoDS_Shape ShapeView_ItemShape::GetShape (const int theRowId) const +QString ToString (const Standard_Boolean& theValue) +{ + return theValue ? "1" : "0"; +} + +// ======================================================================= +// function : ToString +// purpose : +// ======================================================================= +QString ToString (const gp_Pnt& thePoint) { - if (myChildShapes.IsEmpty()) + return QString ("(%1, %2, %3)").arg (thePoint.X()).arg (thePoint.Y()).arg (thePoint.Z()); +} + +// ======================================================================= +// function : ToName +// purpose : +// ======================================================================= +QString ToName (const TopAbs_ShapeEnum& theShapeType) +{ + Standard_SStream aSStream; + TopAbs::Print (theShapeType, aSStream); + return QString (aSStream.str().c_str()); +} + +// ======================================================================= +// function : ToName +// purpose : +// ======================================================================= +QString ToName (const TopAbs_Orientation& theOrientation) +{ + Standard_SStream aSStream; + TopAbs::Print(theOrientation, aSStream); + return QString (aSStream.str().c_str()); +} + +// ======================================================================= +// function : ToName +// purpose : +// ======================================================================= +QString ToName (const GeomAbs_Shape& theType) +{ + switch (theType) { - ShapeView_ItemShape* aThis = (ShapeView_ItemShape*)this; + case GeomAbs_C0: return "GeomAbs_C0"; + case GeomAbs_G1: return "GeomAbs_G1"; + case GeomAbs_C1: return "GeomAbs_C1"; + case GeomAbs_G2: return "GeomAbs_G2"; + case GeomAbs_C2: return "GeomAbs_C2"; + case GeomAbs_C3: return "GeomAbs_C3"; + case GeomAbs_CN: return "GeomAbs_CN"; + default: break; + } + return QString(); +} - if (myExplodeType != TopAbs_SHAPE) - { - TopExp::MapShapes(myShape, myExplodeType, aThis->myChildShapes); - } - else +// ======================================================================= +// function : ToOtherInfo +// purpose : +// ======================================================================= +void ToOtherInfo (const TopoDS_Shape& theShape, QVariant& theValue, QVariant& theInfo) +{ + switch (theShape.ShapeType()) + { + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + case TopAbs_SOLID: + case TopAbs_SHELL: + case TopAbs_FACE: + case TopAbs_WIRE: + break; + case TopAbs_EDGE: { - TopoDS_Iterator aSubShapeIt (myShape); - for (int aCurrentIndex = 0; aSubShapeIt.More(); aSubShapeIt.Next(), aCurrentIndex++) + TopoDS_Edge anEdge = TopoDS::Edge(theShape); + double aFirst, aLast; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); + + GeomAdaptor_Curve aAdaptor(aCurve, aFirst, aLast); + gp_Pnt aFirstPnt = aAdaptor.Value(aFirst); + gp_Pnt aLastPnt = aAdaptor.Value(aLast); + + BRepAdaptor_Curve aBRepAdaptor = BRepAdaptor_Curve(anEdge); + Adaptor3d_Curve* anAdaptor3d = &aBRepAdaptor; + + QStringList aValues, anInfo; + aValues.append (QString::number (GCPnts_AbscissaPoint::Length(*anAdaptor3d))); + anInfo.append ("Length"); + + aValues.append (aCurve->DynamicType()->Name()); + anInfo.append ("DynamicType"); + + aValues.append (ToString (aFirstPnt)); + anInfo.append (QString ("First" + QString::number (aFirst))); + + aValues.append (ToString (aLastPnt)); + anInfo.append (QString ("Last" + QString::number (aLast))); + + aValues.append (ToName (aCurve->Continuity())); + anInfo.append ("Continuity"); + + aValues.append (ToString (aCurve->IsClosed())); + anInfo.append ("IsClosed"); + + if (aCurve->IsPeriodic()) { + aValues.append (QString::number (aCurve->Period())); + anInfo.append ("IsPeriodic"); + } + else { - aThis->myChildShapes.Add (aSubShapeIt.Value()); + aValues.append (ToString (aCurve->IsPeriodic())); + anInfo.append ("IsPeriodic"); } + theValue = aValues.join (" / "); + theInfo = QString ("%1:\n%2").arg (anInfo.join (" / ")).arg (aValues.join ("\n")); + break; } + case TopAbs_SHAPE: + default: + break; } - if (myChildShapes.Extent() >= theRowId + 1) - return myChildShapes(theRowId + 1); +} + +// ======================================================================= +// function : locationInfo +// purpose : +// ======================================================================= +QString locationInfo (const TopLoc_Location& theLocation) +{ + QString anInfo; - return TopoDS_Shape(); + gp_Trsf aTrsf = theLocation.Transformation(); + QStringList aValues, aRowValues; + for (int aRowId = 1; aRowId <= 3; aRowId++) + { + aRowValues.clear(); + for (int aColumnId = 1; aColumnId <= 4; aColumnId++) + aRowValues.append (QString::number (aTrsf.Value(aRowId, aColumnId))); + aValues.append (aRowValues.join (",")); + } + anInfo.append (aValues.join (" ")); + return anInfo; +} + +// ======================================================================= +// function : GetShape +// purpose : +// ======================================================================= +TopoDS_Shape ShapeView_ItemShape::GetShape (const int theRowId) const +{ + TopoDS_Iterator aSubShapeIt (myShape); + for (int aCurrentIndex = 0; aSubShapeIt.More(); aSubShapeIt.Next(), aCurrentIndex++) + { + if (aCurrentIndex != theRowId) + continue; + break; + } + return aSubShapeIt.Value(); } // ======================================================================= @@ -67,10 +205,6 @@ TopoDS_Shape ShapeView_ItemShape::GetShape (const int theRowId) const // ======================================================================= QVariant ShapeView_ItemShape::initValue(const int theRole) const { - QVariant aParentValue = ShapeView_ItemBase::initValue (theRole); - if (aParentValue.isValid()) - return aParentValue; - TopoDS_Shape aShape = getShape(); if (aShape.IsNull()) return QVariant(); @@ -80,11 +214,58 @@ QVariant ShapeView_ItemShape::initValue(const int theRole) const switch (Column()) { - case 0: return TopAbs::ShapeTypeToString (aShape.ShapeType()); - //case 2: return rowCount() > 0 ? QVariant (rowCount()) : QVariant(); + case 0: return ToName (aShape.ShapeType()); + case 2: return rowCount() > 0 ? QVariant (rowCount()) : QVariant(); case 3: return TShapePointer().ToCString(); - case 5: return TopAbs::ShapeOrientationToString (aShape.Orientation()); - case 6: return ViewControl_Tools::ToString (aShape.Location()).ToCString(); + case 4: return ToName(aShape.Orientation()); + case 5: return locationInfo(aShape.Location()); + case 6: return ToString (aShape.Checked()); + case 7: return ToString (aShape.Closed()); + case 8: return ToString (aShape.Infinite()); + case 9: return ToString (aShape.Locked()); + case 10: return ToString (aShape.Modified()); + case 11: return ToString (aShape.Orientable()); + case 12: + { + if (aShape.ShapeType() != TopAbs_VERTEX) + return QVariant(); + TopoDS_Vertex aVertex = TopoDS::Vertex (aShape); + gp_Pnt aPoint = BRep_Tool::Pnt (aVertex); + return ToString (aPoint); + } + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + { + if (aShape.ShapeType() != TopAbs_EDGE) + return QVariant(); + + TopoDS_Edge anEdge = TopoDS::Edge(aShape); + double aFirst, aLast; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast); + + GeomAdaptor_Curve aAdaptor(aCurve, aFirst, aLast); + gp_Pnt aFirstPnt = aAdaptor.Value(aFirst); + gp_Pnt aLastPnt = aAdaptor.Value(aLast); + + BRepAdaptor_Curve aBRepAdaptor = BRepAdaptor_Curve(anEdge); + Adaptor3d_Curve* anAdaptor3d = &aBRepAdaptor; + + switch (Column()) + { + case 13: return QString::number (GCPnts_AbscissaPoint::Length(*anAdaptor3d)); + case 14: return aCurve->DynamicType()->Name(); + case 15: return ToString (aFirstPnt); + case 16: return ToString (aLastPnt); + case 17: return ToName (aCurve->Continuity()); + case 18: return ToString (aCurve->IsClosed()); + case 19: return aCurve->IsPeriodic() ? QString::number (aCurve->Period()) : ToString (aCurve->IsPeriodic()); + } + } default: break; } return QVariant(); @@ -101,17 +282,8 @@ int ShapeView_ItemShape::initRowCount() const return 0; int aRowsCount = 0; - if (myExplodeType != TopAbs_SHAPE) - { - TopTools_IndexedMapOfShape aSubShapes; - TopExp::MapShapes(aShape, myExplodeType, aSubShapes); - aRowsCount = aSubShapes.Extent(); - } - else - { - for (TopoDS_Iterator aSubShapeIt(aShape); aSubShapeIt.More(); aSubShapeIt.Next()) - aRowsCount++; - } + for (TopoDS_Iterator aSubShapeIt(aShape); aSubShapeIt.More(); aSubShapeIt.Next()) + aRowsCount++; return aRowsCount; } @@ -133,8 +305,6 @@ void ShapeView_ItemShape::Init() ShapeView_ItemRootPtr aRootItem = itemDynamicCast (Parent()); ShapeView_ItemShapePtr aShapeItem = itemDynamicCast (Parent()); myShape = aRootItem ? aRootItem->GetShape (Row()) : aShapeItem->GetShape (Row()); - - //SetProperties (createItemProperties()); } // ======================================================================= @@ -178,8 +348,6 @@ TCollection_AsciiString ShapeView_ItemShape::getPointerInfo (const Handle(Standa void ShapeView_ItemShape::Reset() { myFileName = QString(); - myChildShapes.Clear(); - myShape = TopoDS_Shape(); ShapeView_ItemBase::Reset(); } @@ -194,3 +362,4 @@ void ShapeView_ItemShape::initItem() const return; const_cast(this)->Init(); } + diff --git a/tools/ShapeView/ShapeView_ItemShape.hxx b/tools/ShapeView/ShapeView_ItemShape.hxx index 24cbb8bd89..b04076956e 100644 --- a/tools/ShapeView/ShapeView_ItemShape.hxx +++ b/tools/ShapeView/ShapeView_ItemShape.hxx @@ -17,12 +17,8 @@ #define ShapeView_ItemShape_H #include - -#include - #include #include -#include #include #include @@ -50,13 +46,6 @@ public: //! Destructor virtual ~ShapeView_ItemShape() Standard_OVERRIDE {}; - //! Sets explore type - //! \param theType type of item explode. If TopAbs_SHAPE, no expode, only iteration by shape - void SetExplodeType (const TopAbs_ShapeEnum theType) { myExplodeType = theType; } - - //! Returns expode type of the item - TopAbs_ShapeEnum GetExplodeType() const { return myExplodeType; } - //! Returns the current shape const TopoDS_Shape& GetItemShape() const { initItem(); return myShape; } @@ -119,16 +108,13 @@ protected: private: //! Constructor - ShapeView_ItemShape (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : ShapeView_ItemBase (theParent, theRow, theColumn), myExplodeType (TopAbs_SHAPE) {} + ShapeView_ItemShape(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + : ShapeView_ItemBase(theParent, theRow, theColumn) {} private: - TopAbs_ShapeEnum myExplodeType; //!< type of explore own shape and get children TopoDS_Shape myShape; //!< current shape QString myFileName; //!< BREP file name - - TopTools_IndexedMapOfShape myChildShapes; //! cached container of child shapes }; #endif diff --git a/tools/ShapeView/ShapeView_Tools.cxx b/tools/ShapeView/ShapeView_Tools.cxx index 9762e1bcd2..afa6de4571 100644 --- a/tools/ShapeView/ShapeView_Tools.cxx +++ b/tools/ShapeView/ShapeView_Tools.cxx @@ -14,19 +14,11 @@ // commercial license or contractual agreement. #include -#include - -#include #include -#include - -#include -#include - -#include -#include +#include +#include // ======================================================================= // function : ReadShape // purpose : @@ -39,88 +31,3 @@ TopoDS_Shape ShapeView_Tools::ReadShape (const TCollection_AsciiString& theFileN BRepTools::Read (aShape, theFileName.ToCString(), aBuilder); return aShape; } - -// ======================================================================= -// function : IsPossibleToExplode -// purpose : -// ======================================================================= -Standard_Boolean ShapeView_Tools::IsPossibleToExplode (const TopoDS_Shape& theShape, - NCollection_List& theExplodeTypes) -{ - TopAbs_ShapeEnum aShapeType = theShape.ShapeType(); - - if (!theExplodeTypes.Contains (aShapeType)) - theExplodeTypes.Append(aShapeType); - - if (theExplodeTypes.Extent() == TopAbs_SHAPE + 1) // all types are collected, stop - return Standard_True; - - TopoDS_Iterator aSubShapeIt (theShape); - for (int aCurrentIndex = 0; aSubShapeIt.More(); aSubShapeIt.Next(), aCurrentIndex++) - { - if (IsPossibleToExplode (aSubShapeIt.Value(), theExplodeTypes)) - return Standard_True; - } - return Standard_False; -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -QString ShapeView_Tools::ToString (const Standard_Boolean& theValue) -{ - return theValue ? "1" : "0"; -} - -// ======================================================================= -// function : ToName -// purpose : -// ======================================================================= -QString ShapeView_Tools::ToName (const GeomAbs_Shape& theType) -{ - switch (theType) - { - case GeomAbs_C0: return "GeomAbs_C0"; - case GeomAbs_G1: return "GeomAbs_G1"; - case GeomAbs_C1: return "GeomAbs_C1"; - case GeomAbs_G2: return "GeomAbs_G2"; - case GeomAbs_C2: return "GeomAbs_C2"; - case GeomAbs_C3: return "GeomAbs_C3"; - case GeomAbs_CN: return "GeomAbs_CN"; - default: break; - } - return QString(); -} - -// ======================================================================= -// function : GetShapeGlobalPropertiesCount -// purpose : -// ======================================================================= -int ShapeView_Tools::GetShapeGlobalPropertiesCount() -{ - return 6; -} - -// ======================================================================= -// function : GetShapeGlobalProperties -// purpose : -// ======================================================================= -QVariant ShapeView_Tools::GetShapeGlobalProperties (const TopoDS_Shape& theShape, - const int theRow, - const int theColumn) -{ - bool isFirstColumn = theColumn == 0; - - switch (theRow) - { - case 0: return isFirstColumn ? "COMMON PROPERTIES" : ""; - case 1: return isFirstColumn ? "Checked" : ToString (theShape.Checked()); - case 2: return isFirstColumn ? "Closed" : ToString (theShape.Closed()); - case 3: return isFirstColumn ? "Infinite" : ToString (theShape.Infinite()); - case 4: return isFirstColumn ? "Locked" : ToString (theShape.Locked()); - case 5: return isFirstColumn ? "Modified" : ToString (theShape.Modified()); - case 6: return isFirstColumn ? "Orientable" : ToString (theShape.Orientable()); - } - return QVariant(); -} \ No newline at end of file diff --git a/tools/ShapeView/ShapeView_Tools.hxx b/tools/ShapeView/ShapeView_Tools.hxx index 592aa81bb9..a922e42b36 100644 --- a/tools/ShapeView/ShapeView_Tools.hxx +++ b/tools/ShapeView/ShapeView_Tools.hxx @@ -18,21 +18,10 @@ #include -#include - -#include #include #include #include -#include - -#include -#include -#include -#include -#include - //! \class ShapeView_Tools //! It gives auxiliary methods for TopoDS_Shape manipulation class ShapeView_Tools @@ -43,32 +32,6 @@ public: //! \param theFileName a file name //! \return shape or NULL Standard_EXPORT static TopoDS_Shape ReadShape (const TCollection_AsciiString& theFileName); - - //! Checks whether it is possible to expode the shape. The search is recursive untill all types are collected. - //! \param theShape source shape object - //! \param theExplodeTypes container of possible shape types to be exploded - //! \return true if explode is finished, all types are collected. - Standard_EXPORT static Standard_Boolean IsPossibleToExplode(const TopoDS_Shape& theShape, - NCollection_List& theExplodeTypes); - - //! Returns count of gloal properties (6) - //! \return count value - Standard_EXPORT static int GetShapeGlobalPropertiesCount(); - - //! Returns shape global property by row/column - //! \param theShape investigated shape - //! \param theRow row index in [0, 6] - //! \param theColumn column index in [0, 1] - Standard_EXPORT static QVariant GetShapeGlobalProperties (const TopoDS_Shape& theShape, - const int theRow, - const int theColumn); - - //! Returns text presentation of boolean value - Standard_EXPORT static QString ToString (const Standard_Boolean& theValue); - - //! Returns shape type name - Standard_EXPORT static QString ToName (const GeomAbs_Shape& theType); - }; #endif diff --git a/tools/ShapeView/ShapeView_TreeModel.cxx b/tools/ShapeView/ShapeView_TreeModel.cxx index 8b39f592cd..bc29c119ae 100644 --- a/tools/ShapeView/ShapeView_TreeModel.cxx +++ b/tools/ShapeView/ShapeView_TreeModel.cxx @@ -38,9 +38,25 @@ ShapeView_TreeModel::ShapeView_TreeModel (QObject* theParent) // column 1 is reserved for visiblity state SetHeaderItem (2, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH)); SetHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH)); - SetHeaderItem (4, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH)); - SetHeaderItem (5, TreeModel_HeaderSection ("Orientation", COLUMN_ORIENTATION_WIDTH)); - SetHeaderItem (6, TreeModel_HeaderSection ("Location", COLUMN_LOCATION_WIDTH)); + SetHeaderItem (4, TreeModel_HeaderSection ("Orientation", COLUMN_ORIENTATION_WIDTH)); + SetHeaderItem (5, TreeModel_HeaderSection ("Location", COLUMN_LOCATION_WIDTH)); + + SetHeaderItem (6, TreeModel_HeaderSection ("Checked", -1, true)); + SetHeaderItem (7, TreeModel_HeaderSection ("Closed", -1, true)); + SetHeaderItem (8, TreeModel_HeaderSection ("Infinite", -1, true)); + SetHeaderItem (9, TreeModel_HeaderSection ("Locked", -1, true)); + SetHeaderItem (10, TreeModel_HeaderSection ("Modified", -1, true)); + SetHeaderItem (11, TreeModel_HeaderSection ("Orientable", -1, true)); + + SetHeaderItem (12, TreeModel_HeaderSection ("VERTEX: (X, Y, Z)", -1, true)); + + SetHeaderItem (13, TreeModel_HeaderSection ("EDGE: Length", -1, true)); + SetHeaderItem (14, TreeModel_HeaderSection ("DynamicType", -1, true)); + SetHeaderItem (15, TreeModel_HeaderSection ("First", -1, true)); + SetHeaderItem (16, TreeModel_HeaderSection ("Last", -1, true)); + SetHeaderItem (17, TreeModel_HeaderSection ("Continuity", -1, true)); + SetHeaderItem (18, TreeModel_HeaderSection ("IsClosed", -1, true)); + SetHeaderItem (19, TreeModel_HeaderSection ("IsPeriodic", -1, true)); } // ======================================================================= diff --git a/tools/ShapeView/ShapeView_Window.cxx b/tools/ShapeView/ShapeView_Window.cxx index 9d4ec97dfd..76eaefa6b4 100644 --- a/tools/ShapeView/ShapeView_Window.cxx +++ b/tools/ShapeView/ShapeView_Window.cxx @@ -22,7 +22,6 @@ #include #include -#include #include #include @@ -40,7 +39,6 @@ #include #include -#include #include #include @@ -97,39 +95,17 @@ ShapeView_Window::ShapeView_Window (QWidget* theParent) this, SLOT (onTreeViewContextMenuRequested (const QPoint&))); new TreeModel_ContextMenu (myTreeView); ShapeView_TreeModel* aModel = new ShapeView_TreeModel (myTreeView); - for (int i = 5; i <= 6; i++) // hide shape parameters columns - { - TreeModel_HeaderSection anItem = aModel->GetHeaderItem (i); - anItem.SetIsHidden (true); - aModel->SetHeaderItem (i, anItem); - } - - myTreeView->setModel (aModel); ShapeView_VisibilityState* aVisibilityState = new ShapeView_VisibilityState (aModel); aModel->SetVisibilityState (aVisibilityState); TreeModel_Tools::UseVisibilityColumn (myTreeView); - QItemSelectionModel* aSelModel = new QItemSelectionModel (myTreeView->model(), myTreeView); - myTreeView->setSelectionModel (aSelModel); - connect (aSelModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT (onTreeViewSelectionChanged (const QItemSelection&, const QItemSelection&))); - QModelIndex aParentIndex = myTreeView->model()->index (0, 0); myTreeView->setExpanded (aParentIndex, true); myMainWindow->setCentralWidget (myTreeView); - // property view - myPropertyView = new ViewControl_PropertyView (myMainWindow, - QSize(SHAPEVIEW_DEFAULT_VIEW_WIDTH, SHAPEVIEW_DEFAULT_VIEW_HEIGHT)); - myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow); - myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle()); - myPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow)); - myPropertyPanelWidget->setWidget (myPropertyView->GetControl()); - myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget); - // view - myViewWindow = new View_Window (myMainWindow, NULL, false); + myViewWindow = new View_Window (myMainWindow, false); connect (myViewWindow, SIGNAL(eraseAllPerformed()), this, SLOT(onEraseAllPerformed())); aVisibilityState->SetDisplayer (myViewWindow->GetDisplayer()); aVisibilityState->SetPresentationType (View_PresentationType_Main); @@ -141,8 +117,6 @@ ShapeView_Window::ShapeView_Window (QWidget* theParent) aViewDockWidget->setTitleBarWidget (myViewWindow->GetViewToolBar()->GetControl()); myMainWindow->addDockWidget (Qt::RightDockWidgetArea, aViewDockWidget); - myMainWindow->splitDockWidget(myPropertyPanelWidget, aViewDockWidget, Qt::Vertical); - myMainWindow->resize (DEFAULT_SHAPE_VIEW_WIDTH, DEFAULT_SHAPE_VIEW_HEIGHT); myMainWindow->move (DEFAULT_SHAPE_VIEW_POSITION_X, DEFAULT_SHAPE_VIEW_POSITION_Y); } @@ -381,54 +355,12 @@ void ShapeView_Window::onTreeViewContextMenuRequested (const QPoint& thePosition aMenu->addAction (ViewControl_Tools::CreateAction ("BREP view", SLOT (onBREPView()), myMainWindow, this)); aMenu->addAction (ViewControl_Tools::CreateAction ("Close All BREP views", SLOT (onCloseAllBREPViews()), myMainWindow, this)); aMenu->addAction (ViewControl_Tools::CreateAction ("BREP directory", SLOT (onBREPDirectory()), myMainWindow, this)); - aMenu->addAction (ViewControl_Tools::CreateAction ("ShapeFix_Shape", SLOT (onShapeFixShape()), myMainWindow, this)); - - ShapeView_ItemShapePtr aShapeItem = itemDynamicCast(anItemBase); - const TopoDS_Shape& aShape = aShapeItem->GetItemShape(); - TopAbs_ShapeEnum anExplodeType = aShapeItem->GetExplodeType(); - NCollection_List anExplodeTypes; - ShapeView_Tools::IsPossibleToExplode (aShape, anExplodeTypes); - if (anExplodeTypes.Size() > 0) - { - QMenu* anExplodeMenu = aMenu->addMenu ("Explode"); - for (NCollection_List::Iterator anExpIterator (anExplodeTypes); anExpIterator.More(); - anExpIterator.Next()) - { - TopAbs_ShapeEnum aType = anExpIterator.Value(); - QAction* anAction = ViewControl_Tools::CreateAction (TopAbs::ShapeTypeToString (aType), SLOT (onExplode()), myMainWindow, this); - anExplodeMenu->addAction (anAction); - if (anExplodeType == aType) - { - anAction->setCheckable (true); - anAction->setChecked (true); - } - } - QAction* anAction = ViewControl_Tools::CreateAction ("NONE", SLOT (onExplode()), myMainWindow, this); - anExplodeMenu->addSeparator(); - anExplodeMenu->addAction (anAction); - } } QPoint aPoint = myTreeView->mapToGlobal (thePosition); aMenu->exec (aPoint); } -// ======================================================================= -// function : -// onTreeViewSelectionChanged -// purpose : -// ======================================================================= -void ShapeView_Window::onTreeViewSelectionChanged (const QItemSelection&, - const QItemSelection&) -{ - QApplication::setOverrideCursor (Qt::WaitCursor); - - if (myPropertyPanelWidget->toggleViewAction()->isChecked()) - updatePropertyPanelBySelection(); - - QApplication::restoreOverrideCursor(); -} - // ======================================================================= // function : onEraseAllPerformed // purpose : @@ -457,78 +389,6 @@ void ShapeView_Window::onBREPDirectory() viewFile (aFileName); } -// ======================================================================= -// function : onExplode -// purpose : -// ======================================================================= -void ShapeView_Window::onShapeFixShape() -{ - QItemSelectionModel* aModel = myTreeView->selectionModel(); - if (!aModel) - return; - - QModelIndex anIndex = TreeModel_ModelBase::SingleSelected(aModel->selectedIndexes(), 0); - TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex(anIndex); - if (!anItemBase) - return; - - ShapeView_ItemShapePtr aShapeItem = itemDynamicCast(anItemBase); - if (!aShapeItem) - return; - - const TopoDS_Shape aShape = aShapeItem->GetItemShape(); - - Standard_Real LinTol = Precision::Confusion(); - - Handle(ShapeFix_Shape) Fixer = new ShapeFix_Shape (aShape); - Fixer->SetPrecision (LinTol); - Fixer->SetMaxTolerance (LinTol); - Fixer->Perform(); - - TopoDS_Shape aFixedShape = Fixer->Shape(); - addShape (aFixedShape); -} - -// ======================================================================= -// function : onExplode -// purpose : -// ======================================================================= -void ShapeView_Window::onExplode() -{ - QItemSelectionModel* aModel = myTreeView->selectionModel(); - if (!aModel) - return; - - QModelIndex anIndex = TreeModel_ModelBase::SingleSelected(aModel->selectedIndexes(), 0); - TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex(anIndex); - if (!anItemBase) - return; - - ShapeView_ItemShapePtr aShapeItem = itemDynamicCast(anItemBase); - if (!aShapeItem) - return; - - QAction* anAction = (QAction*)sender(); - if (!anAction) - return; - - QApplication::setOverrideCursor (Qt::WaitCursor); - TopAbs_ShapeEnum aShapeType; - if (anAction->text() == "NONE") - aShapeType = TopAbs_SHAPE; - else - aShapeType = TopAbs::ShapeTypeFromString(anAction->text().toStdString().c_str()); - - myViewWindow->GetDisplayer()->EraseAllPresentations(); - aShapeItem->SetExplodeType(aShapeType); - - //anItemBase->Parent()->Reset(); - TODO (update only modified sub-tree) - ShapeView_TreeModel* aTreeModel = dynamic_cast (myTreeView->model()); - aTreeModel->Reset(); - aTreeModel->EmitLayoutChanged(); - QApplication::restoreOverrideCursor(); -} - // ======================================================================= // function : onLoadFile // purpose : @@ -539,12 +399,8 @@ void ShapeView_Window::onLoadFile() QString aFileName = ShapeView_OpenFileDialog::OpenFile(0, aDataDirName); aFileName = QDir().toNativeSeparators (aFileName); - if (aFileName.isEmpty()) - return; - - QApplication::setOverrideCursor (Qt::WaitCursor); + if (!aFileName.isEmpty()) onOpenFile(aFileName); - QApplication::restoreOverrideCursor(); } // ======================================================================= @@ -650,28 +506,6 @@ void ShapeView_Window::viewFile (const QString& theFileName) QApplication::restoreOverrideCursor(); } - -// ======================================================================= -// function : updatePropertyPanelBySelection -// purpose : -// ======================================================================= -void ShapeView_Window::updatePropertyPanelBySelection() -{ - /*QItemSelectionModel* aModel = myTreeView->selectionModel(); - if (!aModel) - return; - - QModelIndexList aSelected = TreeModel_ModelBase::GetSelected (aModel->selectedIndexes(), 0); - QList aTableValues; - - if (aSelected.size() == 1) - { - TreeModel_ItemBasePtr aSelectedItem = TreeModel_ModelBase::GetItemByIndex(aSelected.first()); - ShapeView_Tools::GetPropertyTableValues (aSelectedItem, aTableValues); - } - myPropertyView->Init (aTableValues);*/ -} - // ======================================================================= // function : removeBREPFiles // purpose : diff --git a/tools/ShapeView/ShapeView_Window.hxx b/tools/ShapeView/ShapeView_Window.hxx index 4ff8cd245f..39274f8939 100644 --- a/tools/ShapeView/ShapeView_Window.hxx +++ b/tools/ShapeView/ShapeView_Window.hxx @@ -33,10 +33,7 @@ class View_Window; -class ViewControl_PropertyView; - class QAction; -class QDockWidget; class QMainWindow; class QWidget; @@ -111,24 +108,12 @@ protected slots: //! \param thePosition a clicked point void onTreeViewContextMenuRequested (const QPoint& thePosition); - //! Processes selection in tree view: make presentation or owner selected in the context if corresponding - //! check box is checked - //! \param theSelected a selected items - //! \param theDeselected a deselected items - void onTreeViewSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); - //! Updates visibility states by erase all in context void onEraseAllPerformed(); //! Exports shape to BREP file and view result file void onBREPDirectory(); - //! Perform shape fix for the selected shape. Result is a new shape in the tree. - void onShapeFixShape(); - - //! Set the shape item exploded - void onExplode(); - //! Removes all shapes in tree view void onClearView() { RemoveAllShapes(); } @@ -150,9 +135,6 @@ protected slots: protected: - //! Updates property panel content by item selected in tree view. - void updatePropertyPanelBySelection(); - //! Views file name content in a text editor. It creates new Qt free control with content. //! \param theFileName a file name void viewFile (const QString& theFileName); @@ -178,9 +160,6 @@ private: QMainWindow* myMainWindow; //!< main control, parent for all ShapeView controls - QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget - ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist - View_Window* myViewWindow; //!< OCC 3d view to visualize presentations QTreeView* myTreeView; //!< tree view visualized shapes diff --git a/tools/TInspector/TInspector_Window.cxx b/tools/TInspector/TInspector_Window.cxx index d2903af8a7..8bb89ab31a 100644 --- a/tools/TInspector/TInspector_Window.cxx +++ b/tools/TInspector/TInspector_Window.cxx @@ -42,7 +42,7 @@ const int TINSPECTOR_DEFAULT_WIDTH = 650; const int TINSPECTOR_DEFAULT_HEIGHT = 500;//350; -const int TINSPECTOR_DEFAULT_POSITION_X = 100;//200; +const int TINSPECTOR_DEFAULT_POSITION_X = 200; const int TINSPECTOR_DEFAULT_POSITION_Y = 60; // ======================================================================= diff --git a/tools/TInspectorEXE/TInspectorEXE.cxx b/tools/TInspectorEXE/TInspectorEXE.cxx index b3f1a5ad37..10dcf4b845 100644 --- a/tools/TInspectorEXE/TInspectorEXE.cxx +++ b/tools/TInspectorEXE/TInspectorEXE.cxx @@ -18,7 +18,6 @@ #include -#include #include #include @@ -66,7 +65,7 @@ void setPluginSampleDirectory (const TCollection_AsciiString& theName, TInspecto aFileName = fileNameInDataDir ("CSF_OCCTDataPath", "occ/hammer.brep"); else if (theName.IsEqual ("TKVInspector")) { - //aFileName = fileNameInDataDir ("CSF_OCCTDataPath", "occ/face1.brep"); + aFileName = fileNameInDataDir ("CSF_OCCTDataPath", "occ/face1.brep"); anAdditionalFileName = fileNameInDataDir ("CSF_OCCTDataPath", "occ/face2.brep"); } aRecentlyOpenedFiles.append (aFileName.ToCString()); @@ -104,9 +103,6 @@ int main (int argc, char** argv) if (!strcmp (argv[anArgId], "vinspector")) aPlugins.insert ("TKVInspector"); - - if (!strcmp (argv[anArgId], "messageview")) - aPlugins.insert ("TKMessageView"); } NCollection_List aParameters; @@ -126,13 +122,7 @@ int main (int argc, char** argv) aPlugins.insert("TKShapeView"); aPlugins.insert("TKVInspector"); - //Handle(Message_Report) aReport = Message_Report::CurrentReport (Standard_True); - //aReport->SetLimit (100);//30); - //aReport->SetActive (Standard_True);//Standard_False); - //aPlugins.insert("TKMessageView"); - - anActivatedPluginName = "TKVInspector"; - //anActivatedPluginName = "TKMessageView"; + anActivatedPluginName = "TKDFBrowser"; } else anActivatedPluginName = *aPlugins.rbegin(); diff --git a/tools/TKTInspectorAPI/EXTERNLIB b/tools/TKTInspectorAPI/EXTERNLIB index fd85421be9..df0002f9af 100644 --- a/tools/TKTInspectorAPI/EXTERNLIB +++ b/tools/TKTInspectorAPI/EXTERNLIB @@ -1,7 +1,4 @@ TKG3d TKernel TKLCAF -TKMath -TKBRep -TKTopAlgo -TKPrim +TKMath \ No newline at end of file diff --git a/tools/TKTInspectorAPI/PACKAGES b/tools/TKTInspectorAPI/PACKAGES index 72bf985bde..7cb3cd210e 100644 --- a/tools/TKTInspectorAPI/PACKAGES +++ b/tools/TKTInspectorAPI/PACKAGES @@ -1,3 +1 @@ -Convert TInspectorAPI - diff --git a/tools/TKTreeModel/CMakeLists.txt b/tools/TKTreeModel/CMakeLists.txt index de376fe964..99fc025494 100644 --- a/tools/TKTreeModel/CMakeLists.txt +++ b/tools/TKTreeModel/CMakeLists.txt @@ -1,7 +1,5 @@ project(TKTreeModel) -add_definitions("-D__ViewControl_DLL") - OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool) OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit) OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit_prepare_tool) diff --git a/tools/TKTreeModel/EXTERNLIB b/tools/TKTreeModel/EXTERNLIB index 74b7426c22..893b52c708 100644 --- a/tools/TKTreeModel/EXTERNLIB +++ b/tools/TKTreeModel/EXTERNLIB @@ -1,6 +1 @@ -TKernel -TKMath -TKPrim -TKTopAlgo -TKTInspectorAPI CSF_QT \ No newline at end of file diff --git a/tools/TKView/EXTERNLIB b/tools/TKView/EXTERNLIB index 72cf33304f..b5f64414c0 100644 --- a/tools/TKView/EXTERNLIB +++ b/tools/TKView/EXTERNLIB @@ -4,5 +4,4 @@ TKMath TKService TKOpenGl TKV3d -TKTInspectorAPI CSF_QT \ No newline at end of file diff --git a/tools/ToolsDraw/ToolsDraw.cxx b/tools/ToolsDraw/ToolsDraw.cxx index 618620f544..e03dd5b61e 100644 --- a/tools/ToolsDraw/ToolsDraw.cxx +++ b/tools/ToolsDraw/ToolsDraw.cxx @@ -40,15 +40,6 @@ Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS(); static TInspector_Communicator* MyCommunicator; -// ======================================================================= -// function : GetCommunicator -// purpose : defines plugin library name by the command argument -// ======================================================================= -TInspector_Communicator* ToolsDraw::GetCommunicator() -{ - return MyCommunicator; -} - // ======================================================================= // function : convertToPluginName // purpose : defines plugin library name by the command argument diff --git a/tools/ToolsDraw/ToolsDraw.hxx b/tools/ToolsDraw/ToolsDraw.hxx index 376361289f..b004ad50df 100644 --- a/tools/ToolsDraw/ToolsDraw.hxx +++ b/tools/ToolsDraw/ToolsDraw.hxx @@ -20,8 +20,6 @@ #include #include -class TInspector_Communicator; - //! \class ToolsDraw //! \brief Registers DRAW commands to connect to TInspector tools class ToolsDraw @@ -38,8 +36,6 @@ public: //! \param theCommands Standard_EXPORT static void Commands (Draw_Interpretor& theCommands); - Standard_EXPORT static TInspector_Communicator* GetCommunicator(); - private: }; diff --git a/tools/TreeModel/FILES b/tools/TreeModel/FILES index 6171019848..2eeab8f369 100644 --- a/tools/TreeModel/FILES +++ b/tools/TreeModel/FILES @@ -6,11 +6,7 @@ TreeModel_ContextMenu.hxx TreeModel_HeaderSection.hxx TreeModel_ItemBase.cxx TreeModel_ItemBase.hxx -TreeModel_ItemProperties.cxx -TreeModel_ItemProperties.hxx TreeModel_ItemRole.hxx -TreeModel_ItemStream.cxx -TreeModel_ItemStream.hxx TreeModel_ModelBase.cxx TreeModel_ModelBase.hxx TreeModel_Tools.cxx diff --git a/tools/TreeModel/TreeModel_HeaderSection.hxx b/tools/TreeModel/TreeModel_HeaderSection.hxx index dd57708c91..5ea9ca1e4f 100644 --- a/tools/TreeModel/TreeModel_HeaderSection.hxx +++ b/tools/TreeModel/TreeModel_HeaderSection.hxx @@ -41,11 +41,6 @@ public: //! Destructor ~TreeModel_HeaderSection() {} - //! Returns whether the header section is not initialized with values. - //! The check is empty value of the name text - //! \return boolean value - bool IsEmpty() const { return myName.isEmpty(); } - //! Sets text value //! \theName text value void SetName (const QString& theName) { myName = theName; } diff --git a/tools/TreeModel/TreeModel_ItemBase.cxx b/tools/TreeModel/TreeModel_ItemBase.cxx index 09c1735db0..464a788863 100644 --- a/tools/TreeModel/TreeModel_ItemBase.cxx +++ b/tools/TreeModel/TreeModel_ItemBase.cxx @@ -14,10 +14,9 @@ // commercial license or contractual agreement. #include + #include -#include -#include #include #include #include @@ -27,7 +26,7 @@ // purpose : // ======================================================================= TreeModel_ItemBase::TreeModel_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : m_bInitialized (false), m_iStreamChildren (0) + : m_bInitialized (false) { m_pParent = theParent; m_iRow = theRow; @@ -35,7 +34,7 @@ TreeModel_ItemBase::TreeModel_ItemBase (TreeModel_ItemBasePtr theParent, const i } // ======================================================================= -// function : Reset +// function : reset // purpose : // ======================================================================= void TreeModel_ItemBase::Reset() @@ -56,7 +55,7 @@ void TreeModel_ItemBase::Reset() // ======================================================================= void TreeModel_ItemBase::Reset (int theRole) { - if (!myCachedValues.contains (theRole)) + if (!myCachedValues.contains (theRole)) return; myCachedValues.remove (theRole); @@ -75,11 +74,7 @@ TreeModel_ItemBasePtr TreeModel_ItemBase::Child (int theRow, int theColumn, cons TreeModel_ItemBasePtr anItem; if (isToCreate) { - if (theRow < m_iStreamChildren) - anItem = TreeModel_ItemStream::CreateItem (currentItem(), theRow, theColumn); - else - anItem = createChild (theRow - m_iStreamChildren, theColumn); - + anItem = createChild (theRow, theColumn); if (anItem) m_ChildItems[aPos] = anItem; } @@ -104,53 +99,8 @@ QVariant TreeModel_ItemBase::cachedValue (const int theItemRole) const if (myCachedValues.contains (theItemRole)) return myCachedValues[theItemRole]; - QVariant aValueToCache; - if (theItemRole == TreeModel_ItemRole_RowCountRole) - aValueToCache = initRowCount() + m_iStreamChildren; - else - aValueToCache = initValue (theItemRole); + const_cast(this)->myCachedValues.insert (theItemRole, + theItemRole == TreeModel_ItemRole_RowCountRole ? QVariant (initRowCount()) : initValue (theItemRole)); - const_cast(this)->myCachedValues.insert (theItemRole, aValueToCache); return myCachedValues.contains (theItemRole) ? myCachedValues[theItemRole] : QVariant(); } - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void TreeModel_ItemBase::Init() -{ - m_bInitialized = true; - - NCollection_List aHierarchicalValues; - if (Column() == 0) - { - NCollection_IndexedDataMap aValues; - Standard_SStream aStream; - GetStream (aStream); - Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues); - aHierarchicalValues = Standard_Dump::HierarchicalValueIndices (aValues); - - //if (aHierarchicalValues.Size() == 1) - } - m_iStreamChildren = aHierarchicalValues.Extent(); -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant TreeModel_ItemBase::initValue (const int theItemRole) const -{ - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - switch (Column()) - { - case 1: { return rowCount(); } - //case 2: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString(); - case 3: { return Row(); } - } - - return QVariant(); -} diff --git a/tools/TreeModel/TreeModel_ItemBase.hxx b/tools/TreeModel/TreeModel_ItemBase.hxx index a784548c88..82ba6dc360 100644 --- a/tools/TreeModel/TreeModel_ItemBase.hxx +++ b/tools/TreeModel/TreeModel_ItemBase.hxx @@ -18,10 +18,6 @@ #include #include -#include -#include -#include - #include #include @@ -85,11 +81,7 @@ public: //! Sets the item internal initialized state to the true. If the item has internal values, //! there should be initialized here. - Standard_EXPORT virtual void Init(); - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { return NULL; } + virtual void Init() { m_bInitialized = true; } //! Resets the item and the child items content. Sets the initialized state to false. //! If the item has internal values, there should be reseted here. @@ -99,13 +91,6 @@ public: //! \param theRole an item role Standard_EXPORT virtual void Reset(int theRole); - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - virtual void GetStream (Standard_OStream& theOStream) const { (void)theOStream; } - - //! Sets stream value into the object - virtual void SetStream (Standard_SStream& theStream) const { (void)theStream; } - //! Gets the parent of the item, or TreeModel_ItemBasePtr() if it has no parent. //! \return pointer to the item TreeModel_ItemBasePtr Parent() const { return m_pParent; }; @@ -142,9 +127,6 @@ public: //! \return the row count int rowCount() const { return cachedValue(TreeModel_ItemRole_RowCountRole).toInt(); } - //! Dumps the content of me into the stream - virtual Standard_Boolean Dump (Standard_OStream& theOStream) const { (void)theOStream; return Standard_False; } - protected: //! \param theParent the parent item @@ -152,9 +134,6 @@ protected: //! \param theColumn the item column positition in the parent item Standard_EXPORT TreeModel_ItemBase (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn); - //! Initialize the current item. It creates a backup of the specific item information - virtual void initItem() const {} - //! Creates a child item in the given position. //! \param theRow the child row position //! \param theColumn the child column position @@ -177,7 +156,7 @@ protected: //! Return data value for the role. It should be reimplemented in child //! \param theItemRole a value role //! \return the value - Standard_EXPORT virtual QVariant initValue (const int theItemRole) const; + virtual QVariant initValue (const int theItemRole) const = 0; private: @@ -188,7 +167,6 @@ private: TreeModel_ItemBasePtr m_pParent; //!< the parent item int m_iRow; //!< the item row position in the parent item int m_iColumn; //!< the item column position in the parent item - int m_iStreamChildren; //!< the count of stream items bool m_bInitialized; //!< the state whether the item content is already initialized }; diff --git a/tools/TreeModel/TreeModel_ItemProperties.cxx b/tools/TreeModel/TreeModel_ItemProperties.cxx deleted file mode 100644 index 8ccd2d6f11..0000000000 --- a/tools/TreeModel/TreeModel_ItemProperties.cxx +++ /dev/null @@ -1,143 +0,0 @@ -// 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 -#include - -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(TreeModel_ItemProperties, Standard_Transient) - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void TreeModel_ItemProperties::Init (const TCollection_AsciiString& theStreamValue) -{ - NCollection_IndexedDataMap aValues; - if (!Standard_Dump::SplitJson (theStreamValue, aValues)) - return; - - for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++) - { - TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex); - if (!Standard_Dump::HasChildKey (aValue)) - myValues.Add (aValues.FindKey (anIndex), aValue); - } -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void TreeModel_ItemProperties::Reset() -{ - myValues.Clear(); -} - -// ======================================================================= -// function : RowCount -// purpose : -// ======================================================================= - -int TreeModel_ItemProperties::RowCount() const -{ - return myValues.Size(); -} - -// ======================================================================= -// function : Data -// purpose : -// ======================================================================= - -QVariant TreeModel_ItemProperties::Data (const int theRow, const int theColumn, int theRole) const -{ - if (theRole != Qt::DisplayRole && theRole != Qt::ToolTipRole) - return QVariant(); - - if (theColumn == 0) return myValues.FindKey (theRow + 1).ToCString(); - else if (theColumn == 1) return myValues.FindFromIndex (theRow + 1).ToCString(); - - return QVariant(); -} - -// ======================================================================= -// function : GetPresentations -// purpose : -// ======================================================================= - -void TreeModel_ItemProperties::GetPresentations (const int theRow, const int theColumn, - NCollection_List& thePresentations) -{ - (void)thePresentations; - - if (theRow < 0) // full presentation - { - return; - } - - - if (theColumn == 0) - return; - - NCollection_IndexedDataMap aValues; - aValues.Add (Data (theRow, 0).toString().toStdString().c_str(), Data (theRow, theColumn).toString().toStdString().c_str()); - - Standard_SStream aStreamOnSelected; - Standard_Dump::JoinJson (aStreamOnSelected, aValues); - - //if (theRow < 0) // full presentation - //{ - //Bnd_Box aBox; - //if (aBox.Init (myStream)) - // thePresentations.Append (new Convert_TransientShape (Convert_Tools::CreateShape (aBox))); - //} - - gp_XYZ aPoint; - Standard_Integer aPosition = 1; - if (aPoint.InitJson (aStreamOnSelected, aPosition)) - { - thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint))); - } - - - //QVariant aValue = GetTableData (theRow, theColumn, Qt::DisplayRole); - //TCollection_AsciiString aStrValue = aValue.toString().toStdString().c_str(); - - //gp_XYZ aPoint; - //if (!aPoint.Init (Standard_SStream (aStrValue.ToCString()))) - // return; - - //thePresentations.Append (new Convert_TransientShape (BRepBuilderAPI_MakeVertex (aPoint))); -} - -// ======================================================================= -// function : GetTableFlags -// purpose : -// ======================================================================= - -Qt::ItemFlags TreeModel_ItemProperties::GetTableFlags (const int, const int theColumn) const -{ - Qt::ItemFlags aFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable; - - if (theColumn == 1) - aFlags = aFlags | Qt::ItemIsEditable; - - return aFlags; -} - diff --git a/tools/TreeModel/TreeModel_ItemProperties.hxx b/tools/TreeModel/TreeModel_ItemProperties.hxx deleted file mode 100644 index 06eadb44ee..0000000000 --- a/tools/TreeModel/TreeModel_ItemProperties.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// Created on: 2019-02-25 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef TreeModel_ItemProperties_H -#define TreeModel_ItemProperties_H - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -DEFINE_STANDARD_HANDLE (TreeModel_ItemProperties, Standard_Transient) - -//! \class TreeModel_ItemProperties -//! Class to manipulate properties of tree item. The properties are organized in table structure -class TreeModel_ItemProperties : public Standard_Transient -{ - //! 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() {} - - //! Destructor - ~TreeModel_ItemProperties() {} - - //! Sets the current item - void SetItem (const TreeModel_ItemBasePtr& theItem) { myItem = theItem; } - - //! Returns the current item - TreeModel_ItemBasePtr Item() const { return myItem; } - - //! Fill internal containers by stream values - void Init (const TCollection_AsciiString& theStreamValue); - - //! If the item has internal values, there should be reseted here. - Standard_EXPORT virtual void Reset(); - - //! Returns number of table rows. It uses cached value of GetTableRowCount(), Reset() to reinit it. - //! \return an integer value - Standard_EXPORT int RowCount() const; - - //! Returns number of table columns. It uses cached value of GetTableColumnCount(), Reset() to reinit it. - //! \return an integer value - Standard_EXPORT int ColumnCount() const { return 2; } - - //! 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 interpreted depending on the given role - QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const; - - //! Returns presentation of the attribute to be visualized in the view - //! \param theRow a model index row - //! \param theColumn a model index column - //! \thePresentations [out] container of presentation handles to be visualized - virtual void GetPresentations (const int theRow, const int theColumn, - NCollection_List& thePresentations); - - //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable. - //! Additional flag for the column 1 is Qt::ItemIsEditable. - //! \param theIndex a model index - //! \return flags - Standard_EXPORT virtual Qt::ItemFlags GetTableFlags (const int theRow, const int theColumn) const; - - DEFINE_STANDARD_RTTIEXT (TreeModel_ItemProperties, Standard_Transient) - -private: - TreeModel_ItemBasePtr myItem; //!< current item - - NCollection_IndexedDataMap myValues; //!< the values -}; - -#endif \ No newline at end of file diff --git a/tools/TreeModel/TreeModel_ItemStream.cxx b/tools/TreeModel/TreeModel_ItemStream.cxx deleted file mode 100644 index 94c67d031d..0000000000 --- a/tools/TreeModel/TreeModel_ItemStream.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// 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 - -#include - -#include - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= -TreeModel_ItemStream::TreeModel_ItemStream (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : TreeModel_ItemBase (theParent, theRow, theColumn) -{ - myProperties = new TreeModel_ItemProperties(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void TreeModel_ItemStream::Init() -{ - if (!myProperties->Item()) - myProperties->SetItem (currentItem()); - - TCollection_AsciiString aKey, aKeyValue; - TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(Parent()); - if (!aStreamParent) - { - Standard_SStream aStream; - Parent()->GetStream (aStream); - - NCollection_IndexedDataMap aValues; - Standard_Dump::SplitJson (Standard_Dump::Text (aStream), aValues); - - aKey = aValues.FindKey (Row() + 1); - aKeyValue = aValues.FindFromIndex (Row() + 1); - } - else - { - TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(Parent()); - - TCollection_AsciiString aValue; - aStreamParent->GetChildStream (Row(), aKey, aKeyValue); - } - - myKey = aKey; - myProperties->Init (aKeyValue); - myStreamValue = aKeyValue; - - NCollection_IndexedDataMap aValues; - Standard_Dump::SplitJson (aKeyValue, aValues); - - for (Standard_Integer anIndex = 1; anIndex <= aValues.Size(); anIndex++) - { - TCollection_AsciiString aValue = aValues.FindFromIndex (anIndex); - if (Standard_Dump::HasChildKey (aValue)) - myChildren.Add (aValues.FindKey (anIndex), aValue); - } - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Rest -// purpose : -// ======================================================================= -void TreeModel_ItemStream::Reset() -{ - myKey = ""; - myStreamValue = ""; - - myProperties->Reset(); - myChildren.Clear(); - - TreeModel_ItemBase::Reset(); -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant TreeModel_ItemStream::initValue (const int theItemRole) const -{ - QVariant aParentValue = TreeModel_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (Column() != 0) - return QVariant(); - - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - switch (Column()) - { - case 0: return GetKey().ToCString(); - } - return QVariant(); -} - -// ======================================================================= -// function : GetChildStream -// purpose : -// ======================================================================= -void TreeModel_ItemStream::GetChildStream (const int theRowId, - TCollection_AsciiString& theKey, - TCollection_AsciiString& theValue) const -{ - TreeModel_ItemBasePtr aParentItem = Parent(); - if (!aParentItem) - return; - - theKey = myChildren.FindKey (theRowId + 1); - theValue = myChildren.FindFromIndex (theRowId + 1); -} - -// ======================================================================= -// function : GetStream -// purpose : -// ======================================================================= -void TreeModel_ItemStream::GetStream (Standard_OStream& theOStream) const -{ - //Handle(AIS_InteractiveObject) anIO = GetInteractiveObject(); - //if (anIO.IsNull()) - // return; - - theOStream << myStreamValue; - - //anIO->DumpJson (theOStream); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void TreeModel_ItemStream::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr TreeModel_ItemStream::createChild (int theRow, int theColumn) -{ - return TreeModel_ItemStream::CreateItem (currentItem(), theRow, theColumn); -} diff --git a/tools/TreeModel/TreeModel_ItemStream.hxx b/tools/TreeModel/TreeModel_ItemStream.hxx deleted file mode 100644 index 9581d4e747..0000000000 --- a/tools/TreeModel/TreeModel_ItemStream.hxx +++ /dev/null @@ -1,112 +0,0 @@ -// Created on: 2019-02-25 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef TreeModel_ItemStream_H -#define TreeModel_ItemStream_H - -#include -#include -#include - -#include - -class TreeModel_ItemProperties; -class TreeModel_ItemStream; - -typedef QExplicitlySharedDataPointer TreeModel_ItemStreamPtr; - -//! \class TreeModel_ItemStream -//! 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 TreeModel_ItemStream : public TreeModel_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static TreeModel_ItemStreamPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return TreeModel_ItemStreamPtr (new TreeModel_ItemStream (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~TreeModel_ItemStream() Standard_OVERRIDE {}; - - //! Sets the item internal initialized state to the true. If the item has internal values, - //! there should be initialized here. - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets the item and the child items content. Sets the initialized state to false. - //! If the item has internal values, there should be reseted here. - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns number of displayed presentations - //! \return rows count - virtual int initRowCount() const Standard_OVERRIDE { initItem(); return /*GetChildren().Extent()*/0; } - - //! Returns item information for the given role. Fills internal container if it was not filled yet - //! \param theItemRole a value role - //! \return the value - Standard_EXPORT virtual QVariant initValue (const int theItemRole) const Standard_OVERRIDE; - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - Standard_EXPORT void GetChildStream (const int theRowId, - TCollection_AsciiString& theKey, - TCollection_AsciiString& theValue) const; - - //! Returns data object of the item. - //! \return object - const TCollection_AsciiString& GetKey() const { initItem(); return myKey; } - - const NCollection_IndexedDataMap& GetChildren() const - { initItem(); return myChildren; } - - //! Returns the item properties - Handle(TreeModel_ItemProperties) Properties() const { return myProperties; } - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - virtual void GetStream (Standard_OStream& theOStream) 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; - -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 - Standard_EXPORT TreeModel_ItemStream(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn); - -protected: - Handle(TreeModel_ItemProperties) myProperties; //!< the properties - TCollection_AsciiString myKey; //!< the item key - TCollection_AsciiString myStreamValue; //!< the stream value - NCollection_IndexedDataMap myChildren; //!< the children -}; - -#endif diff --git a/tools/TreeModel/TreeModel_ModelBase.cxx b/tools/TreeModel/TreeModel_ModelBase.cxx index 9a2d40fd6b..72acad8d01 100644 --- a/tools/TreeModel/TreeModel_ModelBase.cxx +++ b/tools/TreeModel/TreeModel_ModelBase.cxx @@ -19,8 +19,6 @@ #include #include -#include - #include #include #include @@ -33,8 +31,6 @@ TreeModel_ModelBase::TreeModel_ModelBase (QObject* theParent) : QAbstractItemModel (theParent), m_pRootItem (0), m_pUseVisibilityColumn (false), myVisibilityState (0) { - myVisibleIcon = QIcon (":/icons/item_visible.png"); - myInvisibleIcon = QIcon (":/icons/item_invisible.png"); } // ======================================================================= @@ -108,18 +104,14 @@ QVariant TreeModel_ModelBase::data (const QModelIndex& theIndex, int theRole) co if (!myVisibilityState || !myVisibilityState->CanBeVisible (theIndex)) return QVariant(); - QVariant aValue = myVisibilityState->IsVisible (theIndex) ? myVisibleIcon : myInvisibleIcon; + QVariant aValue = QIcon (myVisibilityState->IsVisible (theIndex) ? ":/icons/item_visible.png" + : ":/icons/item_invisible.png"); anItem->SetCustomData (aValue, theRole); return aValue; } TreeModel_ItemBasePtr anItem = GetItemByIndex (theIndex); - QVariant anItemData = anItem->data (theIndex, theRole); - - if (anItemData.isNull() && theRole == Qt::BackgroundRole && myHighlightedIndices.contains (theIndex)) - anItemData = TreeModel_Tools::LightHighlightColor(); - - return anItemData; + return anItem->data (theIndex, theRole); } // ======================================================================= @@ -182,9 +174,6 @@ int TreeModel_ModelBase::rowCount (const QModelIndex& theParent) const else aParentItem = GetItemByIndex (theParent); - if (!aParentItem) - return 0; - return aParentItem ? aParentItem->rowCount() : 0; } @@ -217,24 +206,6 @@ void TreeModel_ModelBase::EmitDataChanged (const QModelIndex& theTopLeft, const #endif } -// ======================================================================= -// function : GetSelected -// purpose : -// ======================================================================= -QModelIndexList TreeModel_ModelBase::GetSelected (const QModelIndexList& theIndices, const int theCellId, - const Qt::Orientation theOrientation) -{ - QModelIndexList aSelected; - for (QModelIndexList::const_iterator anIndicesIt = theIndices.begin(); anIndicesIt != theIndices.end(); anIndicesIt++) - { - QModelIndex anIndex = *anIndicesIt; - if ((theOrientation == Qt::Horizontal && anIndex.column() == theCellId) || - (theOrientation == Qt::Vertical && anIndex.row() == theCellId)) - aSelected.append (anIndex); - } - return aSelected; -} - // ======================================================================= // function : SingleSelected // purpose : @@ -242,26 +213,15 @@ QModelIndexList TreeModel_ModelBase::GetSelected (const QModelIndexList& theIndi QModelIndex TreeModel_ModelBase::SingleSelected (const QModelIndexList& theIndices, const int theCellId, const Qt::Orientation theOrientation) { - QModelIndexList aSelected = GetSelected (theIndices, theCellId, theOrientation); - return aSelected.size() == 1 ? aSelected.first() : QModelIndex(); -} - -// ======================================================================= -// function : GetSelectedItems -// purpose : -// ======================================================================= -QList TreeModel_ModelBase::GetSelectedItems (const QModelIndexList& theIndices) -{ - QList anItems; - + QModelIndexList aFirstColumnSelectedIndices; for (QModelIndexList::const_iterator anIndicesIt = theIndices.begin(); anIndicesIt != theIndices.end(); anIndicesIt++) { - TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt); - if (!anItem || anItems.contains (anItem)) - continue; - anItems.append (anItem); + QModelIndex anIndex = *anIndicesIt; + if ((theOrientation == Qt::Horizontal && anIndex.column() == theCellId) || + (theOrientation == Qt::Vertical && anIndex.row() == theCellId)) + aFirstColumnSelectedIndices.append (anIndex); } - return anItems; + return aFirstColumnSelectedIndices.size() == 1 ? aFirstColumnSelectedIndices.first() : QModelIndex(); } // ======================================================================= diff --git a/tools/TreeModel/TreeModel_ModelBase.hxx b/tools/TreeModel/TreeModel_ModelBase.hxx index f38b266f5c..d304c164e5 100644 --- a/tools/TreeModel/TreeModel_ModelBase.hxx +++ b/tools/TreeModel/TreeModel_ModelBase.hxx @@ -20,8 +20,6 @@ #include #include -#include - #include #include #include @@ -86,13 +84,6 @@ public: //!< \return the checker interface TreeModel_VisibilityState* GetVisibilityState () const { return myVisibilityState; } - //! Returns true if the tree view model contains highlighted items. This highlight is set manually. - bool HasHighlighted() { return !myHighlightedIndices.isEmpty(); } - - //! Sets items of the indices highlighted in the model. - //! \param theIndices a list of tree model indices - void SetHighlighted (const QModelIndexList& theIndices = QModelIndexList()) { myHighlightedIndices = theIndices; } - //! Returns the index of the item in the model specified by the given row, column and parent index. //! Saves an internal pointer at the createIndex. This pointer is a shared pointer to the class, //! that realizes a base item interface. If the parent is invalid, a root item is used, otherwise a new item @@ -155,14 +146,6 @@ public: //! \return integer value static int ColumnVisibilityWidth() { return 20; } - //! Returns selected items in the cell of given orientation. - //! \param theIndices a container of selected indices - //! \param theCellId column index if orientation is horizontal, row index otherwise - //! \param theOrientation an orientation to apply the cell index - //! \return model indices from the list - Standard_EXPORT static QModelIndexList GetSelected (const QModelIndexList& theIndices, const int theCellId, - const Qt::Orientation theOrientation = Qt::Horizontal); - //! Returns single selected item in the cell of given orientation. If the orientation is Horizontal, //! in the cell id colum, one row should be selected. //! \param theIndices a container of selected indices @@ -172,12 +155,6 @@ public: Standard_EXPORT static QModelIndex SingleSelected (const QModelIndexList& theIndices, const int theCellId, const Qt::Orientation theOrientation = Qt::Horizontal); - - //! Returns selected tree model items for indices. - //! \param theIndices a container of selected indices - //! \return model items from the list - Standard_EXPORT static QList GetSelectedItems (const QModelIndexList& theIndices); - protected: //! Creates root item //! \param theColumnId index of a column @@ -196,10 +173,6 @@ protected: bool m_pUseVisibilityColumn; //!< the state whether column=0 is reserved for Visibility state TreeModel_VisibilityState* myVisibilityState; //!< the interface of item visibility - QIcon myVisibleIcon; //!< icon of visible state - QIcon myInvisibleIcon; //!< icon of invisible state - - QModelIndexList myHighlightedIndices; //!< tree model indices that should be visualized as highlighted }; #endif diff --git a/tools/TreeModel/TreeModel_Tools.cxx b/tools/TreeModel/TreeModel_Tools.cxx index 7c89df6902..c1b217b529 100644 --- a/tools/TreeModel/TreeModel_Tools.cxx +++ b/tools/TreeModel/TreeModel_Tools.cxx @@ -211,53 +211,3 @@ QString TreeModel_Tools::CutString (const QString& theText, const int theWidth, return aLength < theText.length() ? theText.mid (0, aLength) + theTail : theText; } - -// ======================================================================= -// function : LightHighlightColor -// purpose : -// ======================================================================= -QColor TreeModel_Tools::LightHighlightColor() -{ - QWidget aWidget; - QPalette aPalette = aWidget.palette(); - return aPalette.highlight().color().lighter(); -} - -// ======================================================================= -// function : SetExpandedTo -// purpose : -// ======================================================================= -void TreeModel_Tools::SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex) -{ - QAbstractItemModel* aModel = theTreeView->model(); - - QModelIndex aParent = aModel->parent (theIndex); - while (aParent.isValid()) - { - theTreeView->setExpanded (aParent, true); - aParent = aModel->parent (aParent); - } -} - -// ======================================================================= -// function : setExpanded -// purpose : -// ======================================================================= -void TreeModel_Tools::SetExpanded (QTreeView* theTreeView, const QModelIndex& theIndex, const bool isExpanded, - int& theLevels) -{ - bool isToExpand = theLevels == -1 || theLevels > 0; - if (!isToExpand) - return; - - theTreeView->setExpanded (theIndex, isExpanded); - if (theLevels != -1) - theLevels--; - - QAbstractItemModel* aModel = theTreeView->model(); - for (int aRowId = 0, aRows = aModel->rowCount (theIndex); aRowId < aRows; aRowId++) - { - int aLevels = theLevels; - SetExpanded (theTreeView, aModel->index (aRowId, 0, theIndex), isExpanded, aLevels); - } -} diff --git a/tools/TreeModel/TreeModel_Tools.hxx b/tools/TreeModel/TreeModel_Tools.hxx index 1f24f94ec1..39047a2f03 100644 --- a/tools/TreeModel/TreeModel_Tools.hxx +++ b/tools/TreeModel/TreeModel_Tools.hxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -91,24 +90,6 @@ public: //! \param theWidth width value, if -1, default value is used //! \param theTail symbols added to the end of the cut string Standard_EXPORT static QString CutString (const QString& theText, const int theWidth = -1, const QString& theTail = "..."); - - //! Returns light highlight color - //! \returns Qt color - Standard_EXPORT static QColor LightHighlightColor(); - - //! Makes the view expanded fron the root till the index - Standard_EXPORT static void SetExpandedTo (QTreeView* theTreeView, const QModelIndex& theIndex); - - //! Recursive items expanding in tree view staring from the index - //! \param theTreeView an OCAF tree view - //! \param theParentIndex an index which children should be expanded - //! \param isExpanded a boolean state if the item should be expanded or collapsed - //! \param theLevels a number of levels to be expanded, or -1 for all levels - Standard_EXPORT static void SetExpanded (QTreeView* theTreeView, - const QModelIndex& theIndex, - const bool isExpanded, - int& theLevels); - }; #endif diff --git a/tools/VInspector/FILES b/tools/VInspector/FILES index c1813142f5..68312f8eb1 100644 --- a/tools/VInspector/FILES +++ b/tools/VInspector/FILES @@ -4,33 +4,14 @@ VInspector_CallBack.hxx VInspector_CallBackMode.hxx VInspector_Communicator.cxx VInspector_Communicator.hxx -VInspector_ItemAspectWindow.cxx -VInspector_ItemAspectWindow.hxx VInspector_ItemBase.cxx VInspector_ItemBase.hxx -VInspector_ItemBVHTree.cxx -VInspector_ItemBVHTree.hxx -VInspector_ItemBVHTreeNode.cxx -VInspector_ItemBVHTreeNode.hxx -VInspector_ItemContainer.cxx -VInspector_ItemContainer.hxx -VInspector_ItemContainerAPI.hxx VInspector_ItemContext.cxx VInspector_ItemContext.hxx VInspector_ItemFolderObject.cxx VInspector_ItemFolderObject.hxx -VInspector_ItemGraphic3dCamera.cxx -VInspector_ItemGraphic3dCamera.hxx -VInspector_ItemGraphic3dClipPlane.cxx -VInspector_ItemGraphic3dClipPlane.hxx -VInspector_ItemGraphic3dCStructure.cxx -VInspector_ItemGraphic3dCStructure.hxx -VInspector_ItemGraphic3dCView.cxx -VInspector_ItemGraphic3dCView.hxx -VInspector_ItemGraphic3dGroup.cxx -VInspector_ItemGraphic3dGroup.hxx -VInspector_ItemGraphic3dTransformPers.cxx -VInspector_ItemGraphic3dTransformPers.hxx +VInspector_ItemEntityOwner.cxx +VInspector_ItemEntityOwner.hxx VInspector_ItemHistoryElement.cxx VInspector_ItemHistoryElement.hxx VInspector_ItemHistoryRoot.cxx @@ -38,52 +19,14 @@ VInspector_ItemHistoryRoot.hxx VInspector_ItemHistoryType.cxx VInspector_ItemHistoryType.hxx VInspector_ItemHistoryTypeInfo.hxx -VInspector_ItemOpenGlContext.cxx -VInspector_ItemOpenGlContext.hxx -VInspector_ItemOpenGlLayer.cxx -VInspector_ItemOpenGlLayer.hxx -VInspector_ItemOpenGlLayerList.cxx -VInspector_ItemOpenGlLayerList.hxx -VInspector_ItemOpenGlWindow.cxx -VInspector_ItemOpenGlWindow.hxx VInspector_ItemPresentableObject.cxx VInspector_ItemPresentableObject.hxx -VInspector_ItemPresentations.cxx -VInspector_ItemPresentations.hxx -VInspector_ItemPrs3dAspect.cxx -VInspector_ItemPrs3dAspect.hxx -VInspector_ItemPrs3dDrawer.cxx -VInspector_ItemPrs3dDrawer.hxx -VInspector_ItemPrs3dPresentation.cxx -VInspector_ItemPrs3dPresentation.hxx -VInspector_ItemSelect3DSensitiveSetItem.hxx -VInspector_ItemSelect3DSensitiveSetItem.cxx -VInspector_ItemSelectBasicsEntityOwner.cxx -VInspector_ItemSelectBasicsEntityOwner.hxx -VInspector_ItemSelectBasicsSensitiveEntity.cxx -VInspector_ItemSelectBasicsSensitiveEntity.hxx -VInspector_ItemSelectMgrViewerSelector.cxx -VInspector_ItemSelectMgrViewerSelector.hxx -VInspector_ItemSelectMgrViewerSelectorPicked.cxx -VInspector_ItemSelectMgrViewerSelectorPicked.hxx -VInspector_ItemSelectMgrBaseFrustum.cxx -VInspector_ItemSelectMgrBaseFrustum.hxx +VInspector_ItemSelection.cxx +VInspector_ItemSelection.hxx VInspector_ItemSelectMgrFilter.cxx VInspector_ItemSelectMgrFilter.hxx -VInspector_ItemSelectMgrSelectableObjectSet.cxx -VInspector_ItemSelectMgrSelectableObjectSet.hxx -VInspector_ItemSelectMgrSelectingVolumeManager.cxx -VInspector_ItemSelectMgrSelectingVolumeManager.hxx -VInspector_ItemSelectMgrSelection.cxx -VInspector_ItemSelectMgrSelection.hxx -VInspector_ItemSelectMgrSensitiveEntity.cxx -VInspector_ItemSelectMgrSensitiveEntity.hxx -VInspector_ItemSelectMgrSensitiveEntitySet.cxx -VInspector_ItemSelectMgrSensitiveEntitySet.hxx -VInspector_ItemV3dView.cxx -VInspector_ItemV3dView.hxx -VInspector_ItemV3dViewer.cxx -VInspector_ItemV3dViewer.hxx +VInspector_ItemSensitiveEntity.cxx +VInspector_ItemSensitiveEntity.hxx VInspector_SelectionType.hxx VInspector_ToolActionType.hxx VInspector_ToolBar.cxx diff --git a/tools/VInspector/VInspector_CallBack.cxx b/tools/VInspector/VInspector_CallBack.cxx index a42ff3b208..481ec6f6b2 100644 --- a/tools/VInspector/VInspector_CallBack.cxx +++ b/tools/VInspector/VInspector_CallBack.cxx @@ -38,18 +38,7 @@ IMPLEMENT_STANDARD_RTTIEXT(VInspector_CallBack, VInspectorAPI_CallBack) // ======================================================================= void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) { - if (!myHistoryModel) - return; - - QList anInfo; - if (!thePrs.IsNull()) - anInfo = VInspector_Tools::GetInfo (thePrs); - else - { - anInfo.append ("Activate"); - anInfo.append (""); - anInfo.append (""); - } + QList anInfo = VInspector_Tools::GetInfo (thePrs); anInfo[0] = QString ("%1: %2").arg (anInfo[0].toString()).arg (theMode); myHistoryModel->AddElement (VInspector_CallBackMode_Activate, anInfo); } @@ -60,8 +49,6 @@ void VInspector_CallBack::Activate (Handle(AIS_InteractiveObject) thePrs, const // ======================================================================= void VInspector_CallBack::AddOrRemoveSelected (const TopoDS_Shape& theShape) { - if (!myHistoryModel) - return; QList aValues; aValues.append (""); // Name aValues.append (""); // Pointer @@ -76,8 +63,6 @@ void VInspector_CallBack::AddOrRemoveSelected (const TopoDS_Shape& theShape) // ======================================================================= void VInspector_CallBack::AddOrRemoveSelected (Handle(AIS_InteractiveObject) thePrs) { - if (!myHistoryModel) - return; QList aValues = VInspector_Tools::GetInfo (thePrs); aValues.append (VInspector_Tools::GetSelectedInfoPointers (myContext)); // SelectionInfo myHistoryModel->AddElement (VInspector_CallBackMode_AddOrRemoveSelected, aValues); @@ -89,8 +74,6 @@ void VInspector_CallBack::AddOrRemoveSelected (Handle(AIS_InteractiveObject) the // ======================================================================= void VInspector_CallBack::AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) theOwner) { - if (!myHistoryModel) - return; QList aValues; aValues.append (""); // Name aValues.append (VInspector_Tools::GetPointerInfo (theOwner, true).ToCString()); // Pointer @@ -106,8 +89,6 @@ void VInspector_CallBack::AddOrRemoveSelected (Handle(SelectMgr_EntityOwner) the // ======================================================================= void VInspector_CallBack::ClearSelected() { - if (!myHistoryModel) - return; QList aValues; myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, aValues); } @@ -118,8 +99,6 @@ void VInspector_CallBack::ClearSelected() // ======================================================================= void VInspector_CallBack::MoveTo (const Standard_Integer/* theXPix*/, const Standard_Integer/* theYPix*/) { - if (!myHistoryModel) - return; QList aValues; aValues = VInspector_Tools::GetHighlightInfo (myContext); myHistoryModel->AddElement (VInspector_CallBackMode_MoveTo, aValues); @@ -131,8 +110,6 @@ void VInspector_CallBack::MoveTo (const Standard_Integer/* theXPix*/, const Stan // ======================================================================= void VInspector_CallBack::Select() { - if (!myHistoryModel) - return; QList aValues; aValues = VInspector_Tools::GetSelectedInfo (myContext); myHistoryModel->AddElement (VInspector_CallBackMode_Select, aValues); @@ -144,8 +121,6 @@ void VInspector_CallBack::Select() // ======================================================================= void VInspector_CallBack::ShiftSelect() { - if (!myHistoryModel) - return; QList aValues; aValues = VInspector_Tools::GetSelectedInfo (myContext); myHistoryModel->AddElement (VInspector_CallBackMode_ShiftSelect, aValues); diff --git a/tools/VInspector/VInspector_CallBack.hxx b/tools/VInspector/VInspector_CallBack.hxx index 00290c73b5..57bdeae4ff 100644 --- a/tools/VInspector/VInspector_CallBack.hxx +++ b/tools/VInspector/VInspector_CallBack.hxx @@ -43,22 +43,22 @@ public: //! Appends displayed presentation into history model //! \param thePrs the presentation virtual void Display (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Display, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_Display, VInspector_Tools::GetInfo (thePrs)); } //! Appends redisplayed presentation into history model //! \param thePrs the presentation virtual void Redisplay (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Redisplay, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_Redisplay, VInspector_Tools::GetInfo (thePrs)); } //! Appends removed presentation into history model //! \param thePrs the presentation virtual void Remove (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Remove, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_Remove, VInspector_Tools::GetInfo (thePrs)); } //! Appends loaded presentation into history model //! \param thePrs the presentation virtual void Load (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Load, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_Load, VInspector_Tools::GetInfo (thePrs)); } //! Appends information about modes activation //! \param thePrs the presentation @@ -75,14 +75,13 @@ public: //! Appends information about modes deactivation //! \param thePrs the presentation virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); } //! Appends information about modes deactivation //! \param thePrs the presentation //! \param theMode the selection mode virtual void Deactivate (Handle(AIS_InteractiveObject) thePrs, const Standard_Integer theMode) Standard_OVERRIDE - { (void)theMode; - if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); } + { (void)theMode; myHistoryModel->AddElement (VInspector_CallBackMode_Deactivate, VInspector_Tools::GetInfo (thePrs)); } //! Appends information about selection change //! \param theShape the selected shape @@ -102,7 +101,7 @@ public: //! Appends information about selection clear //! \param thePrs the selected presentation virtual void ClearSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_ClearSelected, VInspector_Tools::GetInfo (thePrs)); } //! Appends information about moving to point //! \param theXPix a pixels on horizontal @@ -112,7 +111,7 @@ public: //! Appends information about setting selection //! \param thePrs the selected presentation virtual void SetSelected (Handle(AIS_InteractiveObject) thePrs) Standard_OVERRIDE - { if (myHistoryModel != 0) myHistoryModel->AddElement (VInspector_CallBackMode_SetSelected, VInspector_Tools::GetInfo (thePrs)); } + { myHistoryModel->AddElement (VInspector_CallBackMode_SetSelected, VInspector_Tools::GetInfo (thePrs)); } //! Appends information about select Standard_EXPORT virtual void Select() Standard_OVERRIDE; diff --git a/tools/VInspector/VInspector_ItemAspectWindow.cxx b/tools/VInspector/VInspector_ItemAspectWindow.cxx deleted file mode 100644 index 6c005c4c24..0000000000 --- a/tools/VInspector/VInspector_ItemAspectWindow.cxx +++ /dev/null @@ -1,101 +0,0 @@ -// Created on: 2018-12-14 -// 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 - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemAspectWindow::initValue (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(); - - Handle(Aspect_Window) aWindow = GetAspectWindow(); - if (aWindow.IsNull()) - return Column() == 0 ? "Empty Aspect_Window" : ""; - - switch (Column()) - { - case 0: return theItemRole == Qt::DisplayRole ? aWindow->DynamicType()->Name() - : STANDARD_TYPE (Aspect_Window)->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemAspectWindow::Init() -{ - VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - myWindow = aParentItem->GetView()->Window(); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemAspectWindow::Reset() -{ - myWindow = NULL; - // an empty method to don't clear the main label, otherwise the model will be empty - TreeModel_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemAspectWindow::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemAspectWindow::buildPresentationShape() -{ - return TopoDS_Shape(); -} diff --git a/tools/VInspector/VInspector_ItemAspectWindow.hxx b/tools/VInspector/VInspector_ItemAspectWindow.hxx deleted file mode 100644 index 65b6d87fc9..0000000000 --- a/tools/VInspector/VInspector_ItemAspectWindow.hxx +++ /dev/null @@ -1,103 +0,0 @@ -// Created on: 2018-12-14 -// 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_ItemAspectWindow_H -#define VInspector_ItemAspectWindow_H - -#include -#include -#include -#include - -class QItemSelectionModel; -class VInspector_ItemAspectWindow; - -typedef QExplicitlySharedDataPointer VInspector_ItemAspectWindowPtr; - -//! \class VInspector_ItemAspectWindow -//! The item shows information about SelectBasics_EntityOwner. -//! The parent is item selection, children are item entity owners -class VInspector_ItemAspectWindow : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemAspectWindowPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemAspectWindowPtr (new VInspector_ItemAspectWindow (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemAspectWindow() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myWindow; } - - //! \return the current sensitive entity - Standard_EXPORT Handle(Aspect_Window) GetAspectWindow() const - { return Handle(Aspect_Window)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! \return number of children. - virtual int initRowCount() const Standard_OVERRIDE { return 0; } - - //! Returns item information for the given role. Fills internal container if it was not filled yet - //! \param theItemRole a value role - //! \return the value - 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 - { (void)theRow; (void)theColumn; return TreeModel_ItemBasePtr(); } - - //! Returns table value for the row in form: depending on the aspect kind - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theEntityKind kind or kind of entity - QVariant getTableData (const int theRow, - const int theColumn, - const int theRole, - const TCollection_AsciiString& theEntityKind) const; - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; - - //! Constructor - //! param theParent a parent item - VInspector_ItemAspectWindow(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - Handle(Aspect_Window) myWindow; //!< aspect window -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemBVHTree.cxx b/tools/VInspector/VInspector_ItemBVHTree.cxx deleted file mode 100644 index 31478bf9f8..0000000000 --- a/tools/VInspector/VInspector_ItemBVHTree.cxx +++ /dev/null @@ -1,198 +0,0 @@ -// Created on: 2019-04-29 -// 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 - -#include -#include -#include -#include - -#include - -#include -#include -#include - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= -VInspector_ItemBVHTree::VInspector_ItemBVHTree (TreeModel_ItemBasePtr theParent, - const int theRow, const int theColumn) -: VInspector_ItemBase(theParent, theRow, theColumn) -{ -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemBVHTree::initRowCount() const -{ - if (Column() != 0) - return 0; - - opencascade::handle > aTree = GetTree(); - if (aTree.IsNull()) - return 0; - - return aTree->Length(); -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemBVHTree::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 (GetTree().IsNull()) - return Column() == 0 ? "Empty BVH tree" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aName = TCollection_AsciiString (GetTree()->DynamicType()->Name()) + - TCollection_AsciiString (" (") + myName.ToCString() + ")"; - return aName.ToCString(); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTree::Init() -{ - VInspector_ItemSelectMgrSelectableObjectSetPtr anObjectParent = itemDynamicCast(Parent()); - opencascade::handle > aBVHTree; - if (anObjectParent) - { - aBVHTree = anObjectParent->GetBVHTree (Row(), myName); - } - else - { - VInspector_ItemSelectMgrSensitiveEntitySetPtr anEntityParent = itemDynamicCast(Parent()); - if (anEntityParent) - aBVHTree = anEntityParent->GetBVHTree (Row(), myName); - } - - setTree (aBVHTree); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTree::Reset() -{ - VInspector_ItemBase::Reset(); - - setTree (NULL); - myName = TCollection_AsciiString(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTree::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : Dump -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemBVHTree::Dump (Standard_OStream& theOStream) const -{ - opencascade::handle > aBVHTree = GetTree(); - if (aBVHTree.IsNull()) - return Standard_False; - - aBVHTree->DumpJson (theOStream); - return Standard_True; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemBVHTree::createChild (int theRow, int theColumn) -{ - return VInspector_ItemBVHTreeNode::CreateItem (currentItem(), theRow, theColumn); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemBVHTree::buildPresentationShape() -{ - return TopoDS_Shape(); - /*opencascade::handle > aBVHTree = myTree; - if (aBVHTree.IsNull()) - return TopoDS_Shape(); - - Standard_SStream OS; - //aBVHTree->DumpJsonNode (Row(), OS); - aBVHTree->DumpJson (OS); - - Standard_Integer aColumnCount; - NCollection_Vector aValues; - Message::ConvertStream (theOStream, aColumnCount, aValues); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - for (int aValueId = 0; aValueId < aValues.Size(); ) - { - for (int aColumnId = 0; aColumnId < aColumnCount; aColumnId++, aValueId++) - { - if (aColumnId != 1) - continue; - - TCollection_AsciiString aValue = aValues.Value (aValueId); - Bnd_Box aBox; - if (!aBox.Init (Standard_SStream (aValue.ToCString()))) - continue; - - TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox); - aBuilder.Add (aCompound, aShape); - } - } - return aCompound;*/ -} diff --git a/tools/VInspector/VInspector_ItemBVHTree.hxx b/tools/VInspector/VInspector_ItemBVHTree.hxx deleted file mode 100644 index 611af1483d..0000000000 --- a/tools/VInspector/VInspector_ItemBVHTree.hxx +++ /dev/null @@ -1,105 +0,0 @@ -// Created on: 2019-04-29 -// 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_ItemBVHTree_H -#define VInspector_ItemBVHTree_H - -#include -#include - -#include -#include -#include - -class VInspector_ItemBVHTree; -typedef QExplicitlySharedDataPointer VInspector_ItemBVHTreePtr; - -//! \class VInspector_ItemBVHTree -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemBVHTree : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemBVHTreePtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemBVHTreePtr (new VInspector_ItemBVHTree (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemBVHTree() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myTree; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - opencascade::handle > GetTree() const - { return opencascade::handle >::DownCast (GetObject()); } - - //! Dumps the content of me into the stream - virtual Standard_Boolean Dump (Standard_OStream& theOStream) const; - -protected: - //! Initialize 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; - - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() 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: - - //! Set V3d viewer selector into the current field - //! \param theTree a viewer selector - void setTree (const opencascade::handle >& theTree) { myTree = theTree; } - -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_ItemBVHTree(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn); - -private: - - opencascade::handle > myTree; //!< the current tree - TCollection_AsciiString myName; //!< the name -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemBVHTreeNode.cxx b/tools/VInspector/VInspector_ItemBVHTreeNode.cxx deleted file mode 100644 index 836acdb693..0000000000 --- a/tools/VInspector/VInspector_ItemBVHTreeNode.cxx +++ /dev/null @@ -1,167 +0,0 @@ -// Created on: 2019-04-29 -// 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 - -#include -//#include -// -#include - -#include - -#include -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemBVHTreeNode::initRowCount() const -{ - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemBVHTreeNode::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(); - - switch (Column()) - { - case 0: return QString ("TreeNode_%1").arg (Row()); break; - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTreeNode::Init() -{ - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTreeNode::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : GetTree -// purpose : -// ======================================================================= - -opencascade::handle > VInspector_ItemBVHTreeNode::GetTree() const -{ - VInspector_ItemBVHTreePtr anObjectParent = itemDynamicCast(Parent()); - - return anObjectParent->GetTree(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemBVHTreeNode::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemBVHTreeNode::createChild (int, int) -{ - return TreeModel_ItemBasePtr(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemBVHTreeNode::buildPresentationShape() -{ - return TopoDS_Shape(); - /*opencascade::handle > aBVHTree = GetTree(); - if (aBVHTree.IsNull()) - return TopoDS_Shape(); - - Standard_SStream theOStream; - aBVHTree->DumpJsonNode (Row(), theOStream); - - Standard_Integer aColumnCount; - NCollection_Vector aValues; - Message::ConvertStream (theOStream, aColumnCount, aValues); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - for (int aValueId = 0; aValueId < aValues.Size(); ) - { - for (int aColumnId = 0; aColumnId < aColumnCount; aColumnId++, aValueId++) - { - if (aColumnId != 1) - continue; - - TCollection_AsciiString aValue = aValues.Value (aValueId); - Bnd_Box aBox; - if (!aBox.Init (Standard_SStream (aValue.ToCString()))) - continue; - - TopoDS_Shape aShape = Convert_Tools::CreateShape (aBox); - aBuilder.Add (aCompound, aShape); - } - } - return aCompound; - */ -} - -// ======================================================================= -// function : Dump -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemBVHTreeNode::Dump (Standard_OStream& /*theOStream*/) const -{ - /*opencascade::handle > aBVHTree = GetTree(); - if (aBVHTree.IsNull()) - return Standard_False; - - aBVHTree->DumpJsonNode (Row(), theOStream); - */ - return Standard_True; -} diff --git a/tools/VInspector/VInspector_ItemBVHTreeNode.hxx b/tools/VInspector/VInspector_ItemBVHTreeNode.hxx deleted file mode 100644 index 4c58fb28b5..0000000000 --- a/tools/VInspector/VInspector_ItemBVHTreeNode.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// Created on: 2019-04-29 -// 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_ItemBVHTreeNode_H -#define VInspector_ItemBVHTreeNode_H - -#include -#include - -//#include -//#include - -class SelectMgr_BaseFrustum; - -class VInspector_ItemBVHTreeNode; -typedef QExplicitlySharedDataPointer VInspector_ItemBVHTreeNodePtr; - -//! \class VInspector_ItemBVHTreeNode -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemBVHTreeNode : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemBVHTreeNodePtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemBVHTreeNodePtr (new VInspector_ItemBVHTreeNode (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemBVHTreeNode() 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 Handle(Standard_Transient) GetObject() const { initItem(); return NULL; } - - //! Returns parent tree, the node information is obtained from the tree by the given index - Standard_EXPORT opencascade::handle > GetTree() const; - - //! Dumps the content of me into the stream - virtual Standard_Boolean Dump (Standard_OStream& theOStream) const; - -protected: - //! Initialize 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; - - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() 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_ItemBVHTreeNode(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemBase.cxx b/tools/VInspector/VInspector_ItemBase.cxx index 56158a4018..8f1cee216e 100644 --- a/tools/VInspector/VInspector_ItemBase.cxx +++ b/tools/VInspector/VInspector_ItemBase.cxx @@ -17,37 +17,6 @@ #include #include -#include - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemBase::Reset() -{ - myPresentationShape = TopoDS_Shape(); - TreeModel_ItemBase::Reset(); -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemBase::initValue (const int theItemRole) const -{ - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - switch (Column()) - { - case 1: { return rowCount(); } - case 2: return ViewControl_Tools::GetPointerInfo (GetObject(), true).ToCString(); - case 3: { return Row(); } - } - - return QVariant(); -} - // ======================================================================= // function : GetContext // purpose : @@ -80,16 +49,3 @@ Handle(AIS_InteractiveContext) VInspector_ItemBase::GetContext() const return myContext; } - -// ======================================================================= -// function : GetContext -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemBase::GetPresentationShape() const -{ - if (Column() != TreeModel_ColumnType_Name) - return TopoDS_Shape(); - - initItem(); - return myPresentationShape; -} diff --git a/tools/VInspector/VInspector_ItemBase.hxx b/tools/VInspector/VInspector_ItemBase.hxx index bb633626c4..c0c268d395 100644 --- a/tools/VInspector/VInspector_ItemBase.hxx +++ b/tools/VInspector/VInspector_ItemBase.hxx @@ -18,13 +18,7 @@ #include #include -#include - -#include #include -#include - -class Graphic3d_TransformPers; class VInspector_ItemBase; typedef QExplicitlySharedDataPointer VInspector_ItemBasePtr; @@ -35,7 +29,7 @@ class VInspector_ItemBase : public TreeModel_ItemBase { public: //! Resets cached values - virtual void Reset() Standard_OVERRIDE; + virtual void Reset() Standard_OVERRIDE { TreeModel_ItemBase::Reset(); } //! Sets the context //! \param theLabel an object where the child items structure is found @@ -49,32 +43,10 @@ public: //! \return a context Standard_EXPORT Handle(AIS_InteractiveContext) GetContext() const; - //! 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 presentation of the attribute to be visualized in the view - //! \thePresentations [out] container of presentation handles to be visualized - virtual void GetPresentations (NCollection_List& thePresentations) - { (void)thePresentations; } - - //! Returns transform persistent of the item or NULL - Handle(Graphic3d_TransformPers) TransformPersistence() const { return myTransformPersistence; } - - //! Returns shape of the item parameters - //! \return generated shape of the item parameters - Standard_EXPORT virtual TopoDS_Shape GetPresentationShape() const; - - //! Rebuild presentation shape if the item use it - //! \return generated shape of the item parameters - void UpdatePresentationShape() { myPresentationShape = buildPresentationShape(); } - protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() { return TopoDS_Shape(); } + //! Initialize the current item. It creates a backup of the specific item information + virtual void initItem() const {} protected: @@ -88,8 +60,6 @@ protected: protected: Handle(AIS_InteractiveContext) myContext; //!< the current context - TopoDS_Shape myPresentationShape; //!< item presentation shape - Handle(Graphic3d_TransformPers) myTransformPersistence; //!< item cached persistent }; #endif \ No newline at end of file diff --git a/tools/VInspector/VInspector_ItemContainer.cxx b/tools/VInspector/VInspector_ItemContainer.cxx deleted file mode 100644 index a72c4741c6..0000000000 --- a/tools/VInspector/VInspector_ItemContainer.cxx +++ /dev/null @@ -1,96 +0,0 @@ -// 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 - -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemContainer::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)) - return QVariant(); - - VInspector_ItemContainerAPI* aContainerItem = dynamic_cast(Parent().data()); - - if (!aContainerItem) - return "Empty item container"; - - return aContainerItem->GetContainerValue (Row(), theItemRole); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemContainer::initRowCount() const -{ - VInspector_ItemContainerAPI* aContainerItem = dynamic_cast(Parent().data()); - - if (!aContainerItem) - return 0; - - return aContainerItem->GetContainerRowCount (Row()); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemContainer::createChild (int theRow, int theColumn) -{ - VInspector_ItemContainerAPI* aContainerItem = dynamic_cast(Parent().data()); - - if (!aContainerItem) - return TreeModel_ItemBasePtr(); - - return aContainerItem->CreateContainerChild (currentItem(), Row(), theRow, theColumn); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemContainer::Init() -{ - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemContainer::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemContainer::initItem() const -{ - if (IsInitialized()) - return; - const_cast (this)->Init(); -} diff --git a/tools/VInspector/VInspector_ItemContainer.hxx b/tools/VInspector/VInspector_ItemContainer.hxx deleted file mode 100644 index f71949bc0c..0000000000 --- a/tools/VInspector/VInspector_ItemContainer.hxx +++ /dev/null @@ -1,87 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemContainer_H -#define VInspector_ItemContainer_H - -#include -#include - -#include -#include -#include - -class Prs3d_Drawer; - -class QItemSelectionModel; - -class VInspector_ItemContainer; -typedef QExplicitlySharedDataPointer VInspector_ItemContainerPtr; - -//! \class VInspector_ItemContainer -//! Item presents additional level of information in the tree model. -//! Parent is item context, children are either folder item or Selection filter item. -class VInspector_ItemContainer : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemContainerPtr CreateItem (TreeModel_ItemBasePtr theParent, - const int theRow, const int theColumn) - { return VInspector_ItemContainerPtr (new VInspector_ItemContainer (theParent, theRow, theColumn)); } - //! Destructor - virtual ~VInspector_ItemContainer() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { return NULL; } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of item selected - //! \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; - - //! Creates a child item in the given position. - //! \param theRow the child row position - //! \param theColumn the child column position - //! \return the created item - virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; - -private: - - //! Constructor - //! param theParent a parent item - VInspector_ItemContainer (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase (theParent, theRow, theColumn) {} - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemContainerAPI.hxx b/tools/VInspector/VInspector_ItemContainerAPI.hxx deleted file mode 100644 index c986433e2b..0000000000 --- a/tools/VInspector/VInspector_ItemContainerAPI.hxx +++ /dev/null @@ -1,50 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemContainerAPI_H -#define VInspector_ItemContainerAPI_H - -#include -#include - -//! \class VInspector_ItemContainerAPI -class VInspector_ItemContainerAPI -{ - -public: - //! Constructor - VInspector_ItemContainerAPI () {} - - //! Destructor - virtual ~VInspector_ItemContainerAPI() {}; - - //! Returns number of item selected - //! \return rows count - virtual int GetContainerRowCount (const int theContainerRow) const = 0; - - //! Returns item information for the given role. Fills internal container if it was not filled yet - //! \param theItemRole a value role - //! \return the value - virtual QVariant GetContainerValue (const int theContainerRow, const int theItemRole) const = 0; - - //! 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 CreateContainerChild (const TreeModel_ItemBasePtr& theParent, const int theContainerRow, int theRow, int theColumn) = 0; - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemContext.cxx b/tools/VInspector/VInspector_ItemContext.cxx index decdc4b162..51770e4f0a 100644 --- a/tools/VInspector/VInspector_ItemContext.cxx +++ b/tools/VInspector/VInspector_ItemContext.cxx @@ -15,7 +15,6 @@ #include -#include #include #include #include @@ -53,14 +52,13 @@ int VInspector_ItemContext::initRowCount() const #ifdef DEBUG_FREE_OWNERS int aRows = 0; // only local context is processed: TODO for global context - NCollection_List anActiveOwners; + NCollection_List anActiveOwners; aContext->MainSelector()->ActiveOwners(anActiveOwners); Handle(SelectMgr_EntityOwner) anOwner; - for (NCollection_List::Iterator anOwnersIt(anActiveOwners); - anOwnersIt.More(); anOwnersIt.Next()) + for (NCollection_List::Iterator anOwnersIt(anActiveOwners); anOwnersIt.More(); anOwnersIt.Next()) { - anOwner = Handle(SelectMgr_EntityOwner)::DownCast(anOwnersIt.Value()); + anOwner = anOwnersIt.Value(); if (anOwner.IsNull()) continue; Handle(AIS_InteractiveObject) anAISObj = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable()); @@ -68,12 +66,12 @@ int VInspector_ItemContext::initRowCount() const aRows++; } // owners in Global Context - NCollection_List anActiveOwners; + NCollection_List anActiveOwners; aContext->MainSelector()->ActiveOwners(anActiveOwners); if (aRows > 0) aNbPresentations += aRows; - NCollection_List anEmptySelectableOwners; - NCollection_List anOwners = + NCollection_List anEmptySelectableOwners; + NCollection_List anOwners = VInspector_Tools::ActiveOwners (aContext, anEmptySelectableOwners); if (anEmptySelectableOwners.Size() > 0) aNbPresentations += 1; @@ -87,10 +85,6 @@ int VInspector_ItemContext::initRowCount() const // ======================================================================= QVariant VInspector_ItemContext::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(); @@ -100,6 +94,7 @@ QVariant VInspector_ItemContext::initValue (const int theItemRole) const switch (Column()) { case 0: return GetContext()->DynamicType()->Name(); + case 1: return rowCount(); case 4: { Handle(AIS_InteractiveObject) anEmptyIO; diff --git a/tools/VInspector/VInspector_ItemContext.hxx b/tools/VInspector/VInspector_ItemContext.hxx index aa693d39c4..166b8a6519 100644 --- a/tools/VInspector/VInspector_ItemContext.hxx +++ b/tools/VInspector/VInspector_ItemContext.hxx @@ -38,10 +38,6 @@ public: //! Destructor virtual ~VInspector_ItemContext() Standard_OVERRIDE {}; - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myContext; } - //! Returns number of displayed presentations //! \return rows count Standard_EXPORT virtual int initRowCount() const Standard_OVERRIDE; diff --git a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx b/tools/VInspector/VInspector_ItemEntityOwner.cxx similarity index 67% rename from tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx rename to tools/VInspector/VInspector_ItemEntityOwner.cxx index add2403288..309bb45d3a 100644 --- a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.cxx +++ b/tools/VInspector/VInspector_ItemEntityOwner.cxx @@ -13,16 +13,13 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include -#include +#include +#include #include #include -#include -#include #include -#include -#include +#include #include #include @@ -35,25 +32,50 @@ // function : initValue // purpose : // ======================================================================= -QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) const +QVariant VInspector_ItemEntityOwner::initValue(int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - switch (theItemRole) { case Qt::DisplayRole: case Qt::EditRole: case Qt::ToolTipRole: { - Handle(SelectBasics_EntityOwner) anOwner = getEntityOwner(); + Handle(SelectMgr_EntityOwner) anOwner = getEntityOwner(); if (anOwner.IsNull()) return QVariant(); switch (Column()) { case 0: return anOwner->DynamicType()->Name(); + case 2: return VInspector_Tools::GetPointerInfo (anOwner, true).ToCString(); + case 3: + { + Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner); + if (BROwnr.IsNull()) + return QVariant(); + + const TopoDS_Shape& aShape = BROwnr->Shape(); + if (aShape.IsNull()) + return QVariant(); + + return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString(); + } + case 17: + case 18: + case 19: + { + Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner); + if (BROwnr.IsNull()) + return QVariant(); + + const TopoDS_Shape& aShape = BROwnr->Shape(); + if (aShape.IsNull()) + return QVariant(); + + return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString() + : Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString() + : /*19*/ VInspector_Tools::LocationToName (aShape.Location()).ToCString(); + } default: break; } break; @@ -70,7 +92,7 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) cons return (theItemRole == Qt::BackgroundRole) ? QColor (Qt::darkBlue) : QColor (Qt::white); } } - VInspector_ItemSelectMgrSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); + VInspector_ItemSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); if (aParentItem) return aParentItem->data(QModelIndex(), theItemRole); break; @@ -83,16 +105,15 @@ QVariant VInspector_ItemSelectBasicsEntityOwner::initValue(int theItemRole) cons // function : Init // purpose : // ======================================================================= -void VInspector_ItemSelectBasicsEntityOwner::Init() +void VInspector_ItemEntityOwner::Init() { - Handle(SelectBasics_EntityOwner) anOwner; + Handle(SelectMgr_EntityOwner) anOwner; - VInspector_ItemSelectMgrSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); + VInspector_ItemSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); if (aParentItem) { Handle(SelectMgr_SensitiveEntity) anEntity = aParentItem->GetSensitiveEntity(); - if (!anEntity.IsNull() && !anEntity->BaseSensitive().IsNull()) - anOwner = anEntity->BaseSensitive()->OwnerId(); + anOwner = anEntity->BaseSensitive()->OwnerId(); } else { @@ -118,7 +139,7 @@ void VInspector_ItemSelectBasicsEntityOwner::Init() { Handle(SelectMgr_SensitiveEntity) anEntity = aSelEntIter.Value(); #endif - const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive(); + const Handle(Select3D_SensitiveEntity)& aBase = anEntity->BaseSensitive(); if (!aBase.IsNull()) { if (aRowId == aCurrentIndex) @@ -130,7 +151,6 @@ void VInspector_ItemSelectBasicsEntityOwner::Init() } } myOwner = anOwner; - UpdatePresentationShape(); TreeModel_ItemBase::Init(); } @@ -138,7 +158,7 @@ void VInspector_ItemSelectBasicsEntityOwner::Init() // function : Reset // purpose : // ======================================================================= -void VInspector_ItemSelectBasicsEntityOwner::Reset() +void VInspector_ItemEntityOwner::Reset() { VInspector_ItemBase::Reset(); SetContext (NULL); @@ -148,35 +168,19 @@ void VInspector_ItemSelectBasicsEntityOwner::Reset() // function : initItem // purpose : // ======================================================================= -void VInspector_ItemSelectBasicsEntityOwner::initItem() const +void VInspector_ItemEntityOwner::initItem() const { if (IsInitialized()) return; - const_cast(this)->Init(); + const_cast(this)->Init(); } // ======================================================================= -// function : GetStream +// function : getEntityOwner // purpose : // ======================================================================= -void VInspector_ItemSelectBasicsEntityOwner::GetStream (Standard_OStream& theOStream) const +Handle(SelectMgr_EntityOwner) VInspector_ItemEntityOwner::getEntityOwner() const { - Handle(SelectMgr_EntityOwner) anEntityOwner = getEntityOwner(); - if (anEntityOwner.IsNull()) - return; - - anEntityOwner->DumpJson (theOStream); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectBasicsEntityOwner::buildPresentationShape() -{ - Handle(StdSelect_BRepOwner) aBROwner = Handle(StdSelect_BRepOwner)::DownCast (myOwner); - if (aBROwner.IsNull()) - return TopoDS_Shape(); - - return aBROwner->Shape(); + initItem(); + return myOwner; } diff --git a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx b/tools/VInspector/VInspector_ItemEntityOwner.hxx similarity index 60% rename from tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx rename to tools/VInspector/VInspector_ItemEntityOwner.hxx index 3562070488..f00adc2ee3 100644 --- a/tools/VInspector/VInspector_ItemSelectBasicsEntityOwner.hxx +++ b/tools/VInspector/VInspector_ItemEntityOwner.hxx @@ -13,8 +13,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef VInspector_ItemSelectBasicsEntityOwner_H -#define VInspector_ItemSelectBasicsEntityOwner_H +#ifndef VInspector_ItemEntityOwner_H +#define VInspector_ItemEntityOwner_H #include #include @@ -22,22 +22,22 @@ class QItemSelectionModel; -class VInspector_ItemSelectBasicsEntityOwner; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectBasicsEntityOwnerPtr; +class VInspector_ItemEntityOwner; +typedef QExplicitlySharedDataPointer VInspector_ItemEntityOwnerPtr; //! \class VInspector_ItemPresentableObject //! Item for selection entity owner. The parent is sensitive entity item, there are no children -class VInspector_ItemSelectBasicsEntityOwner : public VInspector_ItemBase +class VInspector_ItemEntityOwner : public VInspector_ItemBase { public: //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectBasicsEntityOwnerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectBasicsEntityOwnerPtr (new VInspector_ItemSelectBasicsEntityOwner (theParent, theRow, theColumn)); } + static VInspector_ItemEntityOwnerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + { return VInspector_ItemEntityOwnerPtr (new VInspector_ItemEntityOwner (theParent, theRow, theColumn)); } //! Destructor - virtual ~VInspector_ItemSelectBasicsEntityOwner() Standard_OVERRIDE {}; + virtual ~VInspector_ItemEntityOwner() Standard_OVERRIDE {}; //! Inits the item, fills internal containers Standard_EXPORT virtual void Init() Standard_OVERRIDE; @@ -45,16 +45,8 @@ public: //! Resets cached values Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myOwner; } - //! Returns the current entity owner - Handle(SelectBasics_EntityOwner) EntityOwner() const { return myOwner; } - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE; + Handle(SelectMgr_EntityOwner) EntityOwner() const { return myOwner; } protected: //! \return number of children. @@ -69,9 +61,6 @@ protected: virtual void initItem() const Standard_OVERRIDE; protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape(); //! Creates a child item in the given position. //! \param theRow the child row position @@ -84,18 +73,17 @@ private: //! Constructor //! param theParent a parent item - VInspector_ItemSelectBasicsEntityOwner(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + VInspector_ItemEntityOwner(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) : VInspector_ItemBase(theParent, theRow, theColumn) {} private: //! Returns the current entity owner. Initializes the item if it was not initialized yet - Handle(SelectBasics_EntityOwner) getEntityOwner() const - { return Handle(SelectBasics_EntityOwner)::DownCast (GetObject()); } + Handle(SelectMgr_EntityOwner) getEntityOwner() const; private: - Handle(SelectBasics_EntityOwner) myOwner; //!< the current entity owner + Handle(SelectMgr_EntityOwner) myOwner; //!< the current entity owner }; #endif diff --git a/tools/VInspector/VInspector_ItemFolderObject.cxx b/tools/VInspector/VInspector_ItemFolderObject.cxx index 1f0b1e71d3..cbd413bc5c 100644 --- a/tools/VInspector/VInspector_ItemFolderObject.cxx +++ b/tools/VInspector/VInspector_ItemFolderObject.cxx @@ -16,15 +16,7 @@ #include #include -#include -#include -#include #include -#include -#include - -#include -#include // ======================================================================= // function : initValue @@ -32,21 +24,13 @@ // ======================================================================= QVariant VInspector_ItemFolderObject::initValue (int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)) - return QVariant(); - - ParentKind aParentKind = GetParentItemKind(); - switch (aParentKind) + if (Column() == 0 && (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole)) { - case ParentKind_ContextItem: return "Properties"; - case ParentKind_PresentationItem: return "Properties"; - case ParentKind_FolderItem: return Row() == 0 ? "Filters" : QVariant(); - default: return QVariant(); + if (parentItemIsContext()) return "Properties"; + else if (Row() == 0) return "Filters"; + else return QVariant(); } + return QVariant(); } // ======================================================================= @@ -55,30 +39,7 @@ QVariant VInspector_ItemFolderObject::initValue (int theItemRole) const // ======================================================================= int VInspector_ItemFolderObject::initRowCount() const { - ParentKind aParentKind = GetParentItemKind(); - switch (aParentKind) - { - case ParentKind_ContextItem: - { - int aNbChildren = 3; // Filters, Viewer, MainSelector - aNbChildren++; // DefaultDrawer - for (int aTypeId = 0; aTypeId < Prs3d_TypeOfHighlight_NB; aTypeId++) - { - const Handle(Prs3d_Drawer)& aStyle = GetContext()->HighlightStyle ((Prs3d_TypeOfHighlight)aTypeId); - if (!aStyle.IsNull()) - aNbChildren++; - } - return aNbChildren; - } - case ParentKind_PresentationItem: - { - return 4; // TransformPers, Attributes, HilightAttributes and DynamicHilightAttributes - } - case ParentKind_FolderItem: - return (GetContext().IsNull() ? 0 : GetContext()->Filters().Extent()); - default: - return 0; - } + return parentItemIsContext() ? 1 : (GetContext().IsNull() ? 0 : GetContext()->Filters().Extent()); } // ======================================================================= @@ -87,31 +48,10 @@ int VInspector_ItemFolderObject::initRowCount() const // ======================================================================= TreeModel_ItemBasePtr VInspector_ItemFolderObject::createChild (int theRow, int theColumn) { - ParentKind aParentKind = GetParentItemKind(); - switch (aParentKind) - { - case ParentKind_ContextItem: - { - if (theRow == 0) - return VInspector_ItemFolderObject::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 1) - return VInspector_ItemV3dViewer::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 2) - return VInspector_ItemSelectMgrViewerSelector::CreateItem (currentItem(), theRow, theColumn); - else - return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn); - } - case ParentKind_PresentationItem: - { - 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(); - } + if (parentItemIsContext()) + return VInspector_ItemFolderObject::CreateItem (currentItem(), theRow, theColumn); + else + return VInspector_ItemSelectMgrFilter::CreateItem (currentItem(), theRow, theColumn); } // ======================================================================= @@ -132,62 +72,6 @@ void VInspector_ItemFolderObject::Reset() VInspector_ItemBase::Reset(); } -// ======================================================================= -// function : GetPrs3dDrawer -// purpose : -// ======================================================================= -Handle(Prs3d_Drawer) VInspector_ItemFolderObject::GetPrs3dDrawer (const int theRow, - TCollection_AsciiString& theName) const -{ - ParentKind aParentKind = GetParentItemKind(); - switch (aParentKind) - { - case ParentKind_ContextItem: - { - if (theRow == 0 || theRow == 1 || theRow == 2) // "Filters", "Viewer", "Viewer Selector" - return 0; - - if (theRow == 3) - { - theName = "DefaultDrawer"; - return GetContext()->DefaultDrawer(); - } - - for (int aTypeId = 0, aCurId = 0; aTypeId < Prs3d_TypeOfHighlight_NB; aTypeId++) - { - Prs3d_TypeOfHighlight aType = (Prs3d_TypeOfHighlight)aTypeId; - const Handle(Prs3d_Drawer)& aDrawer = GetContext()->HighlightStyle (aType); - if (aDrawer.IsNull()) - continue; - if (aCurId == theRow - 4) - { - theName = TCollection_AsciiString ("HighlightStyle: ") + aType; - return aDrawer; - } - aCurId++; - } - } - case ParentKind_PresentationItem: - { - VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast(Parent()); - Handle(AIS_InteractiveObject) aPrs = aParentPrsItem->GetInteractiveObject(); - switch (theRow) - { - 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; - } - } - case ParentKind_FolderItem: - default: break; - } - - theName = "None"; - return Handle(Prs3d_Drawer)(); -} - // ======================================================================= // function : initItem // purpose : @@ -200,18 +84,10 @@ void VInspector_ItemFolderObject::initItem() const } // ======================================================================= -// function : GetParentItemKind +// function : parentItemIsContext // purpose : // ======================================================================= -VInspector_ItemFolderObject::ParentKind VInspector_ItemFolderObject::GetParentItemKind() const +bool VInspector_ItemFolderObject::parentItemIsContext() const { - VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast(Parent()); - if (aParentPrsItem) - return ParentKind_PresentationItem; - - VInspector_ItemContextPtr aParentContextItem = itemDynamicCast(Parent()); - if (aParentContextItem) - return ParentKind_ContextItem; - - return ParentKind_FolderItem; + return itemDynamicCast (Parent()); } diff --git a/tools/VInspector/VInspector_ItemFolderObject.hxx b/tools/VInspector/VInspector_ItemFolderObject.hxx index 6d49bd9d21..a0a754f8d8 100644 --- a/tools/VInspector/VInspector_ItemFolderObject.hxx +++ b/tools/VInspector/VInspector_ItemFolderObject.hxx @@ -20,10 +20,9 @@ #include #include +#include #include -class Prs3d_Drawer; - class QItemSelectionModel; class VInspector_ItemFolderObject; @@ -44,33 +43,12 @@ public: //! Destructor virtual ~VInspector_ItemFolderObject() Standard_OVERRIDE {}; - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { return NULL; } - //! Inits the item, fills internal containers Standard_EXPORT virtual void Init() Standard_OVERRIDE; //! Resets cached values Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - //! Returns drawer of the row if possible - //! \param theRow child row index - //! \param theName [out] drawer name - Standard_EXPORT Handle(Prs3d_Drawer) GetPrs3dDrawer (const int theRow, - TCollection_AsciiString& theName) const; - - enum ParentKind - { - ParentKind_ContextItem, //!< "Properties" item under an interactive context - ParentKind_PresentationItem, //!< "Properties" item under an interactive presentation - ParentKind_FolderItem //!< "Filters" item under an interactive context - }; - - //! Finds kind of the parent item - //! \return item kind - ParentKind GetParentItemKind() const; - protected: //! Initialize the current item. It is empty because Reset() is also empty. @@ -91,6 +69,11 @@ protected: //! \return the created item virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; +private: + //! Returns whether the parent item is context item + //! \returns bolean value + bool parentItemIsContext() const; + private: //! Constructor diff --git a/tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx b/tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx deleted file mode 100644 index 60d5762bdc..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCStructure.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// 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 -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : GetGroup -// purpose : -// ======================================================================= -Handle(Graphic3d_Group) VInspector_ItemGraphic3dCStructure::GetGroup (const int theRowId) const -{ - Handle(Graphic3d_CStructure) aCStructure = GetCStructure(); - if (aCStructure.IsNull()) - return Handle(Graphic3d_Group)(); - - const Graphic3d_SequenceOfGroup& aGroups = aCStructure->Groups(); - int aCurrentIndex = 0; - for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next()) - { - if (theRowId == aCurrentIndex) - return aGroupIter.Value(); - - aCurrentIndex++; - } - return Handle(Graphic3d_Group)(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCStructure::Init() -{ - VInspector_ItemPrs3dPresentationPtr aParentItem = itemDynamicCast(Parent()); - - Handle(Prs3d_Presentation) aPresentation = aParentItem->GetPresentation(); - myCStructure = aPresentation->CStructure(); - if (!myCStructure.IsNull()) - myTransformPersistence = myCStructure->TransformPersistence(); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCStructure::Reset() -{ - VInspector_ItemBase::Reset(); - myCStructure = NULL; - myTransformPersistence = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCStructure::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dCStructure::initRowCount() const -{ - if (Column() != 0) - return 0; - - Handle(Graphic3d_CStructure) aCStructure = GetCStructure(); - return !aCStructure.IsNull() ? aCStructure->Groups().Length() : 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dCStructure::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(); - - Handle(Graphic3d_CStructure) aCStructure = GetCStructure(); - if (aCStructure.IsNull()) - return Column() == 0 ? "Empty CStructure" : ""; - - switch (Column()) - { - case 0: return theItemRole == Qt::DisplayRole ? aCStructure->DynamicType()->Name() - : STANDARD_TYPE (Graphic3d_CStructure)->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dCStructure::createChild (int theRow, int theColumn) -{ - Handle(Graphic3d_CStructure) aCStructure = GetCStructure(); - //Handle(Prs3d_Presentation) aPresentation = GetPresentation(); - //Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const; - - if (theRow >= 0 && theRow < GetCStructure()->Groups().Length()) - return VInspector_ItemGraphic3dGroup::CreateItem (currentItem(), theRow, theColumn); - //else - // return VInspector_ItemPresentableObject::CreateItem (currentItem(), theRow, theColumn); - - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dCStructure.hxx b/tools/VInspector/VInspector_ItemGraphic3dCStructure.hxx deleted file mode 100644 index 88e88999f1..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCStructure.hxx +++ /dev/null @@ -1,99 +0,0 @@ -// 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_ItemGraphic3dCStructure_H -#define VInspector_ItemGraphic3dCStructure_H - -#include -#include - -class Graphic3d_CStructure; - -class VInspector_ItemGraphic3dCStructure; -typedef QExplicitlySharedDataPointer VInspector_ItemGraphic3dCStructurePtr; - -//! \class VInspector_ItemGraphic3dCStructure -//! 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_ItemGraphic3dCStructure : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemGraphic3dCStructurePtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemGraphic3dCStructurePtr (new VInspector_ItemGraphic3dCStructure (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemGraphic3dCStructure() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCStructure; } - - //! Returns the current C structure, init item if it was not initialized yet - //! \return graphic C structure object - Standard_EXPORT Handle(Graphic3d_CStructure) GetCStructure() const - { return Handle(Graphic3d_CStructure)::DownCast (GetObject()); } - - //! Returns group of the C structure - //! \param theRowId a group index - //! \return graphical group - Standard_EXPORT Handle(Graphic3d_Group) GetGroup (const int theRowId) const; - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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_ItemGraphic3dCStructure(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(Graphic3d_CStructure) myCStructure; -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemGraphic3dCView.cxx b/tools/VInspector/VInspector_ItemGraphic3dCView.cxx deleted file mode 100644 index e5fbea9598..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCView.cxx +++ /dev/null @@ -1,164 +0,0 @@ -// 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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : GetLayerList -// purpose : -// ======================================================================= -const OpenGl_LayerList& VInspector_ItemGraphic3dCView::GetLayerList (Standard_Boolean& isDefault) const -{ - isDefault = Standard_True; - - Handle(Graphic3d_CView) aCView = GetCView(); - if (aCView.IsNull()) - return myDefaultLayer; - - Handle(OpenGl_View) aOpenGlView = Handle(OpenGl_View)::DownCast (aCView); - if (aOpenGlView.IsNull()) - return myDefaultLayer; - - isDefault = Standard_False; - return aOpenGlView->LayerList(); -} - -// ======================================================================= -// function : GetClipPlane -// purpose : -// ======================================================================= -Handle(Graphic3d_ClipPlane) VInspector_ItemGraphic3dCView::GetClipPlane(const int /*theRow*/) -{ - //Handle(V3d_View) aView = GetView(); - - //const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aView->ClipPlanes(); - - //Standard_Integer aPlaneId = 0; - //for (Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (*aClipPlanes); aPlaneIt.More(); aPlaneIt.Next(), ++aPlaneId) - //{ - // if (aPlaneId == theRow) - // return aPlaneIt.Value(); - //} - return 0; -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCView::Init() -{ - VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast(Parent()); - - myCView = aParentItem->GetView()->View(); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCView::Reset() -{ - VInspector_ItemBase::Reset(); - myCView = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCView::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dCView::initRowCount() const -{ - if (Column() != 0) - return 0; - - int aNbElements = 2; // Camera, OpenGl_LayerList - - Handle(Graphic3d_CView) aCView = GetCView(); - const Handle(Graphic3d_SequenceOfHClipPlane)& aClipPlanes = aCView->ClipPlanes(); - if (!aClipPlanes.IsNull()) - aNbElements += aClipPlanes->Size(); - - return aNbElements; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dCView::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(); - - Handle(Graphic3d_CView) aCView = GetCView(); - if (aCView.IsNull()) - return Column() == 0 ? "Empty Graphic3d_CView" : ""; - - switch (Column()) - { - case 0: return theItemRole == Qt::DisplayRole ? aCView->DynamicType()->Name() - : STANDARD_TYPE (Graphic3d_CView)->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dCView::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 1) - return VInspector_ItemOpenGlLayerList::CreateItem (currentItem(), theRow, theColumn); - else - return VInspector_ItemGraphic3dClipPlane::CreateItem (currentItem(), theRow, theColumn); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dCView.hxx b/tools/VInspector/VInspector_ItemGraphic3dCView.hxx deleted file mode 100644 index a28ceb8f94..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCView.hxx +++ /dev/null @@ -1,104 +0,0 @@ -// 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_ItemGraphic3dCView_H -#define VInspector_ItemGraphic3dCView_H - -#include -#include - -#include - -class Graphic3d_CView; - -class VInspector_ItemGraphic3dCView; -typedef QExplicitlySharedDataPointer VInspector_ItemGraphic3dCViewPtr; - -//! \class VInspector_ItemGraphic3dCView -//! 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_ItemGraphic3dCView : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemGraphic3dCViewPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemGraphic3dCViewPtr (new VInspector_ItemGraphic3dCView (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemGraphic3dCView() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCView; } - - //! Returns current clip plane, initialize if it was not initialized yet - Standard_EXPORT Handle(Graphic3d_CView) GetCView() const - { return Handle(Graphic3d_CView)::DownCast (GetObject()); } - - //! Returns layer list if the View is OpenGl_View - //! \param isDefault flag is true if the layer is absent and the default value of this class is used - Standard_EXPORT const OpenGl_LayerList& GetLayerList (Standard_Boolean& isDefault) const; - - //! Returns clip plane of the row if possible - //! \param theRow child row index - Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane(const int theRow); - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 - 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; - -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_ItemGraphic3dCView(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn), myDefaultLayer (1) {} - -private: - Handle(Graphic3d_CView) myCView; //! current graphical CView - OpenGl_LayerList myDefaultLayer; //! default layer if the view is not OpenGl -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemGraphic3dCamera.cxx b/tools/VInspector/VInspector_ItemGraphic3dCamera.cxx deleted file mode 100644 index cd6bc3b392..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCamera.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// 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 - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCamera::Init() -{ - VInspector_ItemV3dViewPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - myCamera = aParentItem->GetView()->DefaultCamera(); - else - { - VInspector_ItemGraphic3dCViewPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - myCamera = aParentItem->GetCView()->Camera(); - } - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCamera::Reset() -{ - VInspector_ItemBase::Reset(); - myCamera = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dCamera::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dCamera::initRowCount() const -{ - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dCamera::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(); - - Handle(Graphic3d_Camera) aCamera = GetCamera(); - if (aCamera.IsNull()) - return Column() == 0 ? "Empty Graphic3d_Camera" : ""; - - switch (Column()) - { - case 0: return theItemRole == Qt::DisplayRole ? aCamera->DynamicType()->Name() - : STANDARD_TYPE (Graphic3d_Camera)->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemGraphic3dCamera::buildPresentationShape (const Handle(Graphic3d_Camera)& theCamera) -{ - if (theCamera.IsNull()) - return TopoDS_Shape(); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - - const gp_Pnt& aCenter = theCamera->Center (); - const gp_Pnt& anEye = theCamera->Eye (); - const gp_Dir& anUp = theCamera->Up(); - const gp_Dir& aCameraDirection = theCamera->Direction(); - - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aCenter)); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (anEye)); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anEye, anUp))); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anEye, aCameraDirection))); - - return aCompound; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dCamera::createChild (int, int) -{ - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dCamera.hxx b/tools/VInspector/VInspector_ItemGraphic3dCamera.hxx deleted file mode 100644 index 5ca33c5dc0..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dCamera.hxx +++ /dev/null @@ -1,101 +0,0 @@ -// 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_ItemGraphic3dCamera_H -#define VInspector_ItemGraphic3dCamera_H - -#include -#include - -class Graphic3d_Camera; - -class VInspector_ItemGraphic3dCamera; -typedef QExplicitlySharedDataPointer VInspector_ItemGraphic3dCameraPtr; - -//! \class VInspector_ItemGraphic3dCamera -//! 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_ItemGraphic3dCamera : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemGraphic3dCameraPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemGraphic3dCameraPtr (new VInspector_ItemGraphic3dCamera (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemGraphic3dCamera() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myCamera; } - - //! Returns the current graphic3d camera, init item if it was not initialized yet - //! \return graphic camera - Standard_EXPORT Handle(Graphic3d_Camera) GetCamera() const { return Handle(Graphic3d_Camera)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myCamera); } - - //! Creates shape for the 3d view parameters - //! \param theView current view - //! \return shape or NULL - static TopoDS_Shape buildPresentationShape (const Handle(Graphic3d_Camera)& theView); - - //! 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 - 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; - -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_ItemGraphic3dCamera(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(Graphic3d_Camera) myCamera; //! current graphic group -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemGraphic3dClipPlane.cxx b/tools/VInspector/VInspector_ItemGraphic3dClipPlane.cxx deleted file mode 100644 index 1e36b08509..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dClipPlane.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// 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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dClipPlane::initRowCount() const -{ - if (Column() != 0) - return 0; - - VInspector_ItemV3dViewPtr aParentViewItem = itemDynamicCast(Parent()); - if (aParentViewItem) - return aParentViewItem->GetView()->ClipPlanes()->Size(); - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dClipPlane::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 (GetClipPlane().IsNull()) - return Column() == 0 ? "Clip Planes" : ""; - - switch (Column()) - { - case 0: return GetClipPlane()->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemGraphic3dClipPlane::Init() -{ - //VInspector_ItemV3dViewPtr aParentViewItem = itemDynamicCast(Parent()); - //Handle(Graphic3d_ClipPlane) aClipPlane; - //if (!aParentViewItem) // ClipPlanes - //{ - // aParentViewItem = itemDynamicCast(Parent()->Parent()); - // aClipPlane = aParentViewItem->GetClipPlane(Row()); - //} - //setClipPlane (aClipPlane); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemGraphic3dClipPlane::Reset() -{ - VInspector_ItemBase::Reset(); - - setClipPlane (NULL); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemGraphic3dClipPlane::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dClipPlane::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - return VInspector_ItemGraphic3dClipPlane::CreateItem (currentItem(), theRow, theColumn); - - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dClipPlane.hxx b/tools/VInspector/VInspector_ItemGraphic3dClipPlane.hxx deleted file mode 100644 index c91e3797ed..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dClipPlane.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// 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_ItemGraphic3dClipPlane_H -#define VInspector_ItemGraphic3dClipPlane_H - -#include -#include - -#include - -class VInspector_ItemGraphic3dClipPlane; -typedef QExplicitlySharedDataPointer VInspector_ItemGraphic3dClipPlanePtr; - -//! \class VInspector_ItemGraphic3dClipPlane -//! 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_ItemGraphic3dClipPlane : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemGraphic3dClipPlanePtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemGraphic3dClipPlanePtr (new VInspector_ItemGraphic3dClipPlane (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemGraphic3dClipPlane() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myClipPlane; } - - //! Returns current clip plane, initialize if it was not initialized yet - Standard_EXPORT Handle(Graphic3d_ClipPlane) GetClipPlane() const - { return Handle(Graphic3d_ClipPlane)::DownCast (GetObject()); } - -protected: - //! Initialize 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; - -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: - - //! Set Clip Plane into the current field - //! \param theViewer a viewer - void setClipPlane (const Handle(Graphic3d_ClipPlane)& theClipPlane) { myClipPlane = theClipPlane; } - -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_ItemGraphic3dClipPlane(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(Graphic3d_ClipPlane) myClipPlane; //!< the current ClipPlane -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx b/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx deleted file mode 100644 index df0d2bc319..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dGroup.cxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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 - -#include -#include -#include - -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dGroup::Init() -{ - VInspector_ItemGraphic3dCStructurePtr aParentItem = itemDynamicCast(Parent()); - myGroup = aParentItem->GetGroup (Row()); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dGroup::Reset() -{ - VInspector_ItemBase::Reset(); - myGroup = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dGroup::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dGroup::initRowCount() const -{ - if (Column() != 0) - return 0; - - Handle(Graphic3d_Group) aGroup = GetGroup(); - Handle(OpenGl_Group) anOpenGlGroup = Handle(OpenGl_Group)::DownCast(aGroup); - if (anOpenGlGroup.IsNull()) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dGroup::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(); - - Handle(Graphic3d_Group) aGroup = GetGroup(); - if (aGroup.IsNull()) - return Column() == 0 ? "Empty group" : ""; - - switch (Column()) - { - case 0: return theItemRole == Qt::DisplayRole ? aGroup->DynamicType()->Name() - : STANDARD_TYPE (Graphic3d_Group)->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : GetStream -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dGroup::GetStream (Standard_OStream& theOStream) const -{ - Handle(Graphic3d_Group) aGroup = GetGroup(); - if (aGroup.IsNull()) - return; - - aGroup->DumpJson (theOStream); -} - - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dGroup::createChild (int, int) -{ - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dGroup.hxx b/tools/VInspector/VInspector_ItemGraphic3dGroup.hxx deleted file mode 100644 index bb669d9513..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dGroup.hxx +++ /dev/null @@ -1,99 +0,0 @@ -// 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_ItemGraphic3dGroup_H -#define VInspector_ItemGraphic3dGroup_H - -#include -#include - -class Graphic3d_Group; -class OpenGl_Element; - -class VInspector_ItemGraphic3dGroup; -typedef QExplicitlySharedDataPointer VInspector_ItemGraphic3dGroupPtr; - -//! \class VInspector_ItemGraphic3dGroup -//! 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_ItemGraphic3dGroup : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemGraphic3dGroupPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemGraphic3dGroupPtr (new VInspector_ItemGraphic3dGroup (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemGraphic3dGroup() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myGroup; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(Graphic3d_Group) GetGroup() const - { return Handle(Graphic3d_Group)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) 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 - 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; - -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_ItemGraphic3dGroup(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(Graphic3d_Group) myGroup; //! current graphic group -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemGraphic3dTransformPers.cxx b/tools/VInspector/VInspector_ItemGraphic3dTransformPers.cxx deleted file mode 100644 index e6ac556eac..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dTransformPers.cxx +++ /dev/null @@ -1,114 +0,0 @@ -// 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 -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemGraphic3dTransformPers::Init() -{ - VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - { - VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast(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(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemGraphic3dTransformPers::initRowCount() const -{ - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemGraphic3dTransformPers::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(); - - Handle(Graphic3d_TransformPers) aTransformPers = GetTransformPers(); - if (aTransformPers.IsNull()) - return Column() == 0 ? "Graphic3d_TransformPers" : ""; - - switch (Column()) - { - case 0: return aTransformPers->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemGraphic3dTransformPers::createChild (int, int) -{ - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemGraphic3dTransformPers.hxx b/tools/VInspector/VInspector_ItemGraphic3dTransformPers.hxx deleted file mode 100644 index 0ae1721be0..0000000000 --- a/tools/VInspector/VInspector_ItemGraphic3dTransformPers.hxx +++ /dev/null @@ -1,94 +0,0 @@ -// 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 -#include - -class Graphic3d_TransformPers; - -class VInspector_ItemGraphic3dTransformPers; -typedef QExplicitlySharedDataPointer 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 data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myTransformPers; } - - //! 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 - { return Handle(Graphic3d_TransformPers)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 diff --git a/tools/VInspector/VInspector_ItemHistoryElement.cxx b/tools/VInspector/VInspector_ItemHistoryElement.cxx index ef57992759..f6a6b1df65 100644 --- a/tools/VInspector/VInspector_ItemHistoryElement.cxx +++ b/tools/VInspector/VInspector_ItemHistoryElement.cxx @@ -26,19 +26,15 @@ // ======================================================================= QVariant VInspector_ItemHistoryElement::initValue(const int theRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theRole); - if (aParentValue.isValid()) - return aParentValue; - if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole) return QVariant(); switch (Column()) { case 0: return getName(); - case 2: return QVariant(); - case 3: return GetPointerInfo(); - case 4: return GetShapeTypeInfo(); + case 1: return QVariant(); + case 2: return GetPointerInfo(); + case 3: return GetShapeTypeInfo(); default: break; } return QVariant(); diff --git a/tools/VInspector/VInspector_ItemHistoryRoot.cxx b/tools/VInspector/VInspector_ItemHistoryRoot.cxx index 77f9512140..7a5c2bd501 100644 --- a/tools/VInspector/VInspector_ItemHistoryRoot.cxx +++ b/tools/VInspector/VInspector_ItemHistoryRoot.cxx @@ -64,11 +64,6 @@ void VInspector_ItemHistoryRoot::AddElement (const VInspector_CallBackMode& theM const VInspector_ItemHistoryTypeInfo& VInspector_ItemHistoryRoot::GetTypeInfo (const int theChildRowIndex) { int anInfoMapIndex = theChildRowIndex + myFirstIndex; - - bool aReversed = true; - if (aReversed) - anInfoMapIndex = (myInfoMap.size() - myFirstIndex) - 1 - anInfoMapIndex; - return myInfoMap[anInfoMapIndex]; } @@ -78,17 +73,13 @@ const VInspector_ItemHistoryTypeInfo& VInspector_ItemHistoryRoot::GetTypeInfo (c // ======================================================================= QVariant VInspector_ItemHistoryRoot::initValue (const int theRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theRole); - if (aParentValue.isValid()) - return aParentValue; - if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole) return QVariant(); switch (Column()) { case 0: return "History"; - case 2: return theRole == Qt::ToolTipRole ? QVariant ("Count of children") : QVariant (rowCount()); + case 1: return theRole == Qt::ToolTipRole ? QVariant ("Count of children") : QVariant (rowCount()); default: break; } diff --git a/tools/VInspector/VInspector_ItemHistoryType.cxx b/tools/VInspector/VInspector_ItemHistoryType.cxx index 70ab2c9049..bd8f90a9a9 100644 --- a/tools/VInspector/VInspector_ItemHistoryType.cxx +++ b/tools/VInspector/VInspector_ItemHistoryType.cxx @@ -31,8 +31,6 @@ QString VInspector_ItemHistoryType::PointerInfo() const VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast(Parent()); const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row()); - if (aTypeInfo.myElements.size() < rowCount()) - return QString(); QList anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item return anElements.size() > 1 ? anElements[1].toString() : QString(); } @@ -48,8 +46,6 @@ QString VInspector_ItemHistoryType::OwnerInfo() const VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast(Parent()); const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row()); - if ( aTypeInfo.myElements.size() < rowCount()) - return QString(); QList anElements = aTypeInfo.myElements[rowCount() - 1]; // the last item return anElements.size() > 3 ? anElements[3].toString() : QString(); } @@ -60,29 +56,21 @@ QString VInspector_ItemHistoryType::OwnerInfo() const // ======================================================================= QVariant VInspector_ItemHistoryType::initValue(const int theRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theRole); - if (aParentValue.isValid()) - return aParentValue; - if (theRole != Qt::DisplayRole && theRole != Qt::EditRole && theRole != Qt::ToolTipRole) return QVariant(); VInspector_ItemHistoryRootPtr aParentItem = itemDynamicCast(Parent()); const VInspector_ItemHistoryTypeInfo& aTypeInfo = aParentItem->GetTypeInfo(Row()); - int aRowCount = rowCount(); - if (aRowCount <= 0 || aTypeInfo.myElements.size() < aRowCount) - return QVariant(); - QList anElements = rowCount() > 0 ? aTypeInfo.myElements[rowCount() - 1] : QList(); // the last item int anInfoSize = anElements.size(); switch (Column()) { case 0: return VInspector_CallBack::GetInfo(aTypeInfo.myMode); - case 3: return rowCount(); - case 4: return anInfoSize > 1 ? anElements[1].toString() : QVariant(); // pointer info - case 5: return anInfoSize > 2 ? anElements[2].toString() : QVariant(); // shape type - case 6: return anInfoSize > 0 ? anElements[0].toString() : QVariant(); // AIS name - case 7: return anInfoSize > 3 ? anElements[3].toString() : QVariant(); // owner info + case 1: return rowCount(); + case 2: return anInfoSize > 1 ? anElements[1].toString() : QVariant(); // pointer info + case 3: return anInfoSize > 2 ? anElements[2].toString() : QVariant(); // shape type + case 4: return anInfoSize > 0 ? anElements[0].toString() : QVariant(); // AIS name + case 5: return anInfoSize > 3 ? anElements[3].toString() : QVariant(); // owner info default: break; } return QVariant(); diff --git a/tools/VInspector/VInspector_ItemOpenGlContext.cxx b/tools/VInspector/VInspector_ItemOpenGlContext.cxx deleted file mode 100644 index 9588f692ef..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlContext.cxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 2019-03-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 - -//#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlContext::Init() -{ - //VInspector_ItemOpenGlContextListPtr aParentItem = itemDynamicCast(Parent()); - //myLayer = aParentItem->GetLayer (Row(), myLayerId); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlContext::Reset() -{ - VInspector_ItemBase::Reset(); - myLayer = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlContext::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlContext::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlContext::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(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return Column() == 0 ? "Empty element" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aLayerId (myLayerId); - return theItemRole == Qt::ToolTipRole ? QVariant ("") - : QVariant (QString("%1 (%2)") - .arg(aLayer->DynamicType()->Name()) - .arg (aLayerId.ToCString())); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlContext::createChild (int theRow, int theColumn) -{ - (void)theRow; - (void)theColumn; - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlContext.hxx b/tools/VInspector/VInspector_ItemOpenGlContext.hxx deleted file mode 100644 index 038e5f8524..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlContext.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Created on: 2019-03-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 VInspector_ItemOpenGlContext_H -#define VInspector_ItemOpenGlContext_H - -#include -#include - -#include -#include - -class Graphic3d_Group; - -class VInspector_ItemOpenGlContext; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlContextPtr; - -//! \class VInspector_ItemOpenGlContext -//! 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_ItemOpenGlContext : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlContextPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlContextPtr (new VInspector_ItemOpenGlContext (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlContext() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const - { return Handle(OpenGl_Layer)::DownCast (GetObject());} - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 - 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; - -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_ItemOpenGlContext(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(OpenGl_Layer) myLayer; //! current layer - Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemOpenGlLayer.cxx b/tools/VInspector/VInspector_ItemOpenGlLayer.cxx deleted file mode 100644 index 8c7599819a..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayer.cxx +++ /dev/null @@ -1,121 +0,0 @@ -// Created on: 2019-03-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 - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Init() -{ - VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast(Parent()); - myLayer = aParentItem->GetLayer (Row(), myLayerId); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Reset() -{ - VInspector_ItemBase::Reset(); - myLayer = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlLayer::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayer::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(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return Column() == 0 ? "Empty element" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aLayerId (myLayerId); - return theItemRole == Qt::ToolTipRole ? QVariant ("") - : QVariant (QString("%1 (%2)") - .arg(aLayer->DynamicType()->Name()) - .arg (aLayerId.ToCString())); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlLayer::createChild (int theRow, int theColumn) -{ - (void)theRow; - (void)theColumn; - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlLayer.hxx b/tools/VInspector/VInspector_ItemOpenGlLayer.hxx deleted file mode 100644 index 862d1e6703..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayer.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Created on: 2019-03-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 VInspector_ItemOpenGlLayer_H -#define VInspector_ItemOpenGlLayer_H - -#include -#include - -#include -#include - -class Graphic3d_Group; - -class VInspector_ItemOpenGlLayer; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlLayerPtr; - -//! \class VInspector_ItemOpenGlLayer -//! 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_ItemOpenGlLayer : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlLayer() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const - { return Handle(OpenGl_Layer)::DownCast (GetObject());} - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 - 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; - -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_ItemOpenGlLayer(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(OpenGl_Layer) myLayer; //! current layer - Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerList.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerList.cxx deleted file mode 100644 index 53e3e76f3c..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerList.cxx +++ /dev/null @@ -1,164 +0,0 @@ -// Created on: 2019-03-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 - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayerList::Init() -{ - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayerList::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : GetLayerList -// purpose : -// ======================================================================= -const OpenGl_LayerList& VInspector_ItemOpenGlLayerList::GetLayerList (Standard_Boolean& isDefault) const -{ - VInspector_ItemGraphic3dCViewPtr aParentItem = itemDynamicCast(Parent()); - return aParentItem->GetLayerList (isDefault); -} - -// ======================================================================= -// function : GetLayer -// purpose : -// ======================================================================= -Handle(OpenGl_Layer) VInspector_ItemOpenGlLayerList::GetLayer (const int /*theRow*/, Graphic3d_ZLayerId& /*theLayerId*/) const -{ - return NULL; - /* - Standard_Boolean isDefault; - const OpenGl_LayerList& aLayerList = GetLayerList (isDefault); - - if (isDefault) - return NULL; - - Standard_Integer aLayerIndex = (int)theRow + 1; - Handle(OpenGl_Layer) aLayer = aLayerList.Layers().Value (aLayerIndex); // OpenGl_LayerSeqIds range is in [1...N] - if (aLayer.IsNull()) - return NULL; - - const OpenGl_LayerSeqIds& aLayerIDs = aLayerList.LayerIDs(); - for (OpenGl_LayerSeqIds::Iterator aMapIt (aLayerIDs); aMapIt.More(); aMapIt.Next()) - { - Standard_Integer anIndex = aMapIt.Value(); - if (anIndex != aLayerIndex) - continue; - - theLayerId = aMapIt.Key(); - } - - return aLayer; - */ -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayerList::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlLayerList::initRowCount() const -{ - if (Column() != 0) - return 0; - - //Standard_Boolean isDefault; - //const OpenGl_LayerList& aListOfLayers = GetLayerList (isDefault); - //if (isDefault) - // return 0; - - //return aListOfLayers.Layers().Length(); - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayerList::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(); - - - switch (Column()) - { - case 0: - { - Standard_Boolean isDefault; - GetLayerList (isDefault); - if (isDefault) - return 0; - - return isDefault ? "Empty layer list" : "OpenGl_LayerList"; - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlLayerList::createChild (int theRow, int theColumn) -{ - return VInspector_ItemOpenGlLayer::CreateItem (currentItem(), theRow, theColumn); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerList.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerList.hxx deleted file mode 100644 index ef020efa82..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerList.hxx +++ /dev/null @@ -1,93 +0,0 @@ -// Created on: 2019-03-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 VInspector_ItemOpenGlLayerList_H -#define VInspector_ItemOpenGlLayerList_H - -#include -#include - -#include - -class VInspector_ItemOpenGlLayerList; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlLayerListPtr; - -//! \class VInspector_ItemOpenGlLayerList -//! Parent item, that corresponds to OpenGl_LayerList -//! Children of the item are: -//! - OpenGl_Layer items -class VInspector_ItemOpenGlLayerList : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlLayerListPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlLayerListPtr (new VInspector_ItemOpenGlLayerList (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlLayerList() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return NULL; } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns layer list if the View is OpenGl_View - //! \param isDefault flag is true if the layer is absent and the default value of this class is used - Standard_EXPORT const OpenGl_LayerList& GetLayerList (Standard_Boolean& isDefault) const; - - //! Returns layer list if the View is OpenGl_View - //! \param theLayerId index of the layer - Standard_EXPORT Handle(OpenGl_Layer) GetLayer (const int theRow, Graphic3d_ZLayerId& theLayerId) const; - -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 - 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; - -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_ItemOpenGlLayerList(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx b/tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx deleted file mode 100644 index a1004ee78c..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.cxx +++ /dev/null @@ -1,124 +0,0 @@ -// Created on: 2019-03-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 - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Init() -{ - VInspector_ItemOpenGlLayerListPtr aParentItem = itemDynamicCast(Parent()); - myLayer = aParentItem->GetLayer (Row(), myLayerId); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::Reset() -{ - VInspector_ItemBase::Reset(); - myLayer = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlLayer::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlLayer::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlLayer::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(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return Column() == 0 ? "Empty element" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aLayerId (myLayerId); - if (aLayerId.IsEmpty()) - aLayerId = TCollection_AsciiString (myLayerId); - return theItemRole == Qt::ToolTipRole ? QVariant ("") - : QVariant (QString("%1 (%2)") - .arg(aLayer->DynamicType()->Name()) - .arg (aLayerId.ToCString())); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlLayer::createChild (int theRow, int theColumn) -{ - (void)theRow; - (void)theColumn; - - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx b/tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx deleted file mode 100644 index f8cdeaf956..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlLayerStructure.hxx +++ /dev/null @@ -1,97 +0,0 @@ -// Created on: 2019-03-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 VInspector_ItemOpenGlLayer_H -#define VInspector_ItemOpenGlLayer_H - -#include -#include - -#include -#include - -class Graphic3d_Group; - -class VInspector_ItemOpenGlLayer; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlLayerPtr; - -//! \class VInspector_ItemOpenGlLayer -//! 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_ItemOpenGlLayer : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlLayerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlLayerPtr (new VInspector_ItemOpenGlLayer (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlLayer() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const - { return Handle(OpenGl_Layer)::DownCast (GetObject());} - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 - 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; - -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_ItemOpenGlLayer(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(OpenGl_Layer) myLayer; //! current layer - Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemOpenGlWindow.cxx b/tools/VInspector/VInspector_ItemOpenGlWindow.cxx deleted file mode 100644 index 5e8a94b8a4..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlWindow.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// Created on: 2019-03-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 - -//#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlWindow::Init() -{ - //VInspector_ItemOpenGlWindowListPtr aParentItem = itemDynamicCast(Parent()); - //myLayer = aParentItem->GetLayer (Row(), myLayerId); - - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlWindow::Reset() -{ - VInspector_ItemBase::Reset(); - myLayer = NULL; -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemOpenGlWindow::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemOpenGlWindow::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemOpenGlWindow::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(); - - Handle(OpenGl_Layer) aLayer = GetLayer(); - if (aLayer.IsNull()) - return Column() == 0 ? "Empty element" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aLayerId (myLayerId); - return theItemRole == Qt::ToolTipRole ? QVariant ("") - : QVariant (QString("%1 (%2)") - .arg(aLayer->DynamicType()->Name()) - .arg (aLayerId.ToCString())); - } - default: - break; - } - return QVariant(); -} - - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemOpenGlWindow::createChild (int theRow, int theColumn) -{ - (void)theRow; - (void)theColumn; - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemOpenGlWindow.hxx b/tools/VInspector/VInspector_ItemOpenGlWindow.hxx deleted file mode 100644 index 6877c2747b..0000000000 --- a/tools/VInspector/VInspector_ItemOpenGlWindow.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Created on: 2019-03-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 VInspector_ItemOpenGlWindow_H -#define VInspector_ItemOpenGlWindow_H - -#include -#include - -#include -#include - -class Graphic3d_Group; - -class VInspector_ItemOpenGlWindow; -typedef QExplicitlySharedDataPointer VInspector_ItemOpenGlWindowPtr; - -//! \class VInspector_ItemOpenGlWindow -//! 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_ItemOpenGlWindow : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemOpenGlWindowPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemOpenGlWindowPtr (new VInspector_ItemOpenGlWindow (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemOpenGlWindow() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myLayer; } - - //! Returns the current graphic3d group, init item if it was not initialized yet - //! \return graphic group - Standard_EXPORT Handle(OpenGl_Layer) GetLayer() const - { return Handle(OpenGl_Layer)::DownCast (GetObject());} - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() 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 - 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; - -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_ItemOpenGlWindow(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - Handle(OpenGl_Layer) myLayer; //! current layer - Graphic3d_ZLayerId myLayerId; //! current Z layer index in OpenGl_View -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemPresentableObject.cxx b/tools/VInspector/VInspector_ItemPresentableObject.cxx index 89c0bdbc96..e1747f7f3f 100644 --- a/tools/VInspector/VInspector_ItemPresentableObject.cxx +++ b/tools/VInspector/VInspector_ItemPresentableObject.cxx @@ -15,27 +15,19 @@ #include -#include #include #include #include - #include -#include -#include -#include -#include +#include +#include #include #include -#include -#include -#include - #include #include #include -#include +#include #include #include @@ -50,9 +42,15 @@ // ======================================================================= QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; + if (Column() == 20 && theItemRole == Qt::BackgroundRole) { + Handle(AIS_InteractiveObject) anIO = GetInteractiveObject(); + if (!anIO.IsNull() && anIO->HasColor()) + { + Quantity_Color aColor; + anIO->Color(aColor); + return QColor ((int)(aColor.Red()*255.), (int)(aColor.Green()*255.), (int)(aColor.Blue()*255.)); + } + } if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole) { @@ -69,11 +67,45 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const return theItemRole == Qt::ToolTipRole ? QVariant ("") : QVariant (anIO->DynamicType()->Name()); } + case 1: + return rowCount(); + case 2: + { + if (!aNullIO) + return VInspector_Tools::GetPointerInfo (anIO, true).ToCString(); + break; + } + case 3: + { + Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO); + if (!aShapeIO.IsNull()) + { + const TopoDS_Shape& aShape = aShapeIO->Shape(); + if (!aShape.IsNull()) + return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString(); + } + break; + } case 4: { int aNbSelected = VInspector_Tools::SelectedOwners (GetContext(), anIO, false); return aNbSelected > 0 ? QString::number (aNbSelected) : ""; } + case 5: + { + TColStd_ListOfInteger aModes; + Handle(AIS_InteractiveContext) aContext = GetContext(); + aContext->ActivatedModes(anIO, aModes); + TCollection_AsciiString aModesInfo; + for (TColStd_ListIteratorOfListOfInteger itr (aModes); itr.More(); itr.Next()) + { + if (!aModesInfo.IsEmpty()) + aModesInfo += ", "; + aModesInfo += VInspector_Tools::GetShapeTypeInfo (AIS_Shape::SelectionType(itr.Value())); + } + return aModesInfo.ToCString(); + } + break; case 6: { double aDeviationCoefficient = 0; @@ -85,6 +117,18 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const } return QString::number(aDeviationCoefficient); } + case 7: + { + double aShapeDeflection = 0; + Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO); + if (!aShapeIO.IsNull()) + { + const TopoDS_Shape& aShape = aShapeIO->Shape(); + if (!aShape.IsNull()) + aShapeDeflection = Prs3d::GetDeflection(aShape, anIO->Attributes()); + } + return QString::number (aShapeDeflection); + } case 8: { double aDeviationCoefficient = 0; @@ -98,6 +142,21 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const bool anIsAutoTriangulation = aNullIO ? false : anIO->Attributes()->IsAutoTriangulation(); return anIsAutoTriangulation ? QString ("true") : QString ("false"); } + case 17: + case 18: + case 19: + { + Handle(AIS_Shape) aShapeIO = Handle(AIS_Shape)::DownCast (anIO); + if (aShapeIO.IsNull()) + return QVariant(); + const TopoDS_Shape& aShape = aShapeIO->Shape(); + if (aShape.IsNull()) + return QVariant(); + + return Column() == 17 ? VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString() + : Column() == 18 ? VInspector_Tools::OrientationToName (aShape.Orientation()).ToCString() + : /*19*/ VInspector_Tools::LocationToName (aShape.Location()).ToCString(); + } default: break; } } @@ -133,11 +192,6 @@ QVariant VInspector_ItemPresentableObject::initValue (int theItemRole) const // ======================================================================= int VInspector_ItemPresentableObject::initRowCount() const { - if (Column() != 0) - return 0; - - int aNbProperties = 2; // "Properties", "Presentations" - Handle(AIS_InteractiveObject) anIO = GetInteractiveObject(); #if OCC_VERSION_HEX < 0x070201 int aRows = 0; @@ -146,12 +200,12 @@ int VInspector_ItemPresentableObject::initRowCount() const // iteration through sensitive privitives for (anIO->Init(); anIO->More(); anIO->Next()) aRows++; - int aNbSelected = aRows; + return aRows; #else - int aNbSelected = !anIO.IsNull() ? anIO->Selections().Size() : 0; + return !anIO.IsNull() + ? anIO->Selections().Size() + : 0; #endif - - return aNbProperties + aNbSelected; } // ======================================================================= @@ -160,12 +214,7 @@ int VInspector_ItemPresentableObject::initRowCount() const // ======================================================================= TreeModel_ItemBasePtr VInspector_ItemPresentableObject::createChild (int theRow, int theColumn) { - if (theRow == 0) - return VInspector_ItemFolderObject::CreateItem (currentItem(), theRow, theColumn); - if (theRow == 1) - return VInspector_ItemPresentations::CreateItem (currentItem(), theRow, theColumn); - else - return VInspector_ItemSelectMgrSelection::CreateItem(currentItem(), theRow, theColumn); + return VInspector_ItemSelection::CreateItem(currentItem(), theRow, theColumn); } // ======================================================================= @@ -197,8 +246,6 @@ void VInspector_ItemPresentableObject::Init() } setInteractiveObject (anIO); - myTransformPersistence = anIO->TransformPersistence(); - UpdatePresentationShape(); TreeModel_ItemBase::Init(); // to use getIO() without circling initialization } @@ -212,7 +259,6 @@ void VInspector_ItemPresentableObject::Reset() SetContext (NULL); setInteractiveObject (NULL); - myTransformPersistence = NULL; } // ======================================================================= @@ -227,20 +273,13 @@ void VInspector_ItemPresentableObject::initItem() const } // ======================================================================= -// function : buildPresentationShape +// function : GetInteractiveObject // purpose : // ======================================================================= -TopoDS_Shape VInspector_ItemPresentableObject::buildPresentationShape() +Handle(AIS_InteractiveObject) VInspector_ItemPresentableObject::GetInteractiveObject() const { - Handle(AIS_InteractiveObject) aPrs = myIO; - if (aPrs.IsNull()) - return TopoDS_Shape(); - - Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs); - if (!aShapePrs.IsNull()) - return aShapePrs->Shape(); - - return TopoDS_Shape(); + initItem(); + return myIO; } // ======================================================================= @@ -253,27 +292,40 @@ QString VInspector_ItemPresentableObject::PointerInfo() const } // ======================================================================= -// function : GetPresentations -// purpose : -// ======================================================================= -void VInspector_ItemPresentableObject::GetPresentations (NCollection_List& thePresentations) -{ - if (Column() != 0) - return; - - thePresentations.Append (GetInteractiveObject()); -} - -// ======================================================================= -// function : GetStream +// function : GetSelectedPresentations // purpose : // ======================================================================= -void VInspector_ItemPresentableObject::GetStream (Standard_OStream& theOStream) const +NCollection_List VInspector_ItemPresentableObject::GetSelectedPresentations + (QItemSelectionModel* theSelectionModel) { - Handle(AIS_InteractiveObject) anIO = GetInteractiveObject(); - if (anIO.IsNull()) - return; + NCollection_List aResultList; + if (!theSelectionModel) + return aResultList; + + QList anItems; + + QModelIndexList anIndices = theSelectionModel->selectedIndexes(); + for (QModelIndexList::const_iterator anIndicesIt = anIndices.begin(); anIndicesIt != anIndices.end(); anIndicesIt++) + { + TreeModel_ItemBasePtr anItem = TreeModel_ModelBase::GetItemByIndex (*anIndicesIt); + if (!anItem || anItems.contains (anItem)) + continue; + anItems.append (anItem); + } - anIO->DumpJson (theOStream); + QList aSelectedIds; // Remember of selected address in order to avoid duplicates + for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) + { + TreeModel_ItemBasePtr anItem = *anItemIt; + VInspector_ItemPresentableObjectPtr aPrsItem = itemDynamicCast(anItem); + if (!aPrsItem) + continue; + Handle(AIS_InteractiveObject) aPresentation = aPrsItem->GetInteractiveObject(); + if (aSelectedIds.contains ((size_t)aPresentation.operator->())) + continue; + aSelectedIds.append ((size_t)aPresentation.operator->()); + if (!aPresentation.IsNull()) + aResultList.Append (aPresentation); + } + return aResultList; } - diff --git a/tools/VInspector/VInspector_ItemPresentableObject.hxx b/tools/VInspector/VInspector_ItemPresentableObject.hxx index 8c6fc04fb1..ed5765200f 100644 --- a/tools/VInspector/VInspector_ItemPresentableObject.hxx +++ b/tools/VInspector/VInspector_ItemPresentableObject.hxx @@ -41,14 +41,9 @@ public: //! Destructor virtual ~VInspector_ItemPresentableObject() Standard_OVERRIDE {}; - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myIO; } - //! Returns the current interactive object, init item if it was not initialized yet //! \return interactive object - Standard_EXPORT Handle(AIS_InteractiveObject) GetInteractiveObject() const - { return Handle(AIS_InteractiveObject)::DownCast (GetObject()); } + Standard_EXPORT Handle(AIS_InteractiveObject) GetInteractiveObject() const; //! Returns pointer information for the current interactive object, init item if it was not initialized yet //! \return string value @@ -60,13 +55,11 @@ public: //! Resets cached values Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - //! Returns presentation of the attribute to be visualized in the view - //! \thePresentations [out] container of presentation handles to be visualized - Standard_EXPORT virtual void GetPresentations (NCollection_List& thePresentations); - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE; + //! Returns presentations, which items are selected in tree view + //! \param theSelectionModel a selection model + //! \return container of presentations + Standard_EXPORT static NCollection_List GetSelectedPresentations + (QItemSelectionModel* theSelectionModel); protected: @@ -88,10 +81,7 @@ protected: //! \return the created item virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; +private: //! Set interactive object into the current field //! \param theIO a presentation diff --git a/tools/VInspector/VInspector_ItemPresentations.cxx b/tools/VInspector/VInspector_ItemPresentations.cxx deleted file mode 100644 index d5a34974e6..0000000000 --- a/tools/VInspector/VInspector_ItemPresentations.cxx +++ /dev/null @@ -1,154 +0,0 @@ -// 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 - -#include -#include - -#include -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemPresentations::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)) - return QVariant(); - - return "Presentations"; -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemPresentations::initRowCount() const -{ - if (Column() != 0) - return 0; - - VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast(Parent()); - if (!aParentPrsItem) - return 0; - - Handle(AIS_InteractiveObject) aPresentation = aParentPrsItem->GetInteractiveObject(); - - int aNbProperties = 0; - if (!aPresentation->GetSelectPresentation (GetContext()->MainPrsMgr()).IsNull()) - aNbProperties++; - - if (!aPresentation->GetHilightPresentation (GetContext()->MainPrsMgr()).IsNull()) - aNbProperties++; - - for (PrsMgr_Presentations::Iterator aPrsIter (aPresentation->Presentations()); aPrsIter.More(); aPrsIter.Next()) - { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue(); - if (!aPrs3d.IsNull()) - aNbProperties++; - } - return aNbProperties; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemPresentations::createChild (int theRow, int theColumn) -{ - return VInspector_ItemPrs3dPresentation::CreateItem (currentItem(), theRow, theColumn); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemPresentations::Init() -{ - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemPresentations::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemPresentations::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetPresentation -// purpose : -// ======================================================================= -Handle(Prs3d_Presentation) VInspector_ItemPresentations::GetPresentation (const int theRowId, - TCollection_AsciiString& theName) const -{ - VInspector_ItemPresentableObjectPtr aParentPrsItem = itemDynamicCast(Parent()); - if (!aParentPrsItem) - return 0; - - Handle(AIS_InteractiveObject) aPresentation = aParentPrsItem->GetInteractiveObject(); - - bool aHasSelectedPresentation = !aPresentation->GetSelectPresentation (NULL).IsNull(); - if (aHasSelectedPresentation && theRowId == 0) - { - theName = "SelectPresentation"; - return aPresentation->GetSelectPresentation (NULL); - } - - bool aHasHilightPresentation = !aPresentation->GetHilightPresentation (NULL).IsNull(); - if (aHasHilightPresentation && ((aHasSelectedPresentation && theRowId == 1) || !aHasSelectedPresentation && theRowId == 0)) - { - theName = "HilightPresentation"; - return aPresentation->GetHilightPresentation (NULL); - } - - int aNextPresentationIndex = aHasSelectedPresentation ? 1 : 0; - if (aHasHilightPresentation) - aNextPresentationIndex++; - - int aCurrentIndex = 0; - for (PrsMgr_Presentations::Iterator aPrsIter (aPresentation->Presentations()); aPrsIter.More(); aPrsIter.Next()) - { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue(); - if (aPrs3d.IsNull()) - continue; - if (theRowId - aNextPresentationIndex == aCurrentIndex) - { - theName = "Prs3d_Presentation"; - return aPrs3d; - } - aCurrentIndex++; - } - return Handle(Prs3d_Presentation)(); -} diff --git a/tools/VInspector/VInspector_ItemPresentations.hxx b/tools/VInspector/VInspector_ItemPresentations.hxx deleted file mode 100644 index 134302d514..0000000000 --- a/tools/VInspector/VInspector_ItemPresentations.hxx +++ /dev/null @@ -1,81 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemPresentations_H -#define VInspector_ItemPresentations_H - -#include -#include - -#include -#include - -class VInspector_ItemPresentations; -typedef QExplicitlySharedDataPointer VInspector_ItemPresentationsPtr; - -//! \class VInspector_ItemPresentations -//! Item presents information about AIS_InteractiveObject. -//! Parent is item context, children are item selections. -class VInspector_ItemPresentations : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemPresentationsPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemPresentationsPtr (new VInspector_ItemPresentations (theParent, theRow, theColumn)); } - //! Destructor - virtual ~VInspector_ItemPresentations() Standard_OVERRIDE {}; - - //! Returns presentation of the parent interactive object - //! \return presentation object - Standard_EXPORT Handle(Prs3d_Presentation) GetPresentation (const int theRowId, TCollection_AsciiString& theName) const; - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of item selected - //! \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; - - //! Creates a child item in the given position. - //! \param theRow the child row position - //! \param theColumn the child column position - //! \return the created item - virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; - -private: - - //! Constructor - //! param theParent a parent item - VInspector_ItemPresentations(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx b/tools/VInspector/VInspector_ItemPrs3dAspect.cxx deleted file mode 100644 index 36b8506571..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dAspect.cxx +++ /dev/null @@ -1,257 +0,0 @@ -// Created on: 2018-08-26 -// 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -int GetMaterialRows() { return 25; } - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= - -QVariant VInspector_ItemPrs3dAspect::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole) - { - Handle(Prs3d_BasicAspect) anAspect = GetAspect(); - bool aNullAspect = anAspect.IsNull(); - switch (Column()) - { - case 0: - { - return theItemRole == Qt::ToolTipRole - ? (aNullAspect ? QVariant("Prs3d_BasicAspect is empty") : QVariant (anAspect->DynamicType()->Name())) - : QVariant (myName.ToCString()); - } - default: break; - } - } - if (theItemRole == Qt::ForegroundRole) - { - Handle(Prs3d_BasicAspect) anAspect = GetAspect(); - bool aNullAspect = anAspect.IsNull(); - if (aNullAspect) return QColor (Qt::lightGray); - - VInspector_ItemPrs3dDrawerPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - { - Handle(Prs3d_Drawer) aDrawer = aParentItem->GetDrawer(); - if (aDrawer->Link().IsNull()) - return QVariant(); // default color - - TCollection_AsciiString aName; - Standard_Boolean isOwnAspect; - aParentItem->GetPrs3dAspect(Row(), aName, isOwnAspect); - if (!isOwnAspect) - return QColor (Qt::lightGray); - } - else - { - VInspector_ItemPrs3dAspectPtr aParentAspectItem = itemDynamicCast(Parent()); - if (aParentAspectItem) - return aParentAspectItem->initValue (theItemRole); - } - } - return QVariant(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= - -int VInspector_ItemPrs3dAspect::initRowCount() const -{ - Handle(Prs3d_BasicAspect) anAspect = GetAspect(); - if (anAspect.IsNull()) - return 0; - - Standard_CString anAspectKind = anAspect->DynamicType()->Name(); - if (anAspectKind == STANDARD_TYPE (Prs3d_DatumAspect)->Name()) - return 3 + 2 * (int) Prs3d_DP_None; - else if (anAspectKind == STANDARD_TYPE (Prs3d_PlaneAspect)->Name()) - return 3; - else if (anAspectKind == STANDARD_TYPE (Prs3d_DimensionAspect)->Name()) - return 3; - - return 0; -} - -// ======================================================================= -// function : GetStream -// purpose : -// ======================================================================= -void VInspector_ItemPrs3dAspect::GetStream (Standard_OStream& theOStream) const -{ - Handle(Prs3d_BasicAspect) anAspect = GetAspect(); - if (anAspect.IsNull()) - return; - - anAspect->DumpJson (theOStream); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= - -TreeModel_ItemBasePtr VInspector_ItemPrs3dAspect::createChild (int theRow, int theColumn) -{ - return VInspector_ItemPrs3dAspect::CreateItem (currentItem(), theRow, theColumn); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dAspect::Init() -{ - TCollection_AsciiString aName; - Handle(Prs3d_BasicAspect) anAspect; - VInspector_ItemPrs3dDrawerPtr aParentItem = itemDynamicCast(Parent()); - - if (aParentItem) - { - Standard_Boolean isOwnAspect; - anAspect = aParentItem->GetPrs3dAspect(Row(), aName, isOwnAspect); - } - else - { - VInspector_ItemPrs3dAspectPtr aParentAspectItem = itemDynamicCast(Parent()); - Standard_Boolean isOwnAspect; - anAspect = aParentAspectItem->GetPrs3dAspect(Row(), aName, isOwnAspect); - } - - setAspect(anAspect, aName); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dAspect::Reset() -{ - VInspector_ItemBase::Reset(); - - setAspect (NULL, TCollection_AsciiString()); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dAspect::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetPrs3dAspect -// purpose : -// ======================================================================= - -Handle(Prs3d_BasicAspect) VInspector_ItemPrs3dAspect::GetPrs3dAspect (const int theRow, - TCollection_AsciiString& theName, - Standard_Boolean& theOwnAspect) const -{ - Handle(Prs3d_BasicAspect) anAspect = GetAspect(); - if (anAspect.IsNull()) - return 0; - - Standard_CString anAspectKind = anAspect->DynamicType()->Name(); - theOwnAspect = true; - if (anAspectKind == STANDARD_TYPE (Prs3d_DatumAspect)->Name()) - { - Handle(Prs3d_DatumAspect) aCustomAspect = Handle(Prs3d_DatumAspect)::DownCast (anAspect); - switch (theRow) { - case 0: theName = "TextAspect"; return aCustomAspect->TextAspect(); - case 1: theName = "PointAspect"; return aCustomAspect->PointAspect(); - case 2: theName = "ArrowAspect"; return aCustomAspect->ArrowAspect(); - default: - { - if (theRow >= 3 && theRow < 3 + Prs3d_DP_None) - { - Prs3d_DatumParts aParts = (Prs3d_DatumParts)(theRow - 3); - theName = TCollection_AsciiString ("LineAspect: ") + aParts; - return aCustomAspect->LineAspect (aParts); - } - - if (theRow >= 3 + Prs3d_DP_None && theRow < 3 + 2 * Prs3d_DP_None) - { - Prs3d_DatumParts aParts = (Prs3d_DatumParts)(theRow - (3+ Prs3d_DP_None)); - theName = TCollection_AsciiString ("ShadingAspect: ") + aParts; - return aCustomAspect->ShadingAspect (aParts); - } - } - break; - } - } - else if (anAspectKind == STANDARD_TYPE (Prs3d_PlaneAspect)->Name()) - { - Handle(Prs3d_PlaneAspect) aCustomAspect = Handle(Prs3d_PlaneAspect)::DownCast (anAspect); - switch (theRow) - { - case 0: theName = "EdgesAspect"; return aCustomAspect->EdgesAspect(); - case 1: theName = "IsoAspect"; return aCustomAspect->IsoAspect(); - case 2: theName = "ArrowAspect"; return aCustomAspect->ArrowAspect(); - } - } - else if (anAspectKind == STANDARD_TYPE (Prs3d_DimensionAspect)->Name()) - { - Handle(Prs3d_DimensionAspect) aCustomAspect = Handle(Prs3d_DimensionAspect)::DownCast (anAspect); - switch (theRow) - { - case 0: theName = "LineAspect"; return aCustomAspect->LineAspect(); - case 1: theName = "TextAspect"; return aCustomAspect->TextAspect(); - case 2: theName = "ArrowAspect"; return aCustomAspect->ArrowAspect(); - } - } - - theName = "None"; - return Handle(Prs3d_BasicAspect)(); -} diff --git a/tools/VInspector/VInspector_ItemPrs3dAspect.hxx b/tools/VInspector/VInspector_ItemPrs3dAspect.hxx deleted file mode 100644 index 7d5dbc858c..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dAspect.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// Created on: 2018-08-26 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemPrs3dAspect_H -#define VInspector_ItemPrs3dAspect_H - -#include -#include - -#include - -class QItemSelectionModel; - -class VInspector_ItemPrs3dAspect; -typedef QExplicitlySharedDataPointer VInspector_ItemPrs3dAspectPtr; - -//! \class VInspector_ItemPrs3dAspect -//! Item presents information about AIS_InteractiveObject. -//! Parent is item context, children are item selections. -class VInspector_ItemPrs3dAspect : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemPrs3dAspectPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemPrs3dAspectPtr (new VInspector_ItemPrs3dAspect (theParent, theRow, theColumn)); } - //! Destructor - virtual ~VInspector_ItemPrs3dAspect() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myAspect; } - - //! Returns the current aspect, init item if it was not initialized yet - //! \return interactive object - Standard_EXPORT Handle(Prs3d_BasicAspect) GetAspect() const - { return Handle(Prs3d_BasicAspect)::DownCast (GetObject()); } - - //! Returns sub aspect of the row if possible, e.g. Datum/Dimension aspect - //! \param theRow child row index - //! \param theName [out] drawer name - Standard_EXPORT Handle(Prs3d_BasicAspect) GetPrs3dAspect (const int theRow, - TCollection_AsciiString& theName, - Standard_Boolean& theOwnAspect) const; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of item selected - //! \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; - - //! Returns stream value of the item to fulfill property panel. - //! \return stream value or dummy - Standard_EXPORT virtual void GetStream (Standard_OStream& theOStream) const Standard_OVERRIDE; - - //! Creates a child item in the given position. - //! \param theRow the child row position - //! \param theColumn the child column position - //! \return the created item - virtual TreeModel_ItemBasePtr createChild (int theRow, int theColumn) Standard_OVERRIDE; - -private: - - //! Set interactive object into the current field - //! \param theIO a presentation - //! \param theName item display data value - void setAspect (Handle(Prs3d_BasicAspect) theAspect, const TCollection_AsciiString& theName) - { myAspect = theAspect; myName = theName; } - -private: - - //! Constructor - //! param theParent a parent item - VInspector_ItemPrs3dAspect(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(Prs3d_BasicAspect) myAspect; //!< the current interactive context - TCollection_AsciiString myName; //!< the item display data value -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemPrs3dDrawer.cxx b/tools/VInspector/VInspector_ItemPrs3dDrawer.cxx deleted file mode 100644 index f4dd35ec1a..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dDrawer.cxx +++ /dev/null @@ -1,203 +0,0 @@ -// Created on: 2018-08-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 -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= - -QVariant VInspector_ItemPrs3dDrawer::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - Handle(Prs3d_Drawer) aDrawer = GetDrawer(); - bool aNullDrawer = aDrawer.IsNull(); - if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole) - { - switch (Column()) - { - case 0: - { - return theItemRole == Qt::ToolTipRole - ? (aNullDrawer ? QVariant("Prs3d_Drawer is empty") : QVariant (aDrawer->DynamicType()->Name())) - : QVariant (myName.ToCString()); - } - default: break; - } - } - if (theItemRole == Qt::ForegroundRole) - return !aNullDrawer ? QColor (Qt::black) : QColor (Qt::lightGray); - - return QVariant(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= - -int VInspector_ItemPrs3dDrawer::initRowCount() const -{ - VInspector_ItemPrs3dDrawerPtr aParentDrawerItem = itemDynamicCast(Parent()); - if (aParentDrawerItem) - return 0; - - Handle(Prs3d_Drawer) aDrawer = GetDrawer(); - if (aDrawer.IsNull()) - return 0; - - int aChildCount = 1; // Link - aChildCount += 18; // Prs3d_Drawer aspects - return aChildCount; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= - -TreeModel_ItemBasePtr VInspector_ItemPrs3dDrawer::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - { - return VInspector_ItemPrs3dDrawer::CreateItem (currentItem(), theRow, theColumn); // "Link" - } - else - return VInspector_ItemPrs3dAspect::CreateItem (currentItem(), theRow, theColumn); // "Aspects" - - //return TreeModel_ItemBasePtr(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dDrawer::Init() -{ - VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - Handle(Prs3d_Drawer) aDrawer; - TCollection_AsciiString aName; - if (aParentItem) - aDrawer = aParentItem->GetPrs3dDrawer(Row(), aName); - else - { - VInspector_ItemPrs3dDrawerPtr aParentDrawerItem = itemDynamicCast(Parent()); - if (aParentDrawerItem) - { - aDrawer = aParentDrawerItem->GetDrawer()->Link(); - aName = "Link"; - } - } - setDrawer (aDrawer, aName); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dDrawer::Reset() -{ - VInspector_ItemBase::Reset(); - - setDrawer (NULL, "None"); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemPrs3dDrawer::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetPrs3dAspect -// purpose : -// ======================================================================= - -Handle(Prs3d_BasicAspect) VInspector_ItemPrs3dDrawer::GetPrs3dAspect (const int theRow, - TCollection_AsciiString& theName, - Standard_Boolean& theOwnAspect) const -{ - if (theRow == 0) // "Link" driver, there is no aspect - return 0; - - Handle(Prs3d_Drawer) aDrawer = GetDrawer(); - if (aDrawer.IsNull()) - return 0; - - // do not create a new instance of the aspect - switch (theRow) - { - case 1: theName = "UIsoAspect"; theOwnAspect = aDrawer->HasOwnUIsoAspect(); return aDrawer->UIsoAspect(); - case 2: theName = "VIsoAspect"; theOwnAspect = aDrawer->HasOwnVIsoAspect(); return aDrawer->VIsoAspect(); - case 3: theName = "WireAspect"; theOwnAspect = aDrawer->HasOwnWireAspect(); return aDrawer->WireAspect(); - case 4: theName = "PointAspect"; theOwnAspect = aDrawer->HasOwnPointAspect(); return aDrawer->PointAspect(); - case 5: theName = "LineAspect"; theOwnAspect = aDrawer->HasOwnLineAspect(); return aDrawer->LineAspect(); - case 6: theName = "TextAspect"; theOwnAspect = aDrawer->HasOwnTextAspect(); return aDrawer->TextAspect(); - case 7: theName = "ShadingAspect"; theOwnAspect = aDrawer->HasOwnShadingAspect(); return aDrawer->ShadingAspect(); - case 8: theName = "PlaneAspect"; theOwnAspect = aDrawer->HasOwnPlaneAspect(); return aDrawer->PlaneAspect(); - case 9: theName = "SeenLineAspect"; theOwnAspect = aDrawer->HasOwnSeenLineAspect(); return aDrawer->SeenLineAspect(); - case 10: theName = "ArrowAspect"; theOwnAspect = aDrawer->HasOwnArrowAspect(); return aDrawer->ArrowAspect(); - case 11: theName = "HiddenLineAspect"; theOwnAspect = aDrawer->HasOwnHiddenLineAspect(); return aDrawer->HiddenLineAspect(); - case 12: theName = "VectorAspect"; theOwnAspect = aDrawer->HasOwnVectorAspect(); return aDrawer->VectorAspect(); - case 13: theName = "DatumAspect"; theOwnAspect = aDrawer->HasOwnDatumAspect(); return aDrawer->DatumAspect(); - case 14: theName = "SectionAspect"; theOwnAspect = aDrawer->HasOwnSectionAspect(); return aDrawer->SectionAspect(); - case 15: theName = "FreeBoundaryAspect"; theOwnAspect = aDrawer->HasOwnFreeBoundaryAspect(); return aDrawer->FreeBoundaryAspect(); - case 16: theName = "UnFreeBoundaryAspect"; theOwnAspect = aDrawer->HasOwnUnFreeBoundaryAspect(); return aDrawer->UnFreeBoundaryAspect(); - case 17: theName = "FaceBoundaryAspect"; theOwnAspect = aDrawer->HasOwnFaceBoundaryAspect(); return aDrawer->FaceBoundaryAspect(); - case 18: theName = "DimensionAspect"; theOwnAspect = aDrawer->HasOwnDimensionAspect(); return aDrawer->DimensionAspect(); - default: break; - } - - theName = "None"; - return Handle(Prs3d_BasicAspect)(); -} - diff --git a/tools/VInspector/VInspector_ItemPrs3dDrawer.hxx b/tools/VInspector/VInspector_ItemPrs3dDrawer.hxx deleted file mode 100644 index 943d06794c..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dDrawer.hxx +++ /dev/null @@ -1,107 +0,0 @@ -// Created on: 2018-08-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 VInspector_ItemPrs3dDrawer_H -#define VInspector_ItemPrs3dDrawer_H - -#include -#include - -#include - -class Prs3d_BasicAspect; - -class QItemSelectionModel; - -class VInspector_ItemPrs3dDrawer; -typedef QExplicitlySharedDataPointer VInspector_ItemPrs3dDrawerPtr; - -//! \class VInspector_ItemPrs3dDrawer -//! Item presents information about AIS_InteractiveObject. -//! Parent is item context, children are item selections. -class VInspector_ItemPrs3dDrawer : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemPrs3dDrawerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemPrs3dDrawerPtr (new VInspector_ItemPrs3dDrawer (theParent, theRow, theColumn)); } - //! Destructor - virtual ~VInspector_ItemPrs3dDrawer() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myDrawer; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Handle(Prs3d_Drawer) GetDrawer() const - { return Handle(Prs3d_Drawer)::DownCast (GetObject()); } - - //! Returns drawer of the row if possible - //! \param theRow child row index - //! \param theName [out] drawer name - Standard_EXPORT Handle(Prs3d_BasicAspect) GetPrs3dAspect (const int theRow, - TCollection_AsciiString& theName, - Standard_Boolean& theOwnAspect) const; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of item selected - //! \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; - - //! 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; - -protected: - - //! Set interactive object into the current field - //! \param theIO a presentation - //! \param theName item display data value - void setDrawer (const Handle(Prs3d_Drawer)& theDrawer, const TCollection_AsciiString& theName) - { myDrawer = theDrawer; myName = theName; } - -protected: - - //! Constructor - //! param theParent a parent item - VInspector_ItemPrs3dDrawer(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(Prs3d_Drawer) myDrawer; //!< the current drawer - TCollection_AsciiString myName; //!< the item display data value -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemPrs3dPresentation.cxx b/tools/VInspector/VInspector_ItemPrs3dPresentation.cxx deleted file mode 100644 index afc4d7abb4..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dPresentation.cxx +++ /dev/null @@ -1,145 +0,0 @@ -// 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 -#include -#include -#include - -#include -#include - -#include - - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemPrs3dPresentation::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (Column() != 0 || (theItemRole != Qt::DisplayRole && theItemRole != Qt::ToolTipRole)) - return QVariant(); - - Handle(Prs3d_Presentation) aPresentation = GetPresentation(); - bool aNullPresentation = aPresentation.IsNull(); - - switch (Column()) - { - case 0: - { - return theItemRole == Qt::ToolTipRole - ? (aNullPresentation ? QVariant("Prs3d_Presentation is empty") : QVariant (aPresentation->DynamicType()->Name())) - : QVariant (myName.ToCString()); - } - } - - return QVariant(); -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemPrs3dPresentation::initRowCount() const -{ - if (Column() != 0) - return 0; - - //Handle(Prs3d_Presentation) aPresentation = GetPresentation(); - - //Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const; - - return 1; //aPresentation->NumberOfGroups(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemPrs3dPresentation::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - return VInspector_ItemGraphic3dCStructure::CreateItem (currentItem(), theRow, theColumn); - //if (theRow == 1) - // return VInspector_ItemPrs3dPresentation::CreateItem (currentItem(), theRow, theColumn); - //else - // return VInspector_ItemSelectMgrSelection::CreateItem(currentItem(), theRow, theColumn); - return TreeModel_ItemBasePtr(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemPrs3dPresentation::Init() -{ - VInspector_ItemPresentationsPtr aParentItem = itemDynamicCast(Parent()); - - TCollection_AsciiString aName; - Handle(Prs3d_Presentation) aPresentation = aParentItem->GetPresentation (Row(), aName); - setPresentation (aPresentation, aName); - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemPrs3dPresentation::Reset() -{ - VInspector_ItemBase::Reset(); - - setPresentation (NULL, "None"); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemPrs3dPresentation::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : setPresentation -// purpose : -// ======================================================================= -void VInspector_ItemPrs3dPresentation::setPresentation (const Handle(Prs3d_Presentation)& thePresentation, - const TCollection_AsciiString& theName) -{ - myPresentation = thePresentation; - myName = theName; -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemPrs3dPresentation::buildPresentationShape() -{ - if (!myPresentation.IsNull()) - myPresentationShape = Convert_Tools::CreateShape (myPresentation->MinMaxValues()); - - return TopoDS_Shape(); -} diff --git a/tools/VInspector/VInspector_ItemPrs3dPresentation.hxx b/tools/VInspector/VInspector_ItemPrs3dPresentation.hxx deleted file mode 100644 index bc9a9b98e7..0000000000 --- a/tools/VInspector/VInspector_ItemPrs3dPresentation.hxx +++ /dev/null @@ -1,104 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemPrs3dPresentation_H -#define VInspector_ItemPrs3dPresentation_H - -#include -#include - -#include -#include - -class QItemSelectionModel; - -class VInspector_ItemPrs3dPresentation; -typedef QExplicitlySharedDataPointer VInspector_ItemPrs3dPresentationPtr; - -//! \class VInspector_ItemPrs3dPresentation -//! Item presents information about AIS_InteractiveObject. -//! Parent is item context, children are item selections. -class VInspector_ItemPrs3dPresentation : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemPrs3dPresentationPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemPrs3dPresentationPtr (new VInspector_ItemPrs3dPresentation (theParent, theRow, theColumn)); } - //! Destructor - virtual ~VInspector_ItemPrs3dPresentation() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myPresentation; } - - //! Returns the current presentation, init item if it was not initialized yet - //! \return presentation object - Standard_EXPORT Handle(Prs3d_Presentation) GetPresentation() const - { return Handle(Prs3d_Presentation)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! Returns number of item selected - //! \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; - - //! 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; - - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; - -private: - - //! Set presentation into the current field - //! \param thePresentation a presentation - //! \param theName the item name - void setPresentation (const Handle(Prs3d_Presentation)& thePresentation, - const TCollection_AsciiString& theName); - -private: - - //! Constructor - //! param theParent a parent item - VInspector_ItemPrs3dPresentation(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(Prs3d_Presentation) myPresentation; //!< the current presentation - TCollection_AsciiString myName; //!< the item display data value -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx b/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx deleted file mode 100644 index 49378693c8..0000000000 --- a/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// 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 - -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -#include -//#include -//#include // child of Select3D_SensitiveSet -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -//#include -// -//#include -#include -//#include -#include -//#include -//#include -// - -#include -#include -//#include -#include -#include - -// ======================================================================= -// function : GetSensitiveEntity -// purpose : -// ======================================================================= -Handle(Standard_Transient) VInspector_ItemSelect3DSensitiveSetItem::GetObject() const -{ - //initItem(); // to update presentation shapes - VInspector_ItemSelectBasicsSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - return aParentItem->GetSensitiveEntity(); - return Handle(Standard_Transient)(); -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelect3DSensitiveSetItem::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity(); - if (anEntity.IsNull()) - return QVariant(); - - switch (theItemRole) - { - case Qt::DisplayRole: - case Qt::EditRole: - case Qt::ToolTipRole: - { - switch (Column()) - { - case 0: return QString ("Index = %1").arg (Row()); - default: - break; - } - break; - } - case Qt::BackgroundRole: - case Qt::ForegroundRole: - { - VInspector_ItemSelectBasicsSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - return aParentItem->data(QModelIndex(), theItemRole); - break; - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemSelect3DSensitiveSetItem::Init() -{ - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemSelect3DSensitiveSetItem::Reset() -{ - // an empty method to don't clear the main label, otherwise the model will be empty - TreeModel_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemSelect3DSensitiveSetItem::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelect3DSensitiveSetItem::buildPresentationShape() -{ - Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity(); - if (anEntity.IsNull()) - return TopoDS_Shape(); - - Handle(Select3D_SensitiveSet) aSensitiveSet = Handle(Select3D_SensitiveSet)::DownCast (GetSensitiveEntity()); - if (aSensitiveSet.IsNull() || aSensitiveSet->Size() < Row()) - return TopoDS_Shape(); - - Select3D_BndBox3d aBndBox = aSensitiveSet->Box (Row()); - return VInspector_Tools::CreateShape (aBndBox); -} diff --git a/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx b/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx deleted file mode 100644 index d8c5de08a3..0000000000 --- a/tools/VInspector/VInspector_ItemSelect3DSensitiveSetItem.hxx +++ /dev/null @@ -1,109 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemSelect3DSensitiveSetItem_H -#define VInspector_ItemSelect3DSensitiveSetItem_H - -#include -#include -#include -#include -#include - -class QItemSelectionModel; -class VInspector_ItemSelect3DSensitiveSetItem; - -typedef QExplicitlySharedDataPointer VInspector_ItemSelect3DSensitiveSetItemPtr; - -//! \class VInspector_ItemSelect3DSensitiveSetItem -//! The item shows information about SelectBasics_EntityOwner. -//! The parent is item selection, children are item entity owners -class VInspector_ItemSelect3DSensitiveSetItem : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelect3DSensitiveSetItemPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelect3DSensitiveSetItemPtr (new VInspector_ItemSelect3DSensitiveSetItem (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelect3DSensitiveSetItem() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const; - - //! \return the current sensitive entity - Standard_EXPORT Handle(SelectBasics_SensitiveEntity) GetSensitiveEntity() const - { return Handle(SelectBasics_SensitiveEntity)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns presentation of the attribute to be visualized in the view - //! \thePresentations [out] container of presentation handles to be visualized - //Standard_EXPORT virtual void GetPresentations (NCollection_List& thePresentations); - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! \return number of children. - virtual int initRowCount() const Standard_OVERRIDE { return 0; } - - //! Returns item information for the given role. Fills internal container if it was not filled yet - //! \param theItemRole a value role - //! \return the value - 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 - { (void)theRow, (void)theColumn; return TreeModel_ItemBasePtr(); } - - //! Returns owner of the current sensitive entity - //! \return owner - //Handle(SelectBasics_EntityOwner) getEntityOwner() const; - - //! Returns table value for the row in form: depending on the aspect kind - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theEntityKind kind or kind of entity - QVariant getTableData (const int theRow, - const int theColumn, - const int theRole, - const TCollection_AsciiString& theEntityKind) const; - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; - - //! Constructor - //! param theParent a parent item - VInspector_ItemSelect3DSensitiveSetItem(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx b/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx deleted file mode 100644 index 4d1bb397a7..0000000000 --- a/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.cxx +++ /dev/null @@ -1,305 +0,0 @@ -// 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 -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include // child of Select3D_SensitiveSet -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -int VInspector_ItemSelectBasicsSensitiveEntity::initRowCount() const -{ - Handle(Select3D_SensitiveSet) aSensitiveSet = Handle(Select3D_SensitiveSet)::DownCast (GetSensitiveEntity()); - if (!aSensitiveSet.IsNull()) - return aSensitiveSet->Size(); - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectBasicsSensitiveEntity::initValue (int theItemRole) const -{ - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - Handle(SelectBasics_SensitiveEntity) anEntity = GetSensitiveEntity(); - if (anEntity.IsNull()) - return QVariant(); - - Handle(SelectBasics_EntityOwner) anOwner = anEntity->OwnerId(); - - switch (theItemRole) - { - case Qt::DisplayRole: - case Qt::EditRole: - case Qt::ToolTipRole: - { - switch (Column()) - { - case 0: return anEntity->DynamicType()->Name(); - default: - break; - } - break; - } - case Qt::BackgroundRole: - case Qt::ForegroundRole: - { - if (Column() == 2) - { - Handle(AIS_InteractiveContext) aContext = GetContext(); - if (!aContext.IsNull()) - { - if (VInspector_Tools::IsOwnerSelected(aContext, getEntityOwner())) - return QVariant ((theItemRole == Qt::BackgroundRole) ? QColor (Qt::darkBlue) : QColor (Qt::white)); - } - } - VInspector_ItemSelectMgrSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); - if (aParentItem) - return aParentItem->data(QModelIndex(), theItemRole); - break; - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectBasicsSensitiveEntity::createChild (int theRow, int theColumn) -{ - return VInspector_ItemSelect3DSensitiveSetItem::CreateItem (currentItem(), theRow, theColumn); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemSelectBasicsSensitiveEntity::Init() -{ - VInspector_ItemSelectMgrSensitiveEntityPtr aParentItem = itemDynamicCast(Parent()); - - Handle(SelectMgr_SensitiveEntity) anEntity = aParentItem->GetSensitiveEntity(); - - myEntity = anEntity->BaseSensitive(); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemSelectBasicsSensitiveEntity::Reset() -{ - // an empty method to don't clear the main label, otherwise the model will be empty - TreeModel_ItemBase::Reset(); - myEntity = NULL; - //if (!myPresentation.IsNull() && !myPresentation->GetContext().IsNull()) - //{ - // myPresentation->GetContext()->Erase (myPresentation, Standard_False); - // myPresentation = NULL; - //} -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemSelectBasicsSensitiveEntity::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : getEntityOwner -// purpose : -// ======================================================================= -Handle(SelectBasics_EntityOwner) VInspector_ItemSelectBasicsSensitiveEntity::getEntityOwner() const -{ - initItem(); - - Handle(SelectBasics_EntityOwner) anOwner; - const Handle(SelectBasics_SensitiveEntity)& aBase = GetSensitiveEntity(); - if (aBase.IsNull()) - return anOwner; - return aBase->OwnerId(); -} - -// ======================================================================= -// function : GetPresentations -// purpose : -// ======================================================================= -void VInspector_ItemSelectBasicsSensitiveEntity::GetPresentations(NCollection_List& thePresentations) -{ - if (Column() != 0) - return; - - if (!myPresentation.IsNull()) - return; - - Handle(Select3D_SensitiveEntity) aBaseEntity = GetSensitiveEntity(); - if (aBaseEntity.IsNull()) - return; - - TopoDS_Shape aShape = GetPresentationShape(); - if (aShape.IsNull()) - return; - - myPresentation = new AIS_Shape (aShape); - myPresentation->SetColor (Quantity_Color (Quantity_NOC_BLUE1)); - thePresentations.Append (myPresentation); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectBasicsSensitiveEntity::buildPresentationShape - (const Handle(SelectBasics_SensitiveEntity)& theEntity) -{ - Handle(Select3D_SensitiveEntity) aBaseEntity = theEntity; - if (aBaseEntity.IsNull()) - return TopoDS_Shape(); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (aBaseEntity->CenterOfGeometry())); - - Select3D_BndBox3d aBoundingBox = aBaseEntity->BoundingBox(); - if (aBoundingBox.IsValid()) - aBuilder.Add (aCompound, VInspector_Tools::CreateShape (aBoundingBox)); - - Standard_CString aTypeName = aBaseEntity->DynamicType()->Name(); - if (aTypeName == STANDARD_TYPE (Select3D_SensitiveBox)->Name()) - { - Handle(Select3D_SensitiveBox) anEntity = Handle(Select3D_SensitiveBox)::DownCast (aBaseEntity); - TopoDS_Shape aShape = Convert_Tools::CreateShape(anEntity->Box()); - aBuilder.Add (aCompound, aShape); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveFace)->Name()) - { - Handle(Select3D_SensitiveFace) anEntity = Handle(Select3D_SensitiveFace)::DownCast (aBaseEntity); - Handle(TColgp_HArray1OfPnt) aPoints; - anEntity->GetPoints (aPoints); - for (Standard_Integer aPntIter = aPoints->Lower(); aPntIter <= aPoints->Upper(); ++aPntIter) - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPoints->Value (aPntIter))); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitivePoint)->Name()) - { - Handle(Select3D_SensitivePoint) anEntity = Handle(Select3D_SensitivePoint)::DownCast (aBaseEntity); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(anEntity->Point())); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveSegment)->Name()) - { - Handle(Select3D_SensitiveSegment) anEntity = Handle(Select3D_SensitiveSegment)::DownCast (aBaseEntity); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge(anEntity->StartPoint(), anEntity->EndPoint())); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveTriangle)->Name()) - { - Handle(Select3D_SensitiveTriangle) anEntity = Handle(Select3D_SensitiveTriangle)::DownCast (aBaseEntity); - gp_Pnt aPnt0, aPnt1, aPnt2; - anEntity->Points3D (aPnt0, aPnt1, aPnt2); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPnt0)); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPnt1)); - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPnt2)); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitivePoly)->Name() || - aTypeName == STANDARD_TYPE (Select3D_SensitiveCircle)->Name() || - aTypeName == STANDARD_TYPE (Select3D_SensitiveCurve)->Name()) - { - Handle(Select3D_SensitivePoly) anEntity = Handle(Select3D_SensitivePoly)::DownCast (aBaseEntity); - - Handle(TColgp_HArray1OfPnt) aPoints; - anEntity->Points3D (aPoints); - for (Standard_Integer aPntIter = aPoints->Lower(); aPntIter <= aPoints->Upper(); ++aPntIter) - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex(aPoints->Value (aPntIter))); - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitivePrimitiveArray)->Name()) - { - } - else if (aTypeName == STANDARD_TYPE (Select3D_SensitiveTriangulation)->Name()) - { - Handle(Select3D_SensitiveTriangulation) anEntity = Handle(Select3D_SensitiveTriangulation)::DownCast (aBaseEntity); - const Handle(Poly_Triangulation)& aPolyTriangulation = anEntity->Triangulation(); - if (!aPolyTriangulation.IsNull()) - { - TopoDS_Face aFace; - aBuilder.MakeFace (aFace, aPolyTriangulation); - aBuilder.Add (aCompound, aFace); - } - } - - return aCompound; -} diff --git a/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx b/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx deleted file mode 100644 index be606bf89d..0000000000 --- a/tools/VInspector/VInspector_ItemSelectBasicsSensitiveEntity.hxx +++ /dev/null @@ -1,119 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemSelectBasicsSensitiveEntity_H -#define VInspector_ItemSelectBasicsSensitiveEntity_H - -#include -#include -#include -#include -#include -#include - -class QItemSelectionModel; -class VInspector_ItemSelectBasicsSensitiveEntity; - -typedef QExplicitlySharedDataPointer VInspector_ItemSelectBasicsSensitiveEntityPtr; - -//! \class VInspector_ItemSelectBasicsSensitiveEntity -//! The item shows information about SelectBasics_EntityOwner. -//! The parent is item selection, children are item entity owners -class VInspector_ItemSelectBasicsSensitiveEntity : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectBasicsSensitiveEntityPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectBasicsSensitiveEntityPtr (new VInspector_ItemSelectBasicsSensitiveEntity (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectBasicsSensitiveEntity() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myEntity; } - - //! \return the current sensitive entity - Standard_EXPORT Handle(SelectBasics_SensitiveEntity) GetSensitiveEntity() const - { return Handle(SelectBasics_SensitiveEntity)::DownCast (GetObject()); } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns presentation of the attribute to be visualized in the view - //! \thePresentations [out] container of presentation handles to be visualized - Standard_EXPORT virtual void GetPresentations (NCollection_List& thePresentations); - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! \return number of children. - 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; - - //! Returns owner of the current sensitive entity - //! \return owner - Handle(SelectBasics_EntityOwner) getEntityOwner() const; - - //! Returns table value for the row in form: depending on the aspect kind - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theEntityKind kind or kind of entity - QVariant getTableData (const int theRow, - const int theColumn, - const int theRole, - const TCollection_AsciiString& theEntityKind) const; - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myEntity); } - - //! Creates shape depending on the entity kind and parameters - //! \param theEntity current sensitive entity - //! \return shape or NULL - static TopoDS_Shape buildPresentationShape (const Handle(SelectBasics_SensitiveEntity)& theEntity); - - //! Constructor - //! param theParent a parent item - VInspector_ItemSelectBasicsSensitiveEntity(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - - Handle(SelectBasics_SensitiveEntity) myEntity; //!< the current sensitive entity - Handle(AIS_InteractiveObject) myPresentation; //!< the current presentation -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx b/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx deleted file mode 100644 index 699044b844..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.cxx +++ /dev/null @@ -1,135 +0,0 @@ -// Created on: 2019-02-04 -// 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 - -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrBaseFrustum::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectMgrBaseFrustum::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(); - - Handle (SelectMgr_BaseFrustum) aFrustum = GetFrustum(); - if (aFrustum.IsNull()) - return Column() == 0 ? "Empty frustum" : ""; - - switch (Column()) - { - case 0: return aFrustum->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrBaseFrustum::Init() -{ - VInspector_ItemSelectMgrSelectingVolumeManagerPtr aParentItem = itemDynamicCast(Parent()); - - Handle(SelectMgr_BaseFrustum) aFrustum; - if (aParentItem) - { - SelectMgr_SelectingVolumeManager aVolumeManager; - if (aParentItem->GetViewerSelector (aVolumeManager)) - { - aFrustum = aVolumeManager.ActiveVolume(); - } - } - setFrustum (aFrustum); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrBaseFrustum::Reset() -{ - VInspector_ItemBase::Reset(); - - setFrustum (NULL); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrBaseFrustum::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : Dump -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemSelectMgrBaseFrustum::Dump (Standard_OStream& theOStream) const -{ - Handle(SelectMgr_BaseFrustum) aFrustum = GetFrustum(); - - if (aFrustum.IsNull()) - return Standard_False; - - aFrustum->DumpJson (theOStream); - return Standard_True; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrBaseFrustum::createChild (int /*theRow*/, int /*theColumn*/) -{ - //if (theRow == 0) - // return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 1) - // return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 2) - // return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn); - // - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx b/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx deleted file mode 100644 index 087818e265..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrBaseFrustum.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// Created on: 2019-02-04 -// 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_ItemSelectMgrBaseFrustum_H -#define VInspector_ItemSelectMgrBaseFrustum_H - -#include -#include - -#include -#include - -class VInspector_ItemSelectMgrBaseFrustum; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrBaseFrustumPtr; - -//! \class VInspector_ItemSelectMgrBaseFrustum -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemSelectMgrBaseFrustum : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrBaseFrustumPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrBaseFrustumPtr (new VInspector_ItemSelectMgrBaseFrustum (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectMgrBaseFrustum() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myFrustum; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Handle(SelectMgr_BaseFrustum) GetFrustum() const - { return Handle(SelectMgr_BaseFrustum)::DownCast (GetObject()); } - - //! Dumps the content of me into the stream - virtual Standard_Boolean Dump (Standard_OStream& theOStream) const; - -protected: - //! Initialize 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; - -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: - - //! Set V3d viewer selector into the current field - //! \param theFrustum a viewer selector - void setFrustum (const Handle(SelectMgr_BaseFrustum)& theFrustum) { myFrustum = theFrustum; } - -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_ItemSelectMgrBaseFrustum(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(SelectMgr_BaseFrustum) myFrustum; //!< the current viewer selector -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrFilter.cxx b/tools/VInspector/VInspector_ItemSelectMgrFilter.cxx index 70bf35e55d..a274b05256 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrFilter.cxx +++ b/tools/VInspector/VInspector_ItemSelectMgrFilter.cxx @@ -30,10 +30,6 @@ // ======================================================================= QVariant VInspector_ItemSelectMgrFilter::initValue (int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - if (theItemRole == Qt::DisplayRole || theItemRole == Qt::ToolTipRole) { Handle(SelectMgr_Filter) aFilter = GetFilter(); @@ -41,6 +37,8 @@ QVariant VInspector_ItemSelectMgrFilter::initValue (int theItemRole) const { case 0: return theItemRole == Qt::ToolTipRole ? QVariant ("") : QVariant (aFilter->DynamicType()->Name()); + case 1: return rowCount() > 0 ? QVariant (rowCount()) : QVariant(); + case 2: return VInspector_Tools::GetPointerInfo (aFilter, true).ToCString(); default: break; } } @@ -129,3 +127,12 @@ void VInspector_ItemSelectMgrFilter::initItem() const const_cast(this)->Init(); } +// ======================================================================= +// function : GetInteractiveObject +// purpose : +// ======================================================================= +Handle(SelectMgr_Filter) VInspector_ItemSelectMgrFilter::GetFilter() const +{ + initItem(); + return myFilter; +} diff --git a/tools/VInspector/VInspector_ItemSelectMgrFilter.hxx b/tools/VInspector/VInspector_ItemSelectMgrFilter.hxx index d94a599be3..68408359e2 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrFilter.hxx +++ b/tools/VInspector/VInspector_ItemSelectMgrFilter.hxx @@ -40,14 +40,9 @@ public: //! Destructor virtual ~VInspector_ItemSelectMgrFilter() Standard_OVERRIDE {}; - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myFilter; } - //! Returns the current filter, init item if it was not initialized yet //! \return filter object - Standard_EXPORT Handle(SelectMgr_Filter) GetFilter() const - { return Handle(SelectMgr_Filter)::DownCast (GetObject()); } + Standard_EXPORT Handle(SelectMgr_Filter) GetFilter() const; //! Inits the item, fills internal containers Standard_EXPORT virtual void Init() Standard_OVERRIDE; diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.cxx b/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.cxx deleted file mode 100644 index 3c0aaae57d..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.cxx +++ /dev/null @@ -1,152 +0,0 @@ -// Created on: 2019-04-29 -// 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 - -#include -#include -#include - -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrSelectableObjectSet::initRowCount() const -{ - if (Column() != 0) - return 0; - - return SelectMgr_SelectableObjectSet::BVHSubsetNb; // VInspector_ItemBVHTree items -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectMgrSelectableObjectSet::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(); - - SelectMgr_SelectableObjectSet aSet; - if (!GetSelectableObjectSet (aSet)) - return Column() == 0 ? "Empty selectable object set" : ""; - - switch (Column()) - { - case 0: return "SelectMgr_SelectableObjectSet"; - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectableObjectSet::Init() -{ - //VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - //Handle(SelectMgr_SelectingVolumeManager) aVolumeMgr; - //if (aParentItem) - //{ - // VInspector_ItemContextPtr aParentContextItem = itemDynamicCast(aParentItem->Parent()); - // if (aParentContextItem) - // { - // Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext(); - // aVolumeMgr = aContext->MainSelector(); - // } - //} - //setViewerSelector (aVolumeMgr); - - //UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectableObjectSet::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectableObjectSet::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetSelectableObjectSet -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemSelectMgrSelectableObjectSet::GetSelectableObjectSet (SelectMgr_SelectableObjectSet& theSet) const -{ - VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast(Parent()); - - if (!aParentItem || aParentItem->GetViewerSelector().IsNull()) - return Standard_False; - - theSet = aParentItem->GetViewerSelector()->GetSelectableObjects(); - return Standard_True; -} - -// ======================================================================= -// function : GetBVHTree -// purpose : -// ======================================================================= -opencascade::handle > VInspector_ItemSelectMgrSelectableObjectSet::GetBVHTree (const int theRow, - TCollection_AsciiString& theName) const -{ - SelectMgr_SelectableObjectSet aSet; - if (!GetSelectableObjectSet (aSet)) - return NULL; - - if (theRow >= SelectMgr_SelectableObjectSet::BVHSubsetNb) - return NULL; - - SelectMgr_SelectableObjectSet::BVHSubset aBVHSubset = (SelectMgr_SelectableObjectSet::BVHSubset)theRow; - theName = TCollection_AsciiString ("BVH_Tree_") + aBVHSubset; - - return aSet.BVH (aBVHSubset); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrSelectableObjectSet::createChild (int theRow, int theColumn) -{ - if (theRow == 0 || theRow == 1 || theRow == 2) - return VInspector_ItemBVHTree::CreateItem (currentItem(), theRow, theColumn); - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.hxx b/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.hxx deleted file mode 100644 index 2fe94f6dd1..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSelectableObjectSet.hxx +++ /dev/null @@ -1,93 +0,0 @@ -// Created on: 2019-04-29 -// 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_ItemSelectMgrSelectableObjectSet_H -#define VInspector_ItemSelectMgrSelectableObjectSet_H - -#include - -#include -#include -#include -#include - -class SelectMgr_BaseFrustum; - -class VInspector_ItemSelectMgrSelectableObjectSet; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrSelectableObjectSetPtr; - -//! \class VInspector_ItemSelectMgrSelectableObjectSet -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemSelectMgrSelectableObjectSet : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrSelectableObjectSetPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrSelectableObjectSetPtr (new VInspector_ItemSelectMgrSelectableObjectSet (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectMgrSelectableObjectSet() 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 Handle(Standard_Transient) GetObject() const { initItem(); return NULL; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Standard_Boolean GetSelectableObjectSet (SelectMgr_SelectableObjectSet& theSet) const; - - //! Returns child BVH tree of the row - opencascade::handle > GetBVHTree (const int theRow, TCollection_AsciiString& theName) const; - -protected: - //! Initialize 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; - -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_ItemSelectMgrSelectableObjectSet(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx b/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx deleted file mode 100644 index 26031aca73..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.cxx +++ /dev/null @@ -1,136 +0,0 @@ -// Created on: 2019-02-04 -// 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 - -#include -#include - -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrSelectingVolumeManager::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 2; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectMgrSelectingVolumeManager::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(); - - SelectMgr_SelectingVolumeManager aVolumeManager; - if (!GetViewerSelector (aVolumeManager)) - return Column() == 0 ? "Empty volume manager" : ""; - - switch (Column()) - { - case 0: return "SelectMgr_SelectingVolumeManager"; - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectingVolumeManager::Init() -{ - //VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - //Handle(SelectMgr_SelectingVolumeManager) aVolumeMgr; - //if (aParentItem) - //{ - // VInspector_ItemContextPtr aParentContextItem = itemDynamicCast(aParentItem->Parent()); - // if (aParentContextItem) - // { - // Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext(); - // aVolumeMgr = aContext->MainSelector(); - // } - //} - //setViewerSelector (aVolumeMgr); - - //UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectingVolumeManager::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrSelectingVolumeManager::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetTableRowCount -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemSelectMgrSelectingVolumeManager::GetViewerSelector (SelectMgr_SelectingVolumeManager& theVolumeManager) const -{ - VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast(Parent()); - - if (!aParentItem || aParentItem->GetViewerSelector().IsNull()) - return Standard_False; - - theVolumeManager = aParentItem->GetViewerSelector()->GetManager(); - return Standard_True; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrSelectingVolumeManager::createChild (int theRow, int theColumn) -{ - if (theRow == 0 || theRow == 1) - return VInspector_ItemSelectMgrBaseFrustum::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 1) - // return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 2) - // return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn); - // - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx b/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx deleted file mode 100644 index d526bf829e..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSelectingVolumeManager.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Created on: 2019-02-04 -// 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_ItemSelectMgrSelectingVolumeManager_H -#define VInspector_ItemSelectMgrSelectingVolumeManager_H - -#include -#include - -#include -#include - -class SelectMgr_BaseFrustum; - -class VInspector_ItemSelectMgrSelectingVolumeManager; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrSelectingVolumeManagerPtr; - -//! \class VInspector_ItemSelectMgrSelectingVolumeManager -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemSelectMgrSelectingVolumeManager : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrSelectingVolumeManagerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrSelectingVolumeManagerPtr (new VInspector_ItemSelectMgrSelectingVolumeManager (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectMgrSelectingVolumeManager() 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 Handle(Standard_Transient) GetObject() const { initItem(); return NULL; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Standard_Boolean GetViewerSelector (SelectMgr_SelectingVolumeManager& theVolumeManager) const; - - //! Returns frustum Frustum for row = 0, FrustumSet for row = 1 - Handle(SelectMgr_BaseFrustum) GetFrustum (const int theRow) const; - -protected: - //! Initialize 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; - -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_ItemSelectMgrSelectingVolumeManager(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.cxx b/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.cxx deleted file mode 100644 index 7af3efa14e..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.cxx +++ /dev/null @@ -1,157 +0,0 @@ -// 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 -#include -#include -#include - -#include -#include - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrSensitiveEntitySet::initRowCount() const -{ - //Handle(SelectMgr_SensitiveEntitySet) aSensitiveSet = Handle(SelectMgr_SensitiveEntitySet)::DownCast (GetSensitiveEntitySet()); - //if (!aSensitiveSet.IsNull()) - // return aSensitiveSet->Size(); - - return 1; // for BVH_Tree -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectMgrSensitiveEntitySet::initValue (int theItemRole) const -{ - if (theItemRole == Qt::DisplayRole && theItemRole == Qt::ToolTipRole && Column() == 2) - return ViewControl_Tools::GetPointerInfo (GetSelectableObject(), true).ToCString(); - - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - - if (theItemRole != Qt::DisplayRole && theItemRole != Qt::EditRole && theItemRole != Qt::ToolTipRole) - return QVariant(); - - Handle(SelectMgr_SensitiveEntitySet) anEntitySet = GetSensitiveEntitySet(); - const Handle(SelectMgr_SelectableObject)& aSelectableObject = GetSelectableObject(); - - if (anEntitySet.IsNull()) - return Column() == 0 ? "Empty sensitive entity set" : ""; - - if (aSelectableObject.IsNull()) - return Column() == 0 ? "Empty selectable object for sensitive entity set" : ""; - - switch (theItemRole) - { - case Qt::DisplayRole: - case Qt::EditRole: - case Qt::ToolTipRole: - { - switch (Column()) - { - case 0: return aSelectableObject->DynamicType()->Name(); - default: - break; - } - break; - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrSensitiveEntitySet::createChild (int theRow, int theColumn) -{ - return VInspector_ItemBVHTree::CreateItem (currentItem(), theRow, theColumn); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntitySet::Init() -{ - VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast(Parent()->Parent()); - - Handle(SelectMgr_SelectableObject) anObject; - Handle(SelectMgr_SensitiveEntitySet) anEntitySet = aParentItem->GetSensitiveEntitySet (Row(), anObject); - - myEntitySet = anEntitySet; - mySelectableObject = anObject; - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntitySet::Reset() -{ - // an empty method to don't clear the main label, otherwise the model will be empty - TreeModel_ItemBase::Reset(); - myEntitySet = NULL; - mySelectableObject = NULL; -} - -// ======================================================================= -// function : GetBVHTree -// purpose : -// ======================================================================= -opencascade::handle > VInspector_ItemSelectMgrSensitiveEntitySet::GetBVHTree (const int /*theRow*/, - TCollection_AsciiString& /*theName*/) const -{ - Handle(SelectMgr_SensitiveEntitySet) anEntitySet = GetSensitiveEntitySet(); - - if (anEntitySet.IsNull()) - return NULL; - - return anEntitySet->BVH(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntitySet::initItem() const -{ - if (IsInitialized()) - return; - - const_cast(this)->Init(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectMgrSensitiveEntitySet::buildPresentationShape() -{ - //mySelectableObject - return TopoDS_Shape(); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.hxx b/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.hxx deleted file mode 100644 index 305417778b..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntitySet.hxx +++ /dev/null @@ -1,112 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VInspector_ItemSelectMgrSensitiveEntitySet_H -#define VInspector_ItemSelectMgrSensitiveEntitySet_H - -#include -#include -#include -#include -#include - -class SelectMgr_SelectableObject; - -class QItemSelectionModel; -class VInspector_ItemSelectMgrSensitiveEntitySet; - -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrSensitiveEntitySetPtr; - -//! \class VInspector_ItemSelectMgrSensitiveEntitySet -class VInspector_ItemSelectMgrSensitiveEntitySet : public VInspector_ItemBase -{ - -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrSensitiveEntitySetPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrSensitiveEntitySetPtr (new VInspector_ItemSelectMgrSensitiveEntitySet (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectMgrSensitiveEntitySet() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myEntitySet; } - - //! \return the current sensitive entity - Standard_EXPORT Handle(SelectMgr_SensitiveEntitySet) GetSensitiveEntitySet() const - { return Handle(SelectMgr_SensitiveEntitySet)::DownCast (GetObject()); } - - //! \return the current sensitive entity - Standard_EXPORT const Handle(SelectMgr_SelectableObject)& GetSelectableObject() const - { GetObject(); return mySelectableObject; } - - //! Inits the item, fills internal containers - Standard_EXPORT virtual void Init() Standard_OVERRIDE; - - //! Resets cached values - Standard_EXPORT virtual void Reset() Standard_OVERRIDE; - - //! Returns child BVH tree of the row - opencascade::handle > GetBVHTree (const int theRow, TCollection_AsciiString& theName) const; - -protected: - - //! Initialize the current item. It is empty because Reset() is also empty. - virtual void initItem() const Standard_OVERRIDE; - - //! \return number of children. - 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; - - //! Returns table value for the row in form: depending on the aspect kind - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theEntityKind kind or kind of entity - QVariant getTableData (const int theRow, - const int theColumn, - const int theRole, - const TCollection_AsciiString& theEntityKind) const; - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; - - //! Constructor - //! param theParent a parent item - VInspector_ItemSelectMgrSensitiveEntitySet(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -private: - - Handle(SelectMgr_SensitiveEntitySet) myEntitySet; //!< the current sensitive entity - Handle(SelectMgr_SelectableObject) mySelectableObject; //!< the current presentation -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx deleted file mode 100644 index 964745e220..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.cxx +++ /dev/null @@ -1,265 +0,0 @@ -// Created on: 2019-02-04 -// 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 - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= -VInspector_ItemSelectMgrViewerSelector::VInspector_ItemSelectMgrViewerSelector (TreeModel_ItemBasePtr theParent, - const int theRow, const int theColumn) -: VInspector_ItemBase(theParent, theRow, theColumn), - myXPix (150), myYPix (350), myXMinPix (150), myYMinPix (350), myXMaxPix (200), myYMaxPix (400) -{ -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrViewerSelector::initRowCount() const -{ - if (Column() != 0) - return 0; - - // SelectMgr_SelectingVolumeManager, VInspector_ItemSelectMgrSelectableObjectSet, VInspector_ItemContainer - Standard_Integer aNbRows = GetFirstChildOfPicked(); - - Handle(SelectMgr_ViewerSelector) aViewSelector = GetViewerSelector(); - if (!aViewSelector.IsNull()) - { - for (Standard_Integer aDetIter = 1; aDetIter <= aViewSelector->NbPicked(); ++aDetIter) - { - aNbRows++; - //Handle(SelectMgr_EntityOwner) anOwner = aViewSelector->->Picked (aDetIter); - } - } - return aNbRows; -} - -// ======================================================================= -// 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" : ""; - - switch (Column()) - { - case 0: return GetViewerSelector()->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelector::Init() -{ - VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - Handle(SelectMgr_ViewerSelector) aViewerSelector; - if (aParentItem) - { - VInspector_ItemContextPtr aParentContextItem = itemDynamicCast(aParentItem->Parent()); - if (aParentContextItem) - { - Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext(); - aViewerSelector = aContext->MainSelector(); - } - } - setViewerSelector (aViewerSelector); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelector::Reset() -{ - VInspector_ItemBase::Reset(); - - setViewerSelector (NULL); -} - -// ======================================================================= -// function : GetSensitiveEntitySet -// purpose : -// ======================================================================= -Handle(SelectMgr_SensitiveEntitySet) VInspector_ItemSelectMgrViewerSelector::GetSensitiveEntitySet (const int theRow, - Handle(SelectMgr_SelectableObject)& theObject) -{ - Standard_Integer anIndex = 0; - - Handle(SelectMgr_ViewerSelector) aViewSelector = GetViewerSelector(); - if (aViewSelector.IsNull()) - return NULL; - - for (SelectMgr_MapOfObjectSensitivesIterator anIterator (aViewSelector->GetObjectSensitives()); anIterator.More(); anIterator.Next(), anIndex++) - { - if (anIndex != theRow) - continue; - - theObject = anIterator.Key(); - return anIterator.Value(); - } - return NULL; -} - -// ======================================================================= -// function : GetContainerRowCount -// purpose : -// ======================================================================= - -int VInspector_ItemSelectMgrViewerSelector::GetContainerRowCount (const int theContainerRow) const -{ - if (theContainerRow != 2) - return 0; - - Handle(SelectMgr_ViewerSelector) aViewSelector = GetViewerSelector(); - if (aViewSelector.IsNull()) - return 0; - - return aViewSelector->GetObjectSensitives().Extent(); -} - -// ======================================================================= -// function : GetContainerValue -// purpose : -// ======================================================================= - -QVariant VInspector_ItemSelectMgrViewerSelector::GetContainerValue (const int theContainerRow, const int theItemRole) const -{ - if (theContainerRow != 2) - return 0; - - if (theItemRole != Qt::DisplayRole) - return QVariant(); - - Handle(SelectMgr_ViewerSelector) aViewSelector = GetViewerSelector(); - if (aViewSelector.IsNull()) - return QVariant(); - - return "SelectMgr_MapOfObjectSensitives"; -} - -// ======================================================================= -// function : CreateContainerChild -// purpose : -// ======================================================================= - -TreeModel_ItemBasePtr VInspector_ItemSelectMgrViewerSelector::CreateContainerChild (const TreeModel_ItemBasePtr& theParent, const int theContainerRow, int theRow, int theColumn) -{ - if (theContainerRow != 2) - return TreeModel_ItemBasePtr(); - - return VInspector_ItemSelectMgrSensitiveEntitySet::CreateItem (theParent, theRow, theColumn); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelector::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : Dump -// purpose : -// ======================================================================= -Standard_Boolean VInspector_ItemSelectMgrViewerSelector::Dump (Standard_OStream& theOStream) const -{ - Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector(); - if (aViewerSelector.IsNull()) - return Standard_False; - - aViewerSelector->DumpJson (theOStream); - return Standard_True; -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectMgrViewerSelector::buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewSelector) -{ - if (theViewSelector.IsNull() || theViewSelector->NbPicked() == 0) - return TopoDS_Shape(); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - - for (Standard_Integer aRankId = 1; aRankId <= theViewSelector->NbPicked(); ++aRankId) - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (theViewSelector->PickedPoint (aRankId))); - - return aCompound; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrViewerSelector::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - return VInspector_ItemSelectMgrSelectingVolumeManager::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 1) - return VInspector_ItemSelectMgrSelectableObjectSet::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 2) - return VInspector_ItemContainer::CreateItem (currentItem(), theRow, theColumn); - else - return VInspector_ItemSelectMgrViewerSelectorPicked::CreateItem (currentItem(), theRow, theColumn); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx deleted file mode 100644 index b460d8272b..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrViewerSelector.hxx +++ /dev/null @@ -1,148 +0,0 @@ -// Created on: 2019-02-04 -// 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_ItemSelectMgrViewerSelector_H -#define VInspector_ItemSelectMgrViewerSelector_H - -#include -#include -#include - -#include -#include -#include - -class VInspector_ItemSelectMgrViewerSelector; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrViewerSelectorPtr; - -//! \class VInspector_ItemSelectMgrViewerSelector -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemSelectMgrViewerSelector : public VInspector_ItemBase, public VInspector_ItemContainerAPI -{ -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 Handle(Standard_Transient) GetObject() const { initItem(); return myViewerSelector; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Handle(SelectMgr_ViewerSelector) GetViewerSelector() const - { return Handle(SelectMgr_ViewerSelector)::DownCast (GetObject()); } - - //! Returns the span from the 0 row to the first item corresponded to the picked item - //! the 0 item is SelectMgr_SelectingVolumeManager - //! the 1 item is VInspector_ItemSelectMgrSelectableObjectSet - //! the 2 item is VInspector_ItemContainer for SelectMgr_MapOfObjectSensitives - Standard_Integer GetFirstChildOfPicked() const { return 3; } - - //! Returns entity set if possible from SelectMgr_MapOfObjectSensitives - //! \param theRow row index - //! \param theObject [out] object connected to the sensitive entity set - Standard_EXPORT Handle(SelectMgr_SensitiveEntitySet) GetSensitiveEntitySet (const int theRow, - Handle(SelectMgr_SelectableObject)& theObject); - - //! Returns number of item selected - //! \return rows count - virtual int GetContainerRowCount (const int theContainerRow) 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 GetContainerValue (const int theContainerRow, const int theItemRole) const Standard_OVERRIDE; - - //! Creates a child item in the given position. - //! \param theRow the child row position - //! \param theColumn the child column position - //! \return the created item - virtual TreeModel_ItemBasePtr CreateContainerChild (const TreeModel_ItemBasePtr& theParent, const int theContainerRow, int theRow, int theColumn) Standard_OVERRIDE; - -protected: - //! Initialize 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; - - //! Dumps the content of me into the stream - virtual Standard_Boolean Dump (Standard_OStream& theOStream) const; - -protected: - - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myViewerSelector); } - - //! Creates shape for the 3d viewer selector parameters - //! \param theViewerSelector current viewer selector - //! \return shape or NULL - static TopoDS_Shape buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewerSelector); - -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: - - //! Set V3d viewer selector into the current field - //! \param theViewerSelector a viewer selector - void setViewerSelector (const Handle(SelectMgr_ViewerSelector)& theViewerSelector) { myViewerSelector = theViewerSelector; } - -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); - -private: - - Handle(SelectMgr_ViewerSelector) myViewerSelector; //!< the current viewer selector - - Standard_Integer myXPix; //!< cached value for picked X - Standard_Integer myYPix; //!< cached value for picked Y - - Standard_Integer myXMinPix; //!< cached value for min value of picked X - Standard_Integer myYMinPix; //!< cached value for min value of picked Y - - Standard_Integer myXMaxPix; //!< cached value for max value of picked X - Standard_Integer myYMaxPix; //!< cached value for max value of picked Y -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx deleted file mode 100644 index ffec7105af..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.cxx +++ /dev/null @@ -1,166 +0,0 @@ -// Created on: 2019-02-04 -// 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 - -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemSelectMgrViewerSelectorPicked::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 0; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemSelectMgrViewerSelectorPicked::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(); - - Standard_Integer aRankId; - Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId); - if (aViewerSelector.IsNull()) - return Column() == 0 ? "Empty viewer selector" : ""; - - switch (Column()) - { - case 0: - { - TCollection_AsciiString aValue = TCollection_AsciiString (aRankId) + " - " + - VInspector_Tools::GetPointerInfo (aViewerSelector->Picked (aRankId)); - return aValue.ToCString(); - } - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelectorPicked::Init() -{ - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelectorPicked::Reset() -{ - VInspector_ItemBase::Reset(); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemSelectMgrViewerSelectorPicked::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : GetViewerSelector -// purpose : -// ======================================================================= -Handle(SelectMgr_ViewerSelector) VInspector_ItemSelectMgrViewerSelectorPicked::GetViewerSelector (Standard_Integer& theRankId) const -{ - VInspector_ItemSelectMgrViewerSelectorPtr aParentItem = itemDynamicCast(Parent()); - if (!aParentItem) - return NULL; - - Handle(SelectMgr_ViewerSelector) aViewerSelector = aParentItem->GetViewerSelector(); - theRankId = Row() + 1 - aParentItem->GetFirstChildOfPicked(); - if (theRankId > aViewerSelector->NbPicked()) - return NULL; - - return aViewerSelector; -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectMgrViewerSelectorPicked::buildPresentationShape() -{ - Standard_Integer aRankId; - Handle(SelectMgr_ViewerSelector) aViewerSelector = GetViewerSelector (aRankId); - return buildPresentationShape (aViewerSelector, aRankId); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemSelectMgrViewerSelectorPicked::buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewSelector, - const Standard_Integer theRowId) -{ - if (theViewSelector.IsNull() || theRowId + 1 > theViewSelector->NbPicked()) - return TopoDS_Shape(); - - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound (aCompound); - - Standard_Integer aRankId = theRowId + 1; - aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (theViewSelector->PickedPoint (aRankId))); - - return aCompound; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrViewerSelectorPicked::createChild (int, int) -{ - //if (theRow == 0) - // return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 1) - // return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn); - //else if (theRow == 2) - // return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn); - // - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx b/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx deleted file mode 100644 index 6e3c0401f6..0000000000 --- a/tools/VInspector/VInspector_ItemSelectMgrViewerSelectorPicked.hxx +++ /dev/null @@ -1,102 +0,0 @@ -// Created on: 2019-02-04 -// 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_ItemSelectMgrViewerSelectorPicked_H -#define VInspector_ItemSelectMgrViewerSelectorPicked_H - -#include -#include - -#include -#include - -class VInspector_ItemSelectMgrViewerSelectorPicked; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrViewerSelectorPickedPtr; - -//! \class VInspector_ItemSelectMgrViewerSelectorPicked -//! Parent item, that corresponds Folder under the AIS_InteractiveContext -//! Children of the item are: none -class VInspector_ItemSelectMgrViewerSelectorPicked : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrViewerSelectorPickedPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrViewerSelectorPickedPtr (new VInspector_ItemSelectMgrViewerSelectorPicked (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemSelectMgrViewerSelectorPicked() 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 Handle(Standard_Transient) GetObject() const { initItem(); return NULL; } - - //! Returns viewer selector of the parent and index of rank inside the parent - //! \param theRankId rank of the item inside viewer selector - Standard_EXPORT Handle(SelectMgr_ViewerSelector) GetViewerSelector (Standard_Integer& theRankId) const; - -protected: - //! Initialize 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; - - -protected: - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE; - - //! Creates shape for the 3d viewer selector parameters - //! \param theViewerSelector current viewer selector - //! \param theRowId index of the item row, theRank - 1 value inside viewer selector - //! \return shape or NULL - static TopoDS_Shape buildPresentationShape (const Handle(SelectMgr_ViewerSelector)& theViewerSelector, - const Standard_Integer theRowId); - -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: - -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_ItemSelectMgrViewerSelectorPicked(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelection.cxx b/tools/VInspector/VInspector_ItemSelection.cxx similarity index 75% rename from tools/VInspector/VInspector_ItemSelectMgrSelection.cxx rename to tools/VInspector/VInspector_ItemSelection.cxx index 0836fe7417..191232968f 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrSelection.cxx +++ b/tools/VInspector/VInspector_ItemSelection.cxx @@ -13,7 +13,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include #include #include @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -31,13 +31,23 @@ #include #include +// ======================================================================= +// function : getSelection +// purpose : +// ======================================================================= +Handle(SelectMgr_Selection) VInspector_ItemSelection::getSelection() const +{ + initItem(); + return mySelection; +} + // ======================================================================= // function : initRowCount // purpose : // ======================================================================= -int VInspector_ItemSelectMgrSelection::initRowCount() const +int VInspector_ItemSelection::initRowCount() const { - Handle(SelectMgr_Selection) aSelection = GetSelection(); + Handle(SelectMgr_Selection) aSelection = getSelection(); #if OCC_VERSION_HEX < 0x070201 int aRows = 0; for (aSelection->Init(); aSelection->More(); aSelection->Next()) @@ -52,12 +62,8 @@ int VInspector_ItemSelectMgrSelection::initRowCount() const // function : initValue // purpose : // ======================================================================= -QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const +QVariant VInspector_ItemSelection::initValue (int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; - switch (theItemRole) { case Qt::DisplayRole: @@ -66,7 +72,8 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const { switch (Column()) { - case 0: return GetSelection()->DynamicType()->Name(); + case 0: return getSelection()->DynamicType()->Name(); + case 1: return rowCount(); case 3: { if (theItemRole == Qt::ToolTipRole) @@ -74,7 +81,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const else { VInspector_ItemPresentableObjectPtr aParentItem = itemDynamicCast(Parent()); - return VInspector_Tools::SelectionModeToName(GetSelection()->Mode(), aParentItem->GetInteractiveObject()).ToCString(); + return VInspector_Tools::SelectionModeToName(getSelection()->Mode(), aParentItem->GetInteractiveObject()).ToCString(); } } case 4: @@ -83,18 +90,18 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const return "SelectMgr_StateOfSelection"; else { int aNbSelected = 0; - SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState(); + SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState(); if (aState == SelectMgr_SOS_Activated || aState == SelectMgr_SOS_Any) { Handle(AIS_InteractiveContext) aContext = GetContext(); #if OCC_VERSION_HEX < 0x070201 for (mySelection->Init(); mySelection->More(); mySelection->Next()) { - const Handle(SelectBasics_EntityOwner)& anOwner = mySelection->Sensitive()->BaseSensitive()->OwnerId(); + const Handle(SelectMgr_EntityOwner)& anOwner = mySelection->Sensitive()->BaseSensitive()->OwnerId(); #else for (NCollection_Vector::Iterator aSelEntIter (mySelection->Entities()); aSelEntIter.More(); aSelEntIter.Next()) { - const Handle(SelectBasics_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId(); + const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId(); #endif if (VInspector_Tools::IsOwnerSelected(aContext, anOwner)) aNbSelected++; @@ -105,16 +112,16 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const } case 9: { - SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState(); + SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState(); return VInspector_Tools::ToName (VInspector_SelectionType_StateOfSelection, aState).ToCString(); } - case 10: return QString::number (GetSelection()->Sensitivity()); + case 10: return QString::number (getSelection()->Sensitivity()); case 11: return VInspector_Tools::ToName (VInspector_SelectionType_TypeOfUpdate, - GetSelection()->UpdateStatus()).ToCString(); + getSelection()->UpdateStatus()).ToCString(); case 12: return VInspector_Tools::ToName (VInspector_SelectionType_TypeOfBVHUpdate, - GetSelection()->BVHUpdateStatus()).ToCString(); + getSelection()->BVHUpdateStatus()).ToCString(); default: break; } @@ -122,7 +129,7 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const } case Qt::ForegroundRole: { - SelectMgr_StateOfSelection aState = GetSelection()->GetSelectionState(); + SelectMgr_StateOfSelection aState = getSelection()->GetSelectionState(); return QVariant (aState == SelectMgr_SOS_Activated ? QColor (Qt::black) : QColor (Qt::darkGray)); } } @@ -133,23 +140,22 @@ QVariant VInspector_ItemSelectMgrSelection::initValue (int theItemRole) const // function : createChild // purpose : // ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrSelection::createChild (int theRow, int theColumn) +TreeModel_ItemBasePtr VInspector_ItemSelection::createChild (int theRow, int theColumn) { - return VInspector_ItemSelectMgrSensitiveEntity::CreateItem (currentItem(), theRow, theColumn); + return VInspector_ItemSensitiveEntity::CreateItem (currentItem(), theRow, theColumn); } // ======================================================================= // function : Init // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSelection::Init() +void VInspector_ItemSelection::Init() { VInspector_ItemPresentableObjectPtr aParentItem = itemDynamicCast(Parent()); Handle(AIS_InteractiveObject) anIO = aParentItem->GetInteractiveObject(); int aRowId = Row(); - int aDeltaIndex = 2; // properties, presentation items int aCurrentId = 0; #if OCC_VERSION_HEX < 0x070201 for (anIO->Init(); anIO->More(); anIO->Next(), aCurrentId++) @@ -157,7 +163,7 @@ void VInspector_ItemSelectMgrSelection::Init() for (SelectMgr_SequenceOfSelection::Iterator aSelIter (anIO->Selections()); aSelIter.More(); aSelIter.Next(), aCurrentId++) #endif { - if (aCurrentId != aRowId - aDeltaIndex) + if (aCurrentId != aRowId) continue; #if OCC_VERSION_HEX < 0x070201 mySelection = anIO->CurrentSelection(); @@ -173,7 +179,7 @@ void VInspector_ItemSelectMgrSelection::Init() // function : Reset // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSelection::Reset() +void VInspector_ItemSelection::Reset() { // an empty method to don't clear the main label, otherwise the model will be empty TreeModel_ItemBase::Reset(); @@ -185,11 +191,10 @@ void VInspector_ItemSelectMgrSelection::Reset() // function : initItem // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSelection::initItem() const +void VInspector_ItemSelection::initItem() const { if (IsInitialized()) return; - const_cast(this)->Init(); + const_cast(this)->Init(); // an empty method to don't initialize the main label, as it was not cleared in Reset() } - diff --git a/tools/VInspector/VInspector_ItemSelectMgrSelection.hxx b/tools/VInspector/VInspector_ItemSelection.hxx similarity index 67% rename from tools/VInspector/VInspector_ItemSelectMgrSelection.hxx rename to tools/VInspector/VInspector_ItemSelection.hxx index 058cfbdba0..f1565a6c03 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrSelection.hxx +++ b/tools/VInspector/VInspector_ItemSelection.hxx @@ -13,38 +13,33 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef VInspector_ItemSelectMgrSelection_H -#define VInspector_ItemSelectMgrSelection_H +#ifndef VInspector_ItemSelection_H +#define VInspector_ItemSelection_H #include #include #include -class VInspector_ItemSelectMgrSelection; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrSelectionPtr; +class VInspector_ItemSelection; +typedef QExplicitlySharedDataPointer VInspector_ItemSelectionPtr; -//! \class VInspector_ItemSelectMgrSelection +//! \class VInspector_ItemSelection //! Item about SelectMgr_Selection. //! Parent is presentable object item, children are sensitive entity items -class VInspector_ItemSelectMgrSelection : public VInspector_ItemBase +class VInspector_ItemSelection : public VInspector_ItemBase { public: //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrSelectionPtr CreateItem(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrSelectionPtr (new VInspector_ItemSelectMgrSelection (theParent, theRow, theColumn)); } + static VInspector_ItemSelectionPtr CreateItem(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + { return VInspector_ItemSelectionPtr (new VInspector_ItemSelection (theParent, theRow, theColumn)); } //! Destructor - virtual ~VInspector_ItemSelectMgrSelection() {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return mySelection; } + virtual ~VInspector_ItemSelection() {}; //! \return current selection value - Standard_EXPORT Handle(SelectMgr_Selection) GetSelection() const - { return Handle(SelectMgr_Selection)::DownCast (GetObject()); } + Standard_EXPORT Handle(SelectMgr_Selection) getSelection() const; //! Inits the item, fills internal containers Standard_EXPORT virtual void Init() Standard_OVERRIDE; @@ -78,7 +73,7 @@ private: //! Constructor //! param theParent a parent item - VInspector_ItemSelectMgrSelection(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + VInspector_ItemSelection(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) : VInspector_ItemBase(theParent, theRow, theColumn) {} private: diff --git a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.cxx b/tools/VInspector/VInspector_ItemSensitiveEntity.cxx similarity index 60% rename from tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.cxx rename to tools/VInspector/VInspector_ItemSensitiveEntity.cxx index 3dc5a08424..b5f9d59174 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.cxx +++ b/tools/VInspector/VInspector_ItemSensitiveEntity.cxx @@ -14,11 +14,10 @@ // commercial license or contractual agreement. -#include -#include +#include #include -#include +#include #include #include #include @@ -26,11 +25,9 @@ #include #include #include -#include -#include +#include +#include #include -#include -#include #include #include @@ -38,28 +35,24 @@ #include // ======================================================================= -// function : initValue +// function : GetSensitiveEntity // purpose : // ======================================================================= -int VInspector_ItemSelectMgrSensitiveEntity::initRowCount() const +Handle(SelectMgr_SensitiveEntity) VInspector_ItemSensitiveEntity::GetSensitiveEntity() const { - if (GetSensitiveEntity()->BaseSensitive().IsNull()) - return 0; - - return 2; + initItem(); + return myEntity; } // ======================================================================= // function : initValue // purpose : // ======================================================================= -QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) const +QVariant VInspector_ItemSensitiveEntity::initValue (int theItemRole) const { - QVariant aParentValue = VInspector_ItemBase::initValue (theItemRole); - if (aParentValue.isValid()) - return aParentValue; + Handle(SelectMgr_SensitiveEntity) aBase = GetSensitiveEntity(); + Handle(SelectMgr_EntityOwner) anOwner = aBase->BaseSensitive()->OwnerId(); - Handle(SelectMgr_SensitiveEntity) anEntity = GetSensitiveEntity(); switch (theItemRole) { case Qt::DisplayRole: @@ -68,7 +61,35 @@ QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) co { switch (Column()) { - case 0: return anEntity->DynamicType()->Name(); + case 0: return myEntity->DynamicType()->Name(); + case 2: return VInspector_Tools::GetPointerInfo (GetSensitiveEntity()->BaseSensitive()->OwnerId(), true).ToCString(); + case 3: + { + Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner); + if (BROwnr.IsNull()) + return QVariant(); + + const TopoDS_Shape& aShape = BROwnr->Shape(); + if (aShape.IsNull()) + return QVariant(); + + return VInspector_Tools::GetShapeTypeInfo (aShape.ShapeType()).ToCString(); + } + case 13: return +#if OCC_VERSION_HEX <= 0x060901 + ("none"); +#else + myEntity->IsActiveForSelection() ? QString ("true") : QString ("false"); +#endif + case 14: return QString::number (GetSensitiveEntity()->BaseSensitive()->SensitivityFactor()); + case 15: return QString::number (GetSensitiveEntity()->BaseSensitive()->NbSubElements()); + case 16: + { + Handle(StdSelect_BRepOwner) BROwnr = Handle(StdSelect_BRepOwner)::DownCast (anOwner); + if (BROwnr.IsNull()) + return QVariant(); + return anOwner->Priority(); + } default: break; } @@ -86,7 +107,7 @@ QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) co return QVariant ((theItemRole == Qt::BackgroundRole) ? QColor (Qt::darkBlue) : QColor (Qt::white)); } } - VInspector_ItemSelectMgrSelectionPtr aParentItem = itemDynamicCast(Parent()); + VInspector_ItemSelectionPtr aParentItem = itemDynamicCast(Parent()); if (aParentItem) return aParentItem->data(QModelIndex(), theItemRole); break; @@ -101,25 +122,20 @@ QVariant VInspector_ItemSelectMgrSensitiveEntity::initValue (int theItemRole) co // function : createChild // purpose : // ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemSelectMgrSensitiveEntity::createChild (int theRow, int theColumn) +TreeModel_ItemBasePtr VInspector_ItemSensitiveEntity::createChild (int theRow, int theColumn) { - if (theRow == 0) - return VInspector_ItemSelectBasicsEntityOwner::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 1) - return VInspector_ItemSelectBasicsSensitiveEntity::CreateItem (currentItem(), theRow, theColumn); - - return TreeModel_ItemBasePtr(); + return VInspector_ItemEntityOwner::CreateItem (currentItem(), theRow, theColumn); } // ======================================================================= // function : Init // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntity::Init() +void VInspector_ItemSensitiveEntity::Init() { - VInspector_ItemSelectMgrSelectionPtr aParentItem = itemDynamicCast(Parent()); + VInspector_ItemSelectionPtr aParentItem = itemDynamicCast(Parent()); - Handle(SelectMgr_Selection) aSelection = aParentItem->GetSelection(); + Handle(SelectMgr_Selection) aSelection = aParentItem->getSelection(); int aRowId = Row(); int aCurrentId = 0; @@ -145,7 +161,7 @@ void VInspector_ItemSelectMgrSensitiveEntity::Init() // function : Reset // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntity::Reset() +void VInspector_ItemSensitiveEntity::Reset() { // an empty method to don't clear the main label, otherwise the model will be empty TreeModel_ItemBase::Reset(); @@ -156,23 +172,23 @@ void VInspector_ItemSelectMgrSensitiveEntity::Reset() // function : initItem // purpose : // ======================================================================= -void VInspector_ItemSelectMgrSensitiveEntity::initItem() const +void VInspector_ItemSensitiveEntity::initItem() const { if (IsInitialized()) return; - const_cast(this)->Init(); + const_cast(this)->Init(); } // ======================================================================= // function : getEntityOwner // purpose : // ======================================================================= -Handle(SelectBasics_EntityOwner) VInspector_ItemSelectMgrSensitiveEntity::getEntityOwner() const +Handle(SelectMgr_EntityOwner) VInspector_ItemSensitiveEntity::getEntityOwner() const { initItem(); - Handle(SelectBasics_EntityOwner) anOwner; - const Handle(SelectBasics_SensitiveEntity)& aBase = myEntity->BaseSensitive(); + Handle(SelectMgr_EntityOwner) anOwner; + const Handle(Select3D_SensitiveEntity)& aBase = myEntity->BaseSensitive(); if (aBase.IsNull()) return anOwner; return aBase->OwnerId(); diff --git a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.hxx b/tools/VInspector/VInspector_ItemSensitiveEntity.hxx similarity index 62% rename from tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.hxx rename to tools/VInspector/VInspector_ItemSensitiveEntity.hxx index a8e55c0b3e..4fbe8045cd 100644 --- a/tools/VInspector/VInspector_ItemSelectMgrSensitiveEntity.hxx +++ b/tools/VInspector/VInspector_ItemSensitiveEntity.hxx @@ -13,41 +13,36 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#ifndef VInspector_ItemSelectMgrSensitiveEntity_H -#define VInspector_ItemSelectMgrSensitiveEntity_H +#ifndef VInspector_ItemSensitiveEntity_H +#define VInspector_ItemSensitiveEntity_H #include -#include -#include +#include #include #include -class VInspector_ItemSelectMgrSensitiveEntity; +class SelectMgr_EntityOwner; +class VInspector_ItemSensitiveEntity; -typedef QExplicitlySharedDataPointer VInspector_ItemSelectMgrSensitiveEntityPtr; +typedef QExplicitlySharedDataPointer VInspector_ItemSensitiveEntityPtr; -//! \class VInspector_ItemSelectMgrSensitiveEntity -//! The item shows information about SelectBasics_EntityOwner. +//! \class VInspector_ItemSensitiveEntity +//! The item shows information about SelectMgr_EntityOwner. //! The parent is item selection, children are item entity owners -class VInspector_ItemSelectMgrSensitiveEntity : public VInspector_ItemBase +class VInspector_ItemSensitiveEntity : public VInspector_ItemBase { public: //! Creates an item wrapped by a shared pointer - static VInspector_ItemSelectMgrSensitiveEntityPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemSelectMgrSensitiveEntityPtr (new VInspector_ItemSelectMgrSensitiveEntity (theParent, theRow, theColumn)); } + static VInspector_ItemSensitiveEntityPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + { return VInspector_ItemSensitiveEntityPtr (new VInspector_ItemSensitiveEntity (theParent, theRow, theColumn)); } //! Destructor - virtual ~VInspector_ItemSelectMgrSensitiveEntity() Standard_OVERRIDE {}; - - //! Returns data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myEntity; } + virtual ~VInspector_ItemSensitiveEntity() Standard_OVERRIDE {}; //! \return the current sensitive entity - Standard_EXPORT Handle(SelectMgr_SensitiveEntity) GetSensitiveEntity() const - { return Handle(SelectMgr_SensitiveEntity)::DownCast (GetObject()); } + Standard_EXPORT Handle(SelectMgr_SensitiveEntity) GetSensitiveEntity() const; //! Inits the item, fills internal containers Standard_EXPORT virtual void Init() Standard_OVERRIDE; @@ -61,7 +56,7 @@ protected: virtual void initItem() const Standard_OVERRIDE; //! \return number of children. - virtual int initRowCount() const Standard_OVERRIDE; + virtual int initRowCount() const Standard_OVERRIDE { return !GetSensitiveEntity()->BaseSensitive().IsNull() ? 1 : 0; } //! Returns item information for the given role. Fills internal container if it was not filled yet //! \param theItemRole a value role @@ -78,13 +73,13 @@ protected: //! Returns owner of the current sensitive entity //! \return owner - Handle(SelectBasics_EntityOwner) getEntityOwner() const; + Handle(SelectMgr_EntityOwner) getEntityOwner() const; private: //! Constructor //! param theParent a parent item - VInspector_ItemSelectMgrSensitiveEntity(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) + VInspector_ItemSensitiveEntity(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) : VInspector_ItemBase(theParent, theRow, theColumn) {} private: diff --git a/tools/VInspector/VInspector_ItemV3dView.cxx b/tools/VInspector/VInspector_ItemV3dView.cxx deleted file mode 100644 index 502d93f460..0000000000 --- a/tools/VInspector/VInspector_ItemV3dView.cxx +++ /dev/null @@ -1,155 +0,0 @@ -// 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 - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemV3dView::initRowCount() const -{ - if (Column() != 0) - return 0; - - return 3; // 0 - Default Camera, 1 - Aspect_Window, 2 - CView - // TODO: V3d_ListOfLight, V3d_Trihedron, - //Aspect_Grid-MyPlane-MyTrsf-MyGridEchoStructure-MyGridEchoGroup -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemV3dView::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 (GetView().IsNull()) - return Column() == 0 ? "Empty view" : ""; - - switch (Column()) - { - case 0: return GetView()->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemV3dView::Init() -{ - VInspector_ItemV3dViewerPtr aParentItem = itemDynamicCast(Parent()); - Handle(V3d_View) aView; - if (aParentItem) - { - aView = aParentItem->GetView (Row()); - } - setView (aView); - - UpdatePresentationShape(); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemV3dView::Reset() -{ - VInspector_ItemBase::Reset(); - - setView (NULL); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemV3dView::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : buildPresentationShape -// purpose : -// ======================================================================= -TopoDS_Shape VInspector_ItemV3dView::buildPresentationShape (const Handle(V3d_View)& /*theView*/) -{ - //BRep_Builder aBuilder; - TopoDS_Compound aCompound; - //aBuilder.MakeCompound (aCompound); - - //Standard_Real aX, anY, aZ, aVx, aVy, aVz; - //theView->Axis (aX, anY, aZ, aVx, aVy, aVz); - //gp_Pnt anOrigin (aX, anY, aZ); - - //aBuilder.Add (aCompound, BRepBuilderAPI_MakeVertex (anOrigin)); - //aBuilder.Add (aCompound, BRepBuilderAPI_MakeEdge (gp_Lin (anOrigin, gp_Dir (aVx, aVy, aVz)))); - - return aCompound; -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemV3dView::createChild (int theRow, int theColumn) -{ - if (theRow == 0) - return VInspector_ItemGraphic3dCamera::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 1) - return VInspector_ItemAspectWindow::CreateItem (currentItem(), theRow, theColumn); - else if (theRow == 2) - return VInspector_ItemGraphic3dCView::CreateItem (currentItem(), theRow, theColumn); - - return TreeModel_ItemBasePtr(); -} diff --git a/tools/VInspector/VInspector_ItemV3dView.hxx b/tools/VInspector/VInspector_ItemV3dView.hxx deleted file mode 100644 index e4c15b948c..0000000000 --- a/tools/VInspector/VInspector_ItemV3dView.hxx +++ /dev/null @@ -1,110 +0,0 @@ -// 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_ItemV3dView_H -#define VInspector_ItemV3dView_H - -#include -#include - -#include -#include - -class VInspector_ItemV3dView; -typedef QExplicitlySharedDataPointer VInspector_ItemV3dViewPtr; - -//! \class VInspector_ItemV3dView -//! 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_ItemV3dView : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemV3dViewPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemV3dViewPtr (new VInspector_ItemV3dView (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemV3dView() 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 Handle(Standard_Transient) GetObject() const { initItem(); return myView; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Handle(V3d_View) GetView() const - { return Handle(V3d_View)::DownCast (GetObject()); } - -protected: - //! Initialize 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; - -protected: - - //! Build presentation shape - //! \return generated shape of the item parameters - virtual TopoDS_Shape buildPresentationShape() Standard_OVERRIDE { return buildPresentationShape (myView); } - - //! Creates shape for the 3d view parameters - //! \param theView current view - //! \return shape or NULL - static TopoDS_Shape buildPresentationShape (const Handle(V3d_View)& theView); - -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: - - //! Set V3d view into the current field - //! \param theViewer a viewer - void setView (const Handle(V3d_View)& theView) { myView = theView; } - -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_ItemV3dView(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(V3d_View) myView; //!< the current view -}; - -#endif diff --git a/tools/VInspector/VInspector_ItemV3dViewer.cxx b/tools/VInspector/VInspector_ItemV3dViewer.cxx deleted file mode 100644 index 005808bac8..0000000000 --- a/tools/VInspector/VInspector_ItemV3dViewer.cxx +++ /dev/null @@ -1,148 +0,0 @@ -// 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 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// ======================================================================= -// function : GetView -// purpose : -// ======================================================================= -Handle(V3d_View) VInspector_ItemV3dViewer::GetView (const int theRow) const -{ - Handle(V3d_Viewer) aViewer = GetViewer(); - - int aViewId = 0; - for (V3d_ListOfViewIterator anActiveViewIter (GetViewer()->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next()) - { - Handle(V3d_View) aView = anActiveViewIter.Value(); - if (aView->View().IsNull()) - continue; - - if (theRow == aViewId) - return aView; - aViewId++; - } - - return NULL; -} - -// ======================================================================= -// function : initRowCount -// purpose : -// ======================================================================= -int VInspector_ItemV3dViewer::initRowCount() const -{ - if (Column() != 0) - return 0; - - int aNbOfViews = 0; - for (V3d_ListOfViewIterator anActiveViewIter (GetViewer()->ActiveViewIterator()); anActiveViewIter.More(); anActiveViewIter.Next()) - { - if (!anActiveViewIter.Value().IsNull()) - aNbOfViews++; - } - return aNbOfViews; -} - -// ======================================================================= -// function : initValue -// purpose : -// ======================================================================= -QVariant VInspector_ItemV3dViewer::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 (GetViewer().IsNull()) - return Column() == 0 ? "Empty viewer" : ""; - - switch (Column()) - { - case 0: return GetViewer()->DynamicType()->Name(); - default: - break; - } - return QVariant(); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void VInspector_ItemV3dViewer::Init() -{ - VInspector_ItemFolderObjectPtr aParentItem = itemDynamicCast(Parent()); - Handle(V3d_Viewer) aViewer; - if (aParentItem) - { - VInspector_ItemContextPtr aParentContextItem = itemDynamicCast(aParentItem->Parent()); - if (aParentContextItem) - { - Handle(AIS_InteractiveContext) aContext = aParentContextItem->GetContext(); - aViewer = aContext->CurrentViewer(); - } - } - setViewer (aViewer); - TreeModel_ItemBase::Init(); // to use getIO() without circling initialization -} - -// ======================================================================= -// function : Reset -// purpose : -// ======================================================================= - -void VInspector_ItemV3dViewer::Reset() -{ - VInspector_ItemBase::Reset(); - - setViewer (NULL); -} - -// ======================================================================= -// function : initItem -// purpose : -// ======================================================================= - -void VInspector_ItemV3dViewer::initItem() const -{ - if (IsInitialized()) - return; - const_cast(this)->Init(); -} - -// ======================================================================= -// function : createChild -// purpose : -// ======================================================================= -TreeModel_ItemBasePtr VInspector_ItemV3dViewer::createChild (int theRow, int theColumn) -{ - return VInspector_ItemV3dView::CreateItem (currentItem(), theRow, theColumn); -} diff --git a/tools/VInspector/VInspector_ItemV3dViewer.hxx b/tools/VInspector/VInspector_ItemV3dViewer.hxx deleted file mode 100644 index 42e2f337e2..0000000000 --- a/tools/VInspector/VInspector_ItemV3dViewer.hxx +++ /dev/null @@ -1,103 +0,0 @@ -// 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_ItemV3dViewer_H -#define VInspector_ItemV3dViewer_H - -#include -#include - -#include - -class VInspector_ItemV3dViewer; -typedef QExplicitlySharedDataPointer VInspector_ItemV3dViewerPtr; - -//! \class VInspector_ItemV3dViewer -//! 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_ItemV3dViewer : public VInspector_ItemBase -{ -public: - - //! Creates an item wrapped by a shared pointer - static VInspector_ItemV3dViewerPtr CreateItem (TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - { return VInspector_ItemV3dViewerPtr (new VInspector_ItemV3dViewer (theParent, theRow, theColumn)); } - - //! Destructor - virtual ~VInspector_ItemV3dViewer() Standard_OVERRIDE {}; - - //! Returns view by index using active views iterator - //! \param theRow row index of the view - //! \return view - Standard_EXPORT Handle(V3d_View) GetView (const int theRow) 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 data object of the item. - //! \return object - virtual Handle(Standard_Transient) GetObject() const { initItem(); return myViewer; } - - //! Returns current drawer, initialize the drawer if it was not initialized yet - Standard_EXPORT Handle(V3d_Viewer) GetViewer() const - { return Handle(V3d_Viewer)::DownCast (GetObject()); } - -protected: - //! Initialize 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; - -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: - - //! Set V3d viewer into the current field - //! \param theViewer a viewer - void setViewer (const Handle(V3d_Viewer)& theViewer) { myViewer = theViewer; } - -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_ItemV3dViewer(TreeModel_ItemBasePtr theParent, const int theRow, const int theColumn) - : VInspector_ItemBase(theParent, theRow, theColumn) {} - -protected: - - Handle(V3d_Viewer) myViewer; //!< the current viewer -}; - -#endif diff --git a/tools/VInspector/VInspector_Tools.cxx b/tools/VInspector/VInspector_Tools.cxx index c56f6065fd..eeb52fe983 100644 --- a/tools/VInspector/VInspector_Tools.cxx +++ b/tools/VInspector/VInspector_Tools.cxx @@ -15,30 +15,14 @@ #include -#include -#include -#include - -#include - #include #include -#include -#if OCC_VERSION_HEX < 0x060901 -#include -#endif #include #include #include #include -#include -#include -#include #include -#include -#include -#include - +#include #include #include #include @@ -49,8 +33,6 @@ #include #include -#include - #include // ======================================================================= @@ -70,9 +52,6 @@ TCollection_AsciiString VInspector_Tools::GetShapeTypeInfo (const TopAbs_ShapeEn // ======================================================================= TCollection_AsciiString VInspector_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo) { - if (!thePointer.operator->()) - return ""; - std::ostringstream aPtrStr; aPtrStr << thePointer.operator->(); if (!isShortInfo) @@ -136,11 +115,12 @@ int VInspector_Tools::SelectedOwners (const Handle(AIS_InteractiveContext)& theC // purpose : // ======================================================================= bool VInspector_Tools::IsOwnerSelected (const Handle(AIS_InteractiveContext)& theContext, - const Handle(SelectBasics_EntityOwner)& theOwner) + const Handle(SelectMgr_EntityOwner)& theOwner) { bool anIsSelected = false; + Handle(SelectMgr_EntityOwner) anOwner = theOwner; for (theContext->InitSelected(); theContext->MoreSelected() && !anIsSelected; theContext->NextSelected()) - anIsSelected = theContext->SelectedOwner() == theOwner; + anIsSelected = theContext->SelectedOwner() == anOwner; return anIsSelected; } @@ -148,10 +128,10 @@ bool VInspector_Tools::IsOwnerSelected (const Handle(AIS_InteractiveContext)& th // function : ContextOwners // purpose : // ======================================================================= -NCollection_List VInspector_Tools::ContextOwners ( +NCollection_List VInspector_Tools::ContextOwners ( const Handle(AIS_InteractiveContext)& theContext) { - NCollection_List aResultOwners; + NCollection_List aResultOwners; if (theContext.IsNull()) return aResultOwners; @@ -184,8 +164,8 @@ NCollection_List VInspector_Tools::ContextOwne #endif if (anEntity.IsNull()) continue; - const Handle(SelectBasics_SensitiveEntity)& aBase = anEntity->BaseSensitive(); - Handle(SelectBasics_EntityOwner) anOwner = aBase->OwnerId(); + const Handle(Select3D_SensitiveEntity)& aBase = anEntity->BaseSensitive(); + Handle(SelectMgr_EntityOwner) anOwner = aBase->OwnerId(); Standard_Transient* anOwnerPtr = anOwner.operator->(); if (aSelectedIds.contains ((size_t)anOwnerPtr)) continue; @@ -201,17 +181,17 @@ NCollection_List VInspector_Tools::ContextOwne // function : ActiveOwners // purpose : // ======================================================================= -NCollection_List VInspector_Tools::ActiveOwners ( +NCollection_List VInspector_Tools::ActiveOwners ( const Handle(AIS_InteractiveContext)& theContext, - NCollection_List& theEmptySelectableOwners) + NCollection_List& theEmptySelectableOwners) { - NCollection_List aResultOwners; + NCollection_List aResultOwners; // only local context is processed: TODO for global context Handle(AIS_InteractiveContext) aContext = theContext; if (aContext.IsNull()) return aResultOwners; - NCollection_List anActiveOwners; + NCollection_List anActiveOwners; // OCCT BUG:1 - equal pointer owners are appears in the list #if OCC_VERSION_HEX > 0x060901 aContext->MainSelector()->ActiveOwners (anActiveOwners); @@ -219,11 +199,10 @@ NCollection_List VInspector_Tools::ActiveOwner anActiveOwners = aContext->MainSelector()->ActiveOwners(); #endif QList aSelectedIds; // Remember of selected address in order to avoid duplicates - Handle(SelectMgr_EntityOwner) anOwner; - for (NCollection_List::Iterator anOwnersIt (anActiveOwners); + for (NCollection_List::Iterator anOwnersIt (anActiveOwners); anOwnersIt.More(); anOwnersIt.Next()) { - anOwner = anOwnersIt.Value(); + const Handle(SelectMgr_EntityOwner)& anOwner = anOwnersIt.Value(); if (anOwner.IsNull()) continue; @@ -246,7 +225,7 @@ NCollection_List VInspector_Tools::ActiveOwner // purpose : // ======================================================================= void VInspector_Tools::AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveContext)& theContext, - const NCollection_List& theOwners) + const NCollection_List& theOwners) { // TODO: the next two rows are to be removed later theContext->UnhilightSelected(false); @@ -254,23 +233,11 @@ void VInspector_Tools::AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveCo theContext->UnhilightSelected(Standard_False); - //TODO: processing in local context only -#if OCC_VERSION_HEX < 0x060901 - Handle(AIS_LocalContext) aLContext = theContext->LocalContext(); - TCollection_AsciiString aSelectionName = aLContext->SelectionName(); - aLContext->UnhilightPicked(Standard_False); -#endif - - for (NCollection_List::Iterator anOwnersIt(theOwners); + for (NCollection_List::Iterator anOwnersIt(theOwners); anOwnersIt.More(); anOwnersIt.Next()) { Handle(SelectMgr_EntityOwner) anOwner = anOwnersIt.Value(); -#if OCC_VERSION_HEX > 0x060901 theContext->AddOrRemoveSelected (anOwner, Standard_False); -#else - AIS_Selection::Selection(aSelectionName.ToCString())->Select(anOwner); - anOwner->SetSelected(Standard_True); -#endif } theContext->UpdateCurrentViewer(); } @@ -434,11 +401,10 @@ TCollection_AsciiString VInspector_Tools::ToName (const VInspector_SelectionType { switch (theValue) { - case SelectMgr_SOS_Activated: return "Activated"; - case SelectMgr_SOS_Deactivated: return "Deactivated"; - //case SelectMgr_SOS_Sleeping: return "Sleeping"; case SelectMgr_SOS_Any: return "Any"; case SelectMgr_SOS_Unknown: return "Unknown"; + case SelectMgr_SOS_Activated: return "Activated"; + case SelectMgr_SOS_Deactivated: return "Deactivated"; default: break; } } @@ -500,180 +466,37 @@ TCollection_AsciiString VInspector_Tools::OrientationToName (const TopAbs_Orient } // ======================================================================= -// function : ReadShape +// function : LocationToName // purpose : // ======================================================================= -TopoDS_Shape VInspector_Tools::ReadShape (const TCollection_AsciiString& theFileName) -{ - TopoDS_Shape aShape; - - BRep_Builder aBuilder; - BRepTools::Read (aShape, theFileName.ToCString(), aBuilder); - - return aShape; -} - -namespace +TCollection_AsciiString VInspector_Tools::LocationToName (const TopLoc_Location& theLocation) { - static Standard_CString VInspector_Table_PrintDisplayActionType[5] = - { - "None", "Display", "Redisplay", "Erase", "Remove" - }; -} - -//======================================================================= -//function : DisplayActionTypeToString -//purpose : -//======================================================================= -Standard_CString VInspector_Tools::DisplayActionTypeToString (View_DisplayActionType theType) -{ - return VInspector_Table_PrintDisplayActionType[theType]; -} - -//======================================================================= -//function : DisplayActionTypeFromString -//purpose : -//======================================================================= -Standard_Boolean VInspector_Tools::DisplayActionTypeFromString (Standard_CString theTypeString, - View_DisplayActionType& theType) -{ - TCollection_AsciiString aName (theTypeString); - for (Standard_Integer aTypeIter = 0; aTypeIter <= View_DisplayActionType_RemoveId; ++aTypeIter) - { - Standard_CString aTypeName = VInspector_Table_PrintDisplayActionType[aTypeIter]; - if (aName == aTypeName) - { - theType = View_DisplayActionType (aTypeIter); - return Standard_True; - } - } - return Standard_False; -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Select3D_BndBox3d& theBoundingBox) -{ - return QString ("(%1, %2, %3), (%4, %5, %6)") - .arg (theBoundingBox.CornerMin().x()).arg (theBoundingBox.CornerMin().y()).arg (theBoundingBox.CornerMin().z()) - .arg (theBoundingBox.CornerMax().x()).arg (theBoundingBox.CornerMax().y()).arg (theBoundingBox.CornerMax().z()); -} + gp_Trsf aTrsf = theLocation.Transformation(); -//======================================================================= -//function : CreateShape -//purpose : -//======================================================================= -TopoDS_Shape VInspector_Tools::CreateShape (const Select3D_BndBox3d& theBoundingBox) -{ - if (!theBoundingBox.IsValid()) - return TopoDS_Shape(); - - 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 Convert_Tools::CreateBoxShape (aPntMin, aPntMax); -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_IndexBuffer)& theIndexBuffer) -{ - const Handle(Graphic3d_Buffer)& aBuffer = theIndexBuffer; - return VInspector_Tools::ToVariant (aBuffer); -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_Buffer)& theBuffer) -{ - if (theBuffer.IsNull()) - return QVariant(); - - QString anInfo; - anInfo = "NbElements = " + QString::number (theBuffer->NbElements) + ","; - anInfo = "NbAttributes = " + QString::number (theBuffer->NbAttributes) + ","; - anInfo = "Stride = " + QString::number (theBuffer->Stride) + ","; - QStringList anAttributes; - for (Standard_Integer anAttribIter = 0; anAttribIter < theBuffer->NbAttributes; ++anAttribIter) - { - const Graphic3d_Attribute& anAttrib = theBuffer->Attribute (anAttribIter); - anAttributes.append(VInspector_Tools::ToString (anAttrib)); - } - return anInfo + " (" + anAttributes.join(", ") + ")"; -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Handle(Graphic3d_BoundBuffer)& /*theBoundBuffer*/) -{ - //const Handle(Graphic3d_Buffer)& aBuffer = theBoundBuffer; - //Handle(Graphic3d_Buffer) aBuffer = Handle(Graphic3d_Buffer)::DownCast (theBoundBuffer); - //return VInspector_Tools::ToVariant (aBuffer); - return QVariant(); -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Graphic3d_Mat4d& theMatrix) -{ TCollection_AsciiString aValues; - for (int aRowId = 1; aRowId <= theMatrix.Rows(); aRowId++) + for (int aRowId = 1; aRowId <= 3; aRowId++) { - for (int aColId = 1; aColId <= theMatrix.Cols(); aColId++) - { - aValues += TCollection_AsciiString (theMatrix.GetValue (aRowId, aColId)); - if (aColId != theMatrix.Rows()) + for (int aColId = 1; aColId <= 4; aColId++) { + aValues += TCollection_AsciiString (aTrsf.Value(aRowId, aColId)); + if (aColId != 4) aValues += ","; } - if (aRowId != theMatrix.Rows()) + if (aRowId != 3) aValues += " "; } - - return aValues.ToCString(); -} - -//======================================================================= -//function : ToVariant -//purpose : -//======================================================================= -QVariant VInspector_Tools::ToVariant (const Graphic3d_Mat4& theMatrix) -{ - TCollection_AsciiString aValues; - for (int aRowId = 1; aRowId <= theMatrix.Rows(); aRowId++) - { - for (int aColId = 1; aColId <= theMatrix.Cols(); aColId++) - { - aValues += TCollection_AsciiString (theMatrix.GetValue (aRowId, aColId)); - if (aColId != theMatrix.Rows()) - aValues += ","; - } - if (aRowId != theMatrix.Rows()) - aValues += " "; - } - - return aValues.ToCString(); + return aValues; } -//======================================================================= -//function : ToString -//purpose : -//======================================================================= -QString VInspector_Tools::ToString (const Graphic3d_Attribute& theAttribute) +// ======================================================================= +// function : ReadShape +// purpose : +// ======================================================================= +TopoDS_Shape VInspector_Tools::ReadShape (const TCollection_AsciiString& theFileName) { - Graphic3d_TypeOfAttribute anId = theAttribute.Id; - Graphic3d_TypeOfData aDataType = theAttribute.DataType; + TopoDS_Shape aShape; - QString anInfo = QString ("%1: %2").arg (anId).arg (aDataType); + BRep_Builder aBuilder; + BRepTools::Read (aShape, theFileName.ToCString(), aBuilder); - return anInfo; + return aShape; } diff --git a/tools/VInspector/VInspector_Tools.hxx b/tools/VInspector/VInspector_Tools.hxx index a765ee2d3a..5b116b446f 100644 --- a/tools/VInspector/VInspector_Tools.hxx +++ b/tools/VInspector/VInspector_Tools.hxx @@ -17,12 +17,6 @@ #define VInspector_Tools_H #include -#include -#include -#include -#include -#include -#include #include #include #include @@ -32,24 +26,13 @@ #include #include -#include #include -#include - -#include - #include #include #include #include -class ViewControl_TableModelValues; - -class Graphic3d_IndexBuffer; -class Graphic3d_Buffer; -class Graphic3d_BoundBuffer; - //! \class VInspector_Tools //! The class that gives auxiliary methods for Visualization elements manipulation class VInspector_Tools @@ -67,7 +50,7 @@ public: //! \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); + const bool isShortInfo); //! Returns number of selected owners for presentation //! \param theContext an interactive context @@ -82,27 +65,27 @@ public: //! \param theOwner a selectable owner //! \return boolean value Standard_EXPORT static bool IsOwnerSelected (const Handle(AIS_InteractiveContext)& theContext, - const Handle(SelectBasics_EntityOwner)& theOwner); + const Handle(SelectMgr_EntityOwner)& theOwner); //! Returns all owners present in the context //! \param theContext an interactive context //! \return container of owners - Standard_EXPORT static NCollection_List ContextOwners ( + Standard_EXPORT static NCollection_List ContextOwners ( const Handle(AIS_InteractiveContext)& theContext); //! Returns active owners in main selector of context //! \param theContext an interactive context //! \param theEmptySelectableOwners container of owners with NULL presentation or not displayed presentation //! \return container of owners - Standard_EXPORT static NCollection_List ActiveOwners ( + Standard_EXPORT static NCollection_List ActiveOwners ( const Handle(AIS_InteractiveContext)& theContext, - NCollection_List& theEmptySelectableOwners); + NCollection_List& theEmptySelectableOwners); //! Unhighlight selected, set selected the owners //! \param theContext an interactive context //! \param theOwners a container of owners Standard_EXPORT static void AddOrRemoveSelectedShapes (const Handle(AIS_InteractiveContext)& theContext, - const NCollection_List& theOwners); + const NCollection_List& theOwners); //! Unhighlight selected, set selected presentations //! \param theContext an interactive context @@ -145,70 +128,15 @@ public: //! \return text value Standard_EXPORT static TCollection_AsciiString OrientationToName (const TopAbs_Orientation& theOrientation); + //! Returns text of orientation + //! \param theLocation a location value + //! \return text value + Standard_EXPORT static TCollection_AsciiString LocationToName (const TopLoc_Location& theLocation); + //! Read Shape using BREP reader //! \param theFileName a file name //! \return shape or NULL Standard_EXPORT static TopoDS_Shape ReadShape (const TCollection_AsciiString& theFileName); - - //! 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 (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 View_DisplayActionType DisplayActionTypeFromString (Standard_CString theTypeString) - { - View_DisplayActionType aType = View_DisplayActionType_NoneId; - DisplayActionTypeFromString (theTypeString, aType); - return aType; - } - - //! Determines the enumeration type from the given string identifier (using case-insensitive comparison). - //! @param theTypeString string identifier - //! @param theType detected action type - //! @return TRUE if string identifier is known - Standard_EXPORT static Standard_Boolean DisplayActionTypeFromString (const Standard_CString theTypeString, - 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 Select3D_BndBox3d& theBoundingBox); - - //! Build string presentation of Graphic3D index buffer - //! \param theIndexBuffer index buffer - //! \return string presentation - Standard_EXPORT static QVariant ToVariant (const Handle(Graphic3d_IndexBuffer)& theIndexBuffer); - - //! Build string presentation of Graphic3D buffer - //! \param theBuffer index buffer - //! \return string presentation - Standard_EXPORT static QVariant ToVariant (const Handle(Graphic3d_Buffer)& theBuffer); - - //! Build string presentation of Graphic3D bound buffer - //! \param theBoundBuffer index buffer - //! \return string presentation - Standard_EXPORT static QVariant ToVariant (const Handle(Graphic3d_BoundBuffer)& theBoundBuffer); - - //! Convert matrix values into a text presentation - //! \param theMatrix a matrix of elements - //! \return string presentation - Standard_EXPORT static QVariant ToVariant (const Graphic3d_Mat4d& theMatrix); - - //! Convert matrix values into a text presentation - //! \param theMatrix a matrix of elements - //! \return string presentation - Standard_EXPORT static QVariant ToVariant (const Graphic3d_Mat4& theMatrix); - - Standard_EXPORT static QString ToString (const Graphic3d_Attribute& theAttribute); - }; #endif diff --git a/tools/VInspector/VInspector_ViewModel.cxx b/tools/VInspector/VInspector_ViewModel.cxx index ea7fac8a5f..207ad48541 100644 --- a/tools/VInspector/VInspector_ViewModel.cxx +++ b/tools/VInspector/VInspector_ViewModel.cxx @@ -17,13 +17,10 @@ #include #include -#include +#include #include -#include - -#include - -#include +#include +#include #include #include @@ -45,30 +42,28 @@ VInspector_ViewModel::VInspector_ViewModel (QObject* theParent) SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH)); SetHeaderItem (1, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH)); SetHeaderItem (2, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH)); - SetHeaderItem (3, TreeModel_HeaderSection ("Row", COLUMN_SIZE_WIDTH)); + SetHeaderItem (3, TreeModel_HeaderSection ("ShapeType", COLUMN_SHAPE_TYPE_WIDTH)); // ItemPresentableObject, ItemSelection SetHeaderItem (4, TreeModel_HeaderSection ("SelectedOwners", -1)); // ItemContext, ItemPresentableObject, ItemSelection - //SetHeaderItem (5, TreeModel_HeaderSection ("ActivatedModes", -1)); // ItemPresentableObject - //SetHeaderItem (6, TreeModel_HeaderSection ("DeviationCoefficient", -1, true)); // ItemContext, ItemPresentableObject - //SetHeaderItem (7, TreeModel_HeaderSection ("Deflection", -1, true)); // ItemPresentableObject - //SetHeaderItem (8, TreeModel_HeaderSection ("IsAutoTriangulation", -1, true)); // ItemPresentableObject - - //SetHeaderItem (9, TreeModel_HeaderSection ("SelectionState", -1)); // ItemSelection - //SetHeaderItem (10, TreeModel_HeaderSection ("Sensitivity", -1, true)); // ItemSelection - //SetHeaderItem (11, TreeModel_HeaderSection ("UpdateStatus", -1, true)); // ItemSelection - //SetHeaderItem (12, TreeModel_HeaderSection ("BVHUpdateStatus", -1, true)); // ItemSelection - - //SetHeaderItem (13, TreeModel_HeaderSection ("IsActiveForSelection", -1, true)); // ItemSensitiveEntity - //SetHeaderItem (14, TreeModel_HeaderSection ("SensitivityFactor", -1, true)); // ItemSensitiveEntity - //SetHeaderItem (15, TreeModel_HeaderSection ("NbSubElements", -1, true)); // ItemSensitiveEntity - //SetHeaderItem (16, TreeModel_HeaderSection ("Priority", -1, true)); // ItemSensitiveEntity - - //SetHeaderItem (17, TreeModel_HeaderSection ("TShape", COLUMN_POINTER_WIDTH, true)); // ItemEntityOwner - //SetHeaderItem (18, TreeModel_HeaderSection ("Orientation", -1, true)); // ItemEntityOwner - //SetHeaderItem (19, TreeModel_HeaderSection ("Location", -1, true)); // ItemEntityOwner - - //SetHeaderItem (20, TreeModel_HeaderSection ("Color", -1)); // ItemPresentableObject - - //SetHeaderItem (21, TreeModel_HeaderSection ("Owner Location", -1, true)); // ItemEntityOwner + SetHeaderItem (5, TreeModel_HeaderSection ("ActivatedModes", -1)); // ItemPresentableObject + SetHeaderItem (6, TreeModel_HeaderSection ("DeviationCoefficient", -1, true)); // ItemContext, ItemPresentableObject + SetHeaderItem (7, TreeModel_HeaderSection ("Deflection", -1, true)); // ItemPresentableObject + SetHeaderItem (8, TreeModel_HeaderSection ("IsAutoTriangulation", -1, true)); // ItemPresentableObject + + SetHeaderItem (9, TreeModel_HeaderSection ("SelectionState", -1)); // ItemSelection + SetHeaderItem (10, TreeModel_HeaderSection ("Sensitivity", -1, true)); // ItemSelection + SetHeaderItem (11, TreeModel_HeaderSection ("UpdateStatus", -1, true)); // ItemSelection + SetHeaderItem (12, TreeModel_HeaderSection ("BVHUpdateStatus", -1, true)); // ItemSelection + + SetHeaderItem (13, TreeModel_HeaderSection ("IsActiveForSelection", -1, true)); // ItemSensitiveEntity + SetHeaderItem (14, TreeModel_HeaderSection ("SensitivityFactor", -1, true)); // ItemSensitiveEntity + SetHeaderItem (15, TreeModel_HeaderSection ("NbSubElements", -1, true)); // ItemSensitiveEntity + SetHeaderItem (16, TreeModel_HeaderSection ("Priority", -1, true)); // ItemSensitiveEntity + + SetHeaderItem (17, TreeModel_HeaderSection ("TShape", COLUMN_POINTER_WIDTH, true)); // ItemEntityOwner + SetHeaderItem (18, TreeModel_HeaderSection ("Orientation", -1, true)); // ItemEntityOwner + SetHeaderItem (19, TreeModel_HeaderSection ("Location", -1, true)); // ItemEntityOwner + + SetHeaderItem (20, TreeModel_HeaderSection ("Color", -1)); // ItemPresentableObject } // ======================================================================= @@ -100,37 +95,29 @@ void VInspector_ViewModel::SetContext (const Handle(AIS_InteractiveContext)& the // fill root item by the application for (int aColId = 0, aNbColumns = columnCount(); aColId < aNbColumns; aColId++) itemDynamicCast(myRootItems[aColId])->SetContext (theContext); - - UpdateTreeModel(); + EmitLayoutChanged(); } // ======================================================================= // function : FindPointers // purpose : // ======================================================================= -void VInspector_ViewModel::FindPointers (const QStringList& thePointers, - const QModelIndex& theParent, - QModelIndexList& theFoundIndices) +QModelIndexList VInspector_ViewModel::FindPointers (const QStringList& thePointers) { - if (thePointers.isEmpty()) - return; - - QModelIndex aParentIndex = theParent.isValid() ? theParent : index (0, 0); + QModelIndexList anIndices; + QModelIndex aParentIndex = index (0, 0); TreeModel_ItemBasePtr aParentItem = TreeModel_ModelBase::GetItemByIndex (aParentIndex); // context item for (int aRowId = 0, aCount = aParentItem->rowCount(); aRowId < aCount; aRowId++) { QModelIndex anIndex = index (aRowId, 0, aParentIndex); TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex); - VInspector_ItemBasePtr aVItem = itemDynamicCast(anItemBase); - if (!aVItem) + VInspector_ItemPresentableObjectPtr anItemPrs = itemDynamicCast(anItemBase); + if (!anItemPrs) continue; - Handle(Standard_Transient) anObject = aVItem->GetObject(); - TCollection_AsciiString aPointerInfo = ViewControl_Tools::GetPointerInfo (anObject); - if (thePointers.contains (aPointerInfo.ToCString())) - theFoundIndices.append (anIndex); - - FindPointers (thePointers, anIndex, theFoundIndices); + if (thePointers.contains (anItemPrs->PointerInfo())) + anIndices.append (anIndex); } + return anIndices; } // ======================================================================= @@ -159,7 +146,7 @@ QModelIndex VInspector_ViewModel::FindIndex (const Handle(AIS_InteractiveObject) // purpose : // ======================================================================= void VInspector_ViewModel::GetSelectedOwners (QItemSelectionModel* theSelectionModel, - NCollection_List& theOwners) + NCollection_List& theOwners) { if (!theSelectionModel) return; @@ -178,12 +165,12 @@ void VInspector_ViewModel::GetSelectedOwners (QItemSelectionModel* theSelectionM for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) { TreeModel_ItemBasePtr anItem = *anItemIt; - Handle(SelectBasics_EntityOwner) anEntityOwner; - if (VInspector_ItemSelectBasicsEntityOwnerPtr anOwnerItem = itemDynamicCast(anItem)) + Handle(SelectMgr_EntityOwner) anEntityOwner; + if (VInspector_ItemEntityOwnerPtr anOwnerItem = itemDynamicCast(anItem)) { anEntityOwner = anOwnerItem->EntityOwner(); } - else if (VInspector_ItemSelectMgrSensitiveEntityPtr aSensItem = itemDynamicCast(anItem)) + else if (VInspector_ItemSensitiveEntityPtr aSensItem = itemDynamicCast(anItem)) { anEntityOwner = aSensItem->GetSensitiveEntity()->BaseSensitive()->OwnerId(); } diff --git a/tools/VInspector/VInspector_ViewModel.hxx b/tools/VInspector/VInspector_ViewModel.hxx index 55bbecf996..839e550057 100644 --- a/tools/VInspector/VInspector_ViewModel.hxx +++ b/tools/VInspector/VInspector_ViewModel.hxx @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -59,11 +59,8 @@ public: //! Returns tree view indices for the given pointers of presentable object //! \param thePointers a list of presentation pointers - //! \param theParent an index of the parent item - //! \param [out] container of indices - Standard_EXPORT void FindPointers (const QStringList& thePointers, - const QModelIndex& theParent, - QModelIndexList& theFoundIndices); + //! \return container of indices + Standard_EXPORT QModelIndexList FindPointers (const QStringList& thePointers); //! Returns tree model index of the presentation item in the tree view. //! \param thePresentation a presentation @@ -80,7 +77,7 @@ public: //! \param theSelectionModel a selection model //! \param theOwners an output list of owners Standard_EXPORT static void GetSelectedOwners (QItemSelectionModel* theSelectionModel, - NCollection_List& theOwners); + NCollection_List& theOwners); //! Updates tree model Standard_EXPORT void UpdateTreeModel(); diff --git a/tools/VInspector/VInspector_ViewModelHistory.cxx b/tools/VInspector/VInspector_ViewModelHistory.cxx index a8f584ef15..de42b99fd7 100644 --- a/tools/VInspector/VInspector_ViewModelHistory.cxx +++ b/tools/VInspector/VInspector_ViewModelHistory.cxx @@ -45,12 +45,11 @@ VInspector_ViewModelHistory::VInspector_ViewModelHistory (QObject* theParent, co : TreeModel_ModelBase (theParent) { SetHeaderItem (0, TreeModel_HeaderSection ("Name", COLUMN_NAME_WIDTH)); - SetHeaderItem (1, TreeModel_HeaderSection ("Visibility", COLUMN_SIZE_WIDTH)); // visualization item - SetHeaderItem (2, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH)); - SetHeaderItem (3, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH)); - SetHeaderItem (4, TreeModel_HeaderSection ("Shape type", COLUMN_SHAPE_TYPE_WIDTH)); - SetHeaderItem (5, TreeModel_HeaderSection ("AIS Name", COLUMN_AIS_NAME_WIDTH)); - SetHeaderItem (6, TreeModel_HeaderSection ("Selected/Highlighted", -1)); + SetHeaderItem (1, TreeModel_HeaderSection ("Size", COLUMN_SIZE_WIDTH)); + SetHeaderItem (2, TreeModel_HeaderSection ("Pointer", COLUMN_POINTER_WIDTH)); + SetHeaderItem (3, TreeModel_HeaderSection ("Shape type", COLUMN_SHAPE_TYPE_WIDTH)); + SetHeaderItem (4, TreeModel_HeaderSection ("AIS Name", COLUMN_AIS_NAME_WIDTH)); + SetHeaderItem (5, TreeModel_HeaderSection ("Selected/Highlighted", -1)); for (int aColumnId = 0, aNbColumns = columnCount(); aColumnId < aNbColumns; aColumnId++) { diff --git a/tools/VInspector/VInspector_Window.cxx b/tools/VInspector/VInspector_Window.cxx index c2bd8ed934..e102fbb709 100644 --- a/tools/VInspector/VInspector_Window.cxx +++ b/tools/VInspector/VInspector_Window.cxx @@ -15,52 +15,30 @@ #include -#include #include -#include -//#include -//#include -//#include -//#include -#include -//#include - -#include - -#include #include #include -#include -#include #include #include -#include #include -#include +#include #include #include #include #include #include -#include -#include -#include +#include #include -//#include #include #include #include #include -#include #include -#include -#include -#include #include #include @@ -78,9 +56,6 @@ #include #include -const int VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH = 300;//600; -const int VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT = 1000; - const int VINSPECTOR_DEFAULT_WIDTH = 1250; const int VINSPECTOR_DEFAULT_HEIGHT = 800; @@ -103,8 +78,6 @@ const int VINSPECTOR_DEFAULT_VIEW_POSITION_Y = 60; // TINSPECTOR_DEFAULT_POSITIO VInspector_Window::VInspector_Window() : myParent (0), myExportToShapeViewDialog (0), myViewWindow (0) { - myDisplayPreview = new View_DisplayPreview(); - myMainWindow = new QMainWindow (0); QWidget* aCentralWidget = new QWidget (myMainWindow); @@ -123,10 +96,7 @@ VInspector_Window::VInspector_Window() myTreeView->setSelectionMode (QAbstractItemView::ExtendedSelection); myTreeView->header()->setStretchLastSection (true); myTreeView->setContextMenuPolicy(Qt::CustomContextMenu); - //((ViewControl_TreeView*)myTreeView)->SetPredefinedSize (QSize (VINSPECTOR_DEFAULT_TREE_VIEW_WIDTH, - // VINSPECTOR_DEFAULT_TREE_VIEW_HEIGHT)); VInspector_ViewModel* aTreeModel = new VInspector_ViewModel (myTreeView); - //aTreeModel->AddPropertiesCreator(new VInspector_PropertiesCreator()); myTreeView->setModel (aTreeModel); // hide Visibility column TreeModel_HeaderSection anItem = aTreeModel->GetHeaderItem ((int)TreeModel_ColumnType_Visibility); @@ -140,23 +110,12 @@ VInspector_Window::VInspector_Window() QItemSelectionModel* aSelModel = new QItemSelectionModel (myTreeView->model(), myTreeView); myTreeView->setSelectionModel (aSelModel); connect (aSelModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT (onTreeViewSelectionChanged (const QItemSelection&, const QItemSelection&))); + this, SLOT (onSelectionChanged (const QItemSelection&, const QItemSelection&))); aParentLay->addWidget(myTreeView, 1, 0); aParentLay->setRowStretch (1, 1); myMainWindow->setCentralWidget (aCentralWidget); - // property view - myPropertyView = new ViewControl_PropertyView (myMainWindow, - QSize(VINSPECTOR_DEFAULT_PROPERTY_VIEW_WIDTH, VINSPECTOR_DEFAULT_PROPERTY_VIEW_HEIGHT)); - myPropertyPanelWidget = new QDockWidget (tr ("PropertyPanel"), myMainWindow); - myPropertyPanelWidget->setObjectName (myPropertyPanelWidget->windowTitle()); - myPropertyPanelWidget->setTitleBarWidget (new QWidget(myMainWindow)); - myPropertyPanelWidget->setWidget (myPropertyView->GetControl()); - myMainWindow->addDockWidget (Qt::RightDockWidgetArea, myPropertyPanelWidget); - connect (myPropertyPanelWidget->toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT (onPropertyPanelShown (bool))); - connect (myPropertyView, SIGNAL (propertyViewSelectionChanged()), this, SLOT (onPropertyViewSelectionChanged ())); - myHistoryView = new ViewControl_TreeView (myMainWindow); myHistoryView->setSelectionBehavior (QAbstractItemView::SelectRows); ((ViewControl_TreeView*)myHistoryView)->SetPredefinedSize (QSize (VINSPECTOR_DEFAULT_HISTORY_VIEW_WIDTH, @@ -243,18 +202,10 @@ void VInspector_Window::GetPreferences (TInspectorAPI_PreferencesDataMap& theIte theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str()); } - anItems.clear(); - View_PreviewParameters::SaveState (myDisplayPreview->GetPreviewParameters(), anItems, "preview_parameters_"); + TreeModel_Tools::SaveState (myHistoryView, anItems, "history_view_"); for (QMap::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++) theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str()); - - anItems.clear(); - TreeModel_Tools::SaveState (myTreeView, anItems); - for (QMap::const_iterator anItemsIt = anItems.begin(); anItemsIt != anItems.end(); anItemsIt++) - { - theItem.Bind (anItemsIt.key().toStdString().c_str(), anItemsIt.value().toStdString().c_str()); - } } // ======================================================================= @@ -279,9 +230,6 @@ void VInspector_Window::SetPreferences (const TInspectorAPI_PreferencesDataMap& else if (TreeModel_Tools::RestoreState (myHistoryView, anItemIt.Key().ToCString(), anItemIt.Value().ToCString(), "history_view_")) continue; - else if (View_PreviewParameters::RestoreState (myDisplayPreview->GetPreviewParameters(), anItemIt.Key().ToCString(), - anItemIt.Value().ToCString(), "preview_parameters_")) - continue; } } @@ -330,219 +278,6 @@ void VInspector_Window::UpdateContent() myTreeView->scrollTo (aPresentationIndex); } } - - if (!myCallBack.IsNull()) - { - VInspector_ViewModelHistory* aHistoryModel = dynamic_cast - (myHistoryView->model()); - aHistoryModel->Reset(); - aHistoryModel->EmitLayoutChanged(); - } -} - -// ======================================================================= -// function : GetSelectedPresentations -// purpose : -// ======================================================================= -NCollection_List VInspector_Window::GetSelectedPresentations (QItemSelectionModel* theModel) -{ - NCollection_List aSelectedPresentations; - - QList anItems = TreeModel_ModelBase::GetSelectedItems (theModel->selectedIndexes()); - - QList aSelectedIds; // Remember of selected address in order to avoid duplicates - NCollection_List anItemPresentations; - for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - { - TreeModel_ItemBasePtr anItem = *anItemIt; - VInspector_ItemBasePtr aVItem = itemDynamicCast(anItem); - if (!aVItem) - continue; - - anItemPresentations.Clear(); - aVItem->GetPresentations (anItemPresentations); - - for (NCollection_List::Iterator anIt (anItemPresentations); anIt.More(); anIt.Next()) - { - Handle(AIS_InteractiveObject) aPresentation = Handle(AIS_InteractiveObject)::DownCast (anIt.Value()); - if (aSelectedIds.contains ((size_t)aPresentation.operator->())) - continue; - aSelectedIds.append ((size_t)aPresentation.operator->()); - if (!aPresentation.IsNull()) - aSelectedPresentations.Append (aPresentation); - } - } - return aSelectedPresentations; -} - -// ======================================================================= -// function : GetSelectedShapes -// purpose : -// ======================================================================= - -void VInspector_Window::GetSelectedShapes (NCollection_List& theSelPresentations) -{ - QModelIndexList theIndices = myTreeView->selectionModel()->selectedIndexes(); - - QList anItems = TreeModel_ModelBase::GetSelectedItems (theIndices); - for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - { - TreeModel_ItemBasePtr anItem = *anItemIt; - VInspector_ItemBasePtr aVItem = itemDynamicCast(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 : -// ======================================================================= -NCollection_List VInspector_Window::GetSelectedShapes (const QModelIndexList& theIndices) -{ - NCollection_List aSelectedShapes; - - QList anItems = TreeModel_ModelBase::GetSelectedItems (theIndices); - for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - { - TreeModel_ItemBasePtr anItem = *anItemIt; - VInspector_ItemBasePtr aVItem = itemDynamicCast(anItem); - if (!aVItem /*|| aVItem->Row() == 0*/) - continue; - - TopoDS_Shape aShape = aVItem->GetPresentationShape(); - if (aShape.IsNull()) - continue; - - aSelectedShapes.Append (aShape); - } - - // obtain selection from the property panel - { - //QList aPropertyTables; - //myPropertyView->GetActiveTables (aPropertyTables); - //if (!aPropertyTables.isEmpty()) - //{ - // ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables - - // 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 TreeModel_ItemBasePtr& theTreeItem, - NCollection_List& theShapes) -{ - QList aPropertyTables; - myPropertyView->GetActiveTables (aPropertyTables); - if (aPropertyTables.isEmpty()) - return; - - ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables - if (!aFirstTable) - return; - - NCollection_List theSelPresentations; - aFirstTable->GetSelectedPresentations (theTreeItem, theSelPresentations); - - for (NCollection_List::Iterator anIterator (theSelPresentations); anIterator.More(); anIterator.Next()) - { - Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (anIterator.Value()); - if (!aShapePrs.IsNull()) - theShapes.Append (aShapePrs->GetShape()); - } - - //QModelIndexList& thePropertyPanelIndices = aFirstTable->GetTableView()->selectionModel()->selectedIndexes(), - - //QList anItems = TreeModel_ModelBase::GetSelectedItems (theTreeViewIndices); - //NCollection_List aPropertyPresentations; - //for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - //{ - // TreeModel_ItemBasePtr anItem = *anItemIt; - // if (!anItem || anItem->Column() != 0) - // continue; - - // QList 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(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::Iterator aPrsIterator (aPropertyPresentations); aPrsIterator.More(); aPrsIterator.Next()) - // { - // Handle(Convert_TransientShape) aShapePrs = Handle(Convert_TransientShape)::DownCast (aPrsIterator.Value()); - // if (!aShapePrs.IsNull()) - // theShapes.Append (aShapePrs->GetShape()); - // } - //} -} - -// ======================================================================= -// function : GetSelectedTransformPers -// purpose : -// ======================================================================= -Handle(Graphic3d_TransformPers) VInspector_Window::GetSelectedTransformPers() -{ - QList anItems = TreeModel_ModelBase::GetSelectedItems (myTreeView->selectionModel()->selectedIndexes()); - for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - { - TreeModel_ItemBasePtr anItem = *anItemIt; - VInspector_ItemBasePtr aVItem = itemDynamicCast(anItem); - if (!aVItem) - continue; - - while (aVItem) - { - Handle(Graphic3d_TransformPers) aPers = aVItem->TransformPersistence(); - if (!aPers.IsNull()) - return aPers; - - aVItem = itemDynamicCast(aVItem->Parent()); - } - } - return Handle(Graphic3d_TransformPers)(); } // ======================================================================= @@ -551,13 +286,8 @@ Handle(Graphic3d_TransformPers) VInspector_Window::GetSelectedTransformPers() // ======================================================================= bool VInspector_Window::Init (const NCollection_List& theParameters) { - VInspector_ViewModel* aViewModel = dynamic_cast (myTreeView->model()); - if (!aViewModel) - return Standard_False; - Handle(AIS_InteractiveContext) aContext; Handle(VInspector_CallBack) aCallBack; - Standard_Boolean isModelUpdated = Standard_False; for (NCollection_List::Iterator aParamsIt (theParameters); aParamsIt.More(); aParamsIt.Next()) { @@ -567,19 +297,14 @@ bool VInspector_Window::Init (const NCollection_List if (aCallBack.IsNull()) aCallBack = Handle(VInspector_CallBack)::DownCast (anObject); - - if (!Handle(ViewControl_PaneCreator)::DownCast (anObject).IsNull()) - { - Handle(ViewControl_PaneCreator) aPaneCreator = Handle(ViewControl_PaneCreator)::DownCast (anObject); - if (!myPaneCreators.Contains (aPaneCreator)) - myPaneCreators.Append (aPaneCreator); - isModelUpdated = Standard_True; - } } - if (aViewModel->GetContext() != aContext) - SetContext(aContext); + if (aContext.IsNull()) + return false; + VInspector_ViewModel* aViewModel = dynamic_cast (myTreeView->model()); + if (aViewModel && aViewModel->GetContext() == aContext) + UpdateTreeModel(); else - isModelUpdated = Standard_True; + SetContext (aContext); if (!aCallBack.IsNull() && aCallBack != myCallBack) { @@ -589,10 +314,6 @@ bool VInspector_Window::Init (const NCollection_List myCallBack->SetContext(aContext); myCallBack->SetHistoryModel(aHistoryModel); } - - if (isModelUpdated) - UpdateTreeModel(); - return true; } @@ -602,22 +323,12 @@ bool VInspector_Window::Init (const NCollection_List // ======================================================================= void VInspector_Window::SetContext (const Handle(AIS_InteractiveContext)& theContext) { - if (theContext.IsNull()) - return; - VInspector_ViewModel* aViewModel = dynamic_cast (myTreeView->model()); - bool isFirst = aViewModel->GetContext().IsNull(); - aViewModel->SetContext (theContext); myTreeView->setExpanded (aViewModel->index (0, 0), true); if (!myCallBack.IsNull()) myCallBack->SetContext (theContext); - - myDisplayPreview->SetContext (theContext); - - if (isFirst) - onExportToMessageView(); } // ======================================================================= @@ -643,22 +354,9 @@ bool VInspector_Window::OpenFile(const TCollection_AsciiString& theFileName) if (aShape.IsNull()) return isModelUpdated; -#ifndef DEBUG_COLORED_SHAPE Handle(AIS_Shape) aPresentation = new AIS_Shape (aShape); -#else - Handle(AIS_ColoredShape) aPresentation = new AIS_ColoredShape (aShape); - - TopExp_Explorer expS(aShape, TopAbs_EDGE); - for (; expS.More(); expS.Next()) - { - aPresentation->SetCustomColor (expS.Current(), Quantity_Color (Quantity_NOC_GREEN)); - } -#endif - View_Displayer* aDisplayer = myViewWindow->GetDisplayer(); - aDisplayer->DisplayPresentation (aPresentation); - - //aContext->Display (aPresentation, false); - //aContext->Load (aPresentation, -1/*selection mode*/); + aContext->Display (aPresentation, false); + aContext->Load (aPresentation, -1/*selection mode*/); aContext->UpdateCurrentViewer(); UpdateTreeModel(); @@ -674,31 +372,8 @@ void VInspector_Window::onTreeViewContextMenuRequested(const QPoint& thePosition { QMenu* aMenu = new QMenu (GetMainWindow()); aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export to ShapeView"), SLOT (onExportToShapeView()), GetMainWindow(), this)); - aMenu->addSeparator(); - - QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0); - TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex); - if (anItemBase) - { - if (itemDynamicCast (anItemBase)) - { - aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Export to MessageView"), SLOT (onExportToMessageView()), GetMainWindow(), this)); - aMenu->addSeparator(); - - aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Default preview"), SLOT (onDefaultPreview()), GetMainWindow(), this)); - } - } - - aMenu->addSeparator(); - 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(); - - aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand"), SLOT (onExpand()), GetMainWindow(), this)); - aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Expand All"), SLOT (onExpandAll()), GetMainWindow(), this)); - aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Collapse All"), SLOT (onCollapseAll()), GetMainWindow(), this)); - + aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Show"), SLOT (onShow()), GetMainWindow(), this)); + aMenu->addAction (ViewControl_Tools::CreateAction (tr ("Hide"), SLOT (onHide()), GetMainWindow(), this)); QPoint aPoint = myTreeView->mapToGlobal (thePosition); aMenu->exec(aPoint); } @@ -722,18 +397,18 @@ void VInspector_Window::onToolBarActionClicked (const int theActionId) } case VInspector_ToolActionType_SelectPresentationsId: { - bool isChecked = myToolBar->GetToolButton ((VInspector_ToolActionType)theActionId)->isChecked(); + bool isChecked = myToolBar->GetToolButton((VInspector_ToolActionType)theActionId)->isChecked(); NCollection_List aPresentationsForViewer; if (isChecked) - aPresentationsForViewer = GetSelectedPresentations (myTreeView->selectionModel()); + aPresentationsForViewer = VInspector_ItemPresentableObject::GetSelectedPresentations(myTreeView->selectionModel()); Handle(AIS_InteractiveContext) aContext = aViewModel->GetContext(); - VInspector_Tools::AddOrRemovePresentations (aContext, aPresentationsForViewer); + VInspector_Tools::AddOrRemovePresentations(aContext, aPresentationsForViewer); UpdateTreeModel(); break; } case VInspector_ToolActionType_SelectOwnersId: { - NCollection_List anOwnersForViewer; + NCollection_List anOwnersForViewer; if (myToolBar->GetToolButton((VInspector_ToolActionType)theActionId)->isChecked()) VInspector_ViewModel::GetSelectedOwners(myTreeView->selectionModel(), anOwnersForViewer); VInspector_Tools::AddOrRemoveSelectedShapes(aViewModel->GetContext(), anOwnersForViewer); @@ -746,123 +421,20 @@ void VInspector_Window::onToolBarActionClicked (const int theActionId) } // ======================================================================= -// function : onPropertyPanelShown -// purpose : -// ======================================================================= -void VInspector_Window::onPropertyPanelShown (bool isToggled) -{ - if (!isToggled) - return; - - updatePropertyPanelBySelection(); -} - -// ======================================================================= -// function : onPropertyViewSelectionChanged -// purpose : -// ======================================================================= -void VInspector_Window::onPropertyViewSelectionChanged() -{ - QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0); - TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex); - if (!aTreeItemSelected) - return; - - QList aPropertyTables; - myPropertyView->GetActiveTables (aPropertyTables); - if (aPropertyTables.isEmpty()) - return; - - ViewControl_Table* aFirstTable = aPropertyTables[0]; // TODO: implement for several tables - NCollection_List aSelPresentations; - aFirstTable->GetSelectedPresentations (aTreeItemSelected, aSelPresentations); - - //Handle(TreeModel_ItemProperties) anItemProperties = aTreeItemSelected->GetProperties(); - - - //QMap> aSelectedIndices; - //aFirstTable->GetSelectedIndices (aSelectedIndices); - - //ViewControl_TableModel* aTableModel = dynamic_cast(aFirstTable->GetTableView()->model()); - //ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues(); - - QStringList aPointers; - aFirstTable->GetSelectedPointers (aPointers); - - //NCollection_List aSelPresentations; - /*for (QMap>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++) - { - int aRowId = aSelIt.key(); - QList 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())) - aPointers.append (aData); - - if (anItemProperties) - anItemProperties->GetPresentations (aRowId, aColId, aSelPresentations); - } - }*/ - highlightTreeViewItems (aPointers); - - //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers(); - //QModelIndexList aTreeViewSelected = myTreeView->selectionModel()->selectedIndexes(); - //NCollection_List aSelectedShapes = GetSelectedShapes (aTreeViewSelected); - - //GetSelectedPropertyPanelShapes(aTreeViewSelected, - // aFirstTable->GetTableView()->selectionModel()->selectedIndexes(), - // aSelectedShapes); - //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent); - - myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations); -} - -// ======================================================================= -// function : onTreeViewSelectionChanged +// function : onSelectionChanged // purpose : // ======================================================================= -void VInspector_Window::onTreeViewSelectionChanged (const QItemSelection&, - const QItemSelection&) +void VInspector_Window::onSelectionChanged (const QItemSelection&, + const QItemSelection&) { - //QApplication::setOverrideCursor (Qt::WaitCursor); + QApplication::setOverrideCursor (Qt::WaitCursor); if (myToolBar->GetToolButton(VInspector_ToolActionType_SelectPresentationsId)->isChecked()) onToolBarActionClicked(VInspector_ToolActionType_SelectPresentationsId); else if (myToolBar->GetToolButton(VInspector_ToolActionType_SelectOwnersId)->isChecked()) onToolBarActionClicked(VInspector_ToolActionType_SelectOwnersId); - if (myPropertyPanelWidget->toggleViewAction()->isChecked()) - updatePropertyPanelBySelection(); - - QModelIndex aTreeItemIndex = TreeModel_ModelBase::SingleSelected (myTreeView->selectionModel()->selectedIndexes(), 0); - TreeModel_ItemBasePtr aTreeItemSelected = TreeModel_ModelBase::GetItemByIndex (aTreeItemIndex); - if (!aTreeItemSelected) - return; - - NCollection_List aSelPresentations; - TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast (aTreeItemSelected); - if (!aStreamParent) - return; - - Handle(TreeModel_ItemProperties) anItemProperties = aStreamParent->Properties (); - if (anItemProperties) - anItemProperties->GetPresentations (-1, -1, aSelPresentations); - //else - GetSelectedShapes (aSelPresentations); - myDisplayPreview->UpdatePreview (View_DisplayActionType_DisplayId, aSelPresentations); - - //Handle(Graphic3d_TransformPers) aSelectedPersistent = GetSelectedTransformPers(); - - //NCollection_List aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes()); - - //updatePreviewPresentation(aSelectedShapes, aSelectedPersistent); - - //QApplication::restoreOverrideCursor(); + QApplication::restoreOverrideCursor(); } // ======================================================================= @@ -881,30 +453,20 @@ void VInspector_Window::onHistoryViewSelectionChanged (const QItemSelection& the QModelIndexList aSelectedIndices = theSelected.indexes(); QStringList aPointers = aHistoryModel->GetSelectedPointers(aSelectedIndices.first()); - selectTreeViewItems (aPointers); -} -// ======================================================================= -// function : onExportToShapeView -// purpose : -// ======================================================================= -void VInspector_Window::onExportToMessageView() -{ - VInspector_ViewModel* aViewModel = dynamic_cast (myTreeView->model()); - if (!aViewModel) + VInspector_ViewModel* aTreeModel = dynamic_cast (myTreeView->model()); + if (!aTreeModel) return; - Handle(AIS_InteractiveContext) aContext = aViewModel->GetContext(); - - TCollection_AsciiString aPluginName ("TKMessageView"); - NCollection_List aParameters; - if (myParameters->FindParameters (aPluginName)) - aParameters = myParameters->Parameters (aPluginName); - - QStringList anExportedPointers; - anExportedPointers.append (VInspector_Tools::GetPointerInfo (aContext, true).ToCString()); - aParameters.Append (aContext); - myParameters->SetParameters (aPluginName, aParameters, false);//myExportToShapeViewDialog->IsAccepted()); + QModelIndexList anIndices = aTreeModel->FindPointers (aPointers); + QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); + aSelectionModel->clear(); + for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++) + { + QModelIndex anIndex = anIndices[anIndicesId]; + myTreeView->setExpanded (aTreeModel->parent (anIndex), true); + aSelectionModel->select (anIndex, QItemSelectionModel::Select); + } } // ======================================================================= @@ -913,8 +475,10 @@ void VInspector_Window::onExportToMessageView() // ======================================================================= void VInspector_Window::onExportToShapeView() { - const QModelIndexList anIndices; - NCollection_List aSelectedShapes = GetSelectedShapes (myTreeView->selectionModel()->selectedIndexes()); + NCollection_List aSelectedPresentations = + VInspector_ItemPresentableObject::GetSelectedPresentations(myTreeView->selectionModel()); + if (aSelectedPresentations.Extent() <= 0) + return; TCollection_AsciiString aPluginName ("TKShapeView"); NCollection_List aParameters; @@ -926,42 +490,24 @@ void VInspector_Window::onExportToShapeView() anItemNames = myParameters->GetSelectedNames (aPluginName); QStringList anExportedPointers; - if (aSelectedShapes.Extent() > 0) + for (NCollection_List::Iterator anIOIt (aSelectedPresentations); anIOIt.More(); anIOIt.Next()) { - for (NCollection_List::Iterator anIOIt (aSelectedShapes); anIOIt.More(); anIOIt.Next()) - { - const TopoDS_Shape& aShape = anIOIt.Value(); - if (aShape.IsNull()) - continue; - aParameters.Append (aShape.TShape()); - anItemNames.Append (TInspectorAPI_PluginParameters::ParametersToString(aShape)); - anExportedPointers.append (VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()); - } - } - - // seach for objects to be exported - QList anItems = TreeModel_ModelBase::GetSelectedItems (myTreeView->selectionModel()->selectedIndexes()); - for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - { - TreeModel_ItemBasePtr anItem = *anItemIt; - VInspector_ItemBasePtr aVItem = itemDynamicCast(anItem); - if (!aVItem) - continue; - - Handle(Standard_Transient) anObject = aVItem->GetObject(); - if (anObject.IsNull()) + Handle(AIS_Shape) aShapePresentation = Handle(AIS_Shape)::DownCast (anIOIt.Value()); + if (aShapePresentation.IsNull()) continue; - aParameters.Append (anObject); - anItemNames.Append (anObject->DynamicType()->Name()); - anExportedPointers.append (VInspector_Tools::GetPointerInfo (anObject, true).ToCString()); + const TopoDS_Shape& aShape = aShapePresentation->Shape(); + if (aShape.IsNull()) + continue; + aParameters.Append (aShape.TShape()); + anItemNames.Append (TInspectorAPI_PluginParameters::ParametersToString(aShape)); + anExportedPointers.append (VInspector_Tools::GetPointerInfo (aShape.TShape(), true).ToCString()); } - - if (anExportedPointers.isEmpty()) + if (anExportedPointers.empty()) return; TCollection_AsciiString aPluginShortName = aPluginName.SubString (3, aPluginName.Length()); - QString aMessage = QString ("Objects %1 are sent to %2.") + QString aMessage = QString ("TShape %1 is sent to %2.") .arg (anExportedPointers.join(", ")) .arg (aPluginShortName.ToCString()); QString aQuestion = QString ("Would you like to activate %1 immediately?\n") @@ -977,76 +523,21 @@ void VInspector_Window::onExportToShapeView() } // ======================================================================= -// function : onDefaultPreview -// purpose : -// ======================================================================= -void VInspector_Window::onDefaultPreview() -{ - myDisplayPreview->DisplayDefaultPreview(); - - UpdateTreeModel(); -} - -// ======================================================================= -// function : onDisplayActionTypeClicked -// purpose : -// ======================================================================= -void VInspector_Window::onDisplayActionTypeClicked() -{ - QAction* anAction = (QAction*)sender(); - - displaySelectedPresentations (VInspector_Tools::DisplayActionTypeFromString (anAction->text().toStdString().c_str())); -} - -// ======================================================================= -// function : onExpand -// purpose : -// ======================================================================= -void VInspector_Window::onExpand() -{ - QApplication::setOverrideCursor (Qt::WaitCursor); - - QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); - QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes(); - for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) - { - int aLevels = 2; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); - } - QApplication::restoreOverrideCursor(); -} - -// ======================================================================= -// function : onExpandAll +// function : onShow // purpose : // ======================================================================= -void VInspector_Window::onExpandAll() +void VInspector_Window::onShow() { - QApplication::setOverrideCursor (Qt::WaitCursor); - - QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); - QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes(); - for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) - { - int aLevels = -1; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], true, aLevels); - } - QApplication::restoreOverrideCursor(); + displaySelectedPresentations (true); } // ======================================================================= -// function : onCollapseAll +// function : onHide // purpose : // ======================================================================= -void VInspector_Window::onCollapseAll() +void VInspector_Window::onHide() { - QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); - QModelIndexList aSelectedIndices = aSelectionModel->selectedIndexes(); - for (int aSelectedId = 0, aSize = aSelectedIndices.size(); aSelectedId < aSize; aSelectedId++) - { - int aLevels = -1; - TreeModel_Tools::SetExpanded (myTreeView, aSelectedIndices[aSelectedId], false, aLevels); - } + displaySelectedPresentations (false); } // ======================================================================= @@ -1060,55 +551,11 @@ void VInspector_Window::UpdateTreeModel() aViewModel->UpdateTreeModel(); } -// ======================================================================= -// function : updatePropertyPanelBySelection -// purpose : -// ======================================================================= -void VInspector_Window::updatePropertyPanelBySelection() -{ - QItemSelectionModel* aModel = myTreeView->selectionModel(); - if (!aModel) - return; - - QModelIndex anIndex = TreeModel_ModelBase::SingleSelected (aModel->selectedIndexes(), 0); - TreeModel_ItemBasePtr anItemBase = TreeModel_ModelBase::GetItemByIndex (anIndex); - if (!anItemBase) - return; - - TreeModel_ItemStreamPtr aStreamItem = itemDynamicCast (anItemBase); - if (!aStreamItem) - return; - - Handle(TreeModel_ItemProperties) anItemProperties = aStreamItem->Properties (); - QList aTableValuesList; - if (!anItemProperties.IsNull()) - { - ViewControl_TableModelValues* aTableValues = new ViewControl_TableModelValues(); - aTableValues->SetProperties (anItemProperties); - aTableValuesList.append (aTableValues); - } - - /*QItemSelectionModel* aModel = myTreeView->selectionModel(); - if (!aModel) - return; - - QModelIndexList aSelected = TreeModel_ModelBase::GetSelected (aModel->selectedIndexes(), 0); - QList aTableValues; - - if (aSelected.size() == 1) - { - TreeModel_ItemBasePtr aSelectedItem = TreeModel_ModelBase::GetItemByIndex(aSelected.first()); - VInspector_Tools::GetPropertyTableValues (aSelectedItem, myPaneCreators, aTableValues); - }*/ - myPropertyView->Init (aTableValuesList); -} - // ======================================================================= // function : displaySelectedPresentations // purpose : // ======================================================================= - -void VInspector_Window::displaySelectedPresentations (const View_DisplayActionType theType) +void VInspector_Window::displaySelectedPresentations(const bool theToDisplay) { VInspector_ViewModel* aViewModel = dynamic_cast (myTreeView->model()); if (!aViewModel) @@ -1118,113 +565,30 @@ void VInspector_Window::displaySelectedPresentations (const View_DisplayActionTy if (aContext.IsNull()) return; - QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); - if (!aSelectionModel) - return; - - NCollection_List aSelectedPresentations = GetSelectedPresentations (aSelectionModel); - //const QModelIndexList& aSelectedIndices = aSelectionModel->selectedIndexes(); - - 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 == View_DisplayActionType_RedisplayId) - { - // REDISPLAY preview ! - - //QList anItems = TreeModel_ModelBase::GetSelectedItems (aSelectedIndices); - //NCollection_List aSelPresentations; - - //for (QList::const_iterator anItemIt = anItems.begin(); anItemIt != anItems.end(); anItemIt++) - //{ - // TreeModel_ItemBasePtr anItem = *anItemIt; - // VInspector_ItemBasePtr aVItem = itemDynamicCast(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 aSelectedShapes = GetSelectedShapes (aSelectedIndices); - //updatePreviewPresentation(aSelectedShapes, GetSelectedTransformPers()); - } - - if (aSelectedPresentations.Extent() == 0) + NCollection_List aSelectedPresentations = + VInspector_ItemPresentableObject::GetSelectedPresentations(myTreeView->selectionModel()); + if (aSelectedPresentations.Extent() <= 0) return; for (NCollection_List::Iterator anIOIt(aSelectedPresentations); anIOIt.More(); anIOIt.Next()) { Handle(AIS_InteractiveObject) aPresentation = anIOIt.Value(); - switch (theType) + if (theToDisplay) { - case View_DisplayActionType_DisplayId: - { - aContext->Display(aPresentation, false); - aContext->Load(aPresentation, -1); - } - 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; + aContext->Display(aPresentation, false); + aContext->Load(aPresentation, -1); } + else + aContext->Erase(aPresentation, false); } aContext->UpdateCurrentViewer(); - UpdateTreeModel(); -} - -// ======================================================================= -// function : highlightTreeViewItems -// purpose : -// ======================================================================= -void VInspector_Window::highlightTreeViewItems (const QStringList& thePointers) -{ - VInspector_ViewModel* aTreeModel = dynamic_cast (myTreeView->model()); - if (!aTreeModel) - return; - - QModelIndexList anIndices; - aTreeModel->FindPointers (thePointers, QModelIndex(), anIndices); - for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++) - { - QModelIndex anIndex = anIndices[anIndicesId]; - TreeModel_Tools::SetExpandedTo (myTreeView, anIndex); - } - aTreeModel->SetHighlighted (anIndices); - - if (!anIndices.isEmpty()) - myTreeView->scrollTo (anIndices.last()); -} - -// ======================================================================= -// function : selectTreeViewItems -// purpose : -// ======================================================================= -void VInspector_Window::selectTreeViewItems (const QStringList& thePointers) -{ - VInspector_ViewModel* aTreeModel = dynamic_cast (myTreeView->model()); - if (!aTreeModel) - return; - - QModelIndexList anIndices; - aTreeModel->FindPointers (thePointers, QModelIndex(), anIndices); + // the order of objects returned by AIS_InteractiveContext is changed because the processed object is moved from + // Erased to Displayed container or back QItemSelectionModel* aSelectionModel = myTreeView->selectionModel(); aSelectionModel->clear(); - for (int anIndicesId = 0, aSize = anIndices.size(); anIndicesId < aSize; anIndicesId++) - { - QModelIndex anIndex = anIndices[anIndicesId]; - TreeModel_Tools::SetExpandedTo (myTreeView, anIndex); - aSelectionModel->select (anIndex, QItemSelectionModel::Select); - } + + UpdateTreeModel(); } // ======================================================================= @@ -1233,63 +597,10 @@ void VInspector_Window::selectTreeViewItems (const QStringList& thePointers) // ======================================================================= Handle(AIS_InteractiveContext) VInspector_Window::createView() { - // create two view windows - Handle(AIS_InteractiveContext) aContext = View_Viewer::CreateStandardViewer(); - - Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY())); - aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded); - aContext->Display (aTrihedron, Standard_True); - - myViewWindow = new View_Window (0, aContext, false /*for opening several BREP files*/, true); + myViewWindow = new View_Window (0); myViewWindow->GetView()->SetPredefinedSize (VINSPECTOR_DEFAULT_VIEW_WIDTH, VINSPECTOR_DEFAULT_VIEW_HEIGHT); myViewWindow->move (VINSPECTOR_DEFAULT_VIEW_POSITION_X, VINSPECTOR_DEFAULT_VIEW_POSITION_Y); myViewWindow->show(); - return aContext; + return myViewWindow->GetView()->GetViewer()->GetContext(); } - -// ======================================================================= -// function : updatePreviewPresentation -// purpose : -// ======================================================================= -//void VInspector_Window::updatePreviewPresentation (const NCollection_List& theShapes, -// const Handle(Graphic3d_TransformPers)& thePersistent) -//{ -// Handle(AIS_InteractiveContext) aContext; -// VInspector_ViewModel* aViewModel = dynamic_cast (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::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); -// } -//} diff --git a/tools/VInspector/VInspector_Window.hxx b/tools/VInspector/VInspector_Window.hxx index 677b9a77a8..73783f39b0 100644 --- a/tools/VInspector/VInspector_Window.hxx +++ b/tools/VInspector/VInspector_Window.hxx @@ -18,14 +18,11 @@ #include #include -#include +#include #include #include #include -#include - -#include #include #include @@ -34,20 +31,16 @@ #include class ViewControl_MessageDialog; -class ViewControl_PropertyView; class VInspector_ToolBar; - -class View_DisplayPreview; class View_Window; class QAbstractItemModel; class QAction; -class QDockWidget; +class QMainWindow; class QTreeView; class QWidget; - //! \class VInspector_Window //! Window that unites all VInspector controls. class VInspector_Window : public QObject @@ -89,27 +82,6 @@ public: //! Returns main control QWidget* GetMainWindow() const { return myMainWindow; } - //! Returns presentations of selected items in tree model - //! \param theModel selection model - //! \return container of presentations - NCollection_List GetSelectedPresentations (QItemSelectionModel* theModel); - - void GetSelectedShapes (NCollection_List& theSelPresentations); - - //! Returns selected shapes - //! \param theModel selection model - //! \return container of shapes - NCollection_List GetSelectedShapes (const QModelIndexList& theIndices); - - //! Returns selected shapes - //! \param theModel selection model - //! \return container of shapes - void GetSelectedPropertyPanelShapes (const TreeModel_ItemBasePtr& theTreeItem, - NCollection_List& theShapes); - - //! Returns the first not zero transform persistent of selected elements - Handle(Graphic3d_TransformPers) GetSelectedTransformPers(); - private: //! Fills controls of the plugin by parameters: @@ -131,15 +103,6 @@ private slots: //! \param theActionId an action identifier in tool bar void onToolBarActionClicked (const int theActionId); - //! Display content of selected tree view item if isToggled is true - //! \param isToggled true if the property dock widget is shown - void onPropertyPanelShown (bool isToggled); - - //! Update presentation of the selected tree view item using information about selection in property view - //! \param theSelected container of selected table cells - //! \param theDeselected container of selected table cells - void onPropertyViewSelectionChanged(); - //! Synchronization selection between history and tree view. Selection by history view //! \param theSelected a selected items //! \param theDeselected a deselected items @@ -150,28 +113,16 @@ private slots: //! check box is checked //! \param theSelected a selected items //! \param theDeselected a deselected items - void onTreeViewSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); - - //! Exports the selected context into MessageView for have preview in the context. - void onExportToMessageView(); + void onSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); //! Exports the first selected shape into ShapeViewer plugin. void onExportToShapeView(); - //! Displays default preview presentation - void onDefaultPreview(); + //! Shows selected presentation if it is not shown yet + void onShow(); - //! Apply activated display action - void onDisplayActionTypeClicked(); - - //! Expand two next levels for all selected item - void onExpand(); - - //! Expand all levels for all selected items - void onExpandAll(); - - //! Collapse all levels for all selected items - void onCollapseAll(); + //! Erase selected presentation if it is shown + void onHide(); private: @@ -182,21 +133,10 @@ private: //! Updates tree model void UpdateTreeModel(); - //! Updates property panel content by item selected in tree view. - void updatePropertyPanelBySelection(); - //! 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 View_DisplayActionType theType); - - //! Set items of the pointers highlighted in tree view - //! \param theType display action type - void highlightTreeViewItems (const QStringList& thePointers); - - //! Set items of the pointers selected in tree view - //! \param theType display action type - void selectTreeViewItems (const QStringList& thePointers); + //! \param theToDisplay if true, presentation is displayed otherwise erased + void displaySelectedPresentations (const bool theToDisplay); //! Creates an istance of 3D view to initialize context. //! \return a context of created view. @@ -208,23 +148,14 @@ private: QMainWindow* myMainWindow; //!< main control VInspector_ToolBar* myToolBar; //!< tool bar actions - - QDockWidget* myPropertyPanelWidget; //!< property pane dockable widget - ViewControl_PropertyView* myPropertyView; //!< property control to display model item values if exist - QTreeView* myTreeView; //!< tree view of AIS content QTreeView* myHistoryView; //!< history of AIS context calls Handle(VInspector_CallBack) myCallBack; //!< AIS context call back, if set - NCollection_List myPaneCreators; //!< panes for AIS presentations - ViewControl_MessageDialog* myExportToShapeViewDialog; //!< dialog about exporting TopoDS_Shape to ShapeView plugin View_Window* myViewWindow; //!< temporary view window, it is created if Open is called but context is still NULL Handle(TInspectorAPI_PluginParameters) myParameters; //!< plugins parameters container - - View_DisplayPreview* myDisplayPreview; //!< class for preview display - }; #endif diff --git a/tools/View/FILES b/tools/View/FILES index cc60600e16..f0c48897a4 100644 --- a/tools/View/FILES +++ b/tools/View/FILES @@ -1,13 +1,8 @@ View.qrc 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 diff --git a/tools/View/View_DisplayActionType.hxx b/tools/View/View_DisplayActionType.hxx deleted file mode 100644 index 7211c1819a..0000000000 --- a/tools/View/View_DisplayActionType.hxx +++ /dev/null @@ -1,29 +0,0 @@ -// 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 diff --git a/tools/View/View_DisplayPreview.cxx b/tools/View/View_DisplayPreview.cxx deleted file mode 100644 index 7e4395a7ab..0000000000 --- a/tools/View/View_DisplayPreview.cxx +++ /dev/null @@ -1,127 +0,0 @@ -// 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 -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -// ======================================================================= -// 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, - const NCollection_List& 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::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); -} diff --git a/tools/View/View_DisplayPreview.hxx b/tools/View/View_DisplayPreview.hxx deleted file mode 100644 index 2d2d6bbf49..0000000000 --- a/tools/View/View_DisplayPreview.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// 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 - -#include -#include -#include -#include - -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& 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& 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 diff --git a/tools/View/View_Displayer.cxx b/tools/View/View_Displayer.cxx index 706d589cc7..e218cae80e 100644 --- a/tools/View/View_Displayer.cxx +++ b/tools/View/View_Displayer.cxx @@ -23,11 +23,8 @@ #include #include #include - -#include #include #include -#include // ======================================================================= // function : Constructor @@ -36,7 +33,6 @@ View_Displayer::View_Displayer() : myIsKeepPresentations (false), myFitAllActive (false), myDisplayMode (-1) { - myDisplayPreview = new View_DisplayPreview(); } // ======================================================================= @@ -57,7 +53,6 @@ void View_Displayer::SetContext (const Handle(AIS_InteractiveContext)& theContex aPresentationsIt.More(); aPresentationsIt.Next()) DisplayPresentation (aPresentationsIt.Value(), aType, false); } - myDisplayPreview->SetContext (theContext); UpdateViewer(); } @@ -245,18 +240,6 @@ bool View_Displayer::IsVisible (const TopoDS_Shape& theShape, const View_Present return !aPresentation.IsNull(); } -// ======================================================================= -// function : UpdatePreview -// purpose : -// ======================================================================= -void View_Displayer::UpdatePreview (const View_DisplayActionType theType, - const NCollection_List& thePresentations) -{ - myDisplayPreview->UpdatePreview (theType, thePresentations); - if (!myIsKeepPresentations || myFitAllActive) - fitAllView(); -} - // ======================================================================= // function : UpdateViewer // purpose : @@ -294,7 +277,18 @@ void View_Displayer::DisplayedPresentations (NCollection_SharedCurrentViewer(); + if (!aViewer.IsNull()) + { + aViewer->InitActiveViews(); + if (aViewer->MoreActiveViews()) + aView = aViewer->ActiveView(); + } + return aView; } // ======================================================================= @@ -328,7 +322,7 @@ Handle(Standard_Transient) View_Displayer::CreatePresentation (const TopoDS_Shap { Handle(AIS_Shape) aShape = new AIS_Shape (theShape); - //aShape->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 1.0)); + aShape->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 1.0)); return aShape; } diff --git a/tools/View/View_Displayer.hxx b/tools/View/View_Displayer.hxx index db68826957..8e7bc4ccf7 100644 --- a/tools/View/View_Displayer.hxx +++ b/tools/View/View_Displayer.hxx @@ -23,12 +23,9 @@ #include #include #include - #include -#include class V3d_View; -class View_DisplayPreview; //! \class View_Displayer //! \brief It is responsible for communication with AIS Interactive Context to: @@ -47,9 +44,6 @@ public: //! Destructor virtual ~View_Displayer() {} - //! Returns preview display instance - View_DisplayPreview* GetDisplayPreview() const { return myDisplayPreview; } - //! 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 @@ -120,10 +114,6 @@ public: Standard_EXPORT bool IsVisible (const TopoDS_Shape& theShape, const View_PresentationType theType = View_PresentationType_Main) const; - //!< Updates visibility of the presentations for the display type - Standard_EXPORT void UpdatePreview (const View_DisplayActionType theType, - const NCollection_List& thePresentations); - //! Calls UpdateCurrentViewer of context Standard_EXPORT void UpdateViewer(); @@ -167,8 +157,6 @@ private: private: - View_DisplayPreview* myDisplayPreview; //!< class for preview display - Handle(AIS_InteractiveContext) myContext; //!< context, where the displayer works NCollection_DataMap> myDisplayed; //!< visualized presentations NCollection_DataMap myColorAttributes; //!< color properties of presentations diff --git a/tools/View/View_PreviewParameters.cxx b/tools/View/View_PreviewParameters.cxx deleted file mode 100644 index 30d0b4766a..0000000000 --- a/tools/View/View_PreviewParameters.cxx +++ /dev/null @@ -1,120 +0,0 @@ -// 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 - -#include -#include -#include - -// ======================================================================= -// 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& 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; -} diff --git a/tools/View/View_PreviewParameters.hxx b/tools/View/View_PreviewParameters.hxx deleted file mode 100644 index c5931bf666..0000000000 --- a/tools/View/View_PreviewParameters.hxx +++ /dev/null @@ -1,68 +0,0 @@ -// 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 -#include - -#include - -#include -#include -#include -#include - -//! \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& 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 diff --git a/tools/View/View_Tools.cxx b/tools/View/View_Tools.cxx index 49a5522460..1699446f00 100644 --- a/tools/View/View_Tools.cxx +++ b/tools/View/View_Tools.cxx @@ -14,10 +14,6 @@ // commercial license or contractual agreement. #include - -#include -#include -#include #include #include #include @@ -40,26 +36,6 @@ QAction* View_Tools::CreateAction (const QString& theText, const char* theSlot, return anAction; } -// ======================================================================= -// function : GetView -// purpose : -// ======================================================================= -Handle(V3d_View) View_Tools::FindActiveView (const Handle(AIS_InteractiveContext)& theContext) -{ - if (theContext.IsNull()) - return NULL; - - const Handle(V3d_Viewer)& aViewer = theContext->CurrentViewer(); - if (aViewer.IsNull()) - return NULL; - - aViewer->InitActiveViews(); - if (!aViewer->MoreActiveViews()) - return NULL; - - return aViewer->ActiveView(); -} - // ======================================================================= // function : SaveState // purpose : @@ -69,16 +45,10 @@ void View_Tools::SaveState (View_Window* theView, QMap& theIte { QStringList aCameraDirection; Standard_Real aVX, aVY, aVZ; - Handle(V3d_View) aView = theView->GetView()->GetViewer()->GetView(); - if (aView.IsNull()) - return; - - aView->Proj (aVX, aVY, aVZ); + theView->GetView()->GetViewer()->GetView()->Proj (aVX, aVY, aVZ); aCameraDirection << QString::number (aVX) << QString::number (aVY) << QString::number (aVZ); theItems[thePrefix + "view_camera_direction"] = aCameraDirection.join (","); - - View_PreviewParameters::SaveState (theView->GetDisplayer()->GetDisplayPreview()->GetPreviewParameters(), theItems, "preview_parameters_"); } // ======================================================================= @@ -99,12 +69,8 @@ bool View_Tools::RestoreState (View_Window* theView, const QString& theKey, cons theView->GetView()->SetInitProj (aVX, aVY, aVZ); } - return true; - } - else if (View_PreviewParameters::RestoreState (theView->GetDisplayer()->GetDisplayPreview()->GetPreviewParameters(), - theKey, theValue, "preview_parameters_")) - { - return true; } - return false; + else + return false; + return true; } diff --git a/tools/View/View_Tools.hxx b/tools/View/View_Tools.hxx index b3c49a76e0..2c105f7ed6 100644 --- a/tools/View/View_Tools.hxx +++ b/tools/View/View_Tools.hxx @@ -24,9 +24,6 @@ #include #include -#include -#include - class View_Window; class QAction; @@ -47,11 +44,6 @@ public: Standard_EXPORT static QAction* CreateAction (const QString& theText, const char* theSlot, QObject* theParent, QObject* theContext); - - //! Gets current viewer from the context and returns active view of the viewer - //! \return view or NULL - Standard_EXPORT static Handle(V3d_View) FindActiveView (const Handle(AIS_InteractiveContext)& theContext); - //! Save state of three view in a container in form: key, value. It saves: //! - visibiblity of columns, //! - columns width diff --git a/tools/View/View_Viewer.cxx b/tools/View/View_Viewer.cxx index 04907e1479..1b2ed6c105 100644 --- a/tools/View/View_Viewer.cxx +++ b/tools/View/View_Viewer.cxx @@ -19,13 +19,6 @@ #include #include -//#define USE_CLIPPLANE - -#ifdef USE_CLIPPLANE -#include -#include -#endif - // ======================================================================= // function : CreateView // purpose : @@ -33,15 +26,7 @@ void View_Viewer::CreateView() { if (myView.IsNull()) - { myView = myContext->CurrentViewer()->CreateView(); - -#ifdef USE_CLIPPLANE - gp_Pln aPln (gp_Pnt (50, 0, 0), gp_Dir (-1., 0., 0.)); - Handle(Graphic3d_ClipPlane) aClipPlane = new Graphic3d_ClipPlane(aPln); - myView->AddClipPlane (aClipPlane); -#endif - } } // ======================================================================= @@ -56,38 +41,26 @@ void View_Viewer::SetWindow(const Handle(Aspect_Window)& theWindow) } // ======================================================================= -// function : InitViewer -// purpose : -// ======================================================================= -void View_Viewer::InitViewer (const Handle(AIS_InteractiveContext)& theContext) -{ - myContext = theContext; - myViewer = myContext->CurrentViewer(); -} - -// ======================================================================= -// function : CreateStandardViewer +// function : InitStandardViewer // purpose : // ======================================================================= -Handle(AIS_InteractiveContext) View_Viewer::CreateStandardViewer() +void View_Viewer::InitStandardViewer() { Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection(); static Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (aDisplayConnection); #if OCC_VERSION_HEX > 0x060901 - Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver); + myViewer = new V3d_Viewer (aGraphicDriver); #else TCollection_AsciiString a3DName ("Visu3D"); - Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver, a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, Standard_True, Standard_False); + myViewer = new V3d_Viewer (aGraphicDriver, a3DName.ToExtString(), "", 1000.0, V3d_XposYnegZpos, Quantity_NOC_GRAY30, + V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, Standard_True, Standard_False); #endif - aViewer->SetDefaultLights(); - aViewer->SetLightOn(); - aViewer->SetDefaultBackgroundColor (Quantity_NOC_GRAY30); - - Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext (aViewer); - aContext->UpdateCurrentViewer(); + myViewer->SetDefaultLights(); + myViewer->SetLightOn(); + myViewer->SetDefaultBackgroundColor (Quantity_NOC_GRAY30); - return aContext; + myContext = new AIS_InteractiveContext (myViewer); + myContext->UpdateCurrentViewer(); } diff --git a/tools/View/View_Viewer.hxx b/tools/View/View_Viewer.hxx index d7cf147164..b05550f76a 100644 --- a/tools/View/View_Viewer.hxx +++ b/tools/View/View_Viewer.hxx @@ -50,11 +50,7 @@ public: //! Creates OCC components on the window //! \param theWindowHandle an id of the application window - Standard_EXPORT void InitViewer (const Handle(AIS_InteractiveContext)& theContext); - - //! Creates OCC components on the window - //! \param theWindowHandle an id of the application window - Standard_EXPORT static Handle(AIS_InteractiveContext) CreateStandardViewer(); + Standard_EXPORT void InitStandardViewer(); //! Returns an OCC viewer const Handle(V3d_Viewer)& GetViewer() { return myViewer; } diff --git a/tools/View/View_Widget.cxx b/tools/View/View_Widget.cxx index 26a4f65577..33230ef59d 100644 --- a/tools/View/View_Widget.cxx +++ b/tools/View/View_Widget.cxx @@ -63,25 +63,16 @@ // function : Constructor // purpose : // ======================================================================= -View_Widget::View_Widget (QWidget* theParent, - const Handle(AIS_InteractiveContext)& theContext, - const bool isFitAllActive) +View_Widget::View_Widget (QWidget* theParent, const bool isFitAllActive) : QWidget (theParent), myCurrentMode (View_CurrentAction3d_Nothing), myFirst (true), myDefaultWidth (-1), myDefaultHeight (-1), myViewIsEnabled (true), myXmin (0), myYmin (0), myXmax (0), myYmax (0), myDragButtonDownX (0), myDragButtonDownY (0), myDragMultiButtonDownX (0), myDragMultiButtonDownY (0), myIsRectVisible (false), myRectBand (0), myHasInitProj (Standard_False), myInitVx (0), myInitVy (0), myInitVz (0) { myViewer = new View_Viewer (View_Viewer::DefaultColor()); - if (!theContext.IsNull()) - myViewer->InitViewer (theContext); - else - { - myViewer->InitViewer (myViewer->CreateStandardViewer()); + myViewer->InitStandardViewer(); - //Handle(AIS_Trihedron) aTrihedron = new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY())); - //aTrihedron->SetDatumDisplayMode (Prs3d_DM_Shaded); - //myViewer->GetContext()->Display (aTrihedron, Standard_True); - } + myViewer->GetContext()->Display(new AIS_Trihedron (new Geom_Axis2Placement (gp::XOY())), Standard_True); setAttribute (Qt::WA_PaintOnScreen); setAttribute (Qt::WA_NoSystemBackground); @@ -429,7 +420,6 @@ void View_Widget::processLeftButtonDown (const int theFlags, const QPoint thePoi } } activateCursor (myCurrentMode); - emit leftButtonDown(thePoint.x(), thePoint.y()); } // ======================================================================= @@ -523,10 +513,8 @@ void View_Widget::processLeftButtonUp (const int theFlags, const QPoint thePoint myDragMultiButtonDownX = 0; myDragMultiButtonDownY = 0; - myCurrentMode = View_CurrentAction3d_Nothing; activateCursor (myCurrentMode); emit selectionChanged(); - emit leftButtonUp(thePoint.x(), thePoint.y()); } // ======================================================================= @@ -620,7 +608,6 @@ void View_Widget::processMouseMove (const int theFlags, const QPoint thePoint) else processMoveEvent (thePoint.x(), thePoint.y()); } - emit moveTo (thePoint.x(), thePoint.y()); } // ======================================================================= diff --git a/tools/View/View_Widget.hxx b/tools/View/View_Widget.hxx index 2693278f5d..5e6ad9bacb 100644 --- a/tools/View/View_Widget.hxx +++ b/tools/View/View_Widget.hxx @@ -74,9 +74,7 @@ protected: public: //! Constructor - Standard_EXPORT View_Widget (QWidget* theParent, - const Handle(AIS_InteractiveContext)& theContext, - const bool isFitAllActive); + Standard_EXPORT View_Widget (QWidget* theParent, const bool isFitAllActive); //! Destructor virtual ~View_Widget() {} @@ -127,21 +125,6 @@ signals: //! Sends a signal about selection change if the left mouse button is pressed and current action does not process it void selectionChanged(); - //! Sends a signal about moving to the point in the view - //! \param theX X mouse position in pixels - //! \param theY Y mouse position in pixels - void moveTo (const int theX, const int theY); - - //! Sends a signal about up the left mouse button down - //! \param theX X mouse position in pixels - //! \param theY Y mouse position in pixels - void leftButtonDown (const int theX, const int theY); - - //! Sends a signal about up the left mouse button up - //! \param theX X mouse position in pixels - //! \param theY Y mouse position in pixels - void leftButtonUp (const int theX, const int theY); - //! Sends a signal about display mode change void displayModeClicked(); diff --git a/tools/View/View_Window.cxx b/tools/View/View_Window.cxx index f4b6bd621b..98edc7485c 100644 --- a/tools/View/View_Window.cxx +++ b/tools/View/View_Window.cxx @@ -43,16 +43,14 @@ const int DEFAULT_SPACING = 3; // function : Constructor // purpose : // ======================================================================= -View_Window::View_Window (QWidget* theParent, - const Handle(AIS_InteractiveContext)& theContext, - const bool isUseKeepView, const bool isFitAllActive) +View_Window::View_Window (QWidget* theParent, const bool isUseKeepView, const bool isFitAllActive) : QWidget (theParent) { QGridLayout* aViewLayout = new QGridLayout (this); aViewLayout->setContentsMargins (0, 0, 0, 0); aViewLayout->setSpacing (DEFAULT_SPACING); - myView = new View_Widget (this, theContext, isFitAllActive); + myView = new View_Widget (this, isFitAllActive); myViewToolBar = new View_ToolBar (this, isUseKeepView); aViewLayout->addWidget (myViewToolBar->GetControl(), 0, 0, 1, 2); connect (myViewToolBar, SIGNAL (contextChanged()), this, SLOT (onViewSelectorActivated())); diff --git a/tools/View/View_Window.hxx b/tools/View/View_Window.hxx index 78fd950dfb..91eb8018c1 100644 --- a/tools/View/View_Window.hxx +++ b/tools/View/View_Window.hxx @@ -40,9 +40,7 @@ class View_Window : public QWidget public: //! Constructor - Standard_EXPORT View_Window (QWidget* theParent, - const Handle(AIS_InteractiveContext)& theContext = Handle(AIS_InteractiveContext)(), - const bool isUseKeepView = true, const bool isFitAllActive = true); + Standard_EXPORT View_Window (QWidget* theParent, const bool isUseKeepView = true, const bool isFitAllActive = true); //! Destructor virtual ~View_Window() {} @@ -98,7 +96,6 @@ private: View_Displayer* myDisplayer; //!< displayer View_Widget* myView; //!< view widget - QToolBar* myActionsToolBar; //!< actions tool bar View_ToolBar* myViewToolBar; //!< window tool bar }; diff --git a/tools/ViewControl/FILES b/tools/ViewControl/FILES index da5ce1079b..432c6f8adf 100644 --- a/tools/ViewControl/FILES +++ b/tools/ViewControl/FILES @@ -1,27 +1,5 @@ -ViewControl.hxx -ViewControl_ColorSelector.cxx -ViewControl_ColorSelector.hxx -ViewControl_EditType.hxx ViewControl_MessageDialog.cxx ViewControl_MessageDialog.hxx -ViewControl_Pane.hxx -ViewControl_PaneCreator.cxx -ViewControl_PaneCreator.hxx -ViewControl_PaneItem.hxx -ViewControl_PropertyView.cxx -ViewControl_PropertyView.hxx -ViewControl_Table.cxx -ViewControl_Table.hxx -ViewControl_TableDoubleVector.cxx -ViewControl_TableDoubleVector.hxx -ViewControl_TableItemDelegate.cxx -ViewControl_TableItemDelegate.hxx -ViewControl_TableModel.cxx -ViewControl_TableModel.hxx -ViewControl_TableModelValues.cxx -ViewControl_TableModelValues.hxx -ViewControl_TableModelValuesDefault.cxx -ViewControl_TableModelValuesDefault.hxx ViewControl_Tools.cxx ViewControl_Tools.hxx -ViewControl_TreeView.hxx +ViewControl_TreeView.hxx \ No newline at end of file diff --git a/tools/ViewControl/ViewControl.hxx b/tools/ViewControl/ViewControl.hxx deleted file mode 100644 index 1ea5334638..0000000000 --- a/tools/ViewControl/ViewControl.hxx +++ /dev/null @@ -1,33 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef VIEWCONTROL_H -#define VIEWCONTROL_H - -#ifdef __ViewControl_DLL - #ifdef _WIN32 - #define VIEWCONTROL_EXPORT __declspec(dllexport) - #else - #define VIEWCONTROL_EXPORT - #endif -#else - #ifdef _WIN32 - #define VIEWCONTROL_EXPORT __declspec(dllimport) - #else - #define VIEWCONTROL_EXPORT - #endif -#endif - -#endif diff --git a/tools/ViewControl/ViewControl_ColorSelector.cxx b/tools/ViewControl/ViewControl_ColorSelector.cxx deleted file mode 100644 index 5735fb7000..0000000000 --- a/tools/ViewControl/ViewControl_ColorSelector.cxx +++ /dev/null @@ -1,593 +0,0 @@ -// 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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//! Kinds of delegate cell in OCCT Color model to present a custom presentation (rect bounded by a colored frame) -enum ViewControl_ColorDelegateKind -{ - ViewControl_ColorDelegateKind_None, //!< usual item - ViewControl_ColorDelegateKind_Activated, //!< active item - ViewControl_ColorDelegateKind_Highlighted, //!< highlighted item - ViewControl_ColorDelegateKind_Selected //!< selected item -}; - -//! Model for a table of parameters: Current Color, Red, Green, Blue, Alpha, OCCT color name -class ViewControl_ParametersModel : public ViewControl_TableModelValues -{ -public: - ViewControl_ParametersModel (ViewControl_ColorSelector* theSelector) - : ViewControl_TableModelValues(), mySelector (theSelector) {} - virtual ~ViewControl_ParametersModel() {} - - //! Inits model by the parameter color - //! \param theColor model active color - void SetColor (const Quantity_ColorRGBA& theColor, ViewControl_TableModel* theModel) - { myColor = theColor; theModel->EmitLayoutChanged(); } - - //! Returns current selected color - //! \return color value - Quantity_ColorRGBA GetColor() const { return myColor; } - - //! Returns item information(short) for display role. - //! \param theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, - int theRole = Qt::DisplayRole) const Standard_OVERRIDE - { - (void)theRow; (void)theColumn; (void) theRole; - /*if (theRole == Qt::BackgroundRole && theColumn == 1 && theRow == 0) - return ViewControl_ColorSelector::ColorToQColor (myColor); - - if (theRole == Qt::ForegroundRole && theColumn == 1 && theRow >= 2 && theRow <= 5) - return ViewControl_TableModelValues::EditCellColor(); - - if (theRole != Qt::DisplayRole) - return QVariant(); - - bool isFirstColumn = theColumn == 0; - switch (theRow) - { - case 0: return isFirstColumn ? QVariant ("Color") : QVariant (); - case 1: - { - if (isFirstColumn) - return QVariant ("Name"); - Quantity_NameOfColor aColorName; - if (ViewControl_ColorSelector::IsExactColorName(myColor, aColorName)) - return Quantity::NameOfColorToString (aColorName); - } - break; - case 2: return isFirstColumn ? QVariant ("Red") : ViewControl_Tools::ToVariant (myColor.GetRGB().Red()); - case 3: return isFirstColumn ? QVariant ("Green") : ViewControl_Tools::ToVariant (myColor.GetRGB().Green()); - case 4: return isFirstColumn ? QVariant ("Blue") : ViewControl_Tools::ToVariant (myColor.GetRGB().Blue()); - case 5: return isFirstColumn ? QVariant ("Alpha") : ViewControl_Tools::ToVariant (myColor.Alpha()); - case 6: return isFirstColumn ? QVariant ("Near Name") - : Quantity::NameOfColorToString (myColor.GetRGB().Name()); - }*/ - return QVariant(); - } - - //! Sets content of the model index for the given role, it is applyed to internal container of values - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return true if the value is changed - virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue, int) - { - if (theColumn != 1 || theRow < 2 || theRow > 5) - return false; - - switch (theRow) - { - case 2: - case 3: - case 4: - { - myColor.ChangeRGB().SetValues (theRow == 2 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Red(), - theRow == 3 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Green(), - theRow == 4 ? ViewControl_Tools::ToShortRealValue (theValue) : myColor.GetRGB().Blue(), - Quantity_TOC_RGB); - } - break; - case 5: myColor.SetAlpha (ViewControl_Tools::ToShortRealValue (theValue)); break; - } - mySelector->ParameterColorChanged(); - return true; - } - - //! Returns number of tree level line items = colums in table view - virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 2; } - - //! Returns onlly one row in table view - virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 7; } - - //! Returns editable flag for color RGB and alpha rows - //! \return flags - Qt::ItemFlags Flags (const QModelIndex& theIndex) const - { - Qt::ItemFlags aFlags = ViewControl_TableModelValues::Flags (theIndex); - - if (theIndex.column() == 1 && theIndex.row() >= 2 && theIndex.row() <= 5) - aFlags = aFlags | Qt::ItemIsEditable; - - return aFlags; - } - - //! Returns type of edit control for the model index. By default, it is an empty control - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit type - virtual ViewControl_EditType GetEditType (const int theRow, const int theColumn) const - { - if (theColumn == 1 && theRow >= 2 && theRow <= 5) - return ViewControl_EditType_Double; - - return ViewControl_EditType_None; - } - -private: - Quantity_ColorRGBA myColor; - ViewControl_ColorSelector* mySelector; -}; - -//! Table of parameters: Red, Green, Blue, Alpha, OCCT color name -class ViewControl_OCCTColorModel : public QAbstractTableModel -{ -public: - ViewControl_OCCTColorModel (QObject* theParent) - : QAbstractTableModel (theParent), myCurrentIndexKind (ViewControl_ColorDelegateKind_None) {} - virtual ~ViewControl_OCCTColorModel() {} - - //! Sets current color, that should have custom presented - //! \param theColor current color - //! \param theKind presentation kind - void SetColor (const Quantity_NameOfColor& theColor, const ViewControl_ColorDelegateKind theKind) - { - int aColorPosition = (int)theColor; - int aRow = (int) (aColorPosition / columnCount()); - int aColumn = aColorPosition - aRow * columnCount(); - myCurrentIndex = index (aRow, aColumn); - myCurrentIndexKind = theKind; - - emit layoutChanged(); - } - - //! Returns OCCT name of color if index position does not exceed Quantity_NameOfColor elements - //! \param theIndex model index - //! \param theNameOfColor [out] OCCT color name - //! \return true if the color is found - bool GetOCCTColor (const QModelIndex& theIndex, Quantity_NameOfColor& theNameOfColor) const - { - int aNameOfColorId = theIndex.row() * columnCount() + theIndex.column(); - if (aNameOfColorId > Quantity_NOC_WHITE) - return false; - theNameOfColor = (Quantity_NameOfColor)aNameOfColorId; - return true; - } - - //! Returns index that has custom presentation - //! \return model index - QModelIndex GetCurrentIndex() const { return myCurrentIndex; } - - //! Returns index color kind that has custom presentation - //! \return kind - ViewControl_ColorDelegateKind GetCurrentIndexKind() const { return myCurrentIndexKind; } - - //! Returns item information(short) for display role. - //! \param theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant data (const QModelIndex& theIndex, - int theRole = Qt::DisplayRole) const Standard_OVERRIDE - { - if (theRole != Qt::ToolTipRole) // background is processed in table item delegate - return QVariant(); - - Quantity_NameOfColor aNameOfColor; - if (!GetOCCTColor (theIndex, aNameOfColor)) - return QVariant(); - - if (theRole == Qt::ToolTipRole) - return QString("%1").arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor))); - //return QString("%1 (%2)").arg(Quantity::NameOfColorToString (aNameOfColor)) - // .arg (ViewControl_ColorSelector::ColorToString (Quantity_Color (aNameOfColor))); - return QVariant(); - } - - //! Returns number of tree level line items = colums in table view - virtual int columnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 26; } - - //! Returns onlly one row in table view - virtual int rowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 20; } - - //! Returns color for the delegate kind - //! \param theKind kind - //! \return color - static QColor GetKindColor (const ViewControl_ColorDelegateKind theKind) - { - switch (theKind) - { - case ViewControl_ColorDelegateKind_Activated: - case ViewControl_ColorDelegateKind_Highlighted: return Qt::blue; - case ViewControl_ColorDelegateKind_Selected: return Qt::black; - default: break; - } - return QColor(); - } - -private: - QModelIndex myCurrentIndex; //!< index to be presented through item delegate - ViewControl_ColorDelegateKind myCurrentIndexKind; //!< kind of custom item -}; - -//! \class DFBrowser_HighlightDelegate -//! \brief An item delegate to paint in highlight color the cell when the mouse cursor is over it -class ViewControl_OCCTColorDelegate : public QItemDelegate -{ -public: - - //! Constructor - ViewControl_OCCTColorDelegate (QObject* theParent = 0) : QItemDelegate (theParent) {} - - //! Destructor - virtual ~ViewControl_OCCTColorDelegate() Standard_OVERRIDE {} - - //! Redefine of the parent virtual method to color the cell rectangle in highlight style - //! \param thePainter a painter - //! \param theOption a paint options - //! \param theIndex a view index - virtual void paint (QPainter* thePainter, const QStyleOptionViewItem& theOption, - const QModelIndex& theIndex) const Standard_OVERRIDE - { - QRect aBaseRect = theOption.rect; - int aNameOfColorId = theIndex.row() * theIndex.model()->columnCount(theIndex) + theIndex.column(); - Quantity_NameOfColor aNameOfColor = Quantity_NOC_WHITE; - if (aNameOfColorId < (int)Quantity_NOC_WHITE) - aNameOfColor = (Quantity_NameOfColor)aNameOfColorId; - - Quantity_Color anOCCTColor (aNameOfColor); - QColor aQColor = ViewControl_ColorSelector::ColorToQColor (Quantity_ColorRGBA (anOCCTColor)); - thePainter->fillRect (aBaseRect, aQColor); - - QColor aColor; - // highlight cell - if (theOption.state & QStyle::State_MouseOver) - aColor = ViewControl_OCCTColorModel::GetKindColor (ViewControl_ColorDelegateKind_Highlighted); - else - { - const ViewControl_OCCTColorModel* aTableModel = dynamic_cast (theIndex.model()); - QModelIndex anIndex = aTableModel->GetCurrentIndex(); - if (anIndex.isValid() && anIndex.row() == theIndex.row() && anIndex.column() == theIndex.column()) - aColor = ViewControl_OCCTColorModel::GetKindColor (aTableModel->GetCurrentIndexKind()); - } - - if (aColor.isValid()) - { - int aRectSize = 2; - thePainter->fillRect (QRect (aBaseRect.topLeft(), QPoint (aBaseRect.bottomLeft().x() + aRectSize, aBaseRect.bottomLeft().y())), - aColor); - thePainter->fillRect (QRect (QPoint (aBaseRect.topRight().x() - aRectSize, aBaseRect.topRight().y()), aBaseRect.bottomRight()), - aColor); - thePainter->fillRect (QRect (QPoint (aBaseRect.topLeft().x() + aRectSize, aBaseRect.topLeft().y()), - QPoint (aBaseRect.topRight().x() - aRectSize, aBaseRect.topRight().y() + aRectSize)), - aColor); - thePainter->fillRect (QRect (QPoint (aBaseRect.bottomLeft().x() + aRectSize, aBaseRect.bottomLeft().y() - aRectSize), - QPoint (aBaseRect.bottomRight().x() - aRectSize, aBaseRect.bottomRight().y())), - aColor); - } - } -}; - -//! Color picker class -class ViewControl_ColorPicker : public QWidget -{ -public: - ViewControl_ColorPicker (QWidget* theParent) : QWidget (theParent) {} - virtual ~ViewControl_ColorPicker() {} -}; - - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= - -ViewControl_ColorSelector::ViewControl_ColorSelector (QWidget* theParent) -: QDialog (theParent) -{ - QGridLayout* aLayout = new QGridLayout (this); - aLayout->setContentsMargins (0, 0, 0, 0); - - myParameters = new QTableView (this); - ViewControl_TableModel* aTableModel = new ViewControl_TableModel (myParameters); - aTableModel->SetModelValues (new ViewControl_ParametersModel (this)); - myParameters->setModel(aTableModel); - - ViewControl_TableItemDelegate* anItemDelegate = new ViewControl_TableItemDelegate(); - anItemDelegate->SetModelValues (aTableModel->GetModelValues()); - myParameters->setItemDelegate(anItemDelegate); - - myParameters->verticalHeader()->setDefaultSectionSize (myParameters->verticalHeader()->minimumSectionSize()); - myParameters->verticalHeader()->setVisible (false); - myParameters->horizontalHeader()->setVisible (false); - myParameters->setMinimumHeight (myParameters->verticalHeader()->minimumSectionSize() * aTableModel->rowCount() + - TreeModel_Tools::HeaderSectionMargin()); - - QItemSelectionModel* aSelectionModel = new QItemSelectionModel (myParameters->model()); - myParameters->setSelectionMode (QAbstractItemView::SingleSelection); - myParameters->setSelectionModel (aSelectionModel); - connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT (onParametersTableSelectionChanged (const QItemSelection&, const QItemSelection&))); - - aLayout->addWidget (myParameters, 0, 0); - - myColorPicker = new ViewControl_ColorPicker (this); - aLayout->addWidget (myColorPicker, 0, 1); - - myOCCTColors = new QTableView (this); - myOCCTColors->setFixedSize (525, 405); - myOCCTColors->verticalHeader()->setDefaultSectionSize (20); - myOCCTColors->verticalHeader()->setVisible (false); - myOCCTColors->horizontalHeader()->setDefaultSectionSize (20); - myOCCTColors->horizontalHeader()->setVisible (false); - myOCCTColors->setModel(new ViewControl_OCCTColorModel(myOCCTColors)); - - myOCCTColors->viewport()->setAttribute (Qt::WA_Hover); - myOCCTColors->setItemDelegate (new ViewControl_OCCTColorDelegate (myOCCTColors)); - - aSelectionModel = new QItemSelectionModel (myOCCTColors->model()); - myOCCTColors->setSelectionMode (QAbstractItemView::SingleSelection); - myOCCTColors->setSelectionModel (aSelectionModel); - connect (aSelectionModel, SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT (onOCCTColorsTableSelectionChanged (const QItemSelection&, const QItemSelection&))); - aLayout->addWidget (myOCCTColors, 1, 0, 1, 2); - - myDialogButtons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - connect(myDialogButtons, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(myDialogButtons, &QDialogButtonBox::rejected, this, &QDialog::reject); - - aLayout->addWidget(myDialogButtons, 2, 0, 1, 2); -} - -// ======================================================================= -// function : SetColor -// purpose : -// ======================================================================= - -void ViewControl_ColorSelector::SetColor (const QString& theColor) -{ - Quantity_ColorRGBA aColor = StringToColorRGBA (theColor); - // parameters model - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModel* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - aParametersModel->SetColor (aColor, aTableModel); - - // OCCT color model - Quantity_NameOfColor aColorName; - bool isExactColorName = ViewControl_ColorSelector::IsExactColorName(aColor, aColorName); - ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast(myOCCTColors->model()); - anOCCTColorModel->SetColor (aColorName, isExactColorName ? ViewControl_ColorDelegateKind_Selected - : ViewControl_ColorDelegateKind_Activated); -} - -// ======================================================================= -// function : GetColor -// purpose : -// ======================================================================= - -QString ViewControl_ColorSelector::GetColor() const -{ - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModel* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - - return ColorToString (aParametersModel->GetColor()); -} - -// ======================================================================= -// function : ParameterColorChanged -// purpose : -// ======================================================================= - -void ViewControl_ColorSelector::ParameterColorChanged() -{ - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModel* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - Quantity_ColorRGBA aColor = aParametersModel->GetColor(); - - // OCCT color model - Quantity_NameOfColor aColorName; - bool isExactColorName = ViewControl_ColorSelector::IsExactColorName(aColor, aColorName); - ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast(myOCCTColors->model()); - anOCCTColorModel->SetColor (aColorName, isExactColorName ? ViewControl_ColorDelegateKind_Selected - : ViewControl_ColorDelegateKind_Activated); -} - -// ======================================================================= -// function : ColorToString -// purpose : -// ======================================================================= - -QString ViewControl_ColorSelector::ColorToString (const Quantity_Color& theColor) -{ - Standard_Real aRed, aGreen, aBlue; - theColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB); - return QString::number (aRed) + ViewControl_ColorSelector::ColorSeparator() + - QString::number (aGreen) + ViewControl_ColorSelector::ColorSeparator() + - QString::number (aBlue); -} - -// ======================================================================= -// function : ColorToString -// purpose : -// ======================================================================= - -QString ViewControl_ColorSelector::ColorToString (const Quantity_ColorRGBA& theColor) -{ - const Quantity_Color& aRGBColor = theColor.GetRGB(); - Standard_ShortReal anAlpha = theColor.Alpha(); - - return ColorToString (aRGBColor) + ViewControl_ColorSelector::ColorSeparator() + QString::number (anAlpha); -} - -// ======================================================================= -// function : ColorToQColor -// purpose : -// ======================================================================= - -QColor ViewControl_ColorSelector::ColorToQColor (const Quantity_Color& theColor) -{ - int aDelta = 255; - - Standard_Real aRed, aGreen, aBlue; - theColor.Values (aRed, aGreen, aBlue, Quantity_TOC_RGB); - - return QColor((int)(aRed * aDelta), (int)(aGreen * aDelta), (int)(aBlue * aDelta)); -} - -// ======================================================================= -// function : ColorToQColor -// purpose : -// ======================================================================= - -QColor ViewControl_ColorSelector::ColorToQColor (const Quantity_ColorRGBA& theColor) -{ - int aDelta = 255; - - Standard_Real aRed, aGreen, aBlue; - theColor.GetRGB().Values (aRed, aGreen, aBlue, Quantity_TOC_RGB); - - return QColor((int)(aRed * aDelta), (int)(aGreen * aDelta), (int)(aBlue * aDelta)); -} - -// ======================================================================= -// function : StringToColor -// purpose : -// ======================================================================= - -Quantity_Color ViewControl_ColorSelector::StringToColor (const QString& theColor, Standard_ShortReal& theAlpha) -{ - Quantity_ColorRGBA aColorGRBA = StringToColorRGBA (theColor); - theAlpha = aColorGRBA.Alpha(); - return aColorGRBA.GetRGB(); -} - -// ======================================================================= -// function : StringToColor -// purpose : -// ======================================================================= - -Quantity_Color ViewControl_ColorSelector::StringToColor (const QString& theColor) -{ - return StringToColorRGBA (theColor).GetRGB(); -} - -// ======================================================================= -// function : StringToColorRGBA -// purpose : -// ======================================================================= - -Quantity_ColorRGBA ViewControl_ColorSelector::StringToColorRGBA (const QString& theColor) -{ - float anAlpha = 1.0f; - - QStringList aList = theColor.split (ViewControl_ColorSelector::ColorSeparator(), QString::SkipEmptyParts); - if (aList.size() < 3) - return Quantity_ColorRGBA(); - - if (aList.size() == 4) - anAlpha = aList[3].toFloat(); - - return Quantity_ColorRGBA (aList[0].toFloat(), aList[1].toFloat(), aList[2].toFloat(), anAlpha); -} - -// ======================================================================= -// function : onParametersTableSelectionChanged -// purpose : -// ======================================================================= - -Standard_Boolean ViewControl_ColorSelector::IsExactColorName (const Quantity_ColorRGBA& theColor, - Quantity_NameOfColor& theColorName) -{ - theColorName = theColor.GetRGB().Name(); - return Quantity_Color (theColorName).IsEqual (theColor.GetRGB()); -} - -// ======================================================================= -// function : onParametersTableSelectionChanged -// purpose : -// ======================================================================= - -void ViewControl_ColorSelector::onParametersTableSelectionChanged (const QItemSelection&, const QItemSelection&) -{ - //Quantity_ColorRGBA aColor = StringToColorRGBA (theColor); - //// parameters model - //ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - //ViewControl_ParametersModel* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - //aParametersModel->SetColor (aColor); - - //// OCCT color model - //Quantity_NameOfColor aColorName; - //bool isExactColorName = ViewControl_ColorSelector::IsExactColorName(aColor, aColorName); - //ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast(myOCCTColors->model()); - //anOCCTColorModel->SetColor (aColorName, isExactColorName ? ViewControl_ColorDelegateKind_Selected - // : ViewControl_ColorDelegateKind_Activated); -} - -// ======================================================================= -// function : onOCCTColorsTableSelectionChanged -// purpose : -// ======================================================================= - -void ViewControl_ColorSelector::onOCCTColorsTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection&) -{ - QModelIndexList aSelectedIndices = theSelected.indexes(); - if (aSelectedIndices.size() != 1) - return; - - ViewControl_OCCTColorModel* anOCCTColorModel = dynamic_cast(myOCCTColors->model()); - Quantity_NameOfColor aNameOfColor; - if (!anOCCTColorModel->GetOCCTColor (aSelectedIndices.first(), aNameOfColor)) - return; - - anOCCTColorModel->SetColor (aNameOfColor, ViewControl_ColorDelegateKind_Selected); - - // parameters model - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModel* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - Quantity_Color anOCCTColor (aNameOfColor); - aParametersModel->SetColor (Quantity_ColorRGBA (anOCCTColor), aTableModel); -} diff --git a/tools/ViewControl/ViewControl_ColorSelector.hxx b/tools/ViewControl/ViewControl_ColorSelector.hxx deleted file mode 100644 index ad4c8dc3db..0000000000 --- a/tools/ViewControl/ViewControl_ColorSelector.hxx +++ /dev/null @@ -1,120 +0,0 @@ -// 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 ViewControl_ColorSelector_H -#define ViewControl_ColorSelector_H - -#include - -#include - -#include -#include -#include -//#include -#include -#include -#include -#include - -class ViewControl_ColorPicker; -class QDialogButtonBox; -class QTableView; - -//! \class ViewControl_ColorSelector -//! \brief Selector of OCCT color -class VIEWCONTROL_EXPORT ViewControl_ColorSelector : public QDialog -{ - Q_OBJECT -public: - - //! Constructor - ViewControl_ColorSelector (QWidget* theParent); - - //! Destructor - virtual ~ViewControl_ColorSelector() Standard_OVERRIDE {} - - //! Inits control by the color value - //! \param theColor text color value - void SetColor (const QString& theColor); - - //! Returns current selected color value - //! \return text color value - QString GetColor() const; - - //! Updates OCCT color model by changing color in parameter model - void ParameterColorChanged(); - - //! Converts color to string value in form: r;g;b - //! \param theColor color value - //! \return text value - static QString ColorToString (const Quantity_Color& theColor); - - //! Converts color to string value in form: r;g;b;alpha - //! \param theColor color value - //! \return text value - static QString ColorToString (const Quantity_ColorRGBA& theColor); - - //! Converts color to QColor value in form: r;g;b - //! \param theColor color value - //! \return qt color value - static QColor ColorToQColor (const Quantity_Color& theColor); - - //! Converts color to QColor value in form: r;g;b;a - //! \param theColor color value - //! \return qt color value - static QColor ColorToQColor (const Quantity_ColorRGBA& theColor); - - //! Converts string to color value from a form: r;g;b;a - //! \param theColor text color value - //! \return color value - static Quantity_Color StringToColor (const QString& theColor, Standard_ShortReal& theAlpha); - - //! Converts string to color value from a form: r;g;b - //! \param theColor text color value - //! \return color value - static Quantity_Color StringToColor (const QString& theColor); - - //! Converts string to color value from a form: r;g;b;a - //! \param theColor text color value - //! \return color value - static Quantity_ColorRGBA StringToColorRGBA (const QString& theColor); - - static Standard_Boolean IsExactColorName (const Quantity_ColorRGBA& theColor, - Quantity_NameOfColor& theColorName); - -private: - //! Returns symbol used as a separtor of color components in string conversion - //! \return symbol value - static QString ColorSeparator() { return ";"; } - -private slots: - //! Slots listen selection change and update the current control content by selection - //! \param theSelected container of selected items - //! \param theDeselected container of items that become deselected - void onParametersTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); - - //! Slots listen selection change and update the current control content by selection - //! \param theSelected container of selected items - //! \param theDeselected container of items that become deselected - void onOCCTColorsTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); - -private: - QTableView* myParameters; //! current color parameters (RGB, alpha, color name) - ViewControl_ColorPicker* myColorPicker; //! color picker - QTableView* myOCCTColors; //! OCCT color values - QDialogButtonBox* myDialogButtons; //! OK/Cancel buttons -}; -#endif diff --git a/tools/ViewControl/ViewControl_EditType.hxx b/tools/ViewControl/ViewControl_EditType.hxx deleted file mode 100644 index fd5d8183ca..0000000000 --- a/tools/ViewControl/ViewControl_EditType.hxx +++ /dev/null @@ -1,32 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_EditType_H -#define ViewControl_EditType_H - -//! Type of context used in a tool library -enum ViewControl_EditType -{ - ViewControl_EditType_None, //!< View widget is null - ViewControl_EditType_Bool, //!< check box widget - ViewControl_EditType_Color, //!< color selector widget - ViewControl_EditType_Double, //!< line edit widget used double validator - ViewControl_EditType_Line, //!< line edit widget - ViewControl_EditType_Spin, //!< spin box widget - ViewControl_EditType_DoubleVector, //!< control to enter three double values - ViewControl_EditType_DoAction //!< control to perform the row action -}; - -#endif diff --git a/tools/ViewControl/ViewControl_Pane.hxx b/tools/ViewControl/ViewControl_Pane.hxx deleted file mode 100644 index 8ffa562f8e..0000000000 --- a/tools/ViewControl/ViewControl_Pane.hxx +++ /dev/null @@ -1,78 +0,0 @@ -// Created on: 2018-12-08 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_Pane_H -#define ViewControl_Pane_H - -#include -#include -#include - -#include - -#include -#include -#include -#include - -class ViewControl_PaneItem; - -//! \class ViewControl_PaneItem -//! Pane for getting/setting pane table values -//! -class ViewControl_Pane -{ -public: - - //! Returns number of table rows - //! \param theObject current pane object - //! \return an integer value - virtual int GetTableRowCount (const Handle(Standard_Transient)& theObject) const = 0; - - //! Returns table value for the row in form: - //! \param theObject current pane object - //! \param theRow a model index row - //! \param theColumn a model index column - virtual QVariant GetTableData (const Handle(Standard_Transient)& theObject, - const int theRow, const int theColumn, const int theRole) const = 0; - - //! Returns type of edit control for the model index. By default, it is an empty control - //! \param theObject current pane object - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit type - virtual ViewControl_EditType GetTableEditType (const Handle(Standard_Transient)& theObject, - const int theRow, const int theColumn) const - { (void)theObject; (void)theRow; (void)theColumn; return ViewControl_EditType_None; } - - //! Sets the value into the table cell. Only 1st column value might be modified. - //! \param theObject current pane object - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theValue a new cell value - virtual bool SetTableData (const Handle(Standard_Transient)& theObject, - const int theRow, const int theColumn, const QVariant& theValue) - { (void)theObject; (void)theRow; (void)theColumn; (void)theValue; return false; } - - //! Return selected element in the pane cell - //! \param theObject current pane object - //! \param theRow a model index row - //! \param theColumn a model index column - virtual ViewControl_PaneItem* GetSelected (const Handle(Standard_Transient)& theObject, - const int theRow, const int theColumn) - { (void)theObject; (void)theRow; (void)theColumn; return 0; } -}; - -#endif \ No newline at end of file diff --git a/tools/ViewControl/ViewControl_PaneCreator.cxx b/tools/ViewControl/ViewControl_PaneCreator.cxx deleted file mode 100644 index 78098c805b..0000000000 --- a/tools/ViewControl/ViewControl_PaneCreator.cxx +++ /dev/null @@ -1,18 +0,0 @@ -// Created on: 2018-12-08 -// 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 - -IMPLEMENT_STANDARD_RTTIEXT(ViewControl_PaneCreator, Standard_Transient) diff --git a/tools/ViewControl/ViewControl_PaneCreator.hxx b/tools/ViewControl/ViewControl_PaneCreator.hxx deleted file mode 100644 index 5418dbdc3e..0000000000 --- a/tools/ViewControl/ViewControl_PaneCreator.hxx +++ /dev/null @@ -1,49 +0,0 @@ -// Created on: 2018-12-08 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_PaneCreator_H -#define ViewControl_PaneCreator_H - -#include -#include -#include -#include -#include - -class ViewControl_Pane; - -DEFINE_STANDARD_HANDLE (ViewControl_PaneCreator, Standard_Transient) - -//! \class ViewControl_PaneCreator -//! \brief An interface to create custom panes by transient object name. -class ViewControl_PaneCreator : public Standard_Transient -{ -public: - - //! Constructor - ViewControl_PaneCreator() {} - - //! Destructor - virtual ~ViewControl_PaneCreator() {} - - //! Creates pane for type - //! \param theName a type name - //! \return a pane if it can be created for this type or NULL - virtual ViewControl_Pane* GetPane (const Standard_CString& theName) = 0; - - DEFINE_STANDARD_RTTIEXT (ViewControl_PaneCreator, Standard_Transient) -}; - -#endif diff --git a/tools/ViewControl/ViewControl_PaneItem.hxx b/tools/ViewControl/ViewControl_PaneItem.hxx deleted file mode 100644 index e0c5f4387c..0000000000 --- a/tools/ViewControl/ViewControl_PaneItem.hxx +++ /dev/null @@ -1,53 +0,0 @@ -// Created on: 2018-12-08 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_PaneItem_H -#define ViewControl_PaneItem_H - -#include -#include -#include - -#include - -//! \class ViewControl_PaneItem -//! Container of pane item information - -class ViewControl_PaneItem -{ -public: - - //! Returns shape of the item or NULL - //! \return shape instance - virtual TopoDS_Shape GetShape() { return myShape; } - - //! Sets shape - //! \param theShape shape instance - void SetShape (const TopoDS_Shape& theShape) { myShape = theShape; } - - //! Returns object or NULL - //! \return current object - virtual Handle(Standard_Transient) GetObject() { return myObject; } - - //! Sets object - //! \param theObject an object - virtual void SetObject (Handle(Standard_Transient)& theObject) { myObject = theObject; } - -protected: - TopoDS_Shape myShape; //!< current shape - Handle(Standard_Transient) myObject; //!< current object -}; - -#endif \ No newline at end of file diff --git a/tools/ViewControl/ViewControl_PropertyView.cxx b/tools/ViewControl/ViewControl_PropertyView.cxx deleted file mode 100644 index f2f20c9213..0000000000 --- a/tools/ViewControl/ViewControl_PropertyView.cxx +++ /dev/null @@ -1,219 +0,0 @@ -// 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -class ViewControl_Widget : public QWidget -{ -public: - //! Constructor - ViewControl_Widget (QWidget* theParent, const QSize& theSize) : QWidget (theParent) { SetPredefinedSize (theSize); } - - //! Destructor - virtual ~ViewControl_Widget() {} - - //! Sets default size of control, that is used by the first control show - //! \param theDefaultWidth the width value - //! \param theDefaultHeight the height value - void SetPredefinedSize (const QSize& theSize) { myDefaultSize = theSize;} - - //! Returns predefined size if both values are positive, otherwise parent size hint - virtual QSize sizeHint() const Standard_OVERRIDE { return myDefaultSize.isValid() ? myDefaultSize : QWidget::sizeHint(); } - -private: - QSize myDefaultSize; //! default size, empty isze if it should not be used -}; - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= -ViewControl_PropertyView::ViewControl_PropertyView (QWidget* theParent, const QSize& thePredefinedSize) -: QObject (theParent), myOwnSelectionChangeBlocked (false) -{ - myMainWidget = new ViewControl_Widget (theParent, QSize (1, 100)); - if (!thePredefinedSize.isEmpty()) - ((ViewControl_Widget*)myMainWidget)->SetPredefinedSize (thePredefinedSize); - - QVBoxLayout* aLayout = new QVBoxLayout (myMainWidget); - aLayout->setContentsMargins (0, 0, 0, 0); - - QScrollArea* anArea = new QScrollArea (myMainWidget); - - myAttributesStack = new QStackedWidget (myMainWidget); - anArea->setWidget (myAttributesStack); - anArea->setWidgetResizable( true ); - aLayout->addWidget (anArea); - - myEmptyWidget = new QWidget (myAttributesStack); - myAttributesStack->addWidget (myEmptyWidget); - - myTableWidget = new QWidget (myAttributesStack); - myTableWidgetLayout = new QVBoxLayout (myTableWidget); - myTableWidgetLayout->setContentsMargins (0, 0, 0, 0); - myAttributesStack->addWidget (myTableWidget); - - myAttributesStack->setCurrentWidget (myEmptyWidget); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void ViewControl_PropertyView::Init (const QList& theTableValues) -{ - for (int aTableId = 0; aTableId < theTableValues.size(); aTableId++) - { - ViewControl_TableModelValues* aValues = theTableValues[aTableId]; - - ViewControl_Table* aTable = findTable (aTableId); - - aTable->Init (aValues); - ViewControl_Tools::SetDefaultHeaderSections (aTable->GetTableView(), Qt::Horizontal); - - aTable->SetActive (true); - } - // hide not used tables - for (int aTableId = theTableValues.size(); aTableId < myTables.size(); aTableId++) - { - ViewControl_Table* aTable = findTable (aTableId, false); - if (!aTable) - continue; - - ViewControl_TableModel* aModel = dynamic_cast (aTable->GetTableView()->model()); - aModel->SetModelValues (0); - - aTable->SetActive (false); - } - - if (theTableValues.size() > 0) - myAttributesStack->setCurrentWidget (myTableWidget); - else - myAttributesStack->setCurrentWidget (myEmptyWidget); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= -void ViewControl_PropertyView::Init (QWidget*) -{ -} - -// ======================================================================= -// function : GetActiveTables -// purpose : -// ======================================================================= -void ViewControl_PropertyView::GetActiveTables (QList& theTables) -{ - for (int aTableId = 0; aTableId < myTables.size(); aTableId++) - { - ViewControl_Table* aTable = findTable (aTableId, false); - if (aTable && aTable->IsActive()) - theTables.append (aTable); - } -} - -// ======================================================================= -// function : ClearActiveTablesSelection -// purpose : -// ======================================================================= -void ViewControl_PropertyView::ClearActiveTablesSelection() -{ - bool aWasBlocked = myOwnSelectionChangeBlocked; - myOwnSelectionChangeBlocked = true; - - QList aTables; - for (int aTableId = 0; aTableId < myTables.size(); aTableId++) - { - ViewControl_Table* aTable = findTable (aTableId, false); - if (aTable && aTable->IsActive()) - aTable->GetTableView()->selectionModel()->clearSelection(); - } - myOwnSelectionChangeBlocked = aWasBlocked; -} - -// ======================================================================= -// function : Clear -// purpose : -// ======================================================================= -void ViewControl_PropertyView::Clear() -{ - for (int aTableId = 0; aTableId < myTables.size(); aTableId++) - { - ViewControl_Table* aTable = findTable (aTableId, false); - if (!aTable) - continue; - - ViewControl_TableModel* aModel = dynamic_cast (aTable->GetTableView()->model()); - aModel->SetModelValues (0); - - aTable->SetActive (true); - } - myAttributesStack->setCurrentWidget (myEmptyWidget); -} - -// ======================================================================= -// function : findTable -// purpose : -// ======================================================================= -ViewControl_Table* ViewControl_PropertyView::findTable (const int theTableId, const bool isToCreate) -{ - if (!isToCreate && theTableId >= myTables.size()) - return 0; - - if (theTableId < myTables.size()) - return myTables[theTableId]; - - ViewControl_Table* aTable = new ViewControl_Table (myMainWidget); - ViewControl_TableModel* aModel = new ViewControl_TableModel(aTable->GetTableView()); - aTable->SetModel (aModel); - - - connect (aTable->GetTableView()->selectionModel(), - SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT(onTableSelectionChanged (const QItemSelection&, const QItemSelection&))); - - myTableWidgetLayout->addWidget (aTable->GetControl()); - - myTables.insert (theTableId, aTable); - - return myTables[theTableId]; -} - -// ======================================================================= -// function : onTableSelectionChanged -// purpose : -// ======================================================================= -void ViewControl_PropertyView::onTableSelectionChanged (const QItemSelection&, const QItemSelection&) -{ - if (myOwnSelectionChangeBlocked) - return; - - emit propertyViewSelectionChanged(); -} diff --git a/tools/ViewControl/ViewControl_PropertyView.hxx b/tools/ViewControl/ViewControl_PropertyView.hxx deleted file mode 100644 index 2cb6f75377..0000000000 --- a/tools/ViewControl/ViewControl_PropertyView.hxx +++ /dev/null @@ -1,99 +0,0 @@ -// 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 TreeModel_PropertyView_H -#define TreeModel_PropertyView_H - -#include -#include - -#include - -#include -#include -#include -#include - -class QAbstractTableModel; -class QStackedWidget; -class QWidget; -class QVBoxLayout; - -class ViewControl_TableModelValues; - -//! \class ViewControl_PropertyView -//! \brief View widget where several tables are visualized in vertical layout. -class ViewControl_PropertyView : public QObject -{ - Q_OBJECT -public: - - //! Constructor - Standard_EXPORT ViewControl_PropertyView (QWidget* theParent, const QSize& thePredefinedSize = QSize()); - - //! Destructor - virtual ~ViewControl_PropertyView() Standard_OVERRIDE {} - - //! Fills the view content with values. Number of visible tables is size of container, - //! Each element of container is values of the corresponded table - //! \param theTableValues values - Standard_EXPORT void Init (const QList& theTableValues); - - //! Fills the view content with the parameter custom widget. - //! \param theWidget control - Standard_EXPORT void Init (QWidget* theWidget); - - //! Clears layout of the view and tables models. - Standard_EXPORT void Clear(); - - //! \return the text edit control - QWidget* GetControl() const { return myMainWidget; } - - //! Returns container of active tables - //! \param theTables [out] modified container - Standard_EXPORT void GetActiveTables (QList& theTables); - - //! Clears selection in active tables - Standard_EXPORT void ClearActiveTablesSelection(); - -signals: - void propertyViewSelectionChanged(); - -protected slots: - //! Emits signal about selection is changed - //! \param theSelected container of selected table cells - //! \param theDeselected container of selected table cells - void onTableSelectionChanged (const QItemSelection& theSelected, const QItemSelection& theDeselected); - -protected: - //! Returns table instance or create if it was not created ealier - //! \param theTableId an index in internal container of tables - //! \param isToCreate if true, the table is created if not exists - ViewControl_Table* findTable (const int theTableId, const bool isToCreate = true); - -private: - bool myOwnSelectionChangeBlocked; //! blocking emit of selection changed signal - - QWidget* myMainWidget; //! parent of all controls - - QStackedWidget* myAttributesStack; //!< container of already created panes - QWidget* myEmptyWidget; //!< an empty widget when nothing is selected in tree view - - QWidget* myTableWidget; //!< widget of tables in vertical layout - QVBoxLayout* myTableWidgetLayout; //! main view layout where tables or custom widgets are presented - QList myTables; //!< table view, shown only first tables filled in Init method - QWidget* myCustomWidget; //!< custom view widget -}; -#endif diff --git a/tools/ViewControl/ViewControl_Table.cxx b/tools/ViewControl/ViewControl_Table.cxx deleted file mode 100644 index 1ee8f1c7e9..0000000000 --- a/tools/ViewControl/ViewControl_Table.cxx +++ /dev/null @@ -1,200 +0,0 @@ -// 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 -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= - -ViewControl_Table::ViewControl_Table (QWidget* theParent) -: QObject (theParent), myIsUseProperty (false) -{ - myMainWidget = new QWidget (theParent); - QGridLayout* aLayout = new QGridLayout (myMainWidget); - aLayout->setContentsMargins (0, 0, 0, 0); - - myTableView = new QTableView (myMainWidget); - myTableView->setVerticalScrollMode (QAbstractItemView::ScrollPerPixel); - - myTableView->setItemDelegate (new ViewControl_TableItemDelegate (theParent)); - - QHeaderView* aVHeader = myTableView->verticalHeader(); - int aDefCellSize = aVHeader->minimumSectionSize(); - aVHeader->setDefaultSectionSize (aDefCellSize); - - aLayout->addWidget (myTableView); -} - -// ======================================================================= -// function : SetModel -// purpose : -// ======================================================================= - -void ViewControl_Table::SetModel (QAbstractTableModel* theModel) -{ - myTableView->setModel (theModel); - - myTableView->setSelectionMode(QAbstractItemView::ExtendedSelection); - QItemSelectionModel* aSelectionModel = new QItemSelectionModel(theModel); - myTableView->setSelectionModel (aSelectionModel); -} - -// ======================================================================= -// function : Init -// purpose : -// ======================================================================= - -void ViewControl_Table::Init (ViewControl_TableModelValues* theModelValues) -{ - myTableView->selectionModel()->clearSelection(); - - ViewControl_TableModel* aModel = dynamic_cast (myTableView->model()); - aModel->SetModelValues (theModelValues); - - ViewControl_TableItemDelegate* aDelegate = dynamic_cast(myTableView->itemDelegate()); - aDelegate->SetModelValues (theModelValues); - - int aSectionSize; - myTableView->horizontalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Horizontal)); - if (theModelValues->GetDefaultSectionSize (Qt::Horizontal, aSectionSize) ) - myTableView->horizontalHeader()->setDefaultSectionSize (aSectionSize); - - myTableView->verticalHeader()->setVisible (theModelValues->IsHeaderVisible (Qt::Vertical)); - if (theModelValues->GetDefaultSectionSize (Qt::Vertical, aSectionSize) ) - { - myTableView->verticalHeader()->setDefaultSectionSize (aSectionSize); - } - else - myTableView->verticalHeader()->setDefaultSectionSize (myTableView->verticalHeader()->minimumSectionSize()); - - aModel->EmitLayoutChanged(); -} - -// ======================================================================= -// function : GetSelectedIndices -// purpose : -// ======================================================================= - -void ViewControl_Table::GetSelectedIndices (QMap>& theSelectedIndices) const -{ - QModelIndexList aSelected = myTableView->selectionModel()->selectedIndexes(); - - int aRow, aColumn; - for (QModelIndexList::const_iterator anIt = aSelected.begin(); anIt != aSelected.end(); anIt++) - { - QModelIndex anIndex = *anIt; - aRow = anIndex.row(); - aColumn = anIndex.column(); - if (!theSelectedIndices.contains (aRow)) - theSelectedIndices.insert (aRow, QList()); - theSelectedIndices[aRow].append (aColumn); - } -} - -// ======================================================================= -// function : SeparatorData -// purpose : -// ======================================================================= - -QString ViewControl_Table::SeparatorData() -{ - return ViewControl_Tools::TableSeparator(); -} - -// ======================================================================= -// function : GetSelectedPresentations -// purpose : -// ======================================================================= - -void ViewControl_Table::GetSelectedPresentations (const TreeModel_ItemBasePtr& theTreeItem, - NCollection_List& theSelPresentations) const -{ - TreeModel_ItemStreamPtr aStreamParent = itemDynamicCast(theTreeItem); - if (!aStreamParent) - return; - - Handle(TreeModel_ItemProperties) anItemProperties = aStreamParent->Properties(); - if (anItemProperties.IsNull()) - return; - - QMap> aSelectedIndices; - GetSelectedIndices (aSelectedIndices); - - for (QMap>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++) - { - int aRowId = aSelIt.key(); - QList 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> aSelectedIndices; - GetSelectedIndices (aSelectedIndices); - - ViewControl_TableModel* aTableModel = dynamic_cast(GetTableView()->model()); - ViewControl_TableModelValues* aTableValues = aTableModel->GetModelValues(); - - for (QMap>::const_iterator aSelIt = aSelectedIndices.begin(); aSelIt != aSelectedIndices.end(); aSelIt++) - { - int aRowId = aSelIt.key(); - QList 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 diff --git a/tools/ViewControl/ViewControl_Table.hxx b/tools/ViewControl/ViewControl_Table.hxx deleted file mode 100644 index 3c7611ea51..0000000000 --- a/tools/ViewControl/ViewControl_Table.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_Table_H -#define ViewControl_Table_H - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -class ViewControl_TableModelValues; - -class QAbstractTableModel; -class QContextMenuEvent; -class QWidget; - -//! \class ViewControl_Table -//! \brief View to display table values with possibility to change table columns -//! if the table has 1D dimension and Horizontal orientation -class ViewControl_Table : public QObject -{ - Q_OBJECT -public: - - //! Constructor - Standard_EXPORT ViewControl_Table (QWidget* theParent); - - //! Destructor - virtual ~ViewControl_Table() Standard_OVERRIDE {} - - //! Set model into table view, init selection model by the given model, connect to selection change - //! \param theModel table values model - void SetModel (QAbstractTableModel* theModel); - - //! Fills table view and table size control by the model - //! \param theModel values model - Standard_EXPORT void Init (ViewControl_TableModelValues* theModelValues); - - //! Sets the table active and show the table - //! \param theState boolean value - void SetActive (const bool theState) { myIsActive = theState; GetTableView()->setVisible (theState); } - - //!< true if the table is used in property view and visible - bool IsActive() const { return myIsActive; } - - //! \return the text edit control - QWidget* GetControl() const { return myMainWidget; } - - //! \return the table view - QTableView* GetTableView() const { return myTableView; } - - //! 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>& 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& theSelPresentations) const; - - //! Returns pointers from selected cells - Standard_EXPORT void GetSelectedPointers (QStringList& thePointers) const; - - //! Returns text of separation row in table - //! \return string value - Standard_EXPORT static QString SeparatorData(); - -private: - bool myIsActive; //!< true if the table is used in property view and visible - - QWidget* myMainWidget; //!< parent of all controls - bool myIsUseProperty; //!< boolean value whether the property control should be shown/hidden - QTableView* myTableView; //!< table view -}; -#endif diff --git a/tools/ViewControl/ViewControl_TableDoubleVector.cxx b/tools/ViewControl/ViewControl_TableDoubleVector.cxx deleted file mode 100644 index 31cb0aea71..0000000000 --- a/tools/ViewControl/ViewControl_TableDoubleVector.cxx +++ /dev/null @@ -1,264 +0,0 @@ -//----------------------------------------------------------------------------- -// Created on: 2019-03-28 -// Created by: Vadim LEONTIEV -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of commercial software by OPEN CASCADE SAS. -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of this copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any third party. -// No ownership title to the software is transferred hereby. -// -// OPEN CASCADE SAS makes no representation or warranties with respect to the -// performance of this software, and specifically disclaims any responsibility -// for any damages, special or consequential, connected with its use. -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -//! Model for a table of parameters: Values: X, Y, Z -class ViewControl_ParametersModelVector : public ViewControl_TableModelValues -{ -public: - ViewControl_ParametersModelVector(ViewControl_TableDoubleVector* theDoubleVector) - : ViewControl_TableModelValues(), myDoubleVector(theDoubleVector) {} - - virtual ~ViewControl_ParametersModelVector() {} - - //! Inits model by the parameters vector - //! \param theVector model the vector - void SetVector(const QList& theVector) - { - if (myVector.isEmpty()) - { myVector.clear(); } - - for (int aNumberVector = 0; aNumberVector < theVector.size(); ++aNumberVector) - { - myVector.append(theVector[aNumberVector]); - } - } - - //! Returns current vector - //! \return vector value to string - QList GetVector() const { return myVector; } - - //! Returns current vector - //! \return vector value to QList - QList GetListFromString(const QString& theVector) const - { - QList aDoubleList; - - QStringList aList = theVector.split(QString(","), QString::SkipEmptyParts); - if (aList.isEmpty()) - return aDoubleList; - - for (int aNumberValue = 0; aNumberValue < aList.size(); ++aNumberValue) - { - aDoubleList.append(QVariant(aList[aNumberValue])); - } - - return aDoubleList; - } - - //! Returns item information(short) for display role. - //! \param theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant Data(const int theRow, const int theColumn, - int theRole = Qt::DisplayRole) const Standard_OVERRIDE - { - if (theRole != Qt::DisplayRole) - return QVariant(); - - bool isFirstColumn = theColumn == 0; - switch (theRow) - { - case 0: return isFirstColumn ? QVariant("X") : myVector[theRow]; - case 1: return isFirstColumn ? QVariant("Y") : myVector[theRow]; - case 2: return isFirstColumn ? QVariant("Z") : myVector[theRow]; - } - return QVariant(); - } - - //! Sets content of the model index for the given role, it is applyed to internal container of values - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return true if the value is changed - virtual bool SetData(const int theRow, const int theColumn, const QVariant& theValue, int) - { - if (theColumn != 1 || theRow < 0 || theRow > 2) - return false; - - switch (theRow) - { - case 0: myVector[theRow] = theValue; break; - case 1: myVector[theRow] = theValue; break; - case 2: myVector[theRow] = theValue; break; - } - - return true; - } - - //! Returns number of tree level line items = colums in table view - virtual int ColumnCount(const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 2; } - - //! Returns onlly one row in table view - virtual int RowCount(const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { (void)theParent; return 3; } - - //! Returns editable flag for DoubleVector - //! \return flags - Qt::ItemFlags Flags(const QModelIndex& theIndex) const - { - Qt::ItemFlags aFlags = ViewControl_TableModelValues::Flags(theIndex); - - if (theIndex.column() == 1 && theIndex.row() >= 0 && theIndex.row() <= 2) - aFlags = aFlags | Qt::ItemIsEditable; - - return aFlags; - } - - //! Returns type of edit control for the model index. By default, it is an empty control - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit type - virtual ViewControl_EditType GetEditType(const int theRow, const int theColumn) const - { - if (theColumn == 1 && theRow >= 0 && theRow <= 2) - return ViewControl_EditType_Double; - - return ViewControl_EditType_None; - } - -private: - QList myVector; - ViewControl_TableDoubleVector* myDoubleVector; -}; - - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= - -ViewControl_TableDoubleVector::ViewControl_TableDoubleVector(QWidget* theParent) -: QDialog(theParent) -{ - QGridLayout* aLayout = new QGridLayout(this); - aLayout->setContentsMargins(0, 0, 0, 0); - - myParameters = new QTableView(this); - - ViewControl_TableModel* aTableModel = new ViewControl_TableModel(myParameters); - aTableModel->SetModelValues(new ViewControl_ParametersModelVector(this)); - myParameters->setModel(aTableModel); - - ViewControl_TableItemDelegate* anItemDelegate = new ViewControl_TableItemDelegate(); - anItemDelegate->SetModelValues(aTableModel->GetModelValues()); - myParameters->setItemDelegate(anItemDelegate); - - myParameters->verticalHeader()->setDefaultSectionSize(myParameters->verticalHeader()->minimumSectionSize()); - myParameters->verticalHeader()->setVisible(false); - myParameters->horizontalHeader()->setVisible(false); - myParameters->setMinimumHeight(myParameters->verticalHeader()->minimumSectionSize() * aTableModel->rowCount() + - TreeModel_Tools::HeaderSectionMargin()); - myParameters->setMinimumWidth(myParameters->horizontalHeader()->defaultSectionSize() * aTableModel->columnCount() + - TreeModel_Tools::HeaderSectionMargin()); - - QItemSelectionModel* aSelectionModel = new QItemSelectionModel(myParameters->model()); - myParameters->setSelectionMode(QAbstractItemView::SingleSelection); - myParameters->setSelectionModel(aSelectionModel); - - aLayout->addWidget(myParameters, 0, 0); - - myDialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - connect(myDialogButtons, &QDialogButtonBox::accepted, this, &QDialog::accept); - connect(myDialogButtons, &QDialogButtonBox::rejected, this, &QDialog::reject); - - aLayout->addWidget(myDialogButtons, 1, 0, 1, 2); -} - -// ======================================================================= -// function : SetVectorValue -// purpose : -// ======================================================================= - -void ViewControl_TableDoubleVector::SetVectorValue(const QString& theVector) -{ - QList aVector = GetListVector(theVector); - // parameters model - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModelVector* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - aParametersModel->SetVector(aVector); -} - -// ======================================================================= -// function : GetListVector -// purpose : -// ======================================================================= - -QList ViewControl_TableDoubleVector::GetListVector(const QString& theVector) -{ - QList aDoubleList; - - QStringList aList = theVector.split(ViewControl_TableDoubleVector::DoubleSeparator(), QString::SkipEmptyParts); - - if (aList.isEmpty()) - return aDoubleList; - - for (int aNumberValue = 0; aNumberValue < aList.size(); ++aNumberValue) - { - aDoubleList.append(QVariant(aList[aNumberValue])); - } - - return aDoubleList; -} - -// ======================================================================= -// function : GetVector -// purpose : -// ======================================================================= - -QString ViewControl_TableDoubleVector::GetVector() const -{ - ViewControl_TableModel* aTableModel = dynamic_cast (myParameters->model()); - ViewControl_ParametersModelVector* aParametersModel = dynamic_cast (aTableModel->GetModelValues()); - - return VectorToString(aParametersModel->GetVector()); -} - -// ======================================================================= -// function : VectorToString -// purpose : -// ======================================================================= - -QString ViewControl_TableDoubleVector::VectorToString(const QList& theVector) const -{ - QString aVectorToString; - - for (int aNumberValue = 0; aNumberValue < theVector.size(); ++aNumberValue) - { - aVectorToString += theVector[aNumberValue].toString() + DoubleSeparator(); - } - aVectorToString.remove(aVectorToString.length() - 1, 1); - - return aVectorToString; -} - diff --git a/tools/ViewControl/ViewControl_TableDoubleVector.hxx b/tools/ViewControl/ViewControl_TableDoubleVector.hxx deleted file mode 100644 index 06cad5806d..0000000000 --- a/tools/ViewControl/ViewControl_TableDoubleVector.hxx +++ /dev/null @@ -1,76 +0,0 @@ -//----------------------------------------------------------------------------- -// Created on: 2019-03-28 -// Created by: Vadim LEONTIEV -// Copyright (c) 2019 OPEN CASCADE SAS -// -// This file is part of commercial software by OPEN CASCADE SAS. -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of this copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any third party. -// No ownership title to the software is transferred hereby. -// -// OPEN CASCADE SAS makes no representation or warranties with respect to the -// performance of this software, and specifically disclaims any responsibility -// for any damages, special or consequential, connected with its use. -//----------------------------------------------------------------------------- - -#ifndef ViewControl_TableDoubleVector_H -#define ViewControl_TableDoubleVector_H - -#include -#include - -#include -#include -#include -#include -#include -#include - -class QDialogButtonBox; -class QTableView; - -//! \class ViewControl_PointCoordinates -//! \dialog of change the point coordinates -class VIEWCONTROL_EXPORT ViewControl_TableDoubleVector : public QDialog -{ - Q_OBJECT -public: - - //! Constructor - ViewControl_TableDoubleVector(QWidget* theParent); - - //! Destructor - virtual ~ViewControl_TableDoubleVector() Standard_OVERRIDE{} - - //! Inits control by the vector value - //! \param theVector text vector value - void SetVectorValue(const QString& theVector); - - //! Returns vector value - //! \return QList vector value - static QList ViewControl_TableDoubleVector::GetListVector(const QString& theVector); - - //! Returns vector value - //! \return text vector value - QString GetVector() const; - - //! Converts vector to string value in form - //! \param theVector vector value - //! \return text value - QString VectorToString(const QList& theVector) const; - -private: - //! Returns symbol used as a separtor of vector components in string conversion - //! \return symbol value - static QString DoubleSeparator() { return ","; } - -private: - QTableView* myParameters; //! current vector parameters - QDialogButtonBox* myDialogButtons; //! OK/Cancel buttons - -}; - -#endif // ViewControl_TableDoubleVector_H diff --git a/tools/ViewControl/ViewControl_TableItemDelegate.cxx b/tools/ViewControl/ViewControl_TableItemDelegate.cxx deleted file mode 100644 index 4e12b3b051..0000000000 --- a/tools/ViewControl/ViewControl_TableItemDelegate.cxx +++ /dev/null @@ -1,198 +0,0 @@ -// Created on: 2018-08-09 -// 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ======================================================================= -// function : Constructor -// purpose : -// ======================================================================= - -ViewControl_TableItemDelegate::ViewControl_TableItemDelegate (QObject* theParent) - : QItemDelegate (theParent), myModelValues (0) -{ -} - -// ======================================================================= -// function : createEditor -// purpose : -// ======================================================================= - -QWidget* ViewControl_TableItemDelegate::createEditor (QWidget* theParent, - const QStyleOptionViewItem&, - const QModelIndex& theIndex) const -{ - if (!myModelValues) - return 0; - - int aRow = theIndex.row(); - int aColumn = theIndex.column(); - ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn); - - QWidget* anEditor = createEditorControl (theParent, anEditType); - initEditorParameters (anEditor, anEditType, myModelValues, aRow, aColumn); - return anEditor; -} - -// ======================================================================= -// function : setEditorData -// purpose : -// ======================================================================= - -void ViewControl_TableItemDelegate::setEditorData (QWidget* theEditor, const QModelIndex& theIndex) const -{ - if (!myModelValues) - return; - - int aRow = theIndex.row(); - int aColumn = theIndex.column(); - ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn); - - setEditorValue (theEditor, anEditType, theIndex.model()->data(theIndex)); -} - -// ======================================================================= -// function : setModelData -// purpose : -// ======================================================================= - -void ViewControl_TableItemDelegate::setModelData (QWidget* theEditor, QAbstractItemModel* theModel, - const QModelIndex& theIndex) const -{ - if (!myModelValues) - return; - - int aRow = theIndex.row(); - int aColumn = theIndex.column(); - ViewControl_EditType anEditType = myModelValues->GetEditType (aRow, aColumn); - - theModel->setData (theIndex, getEditorValue (theEditor, anEditType)); -} - -// ======================================================================= -// function : createEditorControl -// purpose : -// ======================================================================= - -QWidget* ViewControl_TableItemDelegate::createEditorControl (QWidget* theParent, const ViewControl_EditType theEditType) -{ - switch (theEditType) - { - case ViewControl_EditType_None: return 0; - case ViewControl_EditType_Bool: return new QComboBox (theParent); - case ViewControl_EditType_Color: return new ViewControl_ColorSelector (theParent); - case ViewControl_EditType_Double: - { - QLineEdit* aLineEdit = new QLineEdit (theParent); - aLineEdit->setValidator (new QDoubleValidator (theParent)); - return aLineEdit; - } - case ViewControl_EditType_Line: return new QLineEdit (theParent); - case ViewControl_EditType_Spin: - { - QSpinBox* aSpinBox = new QSpinBox (theParent); - aSpinBox->setRange (IntegerFirst(), IntegerLast()); - return aSpinBox; - } - case ViewControl_EditType_DoAction: return new QPushButton (theParent); - case ViewControl_EditType_DoubleVector: return new ViewControl_TableDoubleVector(theParent); - - default: return 0; - } -} - -// ======================================================================= -// function : initEditorParameters -// purpose : -// ======================================================================= - -void ViewControl_TableItemDelegate::initEditorParameters (QWidget* theEditor, - const ViewControl_EditType theEditType, - ViewControl_TableModelValues*, - const int, const int) -{ - switch (theEditType) - { - case ViewControl_EditType_Bool: - { - (qobject_cast (theEditor))->insertItem(0, "true"); - (qobject_cast (theEditor))->insertItem(1, "false"); - break; - } - case ViewControl_EditType_Double: - { - } - default: break; - } -} - -// ======================================================================= -// function : setEditorValue -// purpose : -// ======================================================================= - -void ViewControl_TableItemDelegate::setEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType, - const QVariant& theValue) -{ - switch (theEditType) - { - case ViewControl_EditType_None: break; - case ViewControl_EditType_Bool: (qobject_cast(theEditor))->setCurrentIndex (theValue.toBool() ? 0 : 1); break; - case ViewControl_EditType_Color: (qobject_cast(theEditor))->SetColor (theValue.toString()); break; - case ViewControl_EditType_Double: - case ViewControl_EditType_Line: (qobject_cast(theEditor))->setText (theValue.toString()); break; - case ViewControl_EditType_Spin: (qobject_cast(theEditor))->setValue (theValue.toInt()); break; - case ViewControl_EditType_DoAction: (qobject_cast(theEditor))->setText ("UnSelect"); break; - case ViewControl_EditType_DoubleVector: (qobject_cast(theEditor))->SetVectorValue(theValue.toString()); break; - - default: break; - } -} - -// ======================================================================= -// function : getEditorValue -// purpose : -// ======================================================================= - -QVariant ViewControl_TableItemDelegate::getEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType) -{ - switch (theEditType) - { - case ViewControl_EditType_None: return QVariant(); - case ViewControl_EditType_Bool: return (qobject_cast(theEditor))->currentIndex() == 0 ? true : false; - case ViewControl_EditType_Color: return (qobject_cast(theEditor))->GetColor(); - case ViewControl_EditType_Double: - case ViewControl_EditType_Line: return (qobject_cast(theEditor))->text(); - case ViewControl_EditType_Spin: return (qobject_cast(theEditor))->value(); - case ViewControl_EditType_DoAction: return QVariant ("Clicked"); - case ViewControl_EditType_DoubleVector: return (qobject_cast(theEditor))->GetVector(); - - default: return QVariant(); - } -} diff --git a/tools/ViewControl/ViewControl_TableItemDelegate.hxx b/tools/ViewControl/ViewControl_TableItemDelegate.hxx deleted file mode 100644 index b266d3b7bf..0000000000 --- a/tools/ViewControl/ViewControl_TableItemDelegate.hxx +++ /dev/null @@ -1,98 +0,0 @@ -// Created on: 2018-08-09 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_TableItemDelegate_H -#define ViewControl_TableItemDelegate_H - -#include -#include - -#include -#include -#include - -class ViewControl_TableModelValues; - -//! \class ViewControl_TableItemDelegate -//! \brief This is an implementation for ViewControl_TableModel to present AIS_InteractiveContext object -class ViewControl_TableItemDelegate : public QItemDelegate -{ -public: - - //! Constructor - //! \param theParent parent object - Standard_EXPORT ViewControl_TableItemDelegate (QObject* theParent = 0); - - //! Destructor - virtual ~ViewControl_TableItemDelegate() Standard_OVERRIDE {} - - //! Sets table model values - //! \param theModelValues instance of model values - void SetModelValues (ViewControl_TableModelValues* theModelValues) { myModelValues = theModelValues; } - - //! Creates widget editor: spin box, combo box or line edit - //! \param theParent parent widget - //! \param theOption style option - //! \param theIndex index of requested widget - virtual QWidget* createEditor (QWidget* theParent, const QStyleOptionViewItem& theOption, - const QModelIndex& theIndex) const Standard_OVERRIDE; - - //! Sets the data to be displayed and edited by the editor from the data model item specified by the model index - //! \param theEditor editor to be filled - //! \param theIndex index of requested widget, contains information about model - virtual void setEditorData (QWidget* theEditor, const QModelIndex& theIndex) const Standard_OVERRIDE; - - //! Gets data from the editor widget and stores it in the specified model at the item index. - //! \param theEditor editor to be filled - //! \param theModel data model - //! \param theIndex index of requested widget, contains information about model - virtual void setModelData (QWidget* theEditor, QAbstractItemModel* theModel, - const QModelIndex& theIndex) const Standard_OVERRIDE; - -private: - //! Creates an editor - //! \param theParent parent widget - //! \param theEditType edition control type - //! \return edit control - static QWidget* createEditorControl (QWidget* theParent, const ViewControl_EditType theEditType); - - //! Inits an editor by model values parameters - //! \param theEditor editor - //! \param theEditType edition control type - //! \param theModelValues custom implementation to provide parameters - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit control - static void initEditorParameters (QWidget* theEditor, const ViewControl_EditType theEditType, - ViewControl_TableModelValues* theModelValues, - const int theRow, const int theColumn); - - //! Sets editor value - //! \param theEditor editor - //! \param theEditType editor typ - //! \param theValue new value - static void setEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType, const QVariant& theValue); - - //! Returns value of spin box editor - //! \param theEditor editor - //! \param theEditType editor typ - //! \return current value - static QVariant getEditorValue (QWidget* theEditor, const ViewControl_EditType theEditType); - -private: - ViewControl_TableModelValues* myModelValues; //!< table model values -}; - -#endif diff --git a/tools/ViewControl/ViewControl_TableModel.cxx b/tools/ViewControl/ViewControl_TableModel.cxx deleted file mode 100644 index c3b43209b8..0000000000 --- a/tools/ViewControl/ViewControl_TableModel.cxx +++ /dev/null @@ -1,78 +0,0 @@ -// 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 - -// ======================================================================= -// function : SetModelValues -// purpose : -// ======================================================================= -void ViewControl_TableModel::SetModelValues (ViewControl_TableModelValues* theModelValues) -{ - if (myModelValues) - delete myModelValues; - - myModelValues = theModelValues; -} - -// ======================================================================= -// function : columnCount -// purpose : -// ======================================================================= -int ViewControl_TableModel::columnCount(const QModelIndex& theParent) const -{ - if (!myModelValues) - return 0; - - return myModelValues->ColumnCount (theParent); -} - -// ======================================================================= -// function : rowCount -// purpose : -// ======================================================================= -int ViewControl_TableModel::rowCount(const QModelIndex& theParent ) const -{ - if (!myModelValues) - return 0; - - return myModelValues->RowCount (theParent); -} - -// ======================================================================= -// function : data -// purpose : -// ======================================================================= -QVariant ViewControl_TableModel::data (const QModelIndex& theIndex, int theRole) const -{ - if (!myModelValues) - return QVariant(); - - int aRow = theIndex.row(), aColumn = theIndex.column(); - return myModelValues->Data (aRow, aColumn, theRole); -} - -// ======================================================================= -// function : setData -// purpose : -// ======================================================================= -bool ViewControl_TableModel::setData (const QModelIndex& theIndex, const QVariant& theValue, int theRole) -{ - if (!myModelValues) - return false; - - int aRow = theIndex.row(), aColumn = theIndex.column(); - return myModelValues->SetData (aRow, aColumn, theValue, theRole); -} diff --git a/tools/ViewControl/ViewControl_TableModel.hxx b/tools/ViewControl/ViewControl_TableModel.hxx deleted file mode 100644 index d0459ea68e..0000000000 --- a/tools/ViewControl/ViewControl_TableModel.hxx +++ /dev/null @@ -1,100 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_TableModel_H -#define ViewControl_TableModel_H - -#include - -#include - -#include -#include -#include -#include -#include - -#include - -//! \class ViewControl_TableModel -//! \brief This is an extension of table model to visualize a container of values -//! It is possible to: -//! - set orientation to interpretate the values. -//! - set table view header values. -//! Items of the view are enabled and selectable. -class ViewControl_TableModel : public QAbstractTableModel -{ -public: - - //! Constructor - ViewControl_TableModel (QObject* theParent = 0) : myModelValues (0) { (void)theParent; } - - //! Destructor - virtual ~ViewControl_TableModel() {} - - //! Sets interface to table values - //! \theModelValues instance of values - Standard_EXPORT void SetModelValues (ViewControl_TableModelValues* theModelValues); - - //! Returns instance of interface for access totable values - //! \return interface or NULL - ViewControl_TableModelValues* GetModelValues() const { return myModelValues; } - - //! Emits the layoutChanged signal from outside of this class - void EmitLayoutChanged() { emit layoutChanged(); } - - //! Returns number of columns, 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 columnCount(const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE; - - //! Returns number of rows, depending on orientation: myColumnCount or size of values container - //! \param theParent an index of the parent item - //! \return an integer value - Standard_EXPORT virtual int rowCount(const QModelIndex& theParent = QModelIndex()) 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 theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant data (const QModelIndex& theIndex, int theRole = Qt::DisplayRole) const Standard_OVERRIDE; - - //! Sets the new value of passed role to tree cell. - //! \param[in] index refers to item in tree. - //! \param[in] value the new value. - //! \param[in] role the role of value. - Standard_EXPORT virtual bool setData (const QModelIndex& theIndex, const QVariant& theValue, int theRole) Standard_OVERRIDE; - - //! Returns content of the model index for the given role, it is obtainer from internal container of header values - //! It returns value only for DisplayRole. - //! \param theSection an index of value in the container - //! \param theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - virtual QVariant headerData (int theSection, Qt::Orientation theOrientation, int theRole = Qt::DisplayRole) const Standard_OVERRIDE - { return myModelValues ? myModelValues->HeaderData (theSection, theOrientation, theRole) : QVariant(); } - - //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable - //! \param theIndex a model index - //! \return flags - Qt::ItemFlags flags (const QModelIndex& theIndex) const - { return myModelValues ? myModelValues->Flags (theIndex) : Qt::NoItemFlags; } - -private: - ViewControl_TableModelValues* myModelValues; //! interface to table values -}; - -#endif diff --git a/tools/ViewControl/ViewControl_TableModelValues.cxx b/tools/ViewControl/ViewControl_TableModelValues.cxx deleted file mode 100644 index 3d12d42db5..0000000000 --- a/tools/ViewControl/ViewControl_TableModelValues.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// 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 - -#include -#include -#include -#include - -// ======================================================================= -// function : ColumnCount -// purpose : -// ======================================================================= - -int ViewControl_TableModelValues::ColumnCount (const QModelIndex&) const -{ - if (!GetProperties().IsNull()) - return GetProperties()->ColumnCount(); - - return 0; -} - - -// ======================================================================= -// function : RowCount -// purpose : -// ======================================================================= - -int ViewControl_TableModelValues::RowCount (const QModelIndex&) const -{ - if (!GetProperties().IsNull()) - return GetProperties()->RowCount(); - - return 0; -} - -// ======================================================================= -// function : Data -// purpose : -// ======================================================================= - -QVariant ViewControl_TableModelValues::Data (const int theRow, const int theColumn, int theRole) const -{ - if (!GetProperties().IsNull()) - { - QVariant aValue = GetProperties()->Data (theRow, theColumn, theRole); - if (aValue.isValid()) - return aValue; - } - - if (theRole == Qt::TextAlignmentRole) // for multi-lines text, align it to the top - return Qt::AlignTop; - - if ((theRole == Qt::FontRole || theRole == Qt::ForegroundRole) && isItalicHeader (theRow, theColumn)) - { - if (theRole == Qt::FontRole) - { - QFont aFont = qApp->font(); - aFont.setItalic (true); - return aFont; - } - else - QColor (Qt::darkGray).darker (150); - } - return QVariant(); -} - -// ======================================================================= -// function : SetData -// purpose : -// ======================================================================= - -bool ViewControl_TableModelValues::SetData (const int theRow, const int theColumn, const QVariant& theValue, int) -{ - //if (!GetProperties().IsNull()) - // return GetProperties()->SetTableData (theRow, theColumn, theValue); - - return false; -} - -// ======================================================================= -// function : HeaderData -// purpose : -// ======================================================================= - -QVariant ViewControl_TableModelValues::HeaderData (int theSection, Qt::Orientation theOrientation, int theRole) const -{ - if (theRole == Qt::DisplayRole) - return myHeaderValues.contains (theOrientation) ? myHeaderValues[theOrientation][theSection].GetName() - : QString::number (theSection + 1); - else if (theRole == Qt::ForegroundRole) - return QColor (Qt::darkGray); - - return QVariant(); -} - -// ======================================================================= -// function : GetEditType -// purpose : -// ======================================================================= -ViewControl_EditType ViewControl_TableModelValues::GetEditType (const int theRow, const int theColumn) const -{ - //if (!GetProperties().IsNull()) - //{ - // return GetProperties()->GetTableEditType (theRow, theColumn); - //} - return ViewControl_EditType_None; -} - -// ======================================================================= -// function : isItalicHeader -// purpose : -// ======================================================================= -Qt::ItemFlags ViewControl_TableModelValues::Flags (const QModelIndex& theIndex) const -{ - if (!GetProperties().IsNull()) - { - return GetProperties()->GetTableFlags (theIndex.row(), theIndex.column()); - } - return theIndex.isValid() ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::NoItemFlags; -} - -// ======================================================================= -// function : isItalicHeader -// purpose : -// ======================================================================= -bool ViewControl_TableModelValues::isItalicHeader (const int theRow, const int theColumn) const -{ - Qt::Orientation anOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical; - int aCell = anOrientation == Qt::Horizontal ? theColumn : theRow; - - return GetHeaderItem (anOrientation, aCell).IsItalic(); -} diff --git a/tools/ViewControl/ViewControl_TableModelValues.hxx b/tools/ViewControl/ViewControl_TableModelValues.hxx deleted file mode 100644 index ee8bb6b9af..0000000000 --- a/tools/ViewControl/ViewControl_TableModelValues.hxx +++ /dev/null @@ -1,168 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_TableModelValues_H -#define ViewControl_TableModelValues_H - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -class QItemDelegate; - -//! \class ViewControl_TableModelValues -//! \brief This is an interace for ViewControl_TableModel to give real values of the model -//! It should be filled or redefined. -class ViewControl_TableModelValues -{ -public: - - //! Constructor - Standard_EXPORT ViewControl_TableModelValues (const Qt::Orientation& theOrientation = Qt::Vertical) - { SetOrientation (theOrientation); } - - //! Destructor - virtual ~ViewControl_TableModelValues() {} - - //! Sets item table properties builder - void SetProperties (const Handle(TreeModel_ItemProperties)& theProperties) { myProperties = theProperties; } - - //! Returns item table properties builder - Handle(TreeModel_ItemProperties) GetProperties() const { return myProperties; } - - //! Sets direction of the values applying, whether it should be placed by rows or by columns - //! \param theOrientation if horizontal, the values are applyed by rows, otherwise by columns - void SetOrientation (const Qt::Orientation& theOrientation) { myOrientation = theOrientation; } - - //! Fills the model header values for orientation. - //! \param theValues a container of header text values - //! \param theOrientation an orientation of header - void SetHeaderValues (const QList& theValues, const Qt::Orientation theOrientation) - { myHeaderValues.insert (theOrientation, theValues); } - - //! Returns whether the column is hidden by default - //! \param theColumnId a column index - //! \return header section values container - TreeModel_HeaderSection GetHeaderItem (const Qt::Orientation theOrientation, const int theColumnId) const - { return myHeaderValues.contains(theOrientation) ? myHeaderValues[theOrientation][theColumnId] : TreeModel_HeaderSection(); } - - //! Stores information about table view header visibility - //! \param theOrientation an orientation of header - //! \param theVisibility if true, header is visible - void SetHeaderVisible (const Qt::Orientation theOrientation, const bool theVisibility) - { myVisibleHeader.insert (theOrientation, theVisibility); } - - //! Stores information about table view header visibility - //! \param theOrientation an orientation of header - //! \param theVisibility if true, header is visible - bool IsHeaderVisible (const Qt::Orientation theOrientation) const - { return myVisibleHeader.contains(theOrientation) ? myVisibleHeader[theOrientation] : true; } - - //! Set default section size if defined - //! \param theOrientation an orientation of header - //! \param theVisibility if true, header is visible - void SetDefaultSectionSize (const Qt::Orientation theOrientation, const int& theSectionSize) - { myDefaultSectionSize.insert(theOrientation, theSectionSize); } - - //! Get default section size if defined - //! \param theOrientation an orientation of header - //! \param theVisibility if true, header is visible - bool GetDefaultSectionSize (const Qt::Orientation theOrientation, int& theSectionSize) - { - theSectionSize = myDefaultSectionSize.contains (theOrientation) ? myDefaultSectionSize[theOrientation] : -1; - return myDefaultSectionSize.contains (theOrientation); - } - - //! 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 = QModelIndex()) const; - - //! Returns content of the model index for the given role, it is obtained from internal container of values - //! It returns value only for DisplayRole. - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const; - - //! Sets content of the model index for the given role, it is applyed to internal container of values - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return true if the value is changed - Standard_EXPORT virtual bool SetData (const int theRow, const int theColumn, const QVariant& theValue, - int theRole = Qt::DisplayRole); - - //! Returns content of the model index for the given role, it is obtainer from internal container of header values - //! It returns value only for DisplayRole. - //! \param theSection an index of value in the container - //! \param theIndex a model index - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant HeaderData (int theSection, Qt::Orientation theOrientation, int theRole = Qt::DisplayRole) const; - - //! Returns flags for the item: ItemIsEnabled | Qt::ItemIsSelectable - //! \param theIndex a model index - //! \return flags - Standard_EXPORT virtual Qt::ItemFlags Flags (const QModelIndex& theIndex) const; - - //! Returns item delegate to provide cell editors. By default, it is empty - //! \return delegate - virtual QItemDelegate* GetItemDelegate() { return 0; } - - //! Returns type of edit control for the model index. By default, it is an empty control - //! \param theRow a model index row - //! \param theColumn a model index column - //! \return edit type - Standard_EXPORT virtual ViewControl_EditType GetEditType (const int theRow, const int theColumn) const; - - //! Returns default color for editable cell - //! \return color value - static QColor EditCellColor() { return QColor (Qt::darkBlue); } - -protected: - //! Returns true if the header item is italic of the parameter index - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param boolean value - bool isItalicHeader (const int theRow, const int theColumn) const; - -protected: - - Qt::Orientation myOrientation; //!< orientation how the values should fill the current table view - QMap > myHeaderValues; //!< table header values - QMap myVisibleHeader; //! table header visibility - QMap myDefaultSectionSize; //! table section default size - - Handle(TreeModel_ItemProperties) myProperties; //!< item properties -}; - -#endif diff --git a/tools/ViewControl/ViewControl_TableModelValuesDefault.cxx b/tools/ViewControl/ViewControl_TableModelValuesDefault.cxx deleted file mode 100644 index 104bfbe5de..0000000000 --- a/tools/ViewControl/ViewControl_TableModelValuesDefault.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// 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 - -#include -#include -#include -#include - -// ======================================================================= -// function : ColumnCount -// purpose : -// ======================================================================= - -int ViewControl_TableModelValuesDefault::ColumnCount (const QModelIndex&) const -{ - Qt::Orientation anAdditionalOrientation = myOrientation == Qt::Vertical ? Qt::Horizontal : Qt::Vertical; - if (myHeaderValues[anAdditionalOrientation].size() > 0) - return myHeaderValues[anAdditionalOrientation].size(); - - return myValues.size(); -} - -// ======================================================================= -// function : Data -// purpose : -// ======================================================================= - -QVariant ViewControl_TableModelValuesDefault::Data (const int theRow, const int theColumn, int theRole) const -{ - if (theRole == Qt::DisplayRole) - return myValues.at ((int)getPosition (theRow, theColumn)); - - return ViewControl_TableModelValues::Data (theRow, theColumn, theRole); -} diff --git a/tools/ViewControl/ViewControl_TableModelValuesDefault.hxx b/tools/ViewControl/ViewControl_TableModelValuesDefault.hxx deleted file mode 100644 index bda3b94d75..0000000000 --- a/tools/ViewControl/ViewControl_TableModelValuesDefault.hxx +++ /dev/null @@ -1,92 +0,0 @@ -// Created on: 2017-06-16 -// Created by: Natalia ERMOLAEVA -// Copyright (c) 2017 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#ifndef ViewControl_TableModelValuesDefault_H -#define ViewControl_TableModelValuesDefault_H - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -class QItemDelegate; - -//! \class ViewControl_TableModelValuesDefault -//! \brief This is an interace for ViewControl_TableModel to give real values of the model -//! It should be filled or redefined. -class ViewControl_TableModelValuesDefault : public ViewControl_TableModelValues -{ -public: - - //! Constructor - Standard_EXPORT ViewControl_TableModelValuesDefault (const Qt::Orientation& theOrientation = Qt::Vertical) - : ViewControl_TableModelValues (theOrientation) {} - - //! Destructor - virtual ~ViewControl_TableModelValuesDefault() {} - - //! Fills the model values. - //! \param theValues a container of table model values - void SetValues (const QVector& theValues) { myValues = theValues; } - - //! Returns number of columns, size of header values - //! \param theParent an index of the parent item - //! \return an integer value - Standard_EXPORT virtual int ColumnCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE; - - //! Returns number of rows, depending on orientation: myColumnCount or size of values container - //! \param theParent an index of the parent item - //! \return an integer value - virtual int RowCount (const QModelIndex& theParent = QModelIndex()) const Standard_OVERRIDE - { return ColumnCount (theParent) > 0 ? GetValuesCount() / ColumnCount (theParent) : 0; } - - //! Returns content of the model index for the given role, it is obtained from internal container of values - //! It returns value only for DisplayRole. - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param theRole a view role - //! \return value intepreted depending on the given role - Standard_EXPORT virtual QVariant Data (const int theRow, const int theColumn, int theRole = Qt::DisplayRole) const Standard_OVERRIDE; - - //! Returns number of rows, depending on orientation: myColumnCount or size of values container - //! \param theParent an index of the parent item - //! \return an integer value - virtual int GetValuesCount () const { return myValues.size(); } - -protected: - //! Finds position in internal vector of values using the table column/row count - //! \param theRow a row of a table cell - //! \param theColumn a column of a table cell - size_t getPosition (const int theRow, const int theColumn) const { return ColumnCount() * theRow + theColumn; } - - //! Returns true if the header item is italic of the parameter index - //! \param theRow a model index row - //! \param theColumn a model index column - //! \param boolean value - bool isItalicHeader (const int theRow, const int theColumn) const; - -protected: - - QVector myValues; //! cached container of table values -}; - -#endif diff --git a/tools/ViewControl/ViewControl_Tools.cxx b/tools/ViewControl/ViewControl_Tools.cxx index 20dbad1a38..99d3e441ef 100644 --- a/tools/ViewControl/ViewControl_Tools.cxx +++ b/tools/ViewControl/ViewControl_Tools.cxx @@ -14,25 +14,11 @@ // commercial license or contractual agreement. #include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include #include #include -#include #include #include @@ -57,217 +43,3 @@ void ViewControl_Tools::SetWhiteBackground (QWidget* theControl) aPalette.setColor (QPalette::All, QPalette::Foreground, Qt::white); theControl->setPalette (aPalette); } - -// ======================================================================= -// function : SetDefaultHeaderSections -// purpose : -// ======================================================================= -void ViewControl_Tools::SetDefaultHeaderSections(QTableView* theTableView, const Qt::Orientation theOrientation) -{ - ViewControl_TableModel * aTableModel = dynamic_cast (theTableView->model()); - ViewControl_TableModelValues* aModelValues = aTableModel->GetModelValues(); - if (!aModelValues) - return; - - int aSectionSize; - if (aModelValues->GetDefaultSectionSize (Qt::Horizontal, aSectionSize) ) - theTableView->horizontalHeader()->setDefaultSectionSize (aSectionSize); - else { - bool isStretchLastSection = true; - for (int aColumnId = 0, aNbColumns = aTableModel->columnCount(); aColumnId < aNbColumns; aColumnId++) - { - TreeModel_HeaderSection aSection = aModelValues->GetHeaderItem (theOrientation, aColumnId); - if (aSection.IsEmpty()) - continue; - - int aColumnWidth = aSection.GetWidth(); - if (aColumnWidth > 0) - { - theTableView->setColumnWidth (aColumnId, aColumnWidth); - if (aColumnId == aNbColumns - 1) - isStretchLastSection = false; - } - theTableView->setColumnHidden (aColumnId, aSection.IsHidden()); - } - if (isStretchLastSection != theTableView->horizontalHeader()->stretchLastSection()) - theTableView->horizontalHeader()->setStretchLastSection (isStretchLastSection); - - } -} - -// ======================================================================= -// function : GetPointerInfo -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const Handle(Standard_Transient)& thePointer, const bool isShortInfo) -{ - return Standard_Dump::GetPointerInfo (thePointer, isShortInfo); - /*if (thePointer.IsNull()) - return TCollection_AsciiString(); - - return GetPointerInfo(thePointer.operator->(), isShortInfo);*/ -} - -// ======================================================================= -// function : GetPointerInfo -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::GetPointerInfo (const void* thePointer, const bool isShortInfo) -{ - return Standard_Dump::GetPointerInfo (thePointer, 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();*/ -} - -// ======================================================================= -// function : ToVariant -// purpose : -// ======================================================================= -QVariant ViewControl_Tools::ToVariant (const Standard_ShortReal theValue) -{ - return QVariant (QLocale().toString (theValue)); -} - -// ======================================================================= -// function : ToVariant -// purpose : -// ======================================================================= -QVariant ViewControl_Tools::ToVariant (const Standard_Real theValue) -{ - return QVariant (QLocale().toString (theValue)); -} - -// ======================================================================= -// function : ToRealValue -// purpose : -// ======================================================================= -Standard_ShortReal ViewControl_Tools::ToShortRealValue (const QVariant& theValue) -{ - return QLocale().toFloat (theValue.toString()); -} - -// ======================================================================= -// function : ToRealValue -// purpose : -// ======================================================================= -Standard_Real ViewControl_Tools::ToRealValue (const QVariant& theValue) -{ - return QLocale().toDouble (theValue.toString()); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const Handle(Geom_Transformation)& theValue) -{ - if (theValue.IsNull()) - return TCollection_AsciiString(); - - return ViewControl_Tools::ToString (theValue->Trsf()); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const gp_Trsf& theValue) -{ - TCollection_AsciiString aValues; - for (int aRowId = 1; aRowId <= 3; aRowId++) - { - for (int aColId = 1; aColId <= 4; aColId++) { - aValues += TCollection_AsciiString (theValue.Value(aRowId, aColId)); - if (aColId != 4) - aValues += ","; - } - if (aRowId != 3) - aValues += " "; - } - return aValues; -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const gp_Pnt& thePoint) -{ - return TCollection_AsciiString (thePoint.X()) + "," - + TCollection_AsciiString (thePoint.Y()) + "," - + TCollection_AsciiString (thePoint.Z()); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const gp_Dir& theDir) -{ - return TCollection_AsciiString (theDir.X()) + "," - + TCollection_AsciiString (theDir.Y()) + "," - + TCollection_AsciiString (theDir.Z()); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const gp_XYZ& theValue) -{ - return TCollection_AsciiString (theValue.X()) + "," - + TCollection_AsciiString (theValue.Y()) + "," - + TCollection_AsciiString (theValue.Z()); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const Bnd_Box& theValue) -{ - if (theValue.IsVoid()) - return "Bnd_Box is void"; - - return QString ("(%1, %2, %3), (%4, %5, %6)") - .arg (theValue.CornerMin().X()).arg (theValue.CornerMin().Y()).arg (theValue.CornerMin().Z()) - .arg (theValue.CornerMax().X()).arg (theValue.CornerMax().Y()).arg (theValue.CornerMax().Z()).toStdString().c_str(); - -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const Handle(TColgp_HArray1OfPnt)& thePoints) -{ - QStringList aPointList; - for (Standard_Integer aPntIter = thePoints->Lower(); aPntIter <= thePoints->Upper(); ++aPntIter) - aPointList.append(ViewControl_Tools::ToString (thePoints->Value (aPntIter)).ToCString()); - - return aPointList.join(" ,").toStdString().c_str(); -} - -// ======================================================================= -// function : ToString -// purpose : -// ======================================================================= -TCollection_AsciiString ViewControl_Tools::ToString (const TopLoc_Location& theLocation) -{ - return ToString (theLocation.Transformation()); -} diff --git a/tools/ViewControl/ViewControl_Tools.hxx b/tools/ViewControl/ViewControl_Tools.hxx index 8af7a1dd8f..7dd4bd4b39 100644 --- a/tools/ViewControl/ViewControl_Tools.hxx +++ b/tools/ViewControl/ViewControl_Tools.hxx @@ -16,29 +16,15 @@ #ifndef ViewControl_Tools_H #define ViewControl_Tools_H -#include -#include -#include -#include -#include -#include #include #include -#include -#include -#include -#include #include #include -#include #include -class Geom_Transformation; - class QAction; class QObject; -class QTableView; class QWidget; //! \class ViewControl_Tools @@ -46,9 +32,6 @@ class QWidget; class ViewControl_Tools { public: - //! Returns text of separation row in table - //! \return string value - static QString TableSeparator() { return "---------------------------"; } //! Creates an action with the given text connected to the slot //! \param theText an action text value @@ -63,88 +46,6 @@ public: //! \param theControl a widget to be modified Standard_EXPORT static void SetWhiteBackground (QWidget* theControl); - //! Fills tree view by default sections parameters obtained in view's table model - //! \param theTableView table view instance - //! \param theOrientation header orientation - Standard_EXPORT static void SetDefaultHeaderSections (QTableView* theTableView, const Qt::Orientation theOrientation); - - //! Returns default prefix added for each pointer info string - Standard_EXPORT static TCollection_AsciiString GetPointerPrefix() { return "0x"; } - - //! Convert handle pointer to string value - //! \param thePointer a pointer - //! \param isShortInfo if true, all '0' symbols in the beginning of the pointer are skipped - //! \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); - - //! Convert real value to string value - //! \param theValue a short real value - //! \return the string value - Standard_EXPORT static QVariant ToVariant (const Standard_ShortReal theValue); - - //! Convert real value to string value - //! \param theValue a real value - //! \return the string value - Standard_EXPORT static QVariant ToVariant (const Standard_Real theValue); - - //! Convert real value to real value - //! \param theValue a string value - //! \return the real value - Standard_EXPORT static Standard_ShortReal ToShortRealValue (const QVariant& theValue); - - //! Convert real value to string value - //! \param theValue a string value - //! \return the real value - Standard_EXPORT static Standard_Real ToRealValue (const QVariant& theValue); - - //! Returns text of orientation - //! \param theLocation a location value - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const Handle(Geom_Transformation)& theValue); - - //! Returns text of orientation - //! \param theLocation a location value - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const gp_Trsf& theValue); - - //! Returns text of point - //! \param theValue a 3D point - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const gp_Pnt& thePoint); - - //! Returns text of direction - //! \param theValue a direction - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const gp_Dir& theDir); - - //! Returns text of cartesian entity in 3D space - //! \param theValue an entity - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const gp_XYZ& theValue); - - //! Returns text of bounding box in form: (xmin, ymin, zmin), (xmax, ymax, zmax) - //! \param theValue a bounding box - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const Bnd_Box& theValue); - - //! Returns text of array of points - //! \param thePoints points - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const Handle(TColgp_HArray1OfPnt)& thePoints); - - //! Returns text of location - //! \param theLocation object location - //! \return text value - Standard_EXPORT static TCollection_AsciiString ToString (const TopLoc_Location& theLocation); - }; #endif -- 2.39.5