From 1c3be190d5574c6ded1693ee081edf1472342e8c Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 14 Feb 2007 18:23:36 +0000 Subject: [PATCH] no message --- src/CAF/CAF.h | 55 - src/CAF/CAF_Application.cxx | 302 --- src/CAF/CAF_Application.h | 88 - src/CAF/CAF_Operation.cxx | 51 - src/CAF/CAF_Operation.h | 52 - src/CAF/CAF_Study.cxx | 444 ---- src/CAF/CAF_Study.h | 95 - src/CAF/CAF_Tools.cxx | 85 - src/CAF/CAF_Tools.h | 53 - src/CAF/Makefile.in | 71 - src/CAF/resources/CAF_images.po | 34 - src/CAF/resources/CAF_msg_en.po | 67 - src/CAF/resources/redo.png | Bin 211 -> 0 bytes src/CAF/resources/undo.png | Bin 210 -> 0 bytes src/CAM/CAM.h | 46 - src/CAM/CAM_Application.cxx | 533 ---- src/CAM/CAM_Application.h | 109 - src/CAM/CAM_DataModel.cxx | 85 - src/CAM/CAM_DataModel.h | 79 - src/CAM/CAM_DataObject.cxx | 61 - src/CAM/CAM_DataObject.h | 47 - src/CAM/CAM_Module.cxx | 683 ----- src/CAM/CAM_Module.h | 164 -- src/CAM/CAM_RootObject.cxx | 73 - src/CAM/CAM_RootObject.h | 52 - src/CAM/CAM_Study.cxx | 175 -- src/CAM/CAM_Study.h | 84 - src/CAM/Makefile.in | 65 - src/CAM/resources/CAM_msg_en.po | 34 - src/DDS/DDS.h | 35 - src/DDS/DDS_DicGroup.cxx | 188 -- src/DDS/DDS_DicGroup.h | 79 - src/DDS/DDS_DicItem.cxx | 1128 -------- src/DDS/DDS_DicItem.h | 219 -- src/DDS/DDS_Dictionary.cxx | 510 ---- src/DDS/DDS_Dictionary.h | 79 - src/DDS/DDS_KeyWords.cxx | 174 -- src/DDS/DDS_KeyWords.h | 55 - src/DDS/Makefile.in | 52 - src/Event/Event.h | 50 - src/Event/Makefile.in | 53 - src/Event/SALOME_Event.cxx | 119 - src/Event/SALOME_Event.hxx | 274 -- src/GLViewer/GLViewer.h | 37 - src/GLViewer/GLViewer_AspectLine.cxx | 234 -- src/GLViewer/GLViewer_AspectLine.h | 120 - src/GLViewer/GLViewer_BaseDrawers.cxx | 329 --- src/GLViewer/GLViewer_BaseDrawers.h | 98 - src/GLViewer/GLViewer_BaseObjects.cxx | 1711 ------------ src/GLViewer/GLViewer_BaseObjects.h | 255 -- src/GLViewer/GLViewer_Compass.cxx | 161 -- src/GLViewer/GLViewer_Compass.h | 149 -- src/GLViewer/GLViewer_Context.cxx | 710 ----- src/GLViewer/GLViewer_Context.h | 208 -- src/GLViewer/GLViewer_CoordSystem.cxx | 200 -- src/GLViewer/GLViewer_CoordSystem.h | 107 - src/GLViewer/GLViewer_Defs.h | 66 - src/GLViewer/GLViewer_Drawer.cxx | 1187 --------- src/GLViewer/GLViewer_Drawer.h | 450 ---- src/GLViewer/GLViewer_Geom.cxx | 231 -- src/GLViewer/GLViewer_Geom.h | 198 -- src/GLViewer/GLViewer_Grid.cxx | 351 --- src/GLViewer/GLViewer_Grid.h | 122 - src/GLViewer/GLViewer_Group.cxx | 159 -- src/GLViewer/GLViewer_Group.h | 76 - src/GLViewer/GLViewer_MimeSource.cxx | 247 -- src/GLViewer/GLViewer_MimeSource.h | 74 - src/GLViewer/GLViewer_Object.cxx | 329 --- src/GLViewer/GLViewer_Object.h | 310 --- src/GLViewer/GLViewer_Selector.cxx | 68 - src/GLViewer/GLViewer_Selector.h | 93 - src/GLViewer/GLViewer_Selector2d.cxx | 196 -- src/GLViewer/GLViewer_Selector2d.h | 74 - src/GLViewer/GLViewer_Text.cxx | 198 -- src/GLViewer/GLViewer_Text.h | 114 - src/GLViewer/GLViewer_ToolTip.cxx | 228 -- src/GLViewer/GLViewer_ToolTip.h | 79 - src/GLViewer/GLViewer_Tools.cxx | 1223 --------- src/GLViewer/GLViewer_Tools.h | 246 -- src/GLViewer/GLViewer_ViewFrame.cxx | 600 ----- src/GLViewer/GLViewer_ViewFrame.h | 128 - src/GLViewer/GLViewer_ViewManager.cxx | 49 - src/GLViewer/GLViewer_ViewManager.h | 46 - src/GLViewer/GLViewer_ViewPort.cxx | 601 ----- src/GLViewer/GLViewer_ViewPort.h | 177 -- src/GLViewer/GLViewer_ViewPort2d.cxx | 1393 ---------- src/GLViewer/GLViewer_ViewPort2d.h | 246 -- src/GLViewer/GLViewer_Viewer.cxx | 860 ------ src/GLViewer/GLViewer_Viewer.h | 227 -- src/GLViewer/GLViewer_Viewer2d.cxx | 1092 -------- src/GLViewer/GLViewer_Viewer2d.h | 254 -- src/GLViewer/GLViewer_Widget.cxx | 724 ----- src/GLViewer/GLViewer_Widget.h | 210 -- src/GLViewer/Makefile.in | 121 - src/GLViewer/resources/GLViewer_images.po | 63 - src/GLViewer/resources/GLViewer_msg_en.po | 108 - src/GLViewer/resources/cursor_rotate.png | Bin 291 -> 0 bytes src/GLViewer/resources/cursor_sketch.png | Bin 278 -> 0 bytes src/GLViewer/resources/cursor_zoom.png | Bin 245 -> 0 bytes src/GLViewer/resources/view_dump.png | Bin 518 -> 0 bytes src/GLViewer/resources/view_fitall.png | Bin 523 -> 0 bytes src/GLViewer/resources/view_fitarea.png | Bin 511 -> 0 bytes src/GLViewer/resources/view_fitselect.png | Bin 808 -> 0 bytes src/GLViewer/resources/view_glpan.png | Bin 540 -> 0 bytes src/GLViewer/resources/view_pan.png | Bin 545 -> 0 bytes src/GLViewer/resources/view_reset.png | Bin 477 -> 0 bytes src/GLViewer/resources/view_zoom.png | Bin 488 -> 0 bytes src/LightApp/LightApp.h | 46 - src/LightApp/LightApp_AboutDlg.cxx | 148 -- src/LightApp/LightApp_AboutDlg.h | 54 - src/LightApp/LightApp_Application.cxx | 2505 ------------------ src/LightApp/LightApp_Application.h | 259 -- src/LightApp/LightApp_DataModel.cxx | 158 -- src/LightApp/LightApp_DataModel.h | 72 - src/LightApp/LightApp_DataObject.cxx | 182 -- src/LightApp/LightApp_DataObject.h | 72 - src/LightApp/LightApp_DataOwner.cxx | 87 - src/LightApp/LightApp_DataOwner.h | 62 - src/LightApp/LightApp_DataSubOwner.cxx | 63 - src/LightApp/LightApp_DataSubOwner.h | 43 - src/LightApp/LightApp_Dialog.cxx | 906 ------- src/LightApp/LightApp_Dialog.h | 298 --- src/LightApp/LightApp_Displayer.cxx | 275 -- src/LightApp/LightApp_Displayer.h | 57 - src/LightApp/LightApp_Driver.cxx | 555 ---- src/LightApp/LightApp_Driver.h | 75 - src/LightApp/LightApp_EventFilter.cxx | 81 - src/LightApp/LightApp_EventFilter.h | 56 - src/LightApp/LightApp_GLSelector.cxx | 113 - src/LightApp/LightApp_GLSelector.h | 60 - src/LightApp/LightApp_HDFDriver.cxx | 345 --- src/LightApp/LightApp_HDFDriver.h | 41 - src/LightApp/LightApp_Module.cxx | 565 ---- src/LightApp/LightApp_Module.h | 151 -- src/LightApp/LightApp_ModuleDlg.cxx | 216 -- src/LightApp/LightApp_ModuleDlg.h | 64 - src/LightApp/LightApp_NameDlg.cxx | 149 -- src/LightApp/LightApp_NameDlg.h | 61 - src/LightApp/LightApp_OBFilter.cxx | 47 - src/LightApp/LightApp_OBFilter.h | 44 - src/LightApp/LightApp_OBSelector.cxx | 146 - src/LightApp/LightApp_OBSelector.h | 69 - src/LightApp/LightApp_OCCSelector.cxx | 129 - src/LightApp/LightApp_OCCSelector.h | 59 - src/LightApp/LightApp_Operation.cxx | 298 --- src/LightApp/LightApp_Operation.h | 98 - src/LightApp/LightApp_Preferences.cxx | 105 - src/LightApp/LightApp_Preferences.h | 72 - src/LightApp/LightApp_PreferencesDlg.cxx | 158 -- src/LightApp/LightApp_PreferencesDlg.h | 61 - src/LightApp/LightApp_RootObject.h | 51 - src/LightApp/LightApp_Selection.cxx | 251 -- src/LightApp/LightApp_Selection.h | 76 - src/LightApp/LightApp_SelectionMgr.cxx | 332 --- src/LightApp/LightApp_SelectionMgr.h | 88 - src/LightApp/LightApp_ShowHideOp.cxx | 147 - src/LightApp/LightApp_ShowHideOp.h | 51 - src/LightApp/LightApp_Study.cxx | 464 ---- src/LightApp/LightApp_Study.h | 98 - src/LightApp/LightApp_SwitchOp.cxx | 171 -- src/LightApp/LightApp_SwitchOp.h | 77 - src/LightApp/LightApp_UpdateFlags.h | 49 - src/LightApp/LightApp_VTKSelector.cxx | 255 -- src/LightApp/LightApp_VTKSelector.h | 106 - src/LightApp/LightApp_WidgetContainer.cxx | 151 -- src/LightApp/LightApp_WidgetContainer.h | 60 - src/LightApp/Makefile.in | 227 -- src/LightApp/resources/LightApp.ini | 21 - src/LightApp/resources/LightApp.xml | 92 - src/LightApp/resources/LightApp_images.po | 51 - src/LightApp/resources/LightApp_msg_en.po | 352 --- src/LightApp/resources/icon_about.png | Bin 79549 -> 0 bytes src/LightApp/resources/icon_applogo.png | Bin 2383 -> 0 bytes src/LightApp/resources/icon_default.png | Bin 684 -> 0 bytes src/LightApp/resources/icon_module.png | Bin 1385 -> 0 bytes src/LightApp/resources/icon_module_big.png | Bin 3630 -> 0 bytes src/LightApp/resources/icon_select.png | Bin 976 -> 0 bytes src/ObjBrowser/Makefile.in | 60 - src/VTKViewer/resources/view_update_rate.png | Bin 971 -> 974 bytes 179 files changed, 36574 deletions(-) delete mode 100755 src/CAF/CAF.h delete mode 100755 src/CAF/CAF_Application.cxx delete mode 100755 src/CAF/CAF_Application.h delete mode 100755 src/CAF/CAF_Operation.cxx delete mode 100755 src/CAF/CAF_Operation.h delete mode 100755 src/CAF/CAF_Study.cxx delete mode 100755 src/CAF/CAF_Study.h delete mode 100755 src/CAF/CAF_Tools.cxx delete mode 100755 src/CAF/CAF_Tools.h delete mode 100755 src/CAF/Makefile.in delete mode 100755 src/CAF/resources/CAF_images.po delete mode 100755 src/CAF/resources/CAF_msg_en.po delete mode 100755 src/CAF/resources/redo.png delete mode 100755 src/CAF/resources/undo.png delete mode 100755 src/CAM/CAM.h delete mode 100755 src/CAM/CAM_Application.cxx delete mode 100755 src/CAM/CAM_Application.h delete mode 100755 src/CAM/CAM_DataModel.cxx delete mode 100755 src/CAM/CAM_DataModel.h delete mode 100755 src/CAM/CAM_DataObject.cxx delete mode 100755 src/CAM/CAM_DataObject.h delete mode 100755 src/CAM/CAM_Module.cxx delete mode 100755 src/CAM/CAM_Module.h delete mode 100755 src/CAM/CAM_RootObject.cxx delete mode 100755 src/CAM/CAM_RootObject.h delete mode 100755 src/CAM/CAM_Study.cxx delete mode 100755 src/CAM/CAM_Study.h delete mode 100755 src/CAM/Makefile.in delete mode 100755 src/CAM/resources/CAM_msg_en.po delete mode 100644 src/DDS/DDS.h delete mode 100644 src/DDS/DDS_DicGroup.cxx delete mode 100644 src/DDS/DDS_DicGroup.h delete mode 100644 src/DDS/DDS_DicItem.cxx delete mode 100644 src/DDS/DDS_DicItem.h delete mode 100644 src/DDS/DDS_Dictionary.cxx delete mode 100644 src/DDS/DDS_Dictionary.h delete mode 100644 src/DDS/DDS_KeyWords.cxx delete mode 100644 src/DDS/DDS_KeyWords.h delete mode 100755 src/DDS/Makefile.in delete mode 100755 src/Event/Event.h delete mode 100755 src/Event/Makefile.in delete mode 100755 src/Event/SALOME_Event.cxx delete mode 100755 src/Event/SALOME_Event.hxx delete mode 100644 src/GLViewer/GLViewer.h delete mode 100644 src/GLViewer/GLViewer_AspectLine.cxx delete mode 100644 src/GLViewer/GLViewer_AspectLine.h delete mode 100644 src/GLViewer/GLViewer_BaseDrawers.cxx delete mode 100644 src/GLViewer/GLViewer_BaseDrawers.h delete mode 100644 src/GLViewer/GLViewer_BaseObjects.cxx delete mode 100644 src/GLViewer/GLViewer_BaseObjects.h delete mode 100644 src/GLViewer/GLViewer_Compass.cxx delete mode 100644 src/GLViewer/GLViewer_Compass.h delete mode 100644 src/GLViewer/GLViewer_Context.cxx delete mode 100644 src/GLViewer/GLViewer_Context.h delete mode 100644 src/GLViewer/GLViewer_CoordSystem.cxx delete mode 100644 src/GLViewer/GLViewer_CoordSystem.h delete mode 100644 src/GLViewer/GLViewer_Defs.h delete mode 100644 src/GLViewer/GLViewer_Drawer.cxx delete mode 100644 src/GLViewer/GLViewer_Drawer.h delete mode 100644 src/GLViewer/GLViewer_Geom.cxx delete mode 100644 src/GLViewer/GLViewer_Geom.h delete mode 100644 src/GLViewer/GLViewer_Grid.cxx delete mode 100644 src/GLViewer/GLViewer_Grid.h delete mode 100644 src/GLViewer/GLViewer_Group.cxx delete mode 100644 src/GLViewer/GLViewer_Group.h delete mode 100644 src/GLViewer/GLViewer_MimeSource.cxx delete mode 100644 src/GLViewer/GLViewer_MimeSource.h delete mode 100644 src/GLViewer/GLViewer_Object.cxx delete mode 100644 src/GLViewer/GLViewer_Object.h delete mode 100644 src/GLViewer/GLViewer_Selector.cxx delete mode 100644 src/GLViewer/GLViewer_Selector.h delete mode 100644 src/GLViewer/GLViewer_Selector2d.cxx delete mode 100644 src/GLViewer/GLViewer_Selector2d.h delete mode 100644 src/GLViewer/GLViewer_Text.cxx delete mode 100644 src/GLViewer/GLViewer_Text.h delete mode 100644 src/GLViewer/GLViewer_ToolTip.cxx delete mode 100644 src/GLViewer/GLViewer_ToolTip.h delete mode 100644 src/GLViewer/GLViewer_Tools.cxx delete mode 100644 src/GLViewer/GLViewer_Tools.h delete mode 100644 src/GLViewer/GLViewer_ViewFrame.cxx delete mode 100644 src/GLViewer/GLViewer_ViewFrame.h delete mode 100644 src/GLViewer/GLViewer_ViewManager.cxx delete mode 100644 src/GLViewer/GLViewer_ViewManager.h delete mode 100644 src/GLViewer/GLViewer_ViewPort.cxx delete mode 100644 src/GLViewer/GLViewer_ViewPort.h delete mode 100644 src/GLViewer/GLViewer_ViewPort2d.cxx delete mode 100644 src/GLViewer/GLViewer_ViewPort2d.h delete mode 100644 src/GLViewer/GLViewer_Viewer.cxx delete mode 100644 src/GLViewer/GLViewer_Viewer.h delete mode 100644 src/GLViewer/GLViewer_Viewer2d.cxx delete mode 100644 src/GLViewer/GLViewer_Viewer2d.h delete mode 100644 src/GLViewer/GLViewer_Widget.cxx delete mode 100644 src/GLViewer/GLViewer_Widget.h delete mode 100644 src/GLViewer/Makefile.in delete mode 100644 src/GLViewer/resources/GLViewer_images.po delete mode 100644 src/GLViewer/resources/GLViewer_msg_en.po delete mode 100755 src/GLViewer/resources/cursor_rotate.png delete mode 100755 src/GLViewer/resources/cursor_sketch.png delete mode 100755 src/GLViewer/resources/cursor_zoom.png delete mode 100644 src/GLViewer/resources/view_dump.png delete mode 100644 src/GLViewer/resources/view_fitall.png delete mode 100644 src/GLViewer/resources/view_fitarea.png delete mode 100755 src/GLViewer/resources/view_fitselect.png delete mode 100644 src/GLViewer/resources/view_glpan.png delete mode 100644 src/GLViewer/resources/view_pan.png delete mode 100644 src/GLViewer/resources/view_reset.png delete mode 100644 src/GLViewer/resources/view_zoom.png delete mode 100644 src/LightApp/LightApp.h delete mode 100644 src/LightApp/LightApp_AboutDlg.cxx delete mode 100644 src/LightApp/LightApp_AboutDlg.h delete mode 100644 src/LightApp/LightApp_Application.cxx delete mode 100644 src/LightApp/LightApp_Application.h delete mode 100644 src/LightApp/LightApp_DataModel.cxx delete mode 100644 src/LightApp/LightApp_DataModel.h delete mode 100644 src/LightApp/LightApp_DataObject.cxx delete mode 100644 src/LightApp/LightApp_DataObject.h delete mode 100644 src/LightApp/LightApp_DataOwner.cxx delete mode 100644 src/LightApp/LightApp_DataOwner.h delete mode 100644 src/LightApp/LightApp_DataSubOwner.cxx delete mode 100644 src/LightApp/LightApp_DataSubOwner.h delete mode 100644 src/LightApp/LightApp_Dialog.cxx delete mode 100644 src/LightApp/LightApp_Dialog.h delete mode 100644 src/LightApp/LightApp_Displayer.cxx delete mode 100644 src/LightApp/LightApp_Displayer.h delete mode 100644 src/LightApp/LightApp_Driver.cxx delete mode 100644 src/LightApp/LightApp_Driver.h delete mode 100644 src/LightApp/LightApp_EventFilter.cxx delete mode 100644 src/LightApp/LightApp_EventFilter.h delete mode 100644 src/LightApp/LightApp_GLSelector.cxx delete mode 100644 src/LightApp/LightApp_GLSelector.h delete mode 100644 src/LightApp/LightApp_HDFDriver.cxx delete mode 100644 src/LightApp/LightApp_HDFDriver.h delete mode 100644 src/LightApp/LightApp_Module.cxx delete mode 100644 src/LightApp/LightApp_Module.h delete mode 100644 src/LightApp/LightApp_ModuleDlg.cxx delete mode 100644 src/LightApp/LightApp_ModuleDlg.h delete mode 100644 src/LightApp/LightApp_NameDlg.cxx delete mode 100644 src/LightApp/LightApp_NameDlg.h delete mode 100644 src/LightApp/LightApp_OBFilter.cxx delete mode 100644 src/LightApp/LightApp_OBFilter.h delete mode 100644 src/LightApp/LightApp_OBSelector.cxx delete mode 100644 src/LightApp/LightApp_OBSelector.h delete mode 100644 src/LightApp/LightApp_OCCSelector.cxx delete mode 100644 src/LightApp/LightApp_OCCSelector.h delete mode 100755 src/LightApp/LightApp_Operation.cxx delete mode 100755 src/LightApp/LightApp_Operation.h delete mode 100644 src/LightApp/LightApp_Preferences.cxx delete mode 100644 src/LightApp/LightApp_Preferences.h delete mode 100644 src/LightApp/LightApp_PreferencesDlg.cxx delete mode 100644 src/LightApp/LightApp_PreferencesDlg.h delete mode 100644 src/LightApp/LightApp_RootObject.h delete mode 100644 src/LightApp/LightApp_Selection.cxx delete mode 100644 src/LightApp/LightApp_Selection.h delete mode 100644 src/LightApp/LightApp_SelectionMgr.cxx delete mode 100644 src/LightApp/LightApp_SelectionMgr.h delete mode 100644 src/LightApp/LightApp_ShowHideOp.cxx delete mode 100644 src/LightApp/LightApp_ShowHideOp.h delete mode 100644 src/LightApp/LightApp_Study.cxx delete mode 100644 src/LightApp/LightApp_Study.h delete mode 100755 src/LightApp/LightApp_SwitchOp.cxx delete mode 100755 src/LightApp/LightApp_SwitchOp.h delete mode 100755 src/LightApp/LightApp_UpdateFlags.h delete mode 100644 src/LightApp/LightApp_VTKSelector.cxx delete mode 100644 src/LightApp/LightApp_VTKSelector.h delete mode 100644 src/LightApp/LightApp_WidgetContainer.cxx delete mode 100644 src/LightApp/LightApp_WidgetContainer.h delete mode 100755 src/LightApp/Makefile.in delete mode 100755 src/LightApp/resources/LightApp.ini delete mode 100644 src/LightApp/resources/LightApp.xml delete mode 100644 src/LightApp/resources/LightApp_images.po delete mode 100644 src/LightApp/resources/LightApp_msg_en.po delete mode 100755 src/LightApp/resources/icon_about.png delete mode 100755 src/LightApp/resources/icon_applogo.png delete mode 100644 src/LightApp/resources/icon_default.png delete mode 100644 src/LightApp/resources/icon_module.png delete mode 100755 src/LightApp/resources/icon_module_big.png delete mode 100644 src/LightApp/resources/icon_select.png delete mode 100755 src/ObjBrowser/Makefile.in diff --git a/src/CAF/CAF.h b/src/CAF/CAF.h deleted file mode 100755 index d70c01d80..000000000 --- a/src/CAF/CAF.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAF_H -#define CAF_H - -#if defined CAF_EXPORTS -#if defined WNT -#define CAF_EXPORT __declspec( dllexport ) -#else -#define CAF_EXPORT -#endif -#else -#if defined WNT -#define CAF_EXPORT __declspec( dllimport ) -#else -#define CAF_EXPORT -#endif -#endif - -#if defined SOLARIS -#define bool int -#define false 0 -#define true 1 -#endif - -#if defined WNT -#pragma warning ( disable: 4251 ) -#endif - -#if defined ( _DEBUG ) || defined ( DEBUG ) -#include -#define CAF_VERIFY(x) assert(x); -#define CAF_ASSERT(x) assert(x); -#else -#define CAF_VERIFY(x) x -#define CAF_ASSERT(x) -#endif - -#endif diff --git a/src/CAF/CAF_Application.cxx b/src/CAF/CAF_Application.cxx deleted file mode 100755 index 78bc1d566..000000000 --- a/src/CAF/CAF_Application.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAF_Application.h" - -#include "CAF_Tools.h" -#include "CAF_Study.h" - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include - -extern "C" CAF_EXPORT SUIT_Application* createApplication() -{ - return new CAF_Application(); -} - -/*! - Default constructor -*/ -CAF_Application::CAF_Application() -: STD_Application() -{ -} - -/*! - Constructor with OCAF application - \param app - OCAF application -*/ -CAF_Application::CAF_Application( const Handle( TDocStd_Application )& app ) -: STD_Application(), -myStdApp( app ) -{ -} - -/*! - Destructor -*/ -CAF_Application::~CAF_Application() -{ -} - -/*! - \return application name -*/ -QString CAF_Application::applicationName() const -{ - return QString( "CAFApplication" ); -} - -/*! - \return OCAF application -*/ -Handle( TDocStd_Application ) CAF_Application::stdApp() const -{ - return myStdApp; -} - -/*! - \return file filters for open/save document -*/ -QString CAF_Application::getFileFilter() const -{ - if ( stdApp().IsNull() ) - return QString::null; - - TColStd_SequenceOfExtendedString formats; - stdApp()->Formats( formats ); - - QStringList allWC; - QMap wildCards; - Handle(Resource_Manager) resMgr = new Resource_Manager( stdApp()->ResourcesName() ); - for ( int i = 1; i <= formats.Length(); i++ ) - { - QString extension; - QString extResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".FileExtension" ); - if ( resMgr->Find( (char*)extResStr.latin1() ) ) - extension = QString( resMgr->Value( (char*)extResStr.latin1() ) ); - - QString descr; - QString descrResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".Description" ); - if ( resMgr->Find( (char*)descrResStr.latin1() ) ) - descr = QString( resMgr->Value( (char*)descrResStr.latin1() ) ); - - if ( !descr.isEmpty() && !extension.isEmpty() ) - { - if ( !wildCards.contains( descr ) ) - wildCards.insert( descr, QStringList() ); - wildCards[descr].append( QString( "*.%1" ).arg( extension ) ); - allWC.append( QString( "*.%1" ).arg( extension ) ); - } - } - - if ( wildCards.isEmpty() ) - return QString::null; - - QStringList filters; - for ( QMap::ConstIterator it = wildCards.begin(); it != wildCards.end(); ++it ) - filters.append( QString( "%1 (%2)" ).arg( it.key() ).arg( it.data().join( "; " ) ) ); - - if ( wildCards.count() > 1 ) - filters.prepend( QString( "%1 (%2)" ).arg( tr( "INF_ALL_DOCUMENTS_FILTER" ) ).arg( allWC.join( "; " ) ) ); - - if ( !filters.isEmpty() ) - filters.append( tr( "INF_ALL_FILTER" ) ); - - return filters.join( ";;" ); -} - -/*! - Creates actions of application -*/ -void CAF_Application::createActions() -{ - STD_Application::createActions(); - - SUIT_Desktop* desk = desktop(); - SUIT_ResourceMgr* resMgr = resourceMgr(); - - QtxListAction* editUndo = - new QtxListAction( tr( "TOT_APP_EDIT_UNDO" ), resMgr->loadPixmap( "CAF", tr( "ICON_APP_EDIT_UNDO" ) ), - tr( "MEN_APP_EDIT_UNDO" ), CTRL+Key_Z, desk ); - registerAction( EditUndoId, editUndo ); - - QtxListAction* editRedo = - new QtxListAction( tr( "TOT_APP_EDIT_REDO" ), resMgr->loadPixmap( "CAF", tr( "ICON_APP_EDIT_REDO" ) ), - tr( "MEN_APP_EDIT_REDO" ), CTRL+Key_Y, desk ); - registerAction( EditRedoId, editRedo ); - - editUndo->setComment( tr( "INF_APP_UNDOACTIONS" ) ); - editRedo->setComment( tr( "INF_APP_REDOACTIONS" ) ); - - connect( editUndo, SIGNAL( activated( int ) ), this, SLOT( onUndo( int ) ) ); - connect( editRedo, SIGNAL( activated( int ) ), this, SLOT( onRedo( int ) ) ); - - - int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 ); - - createMenu( EditUndoId, editMenu, 0 ); - createMenu( EditRedoId, editMenu, 0 ); - createMenu( separator(), editMenu, -1, 0 ); - - int stdTBar = createTool( tr( "INF_DESK_TOOLBAR_STANDARD" ) ); - - createTool( separator(), stdTBar ); - createTool( EditUndoId, stdTBar ); - createTool( EditRedoId, stdTBar ); - createTool( separator(), stdTBar ); -} - -/*! - Undo operation on the given document. [ virtual protected ] -*/ -bool CAF_Application::undo( CAF_Study* doc ) -{ - bool success = false; - if ( doc ) - { - if ( success = doc->undo() ) - doc->update(); - } - return success; -} - -/*! - Redo operation on the given document. [ virtual protected ] -*/ -bool CAF_Application::redo(CAF_Study* doc) -{ - bool success = false; - if ( doc ) - { - if ( success = doc->redo() ) - doc->update(); - } - return success; -} - -/*! - Undo operation on the active document. [ virtual protected slot ] -*/ -bool CAF_Application::onUndo( int numActions ) -{ - bool ok = true; - while ( numActions > 0 ) - { - CAF_Study* cafStudy = dynamic_cast( activeStudy() ); - if ( cafStudy ) - { - if ( !undo( cafStudy ) ) - { - ok = false; - break; - } - numActions--; - } - } - updateCommandsStatus(); /* enable/disable undo/redo */ - return ok; -} - -/*! - Redo operation on the active document. [ virtual protected slot ] -*/ -bool CAF_Application::onRedo( int numActions ) -{ - bool ok = true; - while ( numActions > 0 ) - { - CAF_Study* cafStudy = dynamic_cast( activeStudy() ); - if ( cafStudy ) - { - if ( !redo( cafStudy ) ) - { - ok = false; - break; - } - numActions--; - } - } - updateCommandsStatus(); /* enable/disable undo/redo */ - return ok; -} - -/*! - Enables / disables the actions according to the application state. [ virtual protected ] -*/ -void CAF_Application::updateCommandsStatus() -{ - STD_Application::updateCommandsStatus(); - - CAF_Study* cafStudy = 0; - if ( activeStudy() && activeStudy()->inherits( "CAF_Study" ) ) - cafStudy = (CAF_Study*)activeStudy(); - - QAction* undo = action( EditUndoId ); - if ( cafStudy && undo ) - undo->setProperty( "names", cafStudy->undoNames() ); - - QAction* redo = action( EditRedoId ); - if ( cafStudy && redo ) - redo->setProperty( "names", cafStudy->redoNames() ); - - if ( undo ) - undo->setEnabled( cafStudy && cafStudy->canUndo() ); - if ( redo ) - redo->setEnabled( cafStudy && cafStudy->canRedo() ); -} - -/*! - SLOT: called by clicking on Help->About in main menu -*/ -void CAF_Application::onHelpAbout() -{ - SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" ); -} - -/*! - Creates new study -*/ -SUIT_Study* CAF_Application::createNewStudy() -{ - return new CAF_Study( this ); -} - -/*! - Sets OCAF application -*/ -void CAF_Application::setStdApp( const Handle(TDocStd_Application)& app ) -{ - myStdApp = app; -} diff --git a/src/CAF/CAF_Application.h b/src/CAF/CAF_Application.h deleted file mode 100755 index 81a16413d..000000000 --- a/src/CAF/CAF_Application.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAF_APPLICATION_H -#define CAF_APPLICATION_H - -#include "CAF.h" - -#include "STD_Application.h" - -#include -#include - -#include - -class QtxAction; -class CAF_Study; - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif - -/*! - \class CAF_Application - Defines application configuration and behaviour for application with - link to standard OCC OCAF data model. Allows to use OCC OCAF serives - (for example, undo/redo) -*/ -class CAF_EXPORT CAF_Application : public STD_Application -{ - Q_OBJECT - -public: - CAF_Application(); - CAF_Application( const Handle(TDocStd_Application)& ); - virtual ~CAF_Application(); - - virtual QString applicationName() const; - - Handle(TDocStd_Application) stdApp() const; - - virtual QString getFileFilter() const; - -public slots: - virtual void onHelpAbout(); - -protected slots: - virtual bool onUndo( int ); - virtual bool onRedo( int ); - -protected: - enum { EditUndoId = STD_Application::UserID, EditRedoId, UserID }; - -protected: - virtual void createActions(); - virtual void updateCommandsStatus(); - - virtual SUIT_Study* createNewStudy(); - - bool undo( CAF_Study* doc ); - bool redo( CAF_Study* doc ); - - virtual void setStdApp( const Handle(TDocStd_Application)& ); - -private: - Handle(TDocStd_Application) myStdApp; -}; - -#if defined WIN32 -#pragma warning ( default: 4251 ) -#endif - -#endif diff --git a/src/CAF/CAF_Operation.cxx b/src/CAF/CAF_Operation.cxx deleted file mode 100755 index 67fd2785f..000000000 --- a/src/CAF/CAF_Operation.cxx +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAF_Operation.h" - -#include "CAF_Study.h" -#include "CAF_Application.h" - -#include - -/*! - Default constructor -*/ -CAF_Operation::CAF_Operation(SUIT_Application* theApp) -:SUIT_Operation(theApp) -{ -} - -/*! - Destructor -*/ -CAF_Operation::~CAF_Operation() -{ -} - -/*! - \return OCAF document -*/ -Handle(TDocStd_Document) CAF_Operation::stdDoc() const -{ - Handle(TDocStd_Document) doc; - CAF_Study* s = ::qt_cast( study() ); - if ( s ) - doc = s->stdDoc(); - return doc; -} diff --git a/src/CAF/CAF_Operation.h b/src/CAF/CAF_Operation.h deleted file mode 100755 index d6ae43694..000000000 --- a/src/CAF/CAF_Operation.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAF_OPERATION_H -#define CAF_OPERATION_H - -#include "CAF.h" - -#include "SUIT_Operation.h" - -#include -#include - -#include - -class CAF_Study; -//! OCC OCAF Std document -class Handle(TDocStd_Document); - -/*! - \class CAF_Operation - Base operation for all operations used in CAF package - Operation has link to OCC OCAF std document -*/ -class CAF_EXPORT CAF_Operation : public SUIT_Operation -{ - Q_OBJECT - -public: - CAF_Operation( SUIT_Application* ); - virtual ~CAF_Operation(); - -protected: - Handle(TDocStd_Document) stdDoc() const; -}; - -#endif diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx deleted file mode 100755 index 79d0da098..000000000 --- a/src/CAF/CAF_Study.cxx +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAF_Study.h" - -#include "CAF_Tools.h" -#include "CAF_Operation.h" -#include "CAF_Application.h" - -#include -#include -#include - -#include - -#include -#include - -#include -#include - -/*! - Constructor -*/ -CAF_Study::CAF_Study(SUIT_Application* theApp) -: SUIT_Study( theApp ), -myModifiedCnt( 0 ) -{ -} - -/*! - Constructor -*/ -CAF_Study::CAF_Study(SUIT_Application* theApp, Handle (TDocStd_Document)& aStdDoc) -: SUIT_Study( theApp ), -myStdDoc( aStdDoc ), -myModifiedCnt( 0 ) -{ -} - -/*! - Destructor -*/ -CAF_Study::~CAF_Study() -{ -} - -/*! - \return OCAF document -*/ -Handle(TDocStd_Document) CAF_Study::stdDoc() const -{ - return myStdDoc; -} - -/*! - Sets new OCAF document - \param aStdDoc - new OCAF document -*/ -void CAF_Study::setStdDoc( Handle(TDocStd_Document)& aStdDoc ) -{ - myStdDoc = aStdDoc; -} - -/*! - Custom document initialization -*/ -void CAF_Study::createDocument() -{ - SUIT_Study::createDocument(); - - CAF_Application* app = cafApplication(); - if ( app && !app->stdApp().IsNull() ) - { - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - TColStd_SequenceOfExtendedString formats; - app->stdApp()->Formats( formats ); - if ( !formats.IsEmpty() ) - app->stdApp()->NewDocument( formats.First(), myStdDoc ); - } - catch ( Standard_Failure ) { - } - } -} - -/*! - Close document -*/ -void CAF_Study::closeDocument( bool permanent ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( !app.IsNull() && !stdDoc().IsNull() ) - app->Close( stdDoc() ); - - SUIT_Study::closeDocument( permanent ); -} - -/*! - Open document - \param fname - name of file -*/ -bool CAF_Study::openDocument( const QString& fname ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( app.IsNull() ) - return false; - - bool status = false; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK; - } - catch ( Standard_Failure ) { - status = false; - } - - return status && SUIT_Study::openDocument( fname ); -} - -/*! - Save document with other name - \param fname - name of file -*/ -bool CAF_Study::saveDocumentAs( const QString& fname ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( app.IsNull() ) - return false; - - bool save = false; - if ( !stdDoc().IsNull() && stdDoc()->IsSaved() ) - { - QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) ); - save = path == QDir::convertSeparators( fname ); - } - - bool status = false; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if ( save ) - status = app->Save( stdDoc() ) == CDF_SS_OK; - else - { - TCollection_ExtendedString format, path( CAF_Tools::toExtString( fname ) ); - app->Format( path, format ); - - if ( format.Length() ) - stdDoc()->ChangeStorageFormat( format ); - - status = app->SaveAs( stdDoc(), path ) == CDF_SS_OK; - } - } - catch ( Standard_Failure ) { - status = false; - } - - if ( status ) - status = SUIT_Study::saveDocumentAs( fname ); - - if ( status ) - myModifiedCnt = 0; - - return status; -} - -/*! - Open OCAF transaction -*/ -bool CAF_Study::openTransaction() -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if ( myStdDoc->HasOpenCommand() ) - myStdDoc->AbortCommand(); - - myStdDoc->OpenCommand(); - } - catch ( Standard_Failure ) { - res = false; - } - - return res; -} - -/*! - Abort OCAF transaction -*/ -bool CAF_Study::abortTransaction() -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->AbortCommand(); - update(); - } - catch ( Standard_Failure ) { - res = false; - } - return res; -} - -/*! - Commit OCAF transaction -*/ -bool CAF_Study::commitTransaction( const QString& name ) -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->CommitCommand(); - - if ( canUndo() ) - { - Handle(TDF_Delta) d = myStdDoc->GetUndos().Last(); - if ( !d.IsNull() ) - d->SetName( CAF_Tools::toExtString( name ) ); - } - } - catch ( Standard_Failure ) { - res = false; - } - return res; -} - -/*! - \return true, if there is opened OCAF transaction -*/ -bool CAF_Study::hasTransaction() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->HasOpenCommand(); -} - -/*! - \return whether the document was saved in file. [ public ] -*/ -bool CAF_Study::isSaved() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->IsSaved(); -} - -/*! - \return whether the document is modified. [ public ] -*/ -bool CAF_Study::isModified() const -{ - if ( myStdDoc.IsNull() ) - return false; - -// return myStdDoc->IsModified(); - return myModifiedCnt; -} - -/*! - Increments modification count. If 'undoable' is 'true', this modification - can be rolled back by 'undoModified' otherwise the document will be marked - as 'modiifed' until saved. [ protected ] -*/ -void CAF_Study::doModified( bool undoable ) -{ - if ( myStdDoc.IsNull() ) - return; - - myModifiedCnt++; - - /* Assumed that number of available undos / redos is NOT changed dynamically */ - if ( !undoable ) - myModifiedCnt += myStdDoc->GetAvailableUndos(); -} - -/*! - Decrements modification count. [ protected ] -*/ -void CAF_Study::undoModified() -{ - myModifiedCnt--; -} - -/*! - Clears modification count. [ public ] -*/ -void CAF_Study::clearModified() -{ - myModifiedCnt = 0; -} - -/*! - Undoes the last command. [ public ] -*/ -bool CAF_Study::undo() -{ - if ( myStdDoc.IsNull() ) - return false; - - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->Undo(); - undoModified(); /* decrement modification counter */ - } - catch ( Standard_Failure ) { - SUIT_MessageBox::error1(application()->desktop(), tr( "ERR_ERROR" ), - tr( "ERR_DOC_UNDO" ), tr ( "BUT_OK" )); - return false; - } - return true; -} - -/*! - Redoes the last undo. [ public ] -*/ -bool CAF_Study::redo() -{ - if ( myStdDoc.IsNull() ) - return false; - - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->Redo(); - doModified(); /* increment modification counter */ - } - catch ( Standard_Failure ) { - SUIT_MessageBox::error1( application()->desktop(), tr( "ERR_ERROR" ), - tr( "ERR_DOC_REDO" ), tr ( "BUT_OK" ) ); - return false; - } - return true; -} - -/*! - \return true if possible to perform 'undo' command. [ public ] -*/ -bool CAF_Study::canUndo() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->GetAvailableUndos() > 0; -} - -/*! - \return true if possible to perform 'redo' command. [ public ] -*/ -bool CAF_Study::canRedo() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->GetAvailableRedos() > 0; -} - -/*! - \return the list of names of 'undo' actions available. [ public ] -*/ -QStringList CAF_Study::undoNames() const -{ - QStringList names; - if ( !myStdDoc.IsNull() ) - { - for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetUndos() ); it.More(); it.Next() ) - names.prepend( CAF_Tools::toQString( it.Value()->Name() ) ); - } - return names; -} - -/*! - \return the list of names of 'redo' actions available. [ public ] -*/ -QStringList CAF_Study::redoNames() const -{ - QStringList names; - if ( !myStdDoc.IsNull() ) - { - for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetRedos() ); it.More(); it.Next() ) - names.append( CAF_Tools::toQString( it.Value()->Name() ) ); - } - return names; -} - -/*! - \return the standard OCAF application from owner application. [ protected ] -*/ -Handle(TDocStd_Application) CAF_Study::stdApp() const -{ - Handle(TDocStd_Application) stdApp; - CAF_Application* app = cafApplication(); - if ( app ) - stdApp = app->stdApp(); - return stdApp; -} - -/*! - \return the application casted to type CAF_Application. [ protected ] -*/ -CAF_Application* CAF_Study::cafApplication() const -{ - return ::qt_cast( application() ); -} diff --git a/src/CAF/CAF_Study.h b/src/CAF/CAF_Study.h deleted file mode 100755 index 0e5980cc9..000000000 --- a/src/CAF/CAF_Study.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAF_STUDY_H -#define CAF_STUDY_H - -#include "CAF.h" - -#include "SUIT_Study.h" - -#include - -#include -#include - -class CAF_Application; - -#if defined WNT -#pragma warning ( disable: 4251 ) -#endif - -/*! - \class CAF_Study - Represents study for using in CAF, contains reference - to OCAF std document and allows to use OCAF services. - Provides necessary functionality for OCC transactions management. -*/ -class CAF_EXPORT CAF_Study : public SUIT_Study -{ - Q_OBJECT - -public: - CAF_Study( SUIT_Application* theApp ); - CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc ); - virtual ~CAF_Study(); - - virtual void createDocument(); - virtual void closeDocument( bool = true ); - virtual bool openDocument( const QString& ); - - virtual bool saveDocumentAs( const QString& ); - - bool isSaved() const; - bool isModified() const; - void doModified( bool = true ); - void undoModified(); - void clearModified(); - - bool undo(); - bool redo(); - bool canUndo() const; - bool canRedo() const; - QStringList undoNames() const; - QStringList redoNames() const; - - Handle(TDocStd_Document) stdDoc() const; - -protected: - Handle(TDocStd_Application) stdApp() const; - CAF_Application* cafApplication() const; - - virtual bool openTransaction(); - virtual bool abortTransaction(); - virtual bool hasTransaction() const; - virtual bool commitTransaction( const QString& = QString::null ); - - virtual void setStdDoc( Handle(TDocStd_Document)& ); - -private: - Handle(TDocStd_Document) myStdDoc; - int myModifiedCnt; - - friend class CAF_Operation; -}; - -#if defined WNT -#pragma warning ( default: 4251 ) -#endif - -#endif diff --git a/src/CAF/CAF_Tools.cxx b/src/CAF/CAF_Tools.cxx deleted file mode 100755 index f637a3e87..000000000 --- a/src/CAF/CAF_Tools.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : CAF_Tools.cxx -// Author : UI team - -#include "CAF_Tools.h" - -#include -#include - -/*! - Converts TCollection_ExtendedString 'src' to Qt string. [ static ] -*/ -QString CAF_Tools::toQString ( const TCollection_ExtendedString& src ) -{ - return QString( (const QChar*)src.ToExtString(), src.Length() ); -} - -/*! - Converts TCollection_AsciiString'src' to Qt string. [ static ] -*/ -QString CAF_Tools::toQString( const TCollection_AsciiString& src ) -{ - return QString( src.ToCString() ); -} - -/*! - Converts Qt string to TCollection_AsciiString. [ static ] -*/ -TCollection_AsciiString CAF_Tools::toAsciiString( const QString& src ) -{ - TCollection_AsciiString res; - if ( !src.isEmpty() ) - res = TCollection_AsciiString( (char*)src.latin1() ); - return res; -} - -/*! - Converts Qt string to TCollection_ExtendedString. [ static ] -*/ -TCollection_ExtendedString CAF_Tools::toExtString ( const QString& src ) -{ - TCollection_ExtendedString result; - for ( int i = 0; i < (int)src.length(); i++ ) - result.Insert( i + 1, src[ i ].unicode() ); - return result; -} - -/*! - Converts Qt color to OCC color -*/ -Quantity_Color CAF_Tools::color( const QColor& c ) -{ - Quantity_Color aColor; - if ( c.isValid() ) - aColor = Quantity_Color( c.red() / 255., c.green() / 255., - c.blue() / 255., Quantity_TOC_RGB ); - return aColor; -} - -/*! - Converts OCC color to Qt color -*/ -QColor CAF_Tools::color( const Quantity_Color& c ) -{ - return QColor ( int( c.Red() * 255 ), - int( c.Green() * 255 ), - int( c.Blue() * 255 ) ); -} diff --git a/src/CAF/CAF_Tools.h b/src/CAF/CAF_Tools.h deleted file mode 100755 index c0183586e..000000000 --- a/src/CAF/CAF_Tools.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : CAF_Tools.h -// Author : UI team - -#ifndef CAF_TOOLS_H -#define CAF_TOOLS_H - -#include - -#include - -#include - -#include - -#include -#include - -/*! - \class CAF_Tools - Prodives set of auxiliary static methods -*/ -class CAF_EXPORT CAF_Tools : public SUIT_Tools -{ -public: - static QString toQString( const TCollection_AsciiString& ); - static QString toQString( const TCollection_ExtendedString& ); - - static TCollection_ExtendedString toExtString( const QString& ); - static TCollection_AsciiString toAsciiString( const QString& ); - - static Quantity_Color color( const QColor& ); - static QColor color( const Quantity_Color& ); -}; - -#endif diff --git a/src/CAF/Makefile.in b/src/CAF/Makefile.in deleted file mode 100755 index d50233a40..000000000 --- a/src/CAF/Makefile.in +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Vladimir Klyachin (OCN) -# Module : caf -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@srcdir@/resources - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= CAF.h \ - CAF_Application.h \ - CAF_Operation.h \ - CAF_Study.h \ - CAF_Tools.h - -# .po files to transform in .qm -PO_FILES = CAF_images.po \ - CAF_msg_en.po - -# Libraries targets -LIB = libcaf.la - -LIB_SRC= CAF_Application.cxx \ - CAF_Operation.cxx \ - CAF_Study.cxx \ - CAF_Tools.cxx - -LIB_MOC = \ - CAF_Application.h \ - CAF_Operation.h \ - CAF_Study.h - -RESOURCES_FILES = \ -redo.png \ -undo.png - - -CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++ - -LDFLAGS+=$(QT_MT_LIBS) $(CAS_OCAF) $(CAS_OCAFVIS) -LIBS+= -lstd -lsuit - -@CONCLUDE@ - - - - - diff --git a/src/CAF/resources/CAF_images.po b/src/CAF/resources/CAF_images.po deleted file mode 100755 index 083e77506..000000000 --- a/src/CAF/resources/CAF_images.po +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ICON_APP_EDIT_UNDO" -msgstr "undo.png" - -msgid "ICON_APP_EDIT_REDO" -msgstr "redo.png" diff --git a/src/CAF/resources/CAF_msg_en.po b/src/CAF/resources/CAF_msg_en.po deleted file mode 100755 index de9372fed..000000000 --- a/src/CAF/resources/CAF_msg_en.po +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "CAF_Application::ABOUT_INFO" -msgstr "SUIT Caf application" - -msgid "CAF_Application::MEN_APP_EDIT" -msgstr "&Edit" - -msgid "CAF_Application::MEN_DESK_EDIT" -msgstr "&Edit" - -msgid "CAF_Application::MEN_APP_EDIT_REDO" -msgstr "&Redo" - -msgid "CAF_Application::MEN_APP_EDIT_UNDO" -msgstr "&Undo" - -msgid "CAF_Application::PRP_APP_EDIT_REDO" -msgstr "Redoes the last operation" - -msgid "CAF_Application::PRP_APP_EDIT_UNDO" -msgstr "Undoes the last operation" - -msgid "CAF_Application::TOT_APP_EDIT_REDO" -msgstr "Redo" - -msgid "CAF_Application::TOT_APP_EDIT_UNDO" -msgstr "Undo" - -msgid "CAF_Application::INF_APP_UNDOACTIONS" -msgstr " Undoes %1 action(s) " - -msgid "CAF_Application::INF_APP_REDOACTIONS" -msgstr " Redoes %1 action(s) " - -msgid "CAF_Application::INF_ALL_DOCUMENTS_FILTER" -msgstr "All Readable Documents" - -msgid "CAF_Application::INF_ALL_FILTER" -msgstr "All Files (*.*)" diff --git a/src/CAF/resources/redo.png b/src/CAF/resources/redo.png deleted file mode 100755 index ac72e5c27cb02fdb6aebd6fdf3a8f08b4a4bb2fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 211 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#pjDPl)S*0|(O5(ij+KrlrjU z0tN;ko8e_7w;YgSED7=pW^j0R10=?n*?YcQZXkvfq^-UO^uOFVzQz_10&lEi3m{%2_6XphGc;j yHqF!^hL=hVK9Uk42TzGOSUK#9bu1CEvt^K0XP(n=mTxoAAO=rYKbLh*2~7a~`8MzX diff --git a/src/CAF/resources/undo.png b/src/CAF/resources/undo.png deleted file mode 100755 index 61b19777e4f9527d8961358b7dde84d4af2d16e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 210 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|(O5(ij+Krlrkf zU;r{0c8fE|0x8ClAirP+hi5lHVvI@N?k=o9@?RbYa>PnpBT9nv(@M${i&7cVGt-O; z^3oNI^bGV2ZR7T309Dv~x;TbZ%t=mQU}j}wb7#{iVECBO(8;)tf!9FG&|rfFL+EA) z6N97`4y=4Uemp!~4sBgbS7OxF+1c3AYpNKu@|hn*9eH^jXcU8|tDnm{r-UW|1Q0o1 diff --git a/src/CAM/CAM.h b/src/CAM/CAM.h deleted file mode 100755 index b953c9927..000000000 --- a/src/CAM/CAM.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_H -#define CAM_H - -#if defined CAM_EXPORTS -#if defined WNT -#define CAM_EXPORT __declspec( dllexport ) -#else -#define CAM_EXPORT -#endif -#else -#if defined WNT -#define CAM_EXPORT __declspec( dllimport ) -#else -#define CAM_EXPORT -#endif -#endif - -#if defined SOLARIS -#define bool int -#define false 0 -#define true 1 -#endif - -#if defined WNT -#pragma warning ( disable: 4251 ) -#endif - -#endif diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx deleted file mode 100755 index cc2d1f703..000000000 --- a/src/CAM/CAM_Application.cxx +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_Application.h" - -#include "CAM_Study.h" -#include "CAM_Module.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#else -#include -#endif - -/*!Create new instance of CAM_Application*/ -extern "C" CAM_EXPORT SUIT_Application* createApplication() -{ - return new CAM_Application(); -} - -/*!Constructor. read module list. - * \param autoLoad - auto load flag. - */ -CAM_Application::CAM_Application( const bool autoLoad ) -: STD_Application(), -myModule( 0 ), -myAutoLoad( autoLoad ) -{ - readModuleList(); -} - -/*!Destructor. Do nothing.*/ -CAM_Application::~CAM_Application() -{ -} - -/*! Load modules, if \a myAutoLoad flag is true.\n - * Start application - call start() method from parent class. - */ -void CAM_Application::start() -{ - if ( myAutoLoad ) - loadModules(); - - STD_Application::start(); -} - -/*!Get active module. - * \retval CAM_Module - active module. - */ -CAM_Module* CAM_Application::activeModule() const -{ - return myModule; -} - -/*!Get module with name \a modName from modules list. - * \retval CAM_Module pointer - module. - */ -CAM_Module* CAM_Application::module( const QString& modName ) const -{ - CAM_Module* mod = 0; - for ( ModuleListIterator it( myModules ); it.current() && !mod; ++it ) - if ( it.current()->moduleName() == modName ) - mod = it.current(); - return mod; -} - -/*!Gets modules iterator.*/ -CAM_Application::ModuleListIterator CAM_Application::modules() const -{ - return ModuleListIterator( myModules ); -} - -/*!Gets modules list. - * \param out - output list of modules. - */ -void CAM_Application::modules( CAM_Application::ModuleList& out ) const -{ - out.setAutoDelete( false ); - out.clear(); - - for ( ModuleListIterator it( myModules ); it.current(); ++it ) - out.append( it.current() ); -} - -/*!Gets list of names for modules.\n - * Get loaded modules names, if \a loaded is true, else \n - * get names from information list. - * \param lst - output list of names. - * \param loaded - boolean flag. - */ -void CAM_Application::modules( QStringList& lst, const bool loaded ) const -{ - lst.clear(); - - if ( loaded ) - for ( ModuleListIterator it( myModules ); it.current(); ++it ) - lst.append( it.current()->moduleName() ); - else - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) - lst.append( (*it).title ); -} - -/*!Adding module \a mod to list. - *\param mod - module. - */ -void CAM_Application::addModule( CAM_Module* mod ) -{ - if ( !mod || myModules.contains( mod ) ) - return; - - mod->initialize( this ); - - QMap map; - - ModuleList newList; - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) - { - if ( (*it).title == mod->moduleName() ) - newList.append( mod ); - else - { - CAM_Module* curMod = module( (*it).title ); - if ( curMod ) - newList.append( curMod ); - } - if ( !newList.isEmpty() ) - map.insert( newList.getLast(), 0 ); - } - - for ( ModuleListIterator itr( myModules ); itr.current(); ++itr ) - { - if ( !map.contains( itr.current() ) ) - newList.append( itr.current() ); - } - - if ( !map.contains( mod ) ) - newList.append( mod ); - - myModules = newList; - - moduleAdded( mod ); -} - -/*!Load modules from information list. - * \warning If some of modules not loaded, error message appear on desktop. - */ -void CAM_Application::loadModules() -{ - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) - { - CAM_Module* mod = loadModule( (*it).title ); - if ( mod ) - addModule( mod ); - else { - if ( desktop() && desktop()->isShown() ) - SUIT_MessageBox::error1( desktop(), tr( "Loading modules" ), - tr( "Can not load module %1" ).arg( (*it).title ), tr( "Ok" ) ); - else - qWarning( tr( "Can not load module %1" ).arg( (*it).title ).latin1() ); - } - } -} - -/*!Load module with name \a modName. - *\param modName - module name for loading. - *\warning If information list is empty. - *\warning If module library (for module with \a modName) is empty. - *\warning If module library is not loaded. - */ -CAM_Module* CAM_Application::loadModule( const QString& modName ) -{ - if ( myInfoList.isEmpty() ) - { - qWarning( tr( "Modules configuration is not defined." ) ); - return 0; - } - - QString libName = moduleLibrary( modName ); - if ( libName.isEmpty() ) - { - qWarning( tr( "Information about module \"%1\" doesn't exist." ).arg( modName ) ); - return 0; - } - - QString err; - GET_MODULE_FUNC crtInst = 0; - -#ifdef WIN32 - HINSTANCE modLib = ::LoadLibrary( libName ); - if ( !modLib ) - { - LPVOID lpMsgBuf; - ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 ); - err = QString( "Failed to load %1. %2" ).arg( libName ).arg( (LPTSTR)lpMsgBuf ); - ::LocalFree( lpMsgBuf ); - } - else - { - crtInst = (GET_MODULE_FUNC)::GetProcAddress( modLib, GET_MODULE_NAME ); - if ( !crtInst ) - { - LPVOID lpMsgBuf; - ::FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, 0, ::GetLastError(), 0, (LPTSTR)&lpMsgBuf, 0, 0 ); - err = QString( "Failed to find %1 function. %2" ).arg( GET_MODULE_NAME ).arg( (LPTSTR)lpMsgBuf ); - ::LocalFree( lpMsgBuf ); - } - } -#else - void* modLib = dlopen( (char*)libName.latin1(), RTLD_LAZY ); - if ( !modLib ) - err = QString( "Can not load library %1. %2" ).arg( libName ).arg( dlerror() ); - else - { - crtInst = (GET_MODULE_FUNC)dlsym( modLib, GET_MODULE_NAME ); - if ( !crtInst ) - err = QString( "Failed to find function %1. %2" ).arg( GET_MODULE_NAME ).arg( dlerror() ); - } -#endif - - CAM_Module* module = crtInst ? crtInst() : 0; - if ( module ) - { - module->setModuleName( modName ); - module->setName( moduleName( modName ) ); - } - - if ( !err.isEmpty() ) { - if ( desktop() && desktop()->isShown() ) - SUIT_MessageBox::warn1( desktop(), tr( "Error" ), err, tr( "Ok" ) ); - else - qWarning( err.latin1() ); - } - - return module; -} - -/*! @name Activate module group. */ -//@{ -/*!Activate module with name \a modName. - *\param modName - module name. - *\ratval true, if module loaded and activated successful, else false. - */ -bool CAM_Application::activateModule( const QString& modName ) -{ - if ( !modName.isEmpty() && !activeStudy() ) - return false; - - bool res = false; - if ( !modName.isEmpty() ) - { - CAM_Module* mod = module( modName ); - if ( !mod && !moduleLibrary( modName ).isEmpty() ) - { - mod = loadModule( modName ); - addModule( mod ); - } - - if ( mod ) - res = activateModule( mod ); - } - else - res = activateModule( 0 ); - - return res; -} - -/*!Activate module \a mod - *\param mod - module for activation. - *\retval true - if all sucessful. - *\warning Error message if module not activated in active study. - */ -bool CAM_Application::activateModule( CAM_Module* mod ) -{ - if ( mod && !activeStudy() ) - return false; - - if ( myModule == mod ) - return true; - - if ( myModule ) - { - if ( !myModule->deactivateModule( activeStudy() ) ) - { - // .... - } - } - myModule = mod; - - if ( myModule ){ - // Connect the module to the active study - myModule->connectToStudy( dynamic_cast( activeStudy() ) ); - if ( !myModule->activateModule( activeStudy() ) ) - { - myModule->setMenuShown( false ); - myModule->setToolShown( false ); - if ( desktop() && desktop()->isShown() ) - SUIT_MessageBox::error1( desktop(), tr( "ERROR_TLT" ), tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ), tr( "BUT_OK" ) ); - else - qWarning( tr( "ERROR_ACTIVATE_MODULE_MSG" ).arg( myModule->moduleName() ).latin1() ); - myModule = 0; - return false; - } - } - - updateCommandsStatus(); - - return true; -} -//@} - -/*!Create new study for current application. - *\retval study pointer. - */ -SUIT_Study* CAM_Application::createNewStudy() -{ - return new CAM_Study( this ); -} - -/*!Update commands status for parent class and for current class(if module is active)*/ -void CAM_Application::updateCommandsStatus() -{ - STD_Application::updateCommandsStatus(); - - if ( activeModule() ) - activeModule()->updateCommandsStatus(); -} - -/*!Close all modules in study \a theDoc. - *\param theDoc - study - */ -void CAM_Application::beforeCloseDoc( SUIT_Study* theDoc ) -{ - for ( ModuleListIterator it( myModules ); it.current(); ++it ) - it.current()->studyClosed( theDoc ); -} - -/*!Sets active study for parent class. - *\param study - study. - */ -void CAM_Application::setActiveStudy( SUIT_Study* study ) -{ - STD_Application::setActiveStudy( study ); -} - -/*!Do nothing.*/ -void CAM_Application::moduleAdded( CAM_Module* mod ) -{ -// CAM_Study* study = dynamic_cast( activeStudy() ); -// if ( !study ) -// return; - -// study->insertDataModel( mod->dataModel() ); -} - -/*!Gets module name by title \a title - *\param title - title name - *\retval QString module name. - */ -QString CAM_Application::moduleName( const QString& title ) const -{ - QString res; - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) - { - if ( (*it).title == title ) - res = (*it).name; - } - return res; -} - -/*!Gets module title by module name \a name - *\param name - module name - *\retval QString module title. - */ -QString CAM_Application::moduleTitle( const QString& name ) const -{ - QString res; - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) - { - if ( (*it).name == name ) - res = (*it).title; - } - return res; -} - -/*!Get library name for module with title \a title. - *\param title - module title name. - *\param full - boolean flag (if true - return full library name, else internal name) - *\retval QString - library name. - */ -QString CAM_Application::moduleLibrary( const QString& title, const bool full ) const -{ - QString res; - for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it ) - { - if ( (*it).title == title ) - res = (*it).internal; - } - if ( !res.isEmpty() && full ) - res = SUIT_Tools::library( res ); - return res; -} - -/*!Read modules list*/ -void CAM_Application::readModuleList() -{ - if ( !myInfoList.isEmpty() ) - return; - - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - - QStringList modList; - - QStringList args; - for (int i = 1; i < qApp->argc(); i++) - args.append( qApp->argv()[i] ); - - QRegExp rx("--modules\\s+\\(\\s*(.*)\\s*\\)"); - rx.setMinimal( true ); - if ( rx.search( args.join(" ") ) >= 0 && rx.capturedTexts().count() > 0 ) { - QString modules = rx.capturedTexts()[1]; - QStringList mods = QStringList::split(":",modules,false); - for ( uint i = 0; i < mods.count(); i++ ) { - if ( !mods[i].stripWhiteSpace().isEmpty() ) - modList.append( mods[i].stripWhiteSpace() ); - } - } - if ( modList.isEmpty() ) { - QString mods = resMgr->stringValue( "launch", "modules", QString::null ); - modList = QStringList::split( ",", mods ); - } - - for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it ) - { - QString modName = (*it).stripWhiteSpace(); - if ( modName.isEmpty() ) - continue; - - QString modTitle = resMgr->stringValue( *it, QString( "name" ), QString::null ); - if ( modTitle.isEmpty() ) - { - printf( "****************************************************************\n" ); - printf( "* Warning: %s not found in resources.\n", (*it).latin1() ); - printf( "* Module will not be available\n" ); - printf( "****************************************************************\n" ); - continue; - } - - QString modLibrary = resMgr->stringValue( *it, QString( "library" ), QString::null ).stripWhiteSpace(); - if ( !modLibrary.isEmpty() ) - { - QString libExt; - modLibrary = SUIT_Tools::file( modLibrary.stripWhiteSpace() ); - libExt = QString( "so" ); - if ( SUIT_Tools::extension( modLibrary ).lower() == libExt ) - modLibrary = modLibrary.mid( 0, modLibrary.length() - libExt.length() - 1 ); - libExt = QString( "dll" ); - if ( SUIT_Tools::extension( modLibrary ).lower() == libExt ) - modLibrary = modLibrary.mid( 0, modLibrary.length() - libExt.length() - 1 ); -#ifndef WIN32 - if ( modLibrary.startsWith( "lib" ) ) - modLibrary = modLibrary.mid( 3 ); -#endif - } - else - modLibrary = modName; - - ModuleInfo inf; - inf.name = modName; - inf.title = modTitle; - inf.internal = modLibrary; - myInfoList.append( inf ); - } - - if ( myInfoList.isEmpty() ) { - if ( desktop() && desktop()->isShown() ) - SUIT_MessageBox::warn1( desktop(), tr( "Warning" ), tr( "Modules list is empty" ), tr( "&OK" ) ); - else - { - printf( "****************************************************************\n" ); - printf( "* Warning: modules list is empty.\n" ); - printf( "****************************************************************\n" ); - } - } -} - -/*!Add common items for popup menu ( if they are exist ) - *\param type - type of popup menu - *\param thePopup - popup menu - *\param title - title of popup menu - */ -void CAM_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title ) -{ - // to do : add common items for popup menu ( if they are exist ) - if ( activeModule() ) - activeModule()->contextMenuPopup( type, thePopup, title ); -} - -/*!Create empty study.*/ -void CAM_Application::createEmptyStudy() -{ - /*SUIT_Study* study = */activeStudy(); - STD_Application::createEmptyStudy(); -} diff --git a/src/CAM/CAM_Application.h b/src/CAM/CAM_Application.h deleted file mode 100755 index c31e90523..000000000 --- a/src/CAM/CAM_Application.h +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_APPLICATION_H -#define CAM_APPLICATION_H - -#include "STD_Application.h" - -#include "CAM_Module.h" - -#include - -class QPopupMenu; - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*! - \class CAM_Application - Defines application configuration and behaviour for application with modules. - Every module has own data model, necessary windows and viewers, etc. - Application provides all necessary functionality for module management - (loading of modules/activation/deactivation, etc) -*/ -class CAM_EXPORT CAM_Application : public STD_Application -{ - Q_OBJECT - -public: - typedef QPtrList ModuleList; - typedef QPtrListIterator ModuleListIterator; - -public: - CAM_Application( const bool = true ); - virtual ~CAM_Application(); - - virtual void start(); - - CAM_Module* activeModule() const; - CAM_Module* module( const QString& ) const; - - /** @name Modules lists.*/ - //@{ - ModuleListIterator modules() const; - void modules( ModuleList& ) const; - void modules( QStringList&, const bool loaded = true ) const; - //@} - - virtual void addModule( CAM_Module* ); - - virtual void loadModules(); - virtual CAM_Module* loadModule( const QString& ); - - virtual bool activateModule( const QString& ); - - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); - - QString moduleName( const QString& ) const; - QString moduleTitle( const QString& ) const; - - virtual void createEmptyStudy(); - -protected: - virtual SUIT_Study* createNewStudy(); - virtual void updateCommandsStatus(); - - virtual void moduleAdded( CAM_Module* ); - virtual void beforeCloseDoc( SUIT_Study* ); - virtual bool activateModule( CAM_Module* = 0 ); - - virtual void setActiveStudy( SUIT_Study* ); - - QString moduleLibrary( const QString&, const bool = true ) const; - -private: - void readModuleList(); - -private: - typedef struct { QString name, title, internal; } ModuleInfo; - typedef QValueList ModuleInfoList; - -private: - CAM_Module* myModule; - ModuleList myModules; - ModuleInfoList myInfoList; - bool myAutoLoad; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/CAM/CAM_DataModel.cxx b/src/CAM/CAM_DataModel.cxx deleted file mode 100755 index 559901279..000000000 --- a/src/CAM/CAM_DataModel.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_DataModel.h" - -#include "CAM_Module.h" -#include "CAM_RootObject.h" - -/*!Constructor. Initialise module by \a module.*/ -CAM_DataModel::CAM_DataModel( CAM_Module* module ) -: myRoot( 0 ), -myModule( module ) -{ -} - -/*!Destructor. Do nothing.*/ -CAM_DataModel::~CAM_DataModel() -{ -} - -/*! - Default implementation, does nothing. - Can be used for creation of root object. -*/ -void CAM_DataModel::initialize() -{ -} - -/*!Get root object. - *\retval CAM_DataObject pointer - root object. - */ -CAM_DataObject* CAM_DataModel::root() const -{ - return myRoot; -} - -/*!Sets root object to \a newRoot.\n - *Emit root changed, if it was. - *\param newRoot - new root object - */ -void CAM_DataModel::setRoot( const CAM_DataObject* newRoot ) -{ - if ( myRoot == newRoot ) - return; - - if ( myRoot ) - myRoot->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); - - myRoot = (CAM_DataObject*)newRoot; - - if ( myRoot ) - myRoot->connect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) ); - - emit rootChanged( this ); -} - -/*!Gets module. - *\retval CAM_Module pointer - module. - */ -CAM_Module* CAM_DataModel::module() const -{ - return myModule; -} - -/*!Nullify root, if \a obj equal root.*/ -void CAM_DataModel::onDestroyed( SUIT_DataObject* obj ) -{ - if ( myRoot == obj ) - myRoot = 0; -} diff --git a/src/CAM/CAM_DataModel.h b/src/CAM/CAM_DataModel.h deleted file mode 100755 index 4cbc8ab93..000000000 --- a/src/CAM/CAM_DataModel.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_DATAMODEL_H -#define CAM_DATAMODEL_H - -#include "CAM.h" - -#include -#include - -class CAM_Module; -class CAM_DataObject; -class CAM_Study; -class SUIT_DataObject; - -/*! - \class CAM_DataModel - Base class for all data models used in CAM-based applications. - Represents data model of CAM module. Provides necessary interface (default implementation is empty) -*/ -class CAM_EXPORT CAM_DataModel : public QObject -{ - Q_OBJECT - -public: - CAM_DataModel( CAM_Module* ); - virtual ~CAM_DataModel(); - - virtual void initialize(); - - CAM_DataObject* root() const; - CAM_Module* module() const; - - /** @name These methods should be redefined in successors.*/ - //@{ - virtual bool open( const QString&, CAM_Study*, QStringList ) { return true; }//!< return true - virtual bool save( QStringList& ) { return true; }; - virtual bool saveAs( const QString&, CAM_Study*, QStringList& ) { return true; }; - virtual bool close() { return true; }; - virtual bool create( CAM_Study* ) { return true; } - //@} - -protected: - /*! setRoot() should be used to specify custom root object instance.\n - * Such an object can be created in several ways, depending on application or module needs:\n - * \li by initialize() - * \li while the model is being loaded - * \li when the model is updated and becomes non-empty - */ - virtual void setRoot( const CAM_DataObject* ); - -private slots: - void onDestroyed( SUIT_DataObject* ); - -signals: - void rootChanged( const CAM_DataModel* ); - -private: - CAM_DataObject* myRoot; - CAM_Module* myModule; -}; - -#endif diff --git a/src/CAM/CAM_DataObject.cxx b/src/CAM/CAM_DataObject.cxx deleted file mode 100755 index 62a3d3b13..000000000 --- a/src/CAM/CAM_DataObject.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_DataObject.h" - -#include "CAM_Module.h" -#include "CAM_DataModel.h" - -/*!Constructor. Sets parent object.*/ -CAM_DataObject::CAM_DataObject( SUIT_DataObject* parent ) -: SUIT_DataObject( parent ) -{ -} - -/*!Destructor.Do nothing*/ -CAM_DataObject::~CAM_DataObject() -{ -} - -/*!Get module. - *\retval const CAM_Module pointer - module - */ -CAM_Module* CAM_DataObject::module() const -{ - CAM_Module* mod = 0; - - CAM_DataModel* data = dataModel(); - if ( data ) - mod = data->module(); - - return mod; -} - -/*!Get data model. - *Return 0 - if no parent obbject. - *\retval const CAM_DataModel pointer - data model - */ -CAM_DataModel* CAM_DataObject::dataModel() const -{ - CAM_DataObject* parentObj = dynamic_cast( parent() ); - - if ( !parentObj ) - return 0; - - return parentObj->dataModel(); -} diff --git a/src/CAM/CAM_DataObject.h b/src/CAM/CAM_DataObject.h deleted file mode 100755 index 1e4e414b2..000000000 --- a/src/CAM/CAM_DataObject.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_DATAOBJECT_H -#define CAM_DATAOBJECT_H - -#include "CAM.h" - -#include - -class CAM_Module; -class CAM_DataModel; - -/*! - \class CAM_DataObject - Provides only additional link to CAM_DataModel -*/ -class CAM_EXPORT CAM_DataObject : public SUIT_DataObject -{ -public: - CAM_DataObject( SUIT_DataObject* = 0 ); - virtual ~CAM_DataObject(); - - CAM_Module* module() const; - virtual CAM_DataModel* dataModel() const; -}; - -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx deleted file mode 100755 index 5e08436f6..000000000 --- a/src/CAM/CAM_Module.cxx +++ /dev/null @@ -1,683 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_Module.h" - -#include "CAM_DataModel.h" -#include "CAM_Application.h" -#include "CAM_Study.h" - -#include -#include -#include - -#include -#include - -/*!Icon.*/ -static const char* ModuleIcon[] = { -"20 20 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" .................. ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" . . ", -" .................. ", -" . . . ", -" . . . ", -" ... ... ... ", -" .. .. .. .. .. .. ", -" . . . . . . ", -" .. .. .. .. .. .. ", -" ... ... ... "}; - -QPixmap MYPixmap( ModuleIcon ); - -/*!Constructor.*/ -CAM_Module::CAM_Module() -: QObject(), -myApp( 0 ), -myIcon( MYPixmap ), -myDataModel( 0 ) -{ -} - -/*!Constructor. initialize \a name.*/ -CAM_Module::CAM_Module( const QString& name ) -: QObject(), -myApp( 0 ), -myName( name ), -myIcon( MYPixmap ), -myDataModel( 0 ) -{ -} - -/*!Destructor. Remove data model.*/ -CAM_Module::~CAM_Module() -{ - delete myDataModel; - myDataModel = 0; -} - -/*!Initialize application.*/ -void CAM_Module::initialize( CAM_Application* app ) -{ - myApp = app; - if ( myApp ) - { - SUIT_Session* aSession = SUIT_Session::session(); - connect( aSession, SIGNAL( applicationClosed( SUIT_Application* ) ), - this, SLOT( onApplicationClosed( SUIT_Application* ) ) ); - - connect( myApp, SIGNAL( infoChanged( QString ) ), this, SLOT( onInfoChanged( QString ) ) ); - } -} - -/*!\retval Module icon.*/ -QPixmap CAM_Module::moduleIcon() const -{ - return myIcon; -} - -/*!\retval Module icon name.*/ -QString CAM_Module::iconName() const -{ - return ""; -} - -/*!\retval Module name.*/ -QString CAM_Module::moduleName() const -{ - return myName; -} - -/*! \brief Return data model. - * Create data model, if it was't created before. - */ -CAM_DataModel* CAM_Module::dataModel() const -{ - if ( !myDataModel ) - { - CAM_Module* that = (CAM_Module*)this; - that->myDataModel = that->createDataModel(); - that->myDataModel->initialize(); - } - return myDataModel; -} - -/*!\retval CAM_Application pointer - application.*/ -CAM_Application* CAM_Module::application() const -{ - return myApp; -} - -/*!Public slot - * \retval true. - */ -bool CAM_Module::activateModule( SUIT_Study* study ) -{ - return true; -} - -/*!Public slot - * \retval true. - */ -bool CAM_Module::deactivateModule( SUIT_Study* ) -{ - return true; -} - -/*!Public slot, remove data model from \a study.*/ -void CAM_Module::studyClosed( SUIT_Study* study ) -{ - CAM_Study* camDoc = dynamic_cast( study ); - if ( !camDoc ) - return; - - CAM_DataModel* dm = dataModel(); - if ( dm && camDoc->containsDataModel( dm ) ) { - dm->close(); - camDoc->removeDataModel( dm ); - } -} - -/*!Public slot, do nothing.*/ -void CAM_Module::studyChanged( SUIT_Study* , SUIT_Study* ) -{ -} - -/*!Return true if module is active.*/ -bool CAM_Module::isActiveModule() const -{ - return application() ? application()->activeModule() == this : false; -} - -/*! - Put the message into the status bar of the desktop. Message will be displayed - during specified \amscec milliseconds. If parameter \amsec is negative then - message will be persistently displayed when module is active. -*/ -void CAM_Module::putInfo( const QString& msg, const int msec ) -{ - if ( application() ) - application()->putInfo( msg, msec ); - - if ( msec < 0 ) - myInfo = msg; -} - -/*! - Restore persistently displayed info string when previos information status string erasing - if module is active. -*/ -void CAM_Module::onInfoChanged( QString txt ) -{ - if ( txt.isEmpty() && isActiveModule() && !myInfo.isEmpty() && application() ) - application()->putInfo( myInfo ); -} - -/*!Public slot, nullify application pointer if the application was closed.*/ -void CAM_Module::onApplicationClosed( SUIT_Application* theApp ) -{ - if ( myApp == theApp ) - myApp = NULL; -} - -/*!Create and return new instance of CAM_DataModel.*/ -CAM_DataModel* CAM_Module::createDataModel() -{ - return new CAM_DataModel( this ); -} - -/*!Sets module name to \a name. - * \param name - new name for module. - */ -void CAM_Module::setModuleName( const QString& name ) -{ - myName = name; -} - -/*!Sets module icon to \a icon. - * \param icon - new icon for module. - */ -void CAM_Module::setModuleIcon( const QPixmap& icon ) -{ - myIcon = icon; -} - -/*! Return menu manager pointer. - * \retval QtxActionMenuMgr pointer - menu manager. - */ -QtxActionMenuMgr* CAM_Module::menuMgr() const -{ - QtxActionMenuMgr* mgr = 0; - if ( application() && application()->desktop() ) - mgr = application()->desktop()->menuMgr(); - return mgr; -} - -/*! Return tool manager pointer. - * \retval QtxActionToolMgr pointer - tool manager. - */ -QtxActionToolMgr* CAM_Module::toolMgr() const -{ - QtxActionToolMgr* mgr = 0; - if ( application() && application()->desktop() ) - mgr = application()->desktop()->toolMgr(); - return mgr; -} - -/*! Create tool bar with name \a name, if it was't created before. - * \retval -1 - if tool manager was't be created. - */ -int CAM_Module::createTool( const QString& name ) -{ - if ( !toolMgr() ) - return -1; - - return toolMgr()->createToolBar( name ); -} - -/*! Create tool. Register action \a a with id \a id. - * Insert QAction to tool manager. - *\param a - QAction - *\param tBar - integer - *\param id - integer - *\param idx - integer - *\retval integer id of new action in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int idx ) -{ - if ( !toolMgr() ) - return -1; - - int regId = registerAction( id, a ); - int intId = toolMgr()->insert( a, tBar, idx ); - return intId != -1 ? regId : -1; -} - -/*! Create tool. Register action \a a with id \a id. - * Insert QAction to tool manager. - *\param a - QAction - *\param tBar - QString& - *\param id - integer - *\param idx - integer - *\retval integer id of new action in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx ) -{ - if ( !toolMgr() ) - return -1; - - int regId = registerAction( id, a ); - int intId = toolMgr()->insert( a, tBar, idx ); - return intId != -1 ? regId : -1; -} - -/*! Create tool. - * Insert QAction with id \a id from action map(myActionMap) to tool manager. - *\param id - integer - *\param tBar - integer - *\param idx - integer - *\retval integer id of new action in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createTool( const int id, const int tBar, const int idx ) -{ - if ( !toolMgr() ) - return -1; - - int intId = toolMgr()->insert( action( id ), tBar, idx ); - return intId != -1 ? id : -1; -} - -/*! Create tool. - * Insert QAction with id \a id from action map(myActionMap) to tool manager. - *\param id - integer - *\param tBar - QString& - *\param idx - integer - *\retval integer id of new action in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createTool( const int id, const QString& tBar, const int idx ) -{ - if ( !toolMgr() ) - return -1; - - int intId = toolMgr()->insert( action( id ), tBar, idx ); - return intId != -1 ? id : -1; -} - -/*! Create menu. - * Insert submenu \a subMenu to menu manager. - *\param subMenu - QString& - *\param menu - integer - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( const QString& subMenu, const int menu, - const int id, const int group, const int index, - const bool enableEmpty ) -{ - if ( !menuMgr() ) - return -1; - - return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty ); -} - -/*! Create menu. - * Insert submenu \a subMenu to menu manager. - *\param subMenu - QString& - *\param menu - QString& - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( const QString& subMenu, const QString& menu, - const int id, const int group, const int index, - const bool enableEmpty ) -{ - if ( !menuMgr() ) - return -1; - - return menuMgr()->insert( subMenu, menu, group, id, index, enableEmpty ); -} - - -/*! Create menu. Register action \a a with id \a id. - * Insert QAction to menu manager. - *\param a - Qaction - *\param menu - integer - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int index ) -{ - if ( !a || !menuMgr() ) - return -1; - - int regId = registerAction( id, a ); - int intId = menuMgr()->insert( a, menu, group, index ); - return intId != -1 ? regId : -1; -} - -/*! Create menu. Register action \a a with id \a id. - * Insert QAction to menu manager. - *\param a - Qaction - *\param menu - QString& - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int index ) -{ - if ( !a || !menuMgr() ) - return -1; - - int regId = registerAction( id, a ); - int intId = menuMgr()->insert( a, menu, group, index ); - return intId != -1 ? regId : -1; -} - -/*! Create menu. - * Insert QAction with id \a id from action map(myActionMap) to menu manager. - *\param menu - integer - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( const int id, const int menu, const int group, const int index ) -{ - if ( !menuMgr() ) - return -1; - - int intId = menuMgr()->insert( action( id ), menu, group, index ); - return intId != -1 ? id : -1; -} - -/*! Create menu. - * Insert QAction with id \a id from action map(myActionMap) to menu manager. - *\param menu - QString& - *\param id - integer - *\param group - integer - *\param index - integer - *\retval integer id of new menu in tool manager. - *\retval Return -1 if something wrong. - */ -int CAM_Module::createMenu( const int id, const QString& menu, const int group, const int index ) -{ - if ( !menuMgr() ) - return -1; - - int intId = menuMgr()->insert( action( id ), menu, group, index ); - return intId != -1 ? id : -1; -} - -/*!Sets menus shown to \a on floag. - *\param on - flag. - */ -void CAM_Module::setMenuShown( const bool on ) -{ - QtxActionMenuMgr* mMgr = menuMgr(); - if ( !mMgr ) - return; - - bool upd = mMgr->isUpdatesEnabled(); - mMgr->setUpdatesEnabled( false ); - - QAction* sep = separator(); - for ( QMap::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it ) - { - if ( it.data() != sep ) - mMgr->setShown( mMgr->actionId( it.data() ), on ); - } - - mMgr->setUpdatesEnabled( upd ); - if ( upd ) - mMgr->update(); -} - -/*!Sets menu shown for QAction \a a to \a on flag. - * \param a - QAction - * \param on - flag - */ -void CAM_Module::setMenuShown( QAction* a, const bool on ) -{ - if ( menuMgr() ) - menuMgr()->setShown( menuMgr()->actionId( a ), on ); -} - -/*!Sets menu shown for action with id=\a id to \a on flag. - * \param id - id of action - * \param on - flag - */ -void CAM_Module::setMenuShown( const int id, const bool on ) -{ - setMenuShown( action( id ), on ); -} - -/*!Set tools shown to \a on flag. - *\param on - boolean flag. - */ -void CAM_Module::setToolShown( const bool on ) -{ - QtxActionToolMgr* tMgr = toolMgr(); - if ( !tMgr ) - return; - - bool upd = tMgr->isUpdatesEnabled(); - tMgr->setUpdatesEnabled( false ); - - QAction* sep = separator(); - for ( QMap::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it ) - { - if ( it.data() != sep ) - tMgr->setShown( tMgr->actionId( it.data() ), on ); - } - - tMgr->setUpdatesEnabled( upd ); - if ( upd ) - tMgr->update(); -} - -/*!Set tools shown for QAction \a a to \a on flag. - * \param a - QAction - * \param on - boolean flag - */ -void CAM_Module::setToolShown( QAction* a, const bool on ) -{ - if ( toolMgr() ) - toolMgr()->setShown( toolMgr()->actionId( a ), on ); -} - -/*!Set tools shown for action with id=\a id to \a on flag. - * \param id - integer action id - * \param on - boolean flag - */ -void CAM_Module::setToolShown( const int id, const bool on ) -{ - setToolShown( action( id ), on ); -} - -/*! Return action by id. - * \param id - id of action. - * \retval QAction. - */ -QAction* CAM_Module::action( const int id ) const -{ - QAction* a = 0; - if ( myActionMap.contains( id ) ) - a = myActionMap[id]; - return a; -} - -/*! Return id by action. - * \param a - QAction. - * \retval id of action. - */ -int CAM_Module::actionId( const QAction* a ) const -{ - int id = -1; - for ( QMap::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && id == -1; ++it ) - { - if ( it.data() == a ) - id = it.key(); - } - return id; -} - -/*! Create new instance of QtxAction and register action with \a id. - * \param id - id for new action. - * \param text - parameter for creation QtxAction - * \param icon - parameter for creation QtxAction - * \param menu - parameter for creation QtxAction - * \param tip - tip status for QtxAction action. - * \param key - parameter for creation QtxAction - * \param parent - parent for action - * \param toggle - parameter for creation QtxAction - * \param reciever - - * \param member - - */ -QAction* CAM_Module::createAction( const int id, const QString& text, const QIconSet& icon, - const QString& menu, const QString& tip, const int key, - QObject* parent, const bool toggle, QObject* reciever, const char* member ) -{ - QtxAction* a = new QtxAction( text, icon, menu, key, parent, 0, toggle ); - a->setStatusTip( tip ); - - if ( reciever && member ) - connect( a, SIGNAL( activated() ), reciever, member ); - - registerAction( id, a ); - - return a; -} - -/*! Register action in action map. - * \param id - id for action. - * \param a - action - * \retval new id for action. - */ -int CAM_Module::registerAction( const int id, QAction* a ) -{ - int ident = -1; - for ( QMap::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && ident == -1; ++it ) - if ( it.data() == a ) - ident = it.key(); - - if ( ident != -1 ) - return ident; - - static int generatedId = -1; - ident = id < 0 ? --generatedId : id; - - myActionMap.insert( ident, a ); - - if ( menuMgr() ) - menuMgr()->registerAction( a ); - - if ( toolMgr() ) - toolMgr()->registerAction( a ); - - return ident; -} - -/*! Unregister an action. - * \param id - id for action. - * \retval true if succeded, false if action is used - */ -bool CAM_Module::unregisterAction( const int id ) -{ - return unregisterAction( action( id ) ); -} - -/*! Unregister an action. - * \param a - action - * \retval true if succeded, false if action is used - */ -bool CAM_Module::unregisterAction( QAction* a ) -{ - if ( !a ) - return false; - if ( menuMgr() ) { - int id = menuMgr()->actionId( a ); - if ( id != -1 && menuMgr()->containsMenu( id, -1 ) ) - return false; - } - if ( toolMgr() ) { - int id = toolMgr()->actionId( a ); - if ( id != -1 && toolMgr()->containsAction( id ) ) - return false; - } - if ( menuMgr() ) - menuMgr()->unRegisterAction( menuMgr()->actionId( a ) ); - if ( toolMgr() ) - toolMgr()->unRegisterAction( toolMgr()->actionId( a ) ); - return true; -} - -/*! Return qt action manager separator.*/ -QAction* CAM_Module::separator() -{ - return QtxActionMgr::separator(); -} - -/*! Connect data model of module with active study */ -void CAM_Module::connectToStudy( CAM_Study* camStudy ) -{ - CAM_Application* app = camStudy ? dynamic_cast( camStudy->application() ) : 0; - if( !app ) - return; - - CAM_DataModel* prev = 0; - for( CAM_Application::ModuleListIterator it = app->modules(); it.current(); ++it ) - { - CAM_DataModel* dm = it.current()->dataModel(); - if( it.current() == this && !camStudy->containsDataModel( dm ) ) - { - if ( prev ) - camStudy->insertDataModel( it.current()->dataModel(), prev ); - else - camStudy->insertDataModel( it.current()->dataModel(), 0 ); - } - prev = dm; - } -} diff --git a/src/CAM/CAM_Module.h b/src/CAM/CAM_Module.h deleted file mode 100755 index df9282a41..000000000 --- a/src/CAM/CAM_Module.h +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_MODULE_H -#define CAM_MODULE_H - -#include "CAM.h" - -#include -#include -#include -#include - -class QAction; -class SUIT_Study; -class SUIT_Application; -class CAM_Study; -class CAM_DataModel; -class CAM_Application; -class QtxActionMenuMgr; -class QtxActionToolMgr; - -#ifdef WIN32 -#pragma warning( disable: 4251 ) -#endif - -/*! - * Class provide support of tool and menu managers. - */ -class CAM_EXPORT CAM_Module : public QObject -{ - Q_OBJECT - -public: - CAM_Module(); - CAM_Module( const QString& ); - virtual ~CAM_Module(); - - virtual void initialize( CAM_Application* ); - - QString moduleName() const; - QPixmap moduleIcon() const; - - CAM_DataModel* dataModel() const; - CAM_Application* application() const; - - virtual QString iconName() const; - - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& title ) {}; - virtual void updateCommandsStatus() {}; - - virtual void putInfo( const QString&, const int = -1 ); - - bool isActiveModule() const; - - /** @name Set Menu Shown*/ - //@{ - virtual void setMenuShown( const bool ); - void setMenuShown( QAction*, const bool ); - void setMenuShown( const int, const bool ); - //@} - - /** @name Set Tool Shown*/ - //@{ - virtual void setToolShown( const bool ); - void setToolShown( QAction*, const bool ); - void setToolShown( const int, const bool ); - //@} - -public slots: - virtual bool activateModule( SUIT_Study* ); - virtual bool deactivateModule( SUIT_Study* ); - - virtual void connectToStudy( CAM_Study* ); - - virtual void studyClosed( SUIT_Study* ); - virtual void studyChanged( SUIT_Study*, SUIT_Study* ); - - virtual void onApplicationClosed( SUIT_Application* ); - -private slots: - void onInfoChanged( QString ); - -protected: - virtual CAM_DataModel* createDataModel(); - - virtual void setModuleName( const QString& ); - virtual void setModuleIcon( const QPixmap& ); - - QtxActionMenuMgr* menuMgr() const; - QtxActionToolMgr* toolMgr() const; - - /** @name Create tool methods.*/ - //@{ - int createTool( const QString& ); - int createTool( const int, const int, const int = -1 ); - int createTool( const int, const QString&, const int = -1 ); - int createTool( QAction*, const int, const int = -1, const int = -1 ); - int createTool( QAction*, const QString&, const int = -1, const int = -1 ); - //@} - - /** @name Create menu methods.*/ - //@{ - int createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1, const bool = false ); - int createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1, const bool = false ); - int createMenu( const int, const int, const int = -1, const int = -1 ); - int createMenu( const int, const QString&, const int = -1, const int = -1 ); - int createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 ); - int createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 ); - //@} - - static QAction* separator(); - - /**Action ids methods.*/ - //@{ - QAction* action( const int ) const; - int actionId( const QAction* ) const; - //@} - - int registerAction( const int, QAction* ); - bool unregisterAction( const int ); - bool unregisterAction( QAction* ); - QAction* createAction( const int, const QString&, const QIconSet&, const QString&, - const QString&, const int, QObject* = 0, - const bool = false, QObject* = 0, const char* = 0 ); - -private: - CAM_Application* myApp; - QString myName; - QPixmap myIcon; - QString myInfo; - CAM_DataModel* myDataModel; - QMap myActionMap; - - friend class CAM_Application; -}; - -#ifdef WIN32 -#pragma warning( default: 4251 ) -#endif - -extern "C" -{ - typedef CAM_Module* (*GET_MODULE_FUNC)(); -} - -#define GET_MODULE_NAME "createModule" - -#endif diff --git a/src/CAM/CAM_RootObject.cxx b/src/CAM/CAM_RootObject.cxx deleted file mode 100755 index e1d9771e3..000000000 --- a/src/CAM/CAM_RootObject.cxx +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_RootObject.h" - -#include "CAM_DataModel.h" -#include "CAM_Module.h" - -/*!Constructor. Initialize by \a parent. - * Set data model to 0. - */ -CAM_RootObject::CAM_RootObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ), -myDataModel( 0 ) -{ -} - -/*!Constructor. Initialize by \a parent and \a data - data object - *\param data - data object - *\param parent - parent data object - */ -CAM_RootObject::CAM_RootObject( CAM_DataModel* data, SUIT_DataObject* parent ) -: CAM_DataObject( parent ), -myDataModel( data ) -{ -} - -/*!Destructor. Do nothing.*/ -CAM_RootObject::~CAM_RootObject() -{ -} - -/*! - Returns module name -*/ -QString CAM_RootObject::name() const -{ - QString aName = ""; - if (myDataModel) - aName = myDataModel->module()->moduleName(); - return aName; -} - -/*!Get data model - *\retval const CAM_DataModel pointer to data model. - */ -CAM_DataModel* CAM_RootObject::dataModel() const -{ - return myDataModel; -} - -/*!Set data model. - *\param dm - data model to set. - */ -void CAM_RootObject::setDataModel( CAM_DataModel* dm ) -{ - myDataModel = dm; -} diff --git a/src/CAM/CAM_RootObject.h b/src/CAM/CAM_RootObject.h deleted file mode 100755 index 8456e7628..000000000 --- a/src/CAM/CAM_RootObject.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_ROOTOBJECT_H -#define CAM_ROOTOBJECT_H - -#include "CAM_DataObject.h" - -/*! - CAM_RootObject - class intended for optimized access to CAM_DataModel instance - from CAM_DataObject instances. - - To take advantage of this class in a specific application, - custom data model root object class should be derived from both CAM_RootObject - and application-specific DataObject implementation using virtual inheritance. - */ -class CAM_EXPORT CAM_RootObject : public virtual CAM_DataObject -{ -public: - CAM_RootObject( SUIT_DataObject* = 0 ); - CAM_RootObject( CAM_DataModel*, SUIT_DataObject* = 0 ); - virtual ~CAM_RootObject(); - - virtual QString name() const; - - virtual CAM_DataModel* dataModel() const; - virtual void setDataModel( CAM_DataModel* ); - -private: - CAM_DataModel* myDataModel; -}; - -#endif - -#if _MSC_VER > 1000 -#pragma once -#endif diff --git a/src/CAM/CAM_Study.cxx b/src/CAM/CAM_Study.cxx deleted file mode 100755 index 65ded0325..000000000 --- a/src/CAM/CAM_Study.cxx +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "CAM_Study.h" - -#include "CAM_DataModel.h" -#include "CAM_DataObject.h" -#include "CAM_RootObject.h" -#include "CAM_Module.h" - -/*!Constructor.*/ -CAM_Study::CAM_Study( SUIT_Application* app ) -: SUIT_Study( app ) -{ -} - -/*!Destructor*/ -CAM_Study::~CAM_Study() -{ -} - -/*!Closing all data models and close document permanently(if \a permanently = true.) - * \param permanently - flag - */ -void CAM_Study::closeDocument(bool permanently) -{ - for ( ModelListIterator it( myDataModels ); it.current(); ++it ) - it.current()->close(); - - SUIT_Study::closeDocument(permanently); -} - -/*!Append data model to list. - * \param dm - data model for adding - */ -bool CAM_Study::appendDataModel( const CAM_DataModel* dm ) -{ - return insertDataModel( dm, myDataModels.count() ); -} - -/*!Insert data model \a dm after \a other - * \param dm - data model for adding - * \param other - previus data model for \a dm - */ -bool CAM_Study::insertDataModel( const CAM_DataModel* dm, const CAM_DataModel* other ) -{ - int idx = myDataModels.findRef( other ); - return insertDataModel( dm, idx < 0 ? idx : idx + 1 ); -} - -/*!Insert data model with index \a idx. \n - * \param dm - data model - * \param idx - index for inserting(must be no less zero) - * \retval true - if model added successful, else false. - */ -bool CAM_Study::insertDataModel( const CAM_DataModel* dm, const int idx ) -{ - if ( !dm || myDataModels.findRef( dm ) != -1 ) - return false; - - int pos = idx < 0 ? myDataModels.count() : idx; - myDataModels.insert( QMIN( pos, (int)myDataModels.count() ), dm ); - - connect( dm, SIGNAL( rootChanged( const CAM_DataModel* ) ), SLOT( updateModelRoot( const CAM_DataModel* ) ) ); - - dataModelInserted( dm ); - - return true; -} - -/*! Remove data model from list - * \param dm data model - * \retval true - if all ok, else false. - */ -bool CAM_Study::removeDataModel( const CAM_DataModel* dm ) -{ - if ( !dm ) - return true; - - CAM_RootObject* aModelRoot = dynamic_cast( dm->root() ); - if ( aModelRoot ) - aModelRoot->setDataModel( 0 ); - - return myDataModels.remove( dm ); -} - -/*!Check data model contains in list. - * \param dm - data model - * \retval true - if data model in list, else false. - */ -bool CAM_Study::containsDataModel( const CAM_DataModel* dm ) const -{ - return myDataModels.contains( dm ); -} - -/*!Gets list of all data models. - * \param lst - output data model list. - */ -void CAM_Study::dataModels( ModelList& lst ) const -{ - lst.clear(); - for ( ModelListIterator it( myDataModels ); it.current(); ++it ) - lst.append( it.current() ); -} - -/*! Open data model \a dModel, if it saved*/ -void CAM_Study::dataModelInserted( const CAM_DataModel* dModel ) -{ - CAM_DataModel* dm = (CAM_DataModel*)dModel; - - if ( isSaved() ) // need to load data model from an exisitng file? - openDataModel( studyName(), dm ); - else // no, just need to update data model's connection to study tree - //(some application may want to show model's root in a study tree even if a model is empty) - dm->create( this ); - updateModelRoot( dm ); -} - -/*! \retval false*/ -bool CAM_Study::openDataModel( const QString&, CAM_DataModel* ) -{ - return false; -} - -/*! \retval false*/ -bool CAM_Study::saveDataModel( const QString&, CAM_DataModel* ) -{ - return false; -} - -/*! Public slot. Update model root.*/ -void CAM_Study::updateModelRoot( const CAM_DataModel* dm ) -{ - if ( !root() ) - return; - - DataObjectList childList; - root()->children( childList ); - CAM_DataObject* curRoot = 0; - QString aName = dm->root() ? dm->root()->name() : dm->module()->moduleName(); - int i = 0; - for ( int n = childList.count(); i < n; i++ ) { - if ( childList.at( i )->name() == aName ) { - curRoot = dynamic_cast( childList.at( i ) ); - break; - } - } - - if ( curRoot == dm->root() ) - return; - - // replacing old data model root with a new one - old root deleted here ! - if ( curRoot ) - root()->replaceChild( curRoot, dm->root(), true ); - else { - int idx = myDataModels.findRef( dm ); - if ( idx != -1 ) - root()->insertChild( dm->root(), idx ); - } -} diff --git a/src/CAM/CAM_Study.h b/src/CAM/CAM_Study.h deleted file mode 100755 index 18839617a..000000000 --- a/src/CAM/CAM_Study.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef CAM_STUDY_H -#define CAM_STUDY_H - -#include "CAM.h" - -#include "CAM_DataModel.h" - -#include - -#include - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*! - \class CAM_Study - Represents study for using in CAM, contains list of - data model references from all modules. Provides - necessary functionality for data models management. -*/ -class CAM_EXPORT CAM_Study : public SUIT_Study -{ - Q_OBJECT - -public: - typedef QPtrList ModelList; - typedef QPtrListIterator ModelListIterator; - -public: - CAM_Study( SUIT_Application* ); - virtual ~CAM_Study(); - - virtual void closeDocument(bool permanently = true); - - /** @name Insert data model methods.*/ - //@{ - bool appendDataModel( const CAM_DataModel* ); - virtual bool insertDataModel( const CAM_DataModel*, const int = -1 ); - bool insertDataModel( const CAM_DataModel*, const CAM_DataModel* ); - //@} - - virtual bool removeDataModel( const CAM_DataModel* ); - - bool containsDataModel( const CAM_DataModel* ) const; - - void dataModels( ModelList& ) const; - -protected: - virtual void dataModelInserted( const CAM_DataModel* ); - virtual bool openDataModel( const QString&, CAM_DataModel* ); - virtual bool saveDataModel( const QString&, CAM_DataModel* ); - -protected slots: - virtual void updateModelRoot( const CAM_DataModel* ); - -private: - //! Data model list - ModelList myDataModels; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/CAM/Makefile.in b/src/CAM/Makefile.in deleted file mode 100755 index 6c02e685b..000000000 --- a/src/CAM/Makefile.in +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Vladimir Klyachin (OCN) -# Module : CAM -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@srcdir@/resources - - -@COMMENCE@ - -EXPORT_HEADERS= CAM_Application.h \ - CAM_DataModel.h \ - CAM_DataObject.h \ - CAM.h \ - CAM_Module.h \ - CAM_Study.h \ - CAM_RootObject.h - -PO_FILES = CAM_msg_en.po - -LIB = libCAM.la - -LIB_SRC= CAM_Application.cxx \ - CAM_DataModel.cxx \ - CAM_DataObject.cxx \ - CAM_Module.cxx \ - CAM_Study.cxx \ - CAM_RootObject.cxx - -LIB_MOC = CAM_Application.h \ - CAM_Module.h \ - CAM_Study.h \ - CAM_DataModel.h - -CPPFLAGS+=$(QT_INCLUDES) - -LDFLAGS+=$(QT_MT_LIBS) - -LIBS+= -lsuit -lstd -LDFLAGSFORBIN= -lSUITApp - -@CONCLUDE@ - - diff --git a/src/CAM/resources/CAM_msg_en.po b/src/CAM/resources/CAM_msg_en.po deleted file mode 100755 index 4377dfc56..000000000 --- a/src/CAM/resources/CAM_msg_en.po +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ERROR_TLT" -msgstr "Error" - -msgid "ERROR_ACTIVATE_MODULE_MSG" -msgstr "Failed to activate module %1" diff --git a/src/DDS/DDS.h b/src/DDS/DDS.h deleted file mode 100644 index 4e32211d2..000000000 --- a/src/DDS/DDS.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef DDS_H -#define DDS_H - -#include - -#include -#include - -#define UNIT_SYSTEM_SI "SI" - -typedef enum { DDS_MT_OK, DDS_MT_WARNING, - DDS_MT_ERROR, DDS_MT_ALARM, - DDS_MT_INFO, DDS_MT_NONE } DDS_MsgType; - -DEFINE_BASECOLLECTION(DDS_BaseColOfAsciiString,TCollection_AsciiString) - -#endif diff --git a/src/DDS/DDS_DicGroup.cxx b/src/DDS/DDS_DicGroup.cxx deleted file mode 100644 index 56197a523..000000000 --- a/src/DDS/DDS_DicGroup.cxx +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "DDS_DicGroup.h" - -#include "DDS_Dictionary.h" - -#include -#include - -#include - -#include - -#include -#include - -IMPLEMENT_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) -IMPLEMENT_STANDARD_RTTIEXT(DDS_DicGroup, MMgt_TShared) - -/*! - \class DDS_DicGroup - - This class to provide set of DDS_DicItem objects from one component. -*/ - -/*! - Constructor. Create the group with name \aname. -*/ -DDS_DicGroup::DDS_DicGroup( const TCollection_AsciiString& name ) -: MMgt_TShared(), -myName( name ), -myActiveSystem( UNIT_SYSTEM_SI ) -{ -} - -/*! - Copy constructor. -*/ -DDS_DicGroup::DDS_DicGroup( const DDS_DicGroup& ) -{ -} - -/*! - Get the name of group (component). -*/ -TCollection_AsciiString DDS_DicGroup::GetName() const -{ - return myName; -} - -/*! - Returns the names list of defined unit systems. - Parameter \atheSystems will contains the sequence of string names. -*/ -void DDS_DicGroup::GetUnitSystems( TColStd_SequenceOfAsciiString& theSystemSeq ) const -{ - theSystemSeq.Clear(); - for ( UnitSystemMap::Iterator it( myUnitSystem ); it.More(); it.Next() ) - { - if ( it.Key() == TCollection_AsciiString( UNIT_SYSTEM_SI ) ) - theSystemSeq.Prepend( it.Key() ); - else - theSystemSeq.Append( it.Key() ); - } -} - -/*! - Returns the label of unit system \aname. If unit system not found then empty string returned. -*/ -TCollection_ExtendedString DDS_DicGroup::GetUnitSystemLabel( const TCollection_AsciiString& name ) const -{ - TCollection_ExtendedString aLabel; - if ( myUnitSystem.IsBound( name ) ) - aLabel = myUnitSystem.Find( name ); - return aLabel; -} - -/*! - Gets the name of active unit system. -*/ -TCollection_AsciiString DDS_DicGroup::GetActiveUnitSystem() const -{ - return myActiveSystem; -} - -/*! - Sets the name of active unit system. -*/ -void DDS_DicGroup::SetActiveUnitSystem( const TCollection_AsciiString& theSystem ) -{ - if ( myUnitSystem.IsBound( theSystem ) ) - myActiveSystem = theSystem; -} - -/*! - Assignment operator. -*/ -void DDS_DicGroup::operator=( const DDS_DicGroup& ) -{ -} - -/*! - Fill the internal data structures from XML parsed structures. Internal. -*/ -void DDS_DicGroup::FillDataMap( const LDOM_Element& theComponentData, const LDOM_Element& theDocElement ) -{ - TCollection_AsciiString aCompName = theComponentData.getAttribute( DDS_Dictionary::KeyWord( "COMPONENT_NAME" ) ); - - LDOM_Element systems = theComponentData.GetChildByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEMS" ) ); - if ( !systems.isNull() ) - { - LDOM_NodeList systemList = systems.getElementsByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEM" ) ); - for ( Standard_Integer i = 0; i < systemList.getLength(); i++ ) - { - //const LDOM_Element& aSystem = (const LDOM_Element &)systemList.item( i ); - LDOM_Node aNode = systemList.item( i ); - const LDOM_Element& anElem = (const LDOM_Element&) aNode; - LDOM_Element aSystem(anElem); - TCollection_AsciiString aName = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_NAME" ) ); - TCollection_ExtendedString aLabel = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_LABEL" ) ); - - if ( aName.IsEmpty() ) - continue; - - if ( !myUnitSystem.IsBound( aName ) ) - myUnitSystem.Bind( aName, aLabel ); - } - } - - if ( !myUnitSystem.IsBound( UNIT_SYSTEM_SI ) ) - { - printf( "Warning: Mandatory unit system SI not defined in component: \"%s\". Added automaticaly", aCompName.ToCString() ); - myUnitSystem.Bind( UNIT_SYSTEM_SI, TCollection_ExtendedString( "System international" ) ); - } - - TColStd_SequenceOfAsciiString unitSystems; - GetUnitSystems( unitSystems ); - - LDOM_NodeList aData = theComponentData.getElementsByTagName( DDS_Dictionary::KeyWord( "DATUM" ) ); - if ( !aData.getLength() ) - return; - - for ( Standard_Integer i = 0; i < aData.getLength(); i++ ) - { - //LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i ); - LDOM_Node aNode = aData.item( i ); - const LDOM_Element& anElem = (const LDOM_Element&) aNode; - LDOM_Element aQuantity(anElem); - - // 1. Attributes (id,label,units?,format?,required?) - TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) ); - Handle(DDS_DicItem) aDicItem = new DDS_DicItem(); - - aDicItem->myComponent = this; - aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems ); - myDataMap.Add( anID, aDicItem ); - } -} - -/*! - Gets dictionary item with specified identifier \atheID. - If dictionary item not found then null handle returned. -*/ -Handle(DDS_DicItem) DDS_DicGroup::GetDicItem( const TCollection_AsciiString& theID ) const -{ - Handle(DDS_DicItem) aDicItem; - // get dictionary item by id - if ( myDataMap.Contains( theID ) ) - aDicItem = myDataMap.FindFromKey( theID ); - - return aDicItem; -} diff --git a/src/DDS/DDS_DicGroup.h b/src/DDS/DDS_DicGroup.h deleted file mode 100644 index a804776ea..000000000 --- a/src/DDS/DDS_DicGroup.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef DDS_DICGROUP_H -#define DDS_DICGROUP_H - -#include "DDS.h" - -#include "DDS_DicItem.h" - -#include - -#include - -#include - -class LDOM_Element; -class TColStd_SequenceOfAsciiString; - -DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) - -class DDS_DicGroup : public MMgt_TShared -{ -public: - DDS_DicGroup( const TCollection_AsciiString& ); - - TCollection_AsciiString GetName() const; - - Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; - - Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; - Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; - - Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; - Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); - -private: - DDS_DicGroup( const DDS_DicGroup& ); - - void operator=( const DDS_DicGroup& ); - - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); - -private: - typedef NCollection_DataMap UnitSystemMap; - -private: - TCollection_AsciiString myName; - DDS_IndexedDataMapOfDicItems myDataMap; - UnitSystemMap myUnitSystem; - TCollection_AsciiString myActiveSystem; - - friend class DDS_Dictionary; - -public: - DEFINE_STANDARD_RTTI(DDS_DicGroup) -}; - -DEFINE_BASECOLLECTION(DDS_BaseCollectionOfDicGroups, Handle(DDS_DicGroup)) -DEFINE_INDEXEDDATAMAP(DDS_IndexedDataMapOfDicGroups, DDS_BaseCollectionOfDicGroups, - TCollection_AsciiString, Handle(DDS_DicGroup)) - -#endif diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx deleted file mode 100644 index 02cdefb93..000000000 --- a/src/DDS/DDS_DicItem.cxx +++ /dev/null @@ -1,1128 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "DDS_DicItem.h" -#include "DDS_Dictionary.h" - -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -IMPLEMENT_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared) -IMPLEMENT_STANDARD_RTTIEXT(DDS_DicItem, MMgt_TShared) - -/*! - \class DDS_DicItem - - This class to provide information about datum (phisical characteristic parameter). -*/ - -/*! - Constructor. Creates the instance of empty dictionary item. -*/ -DDS_DicItem::DDS_DicItem() -: myType( 0 ), -myDefValue( 0 ), -myMax( 0 ), -myMin( 0 ), -myMinZoom( 0.1 ), -myMaxZoom( 10 ), -myZoomOrder( 2 ) -{ -} - -/*! - Copy constructor. Internal. -*/ -DDS_DicItem::DDS_DicItem( const DDS_DicItem& ) -{ -} - -/*! - Assignment operator. Internal. -*/ -void DDS_DicItem::operator=( const DDS_DicItem& ) -{ -} - -/*! - Gets the identifier of parameter. -*/ -TCollection_AsciiString DDS_DicItem::GetId() const -{ - return myId; -} - -/*! - Gets the type of parameter. -*/ -DDS_DicItem::Type DDS_DicItem::GetType() const -{ - return (DDS_DicItem::Type)myType; -} - -/*! - Gets the label of the parameter. -*/ -TCollection_ExtendedString DDS_DicItem::GetLabel() const -{ - return myLabel; -} - -/*! - Gets the filter (regular expression) for the parameter values. -*/ -TCollection_ExtendedString DDS_DicItem::GetFilter() const -{ - return myFilter; -} - -/*! - Gets the Required attribute of the parameter. -*/ -TCollection_ExtendedString DDS_DicItem::GetRequired() const -{ - return myRequired; -} - -/*! - Gets the wrong value warning level of the parameter. -*/ -DDS_MsgType DDS_DicItem::GetWarningLevel() const -{ - return (DDS_MsgType)myWarnLevel; -} - -/*! - Gets the long description of the parameter. -*/ -TCollection_ExtendedString DDS_DicItem::GetLongDescription() const -{ - return myLongDescr; -} - -/*! - Gets the short description of the parameter. -*/ -TCollection_ExtendedString DDS_DicItem::GetShortDescription() const -{ - return myShortDescr; -} - -/*! - Gets the name of component - owner of parameter. -*/ -TCollection_AsciiString DDS_DicItem::GetComponent() const -{ - TCollection_AsciiString aCompName; - Handle(DDS_DicGroup) aComponent = Handle(DDS_DicGroup)::DownCast(myComponent); - if ( !aComponent.IsNull() ) - aCompName = aComponent->GetName(); - return aCompName; -} - -/*! - Gets the parameter unit of measure for active unit system. -*/ -TCollection_AsciiString DDS_DicItem::GetUnits() const -{ - return GetUnits( GetActiveUnitSystem() ); -} - -/*! - Gets the parameter unit of measure for specified unit system \atheSystem. - If specified unit system doesn't exist then empty string returned. -*/ -TCollection_AsciiString DDS_DicItem::GetUnits( const UnitSystem& theSystem ) const -{ - TCollection_AsciiString anUnits; - UnitData* unitData = GetUnitData( theSystem ); - if ( unitData ) - anUnits = unitData->myUnits; - return anUnits; -} - -/*! - Gets the minimum value of parameter for active unit system. - Returned value converted to SI. -*/ -Standard_Real DDS_DicItem::GetMinValue() const -{ - return GetMinValue( GetActiveUnitSystem() ); -} - -/*! - Gets the minimum value of parameter for specified unit system \atheSystem. - Returned value converted to SI. -*/ -Standard_Real DDS_DicItem::GetMinValue( const UnitSystem& theUnitsSystem ) const -{ - return FromSI( myMin, theUnitsSystem ); -} - -/*! - Gets the maximum value of parameter for active unit system. - Returned value converted to SI. -*/ -Standard_Real DDS_DicItem::GetMaxValue() const -{ - return GetMaxValue( GetActiveUnitSystem() ); -} - -/*! - Gets the maximum value of parameter for specified unit system \atheSystem. - Returned value converted to SI. -*/ -Standard_Real DDS_DicItem::GetMaxValue( const UnitSystem& theUnitsSystem ) const -{ - return FromSI( myMax, theUnitsSystem ); -} - -/*! - Gets the precision (number of digit after decimal point) of parameter for active unit system. -*/ -Standard_Integer DDS_DicItem::GetPrecision() const -{ - return GetPrecision( GetActiveUnitSystem() ); -} - -/*! - Gets the precision (number of digit after decimal point) of parameter for specified - unit system \atheSystem. If specified unit system doesn't exist then zero returned. -*/ -Standard_Integer DDS_DicItem::GetPrecision( const UnitSystem& theSystem ) const -{ - Standard_Integer aRes = 0; - UnitData* unitData = GetUnitData( theSystem ); - if ( unitData ) - aRes = unitData->myPrecision; - return aRes; -} - -/*! - Gets the default value of parameter for active unit system. Default value returned as string. - If type of value is numeric (Float or Integer) and default value defined then returned number - converted to SI. -*/ -TCollection_ExtendedString DDS_DicItem::GetDefaultValue() const -{ - return GetDefaultValue( GetActiveUnitSystem() ); -} - -/*! - Gets the default value of parameter for specified unit system \atheSystem. Default value returned - as string. If type of value is numeric (Float or Integer) and default value defined then returned - number converted to SI. -*/ -TCollection_ExtendedString DDS_DicItem::GetDefaultValue( const UnitSystem& theSystem ) const -{ - if ( !myDefString.Length() ) - return myDefString; - - TCollection_ExtendedString aStr; - - switch ( myType ) - { - case Float: - case Integer: - aStr = FromSI( myDefValue, theSystem ); - break; - case List: - case String: - aStr = myDefString; - break; - default: - break; - } - return aStr; -} - -/*! - Gets the format string of parameter for active unit system. If argument \atheCanonical - is true then format string will be reduced to sprintf() specification (without extra - non standard qualifiers). -*/ -TCollection_AsciiString DDS_DicItem::GetFormat( const Standard_Boolean theCanonical ) const -{ - return GetFormat( GetActiveUnitSystem(), theCanonical ); -} - -/*! - Gets the format string of parameter for specified unit system \atheSystem. If argument - \atheCanonical is true then format string will be reduced to sprintf() specification - (without extra non standard qualifiers). -*/ -TCollection_AsciiString DDS_DicItem::GetFormat( const UnitSystem& theSystem, - const Standard_Boolean theCanonical ) const -{ - TCollection_AsciiString aFormat; - UnitData* unitData = GetUnitData( theSystem ); - if ( unitData ) - aFormat = unitData->myFormat; - - if ( theCanonical && aFormat.Length() > 1 ) - { - static TCollection_AsciiString f; - f = aFormat; - Standard_Boolean isRemoved = false; - while ( !isRemoved ) - { - char ch = f.Value( f.Length() - 1 ); - if ( ( ch != '%' && ch != '.' && !IsDigit( ch ) ) && f.Length() > 1 ) - f.Remove( f.Length() - 1 ); - else - isRemoved = true; - } - aFormat = f; - } - - return aFormat; -} - -/*! - Gets name of a list referenced by the parameter. This string is empty if the list - refernce is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue -*/ -TCollection_ExtendedString DDS_DicItem::GetNameOfValues() const -{ - return myListName; -} - -/*! - Gets item names and item ids of a list referenced by the parameter. This sequences is empty if - the list reference is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue -*/ -Standard_Boolean DDS_DicItem::GetListOfValues( Handle(TColStd_HArray1OfExtendedString)& theStrings, - Handle(TColStd_HArray1OfInteger)& theIntegers ) const -{ - theStrings = myListRef; - theIntegers = myListRefID; - return !theIntegers.IsNull() && !theStrings.IsNull(); -} - -/*! - Gets item names, item ids and item icons of a list referenced by the parameter. This sequences is empty - if the list reference is not defined - then use other properties: Type, DefaultValue, MaxValue, MinValue -*/ -Standard_Boolean DDS_DicItem::GetListOfValues( Handle(TColStd_HArray1OfExtendedString)& theStrings, - Handle(TColStd_HArray1OfInteger)& theIntegers, - Handle(TColStd_HArray1OfExtendedString)& theIcons ) const -{ - theStrings = myListRef; - theIntegers = myListRefID; - theIcons = myListRefIcons; - return !theIntegers.IsNull() && !theStrings.IsNull() && !theIcons.IsNull(); -} - - -/*! - Gets special values of the parameter. -*/ -Standard_Boolean DDS_DicItem::GetSpecialValues( TColStd_MapOfReal& theMap ) const -{ - theMap.Clear(); - if ( !myListRef.IsNull() ) - { - for ( Standard_Integer i = myListRef->Lower(); i <= myListRef->Upper(); i++ ) - { - if ( myListRef->Value( i ).IsAscii() ) - { - TCollection_AsciiString aStr( myListRef->Value( i ) ); - if ( aStr.IsRealValue() ) - theMap.Add( aStr.RealValue() ); - } - } - } - - return theMap.Extent() > 0; -} - -/*! - Gets minimum value of lateral zooming -*/ -Standard_Real DDS_DicItem::GetMinZoom() const -{ - return myMinZoom; -} - -/*! - Gets maximum value of lateral zooming -*/ -Standard_Real DDS_DicItem::GetMaxZoom() const -{ - return myMaxZoom; -} - -/*! - Gets order of lateral zooming -*/ -Standard_Real DDS_DicItem::GetZoomOrder() const -{ - return myZoomOrder; -} - -/*! - Convert value \atheVal to default SI units according to active unit system. -*/ -Standard_Real DDS_DicItem::ToSI( const Standard_Real theVal ) const -{ - return ToSI( theVal, GetActiveUnitSystem() ); -} - -/*! - Convert value \atheVal from default SI units according to active unit system. -*/ -Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal ) const -{ - return FromSI( theVal, GetActiveUnitSystem() ); -} - -/*! - Convert value to default SI units according to unit system \atheUnitsSystem. -*/ -Standard_Real DDS_DicItem::ToSI( const Standard_Real theVal, const UnitSystem& theUnitsSystem ) const -{ - Standard_Real aRes = theVal; - UnitData* anUnitData = GetUnitData( theUnitsSystem ); - if ( anUnitData ) - aRes = anUnitData->myZero + aRes * anUnitData->myScale; - return aRes; -} - -/*! - Convert value from default SI units according to unit system \atheUnitsSystem. -*/ -Standard_Real DDS_DicItem::FromSI( const Standard_Real theVal, const UnitSystem& theUnitsSystem ) const -{ - Standard_Real aRes = theVal; - UnitData* anUnitData = GetUnitData( theUnitsSystem ); - if ( anUnitData ) - aRes = ( aRes - anUnitData->myZero ) / anUnitData->myScale; - return aRes; -} - -/*! - Returns 'true' if data specified by \aflag exist. -*/ -Standard_Boolean DDS_DicItem::HasData( const Standard_Integer flag ) const -{ - return ( myData & flag ) == flag; -} - -/*! - Returns options for specified name \aname. If option not found then empty string returned. -*/ -TCollection_ExtendedString DDS_DicItem::GetOption( const TCollection_AsciiString& name ) const -{ - TCollection_ExtendedString res; - if ( myOptions.IsBound( name ) ) - res = myOptions.Find( name ); - return res; -} - -/*! - Returns names list of existing options in the specified sequence \anames. - If list not empty retunrs 'true' otherwise 'false'. -*/ -Standard_Boolean DDS_DicItem::GetOptionNames( TColStd_SequenceOfAsciiString& names ) const -{ - names.Clear(); - - for ( OptionsMap::Iterator it( myOptions ); it.More(); it.Next() ) - names.Append( it.Key() ); - - return !names.IsEmpty(); -} - - -/*! - Parse record in XML file and retrieve information relevant for this dictionary item -*/ -void DDS_DicItem::FillDataMap( TCollection_AsciiString theID, const LDOM_Element& theDatum, - const LDOM_Element& theCompElement, const LDOM_Element& theDocElement, - const TColStd_SequenceOfAsciiString& theSystems ) -{ - TCollection_AsciiString aLabel = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_LABEL" ) ); - TCollection_AsciiString aFormat = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_FORMAT" ) ); - TCollection_AsciiString aFilter = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_FILTER" ) ); - TCollection_AsciiString aRequired = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_REQUIRED" ) ); - - TCollection_AsciiString aBaseKeyWord = DDS_Dictionary::KeyWord( "DATUM_UNITS" ); - - for ( Standard_Integer j = 1; j <= theSystems.Length(); j++ ) - { - UnitSystem anUnitSystem = theSystems.Value( j ); - if ( !anUnitSystem.Length() ) - continue; - - TCollection_AsciiString aUnitKeyword = anUnitSystem + aBaseKeyWord; - - if ( !myUnitData.IsBound( anUnitSystem ) ) - myUnitData.Bind( anUnitSystem, UnitData() ); - - UnitData& anUnitData = myUnitData.ChangeFind( anUnitSystem ); - anUnitData.myUnits = theDatum.getAttribute( LDOMString( aUnitKeyword.ToCString() ) ); - } - - if ( theSystems.Length() && myUnitData.IsBound( theSystems.First() ) && - !myUnitData.Find( theSystems.First() ).myUnits.Length() ) - { - TCollection_AsciiString units = theDatum.getAttribute( LDOMString( aBaseKeyWord.ToCString() ) ); - if ( units.Length() ) - myUnitData.ChangeFind( theSystems.First() ).myUnits = units; - } - - TCollection_AsciiString units; - for ( NCollection_DataMap::Iterator iter( myUnitData ); iter.More() && units.IsEmpty(); iter.Next() ) - units = iter.Value().myUnits; - - for ( NCollection_DataMap::Iterator itr( myUnitData ); itr.More(); itr.Next() ) - { - UnitData& dataUnits = itr.ChangeValue(); - if ( dataUnits.myUnits.IsEmpty() ) - dataUnits.myUnits = units; - } - - // 2. Elements ( domain, description ) - Standard_Real aRealMinV = 0; - Standard_Real aRealMaxV = 0; - Standard_Real aRealDefV = 0; - - TCollection_AsciiString aType; - - DDS_MsgType aWrongValue = DDS_MT_NONE; - DDS_DicItem::Type aEnumType = DDS_DicItem::Unknown; - - TCollection_AsciiString aMinV; - TCollection_AsciiString aMaxV; - TCollection_AsciiString aDefV; - TCollection_AsciiString aListName; - - TCollection_AsciiString aLongD; - TCollection_AsciiString aShortD; - - TColStd_SequenceOfInteger aSeqOfValueID; - TColStd_SequenceOfExtendedString aSeqOfValue; - TColStd_SequenceOfExtendedString aSeqOfValueIconName; - - // Presentation - Standard_Real aMinZoom = 0; - Standard_Real aMaxZoom = 0; - Standard_Real aZoomOrder = 0; - - // Datum::Reports tags (if any) - LDOM_Element aWLev = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "WARNING_LEVEL" ) ); - if ( !aWLev.isNull() ) - { - TCollection_AsciiString aWrongValWL = aWLev.getAttribute( DDS_Dictionary::KeyWord( "WRONG_VALUE" ) ); - if ( aWrongValWL.IsEqual( "Info" ) ) - aWrongValue = DDS_MT_INFO; - else if ( aWrongValWL.IsEqual( "Warning" ) ) - aWrongValue = DDS_MT_WARNING; - else if ( aWrongValWL.IsEqual( "Alarm" ) ) - aWrongValue = DDS_MT_ALARM; - else if ( aWrongValWL.IsEqual( "Error" ) ) - aWrongValue = DDS_MT_ERROR; - } - - // Datum::Presentation - LDOM_Element aPrs = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "PRS" ) ); - if ( !aPrs.isNull() ) - { - LDOM_Element aLateralZoom = aPrs.GetChildByTagName( DDS_Dictionary::KeyWord( "LATERAL_ZOOM" ) ); - if ( !aLateralZoom.isNull() ) - { - TCollection_AsciiString aMinZoomStr = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_MINV" ) ); - TCollection_AsciiString aMaxZoomStr = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_MAXV" ) ); - TCollection_AsciiString aZoomOrderStr = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_ORDER" ) ); - - aMinZoomStr.RemoveAll( ' ' ); - if ( aMinZoomStr.IsRealValue() ) - aMinZoom = aMinZoomStr.RealValue(); - - aMaxZoomStr.RemoveAll( ' ' ); - if ( aMaxZoomStr.IsRealValue() ) - aMaxZoom = aMaxZoomStr.RealValue(); - - aZoomOrderStr.RemoveAll( ' ' ); - if ( aZoomOrderStr.IsRealValue() ) - aZoomOrder = aZoomOrderStr.RealValue(); - } - } - - // Quantity::Domain record as the only child of that tag name - LDOM_Element aDomain = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "DY_DOMAIN" ) ); - if ( !aDomain.isNull() ) - { - LDOM_Element aValueDescr = aDomain.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_DESCR" ) ); - if ( !aValueDescr.isNull() ) - { - // read: valueDescr? (type?,min?,max?,default?) - aType = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_TYPE" ) ); - if ( aType.IsEqual( "String" ) ) - aEnumType = String; - else if ( aType.IsEqual( "Float" ) ) - aEnumType = Float; - else if ( aType.IsEqual( "Integer" ) ) - aEnumType = Integer; - - if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MINV" ) ).isNull() ) - myData |= MinValue; - aMinV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MINV" ) ); - aMinV.RemoveAll( ' ' ); - if ( aMinV.IsRealValue() ) - aRealMinV = aMinV.RealValue(); - if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() ) - myData |= MaxValue; - aMaxV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MAXV" ) ); - aMaxV.RemoveAll( ' ' ); - if ( aMaxV.IsRealValue() ) - aRealMaxV = aMaxV.RealValue(); - aDefV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) ); - if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_DEFV" ) ).isNull() ) - myData |= DefaultValue; - - aDefV.RemoveAll( ' ' ); - if ( aDefV.IsRealValue() ) - aRealDefV = aDefV.RealValue(); - - TCollection_AsciiString aSpecVal = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_SPEC" ) ); - Split( aSpecVal, myListRef ); - } - else - { - // read: listRef? (list?) - LDOM_Element aListRef = aDomain.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_REF" ) ); - if ( !aListRef.isNull() ) - { - aType = "List"; - aEnumType = List; - LDOMString aListId = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VLR_LIST" ) ); - aDefV = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) ); - aDefV.RemoveAll( ' ' ); - LDOM_Element foundListItem; - for ( LDOM_Element aListItem = theCompElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) ); - aListItem != NULL && foundListItem == NULL; aListItem = aListItem.GetSiblingByTagName() ) - { - if ( aListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) ) - foundListItem = aListItem; - - } - for ( LDOM_Element aLstItem = theDocElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) ); - aLstItem != NULL && foundListItem == NULL; aLstItem = aLstItem.GetSiblingByTagName() ) - { - if ( aLstItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) ) - foundListItem = aLstItem; - } - - if ( foundListItem != NULL ) - { - // The appropriate list of values is found: store the list name - aListName = foundListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_NAME" ) ); - // Iteration through the list of values - LDOM_Element aListItemValue = foundListItem.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUE" ) ); - while ( aListItemValue != NULL ) - { - // read value ID - TCollection_AsciiString aListValueID = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEID" ) ); - if ( aListValueID.IsIntegerValue() ) - { - // Read the text in the element "value" - //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild(); - LDOM_Node aNode = aListItemValue.getFirstChild(); - const LDOM_Text& aText = (const LDOM_Text&) aNode; - LDOM_Text aListItemTxt(aText); - if ( !aListItemTxt.isNull() ) - { - // adding ID and text value to sequence - aSeqOfValueID.Append( aListValueID.IntegerValue() ); - aSeqOfValue.Append( aListItemTxt.getData() ); - // adding icon file name (optional) to sequence - TCollection_ExtendedString aListValueIcon = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEICON" ) ); - aSeqOfValueIconName.Append( aListValueIcon ); - } - aListItemValue = aListItemValue.GetSiblingByTagName(); - } - } - } - } - } - } - - // Quantity::Description record as the only child of that tag name - LDOM_Element aDescr = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "DESCR" ) ); - if ( !aDescr.isNull() ) - { - // short description (#PCDATA)* - LDOM_Element aShDescr = aDescr.GetChildByTagName( DDS_Dictionary::KeyWord( "SHORT_D" ) ); - if ( !aShDescr.isNull() ) - { - // text is always a sub-node of element, containing it - //LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild(); - LDOM_Node aNode = aShDescr.getFirstChild(); - const LDOM_Text& aText = (const LDOM_Text&) aNode; - LDOM_Text aShDescrTxt(aText); - if ( !aShDescrTxt.isNull() ) - aShortD = aShDescrTxt.getData(); - } - - // long description (#PCDATA)* - LDOM_Element aLDescr = aDescr.GetChildByTagName( DDS_Dictionary::KeyWord( "LONG_D" ) ); - if ( !aLDescr.isNull() ) - { - // text is always a sub-node of element, containing it - //LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild(); - LDOM_Node aNode = aLDescr.getFirstChild(); - const LDOM_Text& aText = (const LDOM_Text&) aNode; - LDOM_Text aLDescrTxt(aText); - if ( !aLDescrTxt.isNull() ) - aLongD = aLDescrTxt.getData(); - } - } - - // Quantity::Options - LDOM_Element anOpt = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "OPTIONS" ) ); - if ( !anOpt.isNull() ) - { - LDOM_NodeList anOptions = anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) ); - for ( Standard_Integer oi = 0; oi < anOptions.getLength(); oi++ ) - { - LDOM_Node node = anOptions.item( oi ); - if ( node.getNodeType() != LDOM_Node::ELEMENT_NODE ) - continue; - - LDOM_Element& elem = (LDOM_Element&)node; - TCollection_AsciiString name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) ); - - TCollection_ExtendedString value; - const LDOM_Text& aText = (const LDOM_Text&)elem.getFirstChild(); - LDOM_Text anOptTxt( aText ); - if ( !anOptTxt.isNull() ) - value = anOptTxt.getData(); - - if ( !name.IsEmpty() && value.Length() && !myOptions.IsBound( name ) ) - myOptions.Bind( name, value ); - } - } - - NCollection_DataMap aDimMap; - - for ( NCollection_DataMap::Iterator it( myUnitData ); it.More(); it.Next() ) - { - UnitData& anUnitData = it.ChangeValue(); - - // check units - anUnitData.myZero = 0.; - anUnitData.myScale = 1.; - try { - Standard_CString aUnitDataStr; - aUnitDataStr = (Standard_CString)anUnitData.myUnits.ToCString(); - if ( anUnitData.myUnits.ToCString()[0] && strcmp( anUnitData.myUnits.ToCString(), "%" ) ) - { - Handle(Units_Dimensions) aDim; - anUnitData.myZero = UnitsAPI::AnyToSI( 0.0, aUnitDataStr, aDim ); - anUnitData.myScale = UnitsAPI::AnyToSI( 1.0, aUnitDataStr, aDim ) - anUnitData.myZero; - UnitsAPI::AnyFromSI( 1.0, aUnitDataStr ); - if ( !aDimMap.IsBound( it.Key() ) ) - aDimMap.Bind( it.Key(), aDim ); - } - else if ( anUnitData.myUnits.ToCString()[0] ) // treat '%' as unit with scale 100 - anUnitData.myScale = 0.01; - } - catch( Standard_Failure ) { - anUnitData.myUnits.Clear(); - } - - Handle(Units_Dimensions) aPrev; - Standard_Boolean aStatus = Standard_True; - for ( NCollection_DataMap::Iterator itr( aDimMap ); - itr.More() && aStatus; itr.Next() ) - { - if ( itr.Value().IsNull() ) - continue; - - if ( aPrev.IsNull() ) - aPrev = itr.Value(); - - aStatus = aPrev->IsEqual( itr.Value() ); - } - - if ( !aStatus ) - printf( "Error in DataDictionary: Different dimensions for %s item", theID.ToCString() ); - } - - myId = theID; - myType = aEnumType; - myWarnLevel = aWrongValue; - myLabel = aLabel.ToCString(); - myFilter = aFilter.ToCString(); - myLongDescr = aLongD.ToCString(); - myShortDescr = aShortD.ToCString(); - myMin = aRealMinV; - myMax = aRealMaxV; - myDefValue = aRealDefV; - myDefString = aDefV.ToCString(); - myRequired = aRequired.ToCString(); - myListName = aListName.ToCString(); - myMinZoom = aMinZoom; - myMaxZoom = aMaxZoom; - myZoomOrder = aZoomOrder; - - // prepare formats - PrepareFormats( aFormat ); - - const Standard_Integer aLength = aSeqOfValue.Length(); - if ( aLength > 0 ) - { - myListRef = new TColStd_HArray1OfExtendedString( 1, aLength ); - myListRefID = new TColStd_HArray1OfInteger( 1, aLength ); - myListRefIcons = new TColStd_HArray1OfExtendedString( 1, aLength ); - for ( Standard_Integer i = aLength; i > 0; i-- ) - { - myListRef->ChangeValue( i ) = aSeqOfValue.Value( i ); - myListRefID->ChangeValue( i ) = aSeqOfValueID.Value( i ); - myListRefIcons->ChangeValue( i ) = aSeqOfValueIconName.Value( i ); - } - } - - if ( myType == List && myDefString == "" && !myListRef.IsNull() && myListRef->Length() > 0 ) - myDefString = myListRef->Value( myListRef->Lower() ); -} - -/*! - Returns default formats for each unit systems -*/ -void DDS_DicItem::GetDefaultFormat() -{ - for ( NCollection_DataMap::Iterator it( myUnitData ); it.More(); it.Next() ) - { - UnitData& anUnitData = it.ChangeValue(); - - switch ( myType ) - { - case Integer: - anUnitData.myFormat = "%d"; - break; - case Float: - anUnitData.myFormat = "%g"; - break; - case String: - default: - anUnitData.myFormat.Clear(); - break;; - } - } -} - -/*! - Returns format for the string -*/ -void DDS_DicItem::GetStringFormat( const TCollection_AsciiString& theFlags, - const TCollection_AsciiString& theWidth, - const TCollection_AsciiString& thePrecision, - const TCollection_AsciiString& theTypePrefix, - TCollection_AsciiString& theFormat ) -{ - theFormat = "%"; - theFormat += theFlags; - theFormat += theWidth; - - if ( !thePrecision.IsEmpty() ) - { - theFormat += "."; - theFormat += thePrecision; - } - - theFormat += theTypePrefix; - theFormat += "s"; -} - -/*! - Returns format for the integer -*/ -void DDS_DicItem::GetIntegerFormat( const TCollection_AsciiString& theFlags, - const TCollection_AsciiString& theWidth, - const TCollection_AsciiString& thePrecision, - const TCollection_AsciiString& theTypePrefix, - const Standard_Character theType, - TCollection_AsciiString& theFormat ) -{ - Standard_Integer aPrecision = 0; - if ( !thePrecision.IsEmpty() ) - aPrecision = thePrecision.IntegerValue(); - Standard_Integer aWidth = 0; - - if ( !theWidth.IsEmpty() ) - aWidth = theWidth.IntegerValue(); - - if ( !thePrecision.IsEmpty() && aPrecision < 0 ) - { - // possible value 0.1 will be 10.0 - aWidth -= aPrecision; - aPrecision = 0; - } - - if ( !thePrecision.IsEmpty() && aPrecision > ( aWidth - 2 ) ) - aWidth = aPrecision + 2; - - theFormat = "%"; - - theFormat += theFlags; - if ( !theWidth.IsEmpty() ) - theFormat += aWidth; - - theFormat += theTypePrefix; - theFormat += theType; -} - -/*! - Returns format for the float -*/ -void DDS_DicItem::GetFloatFormat( const TCollection_AsciiString& theFlags, - const TCollection_AsciiString& theWidth, - const TCollection_AsciiString& thePrecision, - const TCollection_AsciiString& theTypePrefix, - const Standard_Character theType, - TCollection_AsciiString& theFormat ) -{ - Standard_Integer aPrecision = 0; - if ( !thePrecision.IsEmpty() ) - aPrecision = thePrecision.IntegerValue(); - Standard_Integer aWidth = 0; - - if (!theWidth.IsEmpty() ) - aWidth = theWidth.IntegerValue(); - - if (!thePrecision.IsEmpty() && aPrecision < 0 ) - { - // possible value 0.1 will be 10.0 - aWidth -= aPrecision; - aPrecision = 0; - } - - if ( !thePrecision.IsEmpty() && aPrecision > ( aWidth - 2 ) ) - { - aWidth = aPrecision + 2; - } - - theFormat = "%"; - theFormat += theFlags; - - if ( !theWidth.IsEmpty() ) - theFormat += aWidth; - - if ( !thePrecision.IsEmpty() ) - { - theFormat += "."; - theFormat += aPrecision; - } - - theFormat += theTypePrefix; - theFormat += theType; -} - -/*! - Prepares formats for each unit systems -*/ -void DDS_DicItem::PrepareFormats( const TCollection_AsciiString& theFormat ) -{ - for ( NCollection_DataMap::Iterator it( myUnitData ); it.More(); it.Next() ) - { - UnitData& anUnitData = it.ChangeValue(); - - anUnitData.myFormat = theFormat; - anUnitData.myPrecision = 0; - } - - TCollection_AsciiString aPrecisionStr; - if ( theFormat.IsEmpty() && myType == List ) - return; - - // checking % presenting - if ( *theFormat.ToCString() != '%' ) - { - GetDefaultFormat(); - return; - } - - TCollection_AsciiString aStr = ( theFormat.ToCString() + 1 ); - Standard_Character aType = aStr.Value( aStr.Length() ); - - if ( ( aType != 's' && myType == String ) || - ( aType != 'd' && myType == Integer ) || - ( aType != 'f' && aType != 'g' && aType != 'e' && aType != 'G' && aType != 'E' && myType == Float ) ) - { - GetDefaultFormat(); - return; - } - - // removing type character - aStr.Trunc( aStr.Length() - 1 ); - - TCollection_AsciiString aFlags; - while ( !aStr.IsEmpty() && aStr.Value( 1 ) != '.' && ( aStr.Value( 1 ) < '0' || aStr.Value( 1 ) > '9' ) ) - { - aFlags = aFlags + aStr.Value( 1 ); - aStr.Remove( 1 ); - } - - Standard_Integer aPos = 1; - while ( aPos <= aStr.Length() && ( aStr.Value( aPos ) == '.' || - ( aStr.Value( aPos ) >= '0' && aStr.Value( aPos ) <= '9' ) ) ) - aPos++; - - TCollection_AsciiString aTypePrefix; - if ( aPos <= aStr.Length() ) - { - aTypePrefix = aStr.SubString( aPos, aStr.Length() ); - aStr.Trunc( aPos - 1 ); - } - - Standard_Integer aBasePrecision = 0; - - // taking width and precision - TCollection_AsciiString aPrecision; - - aPos = aStr.Search( "." ); - if ( aPos >= 0 ) - { - // aPrecision is defined - aPrecision = aStr.Split( aPos ); - aStr.Remove( aStr.Length() ); - if ( !aPrecision.IsEmpty() ) - { - if ( !aPrecision.IsIntegerValue() ) - { - GetDefaultFormat(); - return; - } - else - { - aPrecisionStr = aPrecision; - aBasePrecision = aPrecision.IntegerValue(); - } - } - } - - if ( !aStr.IsEmpty() && !aStr.IsIntegerValue() ) - { - GetDefaultFormat(); - return; - } - - NCollection_DataMap::Iterator itr; - - switch ( myType ) - { - case String: - for ( itr.Initialize( myUnitData ); itr.More(); itr.Next() ) - { - if ( aType != 'f' && aType != 'g' && aType != 'e' && aType != 'G' && aType != 'E' ) - GetStringFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, itr.ChangeValue().myFormat ); - } - break; - case Float: - case Integer: - for ( itr.Initialize( myUnitData ); itr.More(); itr.Next() ) - { - UnitData& anUnitData = itr.ChangeValue(); - Standard_Integer aAmendment = - (Standard_Integer)log10( 10.0 / DDS_Dictionary::FromSI( 10.0, anUnitData.myUnits.ToCString() ) ); - anUnitData.myPrecision = aBasePrecision + aAmendment; - aPrecisionStr = TCollection_AsciiString( anUnitData.myPrecision ); - - // create a formats - if ( myType == Integer ) - GetIntegerFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, aType, anUnitData.myFormat ); - else - GetFloatFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, aType, anUnitData.myFormat ); - } - break; - default:; - GetDefaultFormat(); - break; - } -} - -/*! - Split the string \atheStr by spaces and returns substrings in array \aaRes. -*/ -void DDS_DicItem::Split( const TCollection_AsciiString& theStr, Handle(TColStd_HArray1OfExtendedString)& aRes ) -{ - aRes.Nullify(); - - if ( theStr.Length() > 0 ) - { - TCollection_AsciiString aStr = theStr; - TColStd_SequenceOfAsciiString aSeq; - Standard_Integer anIndex = aStr.SearchFromEnd( (Standard_CString)" " ); - while( anIndex > 1 ) - { - TCollection_AsciiString tmpStr = aStr.Split( anIndex - 1 ); - tmpStr.RemoveAll( ( Standard_Character )' ' ); - if ( tmpStr.Length() > 0 ) - aSeq.Append( tmpStr ); - anIndex = aStr.SearchFromEnd( (Standard_CString)" " ); - } - - aStr.RemoveAll( ( Standard_Character )' ' ); - if ( aStr.Length() > 0 ) - aSeq.Append( aStr ); - - if ( aSeq.Length() > 0 ) - { - aRes = new TColStd_HArray1OfExtendedString( 1, aSeq.Length() ); - for ( int i = 1, n = aSeq.Length(); i <= n; i++ ) - aRes->ChangeValue( i ) = aSeq( i ); - } - } -} - -/*! - Returns unit structure for given unit system \asys. -*/ -DDS_DicItem::UnitData* DDS_DicItem::GetUnitData( const UnitSystem& sys ) const -{ - UnitData* unit = 0; - - if ( myUnitData.IsBound( sys ) ) - unit = (UnitData*)&myUnitData.Find( sys ); - - return unit; -} - -/*! - Gets the active unit system. -*/ -DDS_DicItem::UnitSystem DDS_DicItem::GetActiveUnitSystem() const -{ - UnitSystem aSystem; - Handle(DDS_DicGroup) aComponent = Handle(DDS_DicGroup)::DownCast(myComponent); - if ( !aComponent.IsNull() ) - aSystem = aComponent->GetActiveUnitSystem(); - return aSystem; -} diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h deleted file mode 100644 index b32639900..000000000 --- a/src/DDS/DDS_DicItem.h +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef DDS_DICITEM_H -#define DDS_DICITEM_H - -#include "DDS.h" - -#include - -#include - -#include -#include - -#include -#include - -class LDOM_Element; -class DDS_Dictionary; -class TColStd_MapOfReal; -class TColStd_SequenceOfInteger; -class TColStd_SequenceOfAsciiString; -class TColStd_SequenceOfExtendedString; - -// Class, containing all information about one parameter: -// unique : id -// obligative: label, type, short description, required -// optional : format, units, -// min value, max value, default value. - -class DDS_DicItem : public MMgt_TShared -{ -public: - /*! Enum describes type of datum value */ - enum Type - { - String, //!< String type of value - Float, //!< Real (double) numeric type of value - Integer, //!< Integer (int) numeric type of value - List, //!< List type of enumerable value - Unknown //!< Unknown or undefined type of value - }; - - /*! Enum describes the flags for existance of domain data */ - enum Data - { - MinValue = 0x01, //!< Flag of minimum value definition existence - MaxValue = 0x02, //!< Flag of maximum value definition existence - DefaultValue = 0x04 //!< Flag of default value definition existence - }; - - // This struct is intended for map of Format, Units, Precision and Scale - struct UnitData - { - Standard_Real myZero; - Standard_Real myScale; - TCollection_AsciiString myUnits; - TCollection_AsciiString myFormat; - Standard_Integer myPrecision; - }; - - typedef TCollection_AsciiString UnitSystem; - -public: - DDS_DicItem(); - - Standard_EXPORT TCollection_AsciiString GetId() const; - Standard_EXPORT DDS_DicItem::Type GetType() const; - Standard_EXPORT TCollection_ExtendedString GetLabel() const; - Standard_EXPORT TCollection_ExtendedString GetFilter() const; - Standard_EXPORT TCollection_ExtendedString GetRequired() const; - Standard_EXPORT DDS_MsgType GetWarningLevel() const; - Standard_EXPORT TCollection_ExtendedString GetLongDescription() const; - Standard_EXPORT TCollection_ExtendedString GetShortDescription() const; - Standard_EXPORT TCollection_AsciiString GetComponent() const; - - Standard_EXPORT TCollection_AsciiString GetUnits() const; - Standard_EXPORT TCollection_AsciiString GetUnits( const UnitSystem& ) const; - - Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const; - Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const; - - Standard_EXPORT Standard_Real GetMinValue() const; - Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const; - - Standard_EXPORT Standard_Real GetMaxValue() const; - Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const; - - Standard_EXPORT Standard_Integer GetPrecision() const; - Standard_EXPORT Standard_Integer GetPrecision( const UnitSystem& ) const; - - Standard_EXPORT TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const; - Standard_EXPORT TCollection_AsciiString GetFormat( const UnitSystem&, - const Standard_Boolean = Standard_True ) const; - Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const; - Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)& ) const; - Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&, - Handle(TColStd_HArray1OfInteger)&, - Handle(TColStd_HArray1OfExtendedString)& ) const; - Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const; - - Standard_EXPORT Standard_Real GetMinZoom() const; - Standard_EXPORT Standard_Real GetMaxZoom() const; - Standard_EXPORT Standard_Real GetZoomOrder() const; - - Standard_EXPORT Standard_Real ToSI( const Standard_Real ) const; - Standard_EXPORT Standard_Real FromSI( const Standard_Real ) const; - - Standard_EXPORT Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const; - Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const; - - Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const; - - Standard_EXPORT TCollection_ExtendedString GetOption( const TCollection_AsciiString& ) const; - Standard_EXPORT Standard_Boolean GetOptionNames( TColStd_SequenceOfAsciiString& ) const; - -private: - DDS_DicItem( const DDS_DicItem& ); - void operator=( const DDS_DicItem& ); - void FillDataMap( TCollection_AsciiString, const LDOM_Element&, - const LDOM_Element&, const LDOM_Element&, - const TColStd_SequenceOfAsciiString& ); - void PrepareFormats( const TCollection_AsciiString& ); - void GetDefaultFormat(); - UnitSystem GetActiveUnitSystem() const; - - void GetStringFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - TCollection_AsciiString& ); - void GetIntegerFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void GetFloatFormat( const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const TCollection_AsciiString&, - const Standard_Character, - TCollection_AsciiString& ); - void Split( const TCollection_AsciiString&, - Handle(TColStd_HArray1OfExtendedString)& ); - - UnitData* GetUnitData( const UnitSystem& ) const; - -private: - typedef NCollection_DataMap OptionsMap; - -private: - TCollection_AsciiString myId; - TCollection_ExtendedString myLabel; - TCollection_ExtendedString myFilter; - TCollection_ExtendedString myRequired; - - Standard_Integer myType; - Standard_Integer myWarnLevel; - - TCollection_ExtendedString myLongDescr; - TCollection_ExtendedString myShortDescr; - - Standard_Real myMax; - Standard_Real myMin; - Standard_Real myDefValue; - TCollection_ExtendedString myDefString; - - Standard_Integer myData; - - // valueList - TCollection_ExtendedString myListName; - - Handle(TColStd_HArray1OfExtendedString) myListRef; - Handle(TColStd_HArray1OfInteger) myListRefID; - Handle(TColStd_HArray1OfExtendedString) myListRefIcons; - - // presentation - Standard_Real myMinZoom; - Standard_Real myMaxZoom; - Standard_Real myZoomOrder; - - Handle(Standard_Transient) myComponent; - - OptionsMap myOptions; - // unitData - NCollection_DataMap myUnitData; - - friend class DDS_DicGroup; - -public: - // Declaration of CASCADE RTTI - DEFINE_STANDARD_RTTI(DDS_DicItem) -}; - -DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared) - -DEFINE_BASECOLLECTION(DDS_BaseCollectionOfDicItems, Handle(DDS_DicItem)) -DEFINE_INDEXEDDATAMAP(DDS_IndexedDataMapOfDicItems, DDS_BaseCollectionOfDicItems, - TCollection_AsciiString, Handle(DDS_DicItem)) - -#endif diff --git a/src/DDS/DDS_Dictionary.cxx b/src/DDS/DDS_Dictionary.cxx deleted file mode 100644 index dd741872f..000000000 --- a/src/DDS/DDS_Dictionary.cxx +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "DDS_Dictionary.h" - -#include "DDS_KeyWords.h" - -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include - -IMPLEMENT_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) -IMPLEMENT_STANDARD_RTTIEXT(DDS_Dictionary, MMgt_TShared) - -/*! - \class DDS_Dictionary - - This class to provide information about used datums, reading them from 'xml' file - - Datum is the set of parameters described a phisical characteristic. These parameters loaded from - special XML which has following format: - - \hr - - - - - - - ... - - - - - - - - - - [brief_desription_text] - [full_description_text] - - - - - ... - - - - - ... - - - [list_element_name] - [list_element_name] - ... - [list_element_name] - - - ... - - - - - \hr - - In description of datum file format used internal keys as XML tag and attributes names. - Concrete XML keywords defined by DDS_KeyWords class. - - Describe datum file format more detailed. XML file should have one main tag named as "dictionary" (key "D_URI"). - This tag should contains one or several components. Component is a independent set of datums and unit systems. - Components defined as XML tag named "component" (key "COMPONENT") with attribute "name" (key COMPONENT_NAME). - Component name used as component identifier and should be unique. Component tag can contains: - - \li Tag "unit_systems" (key UNIT_SYSTEMS) defines set of used unit systems. Should exist at least one unit - system named SI ("System International"). If this system not exist then it will be defined automatically. - Each unit system defined by XML tag "unit system" (key UNIT_SYSTEM) under tag "unit_systems" with attributes - "name" (key UNIT_SYSTEM_NAME) and "label" (key UNIT_SYSTEM_LABEL). Name is identifier of unit system. Label is - human readable description. - - \li One or several tag "datum" (key DATUM). For this tag can be defined following attributes: - - \lo Identifier (key DATUM_ID) specify the unique id string for the datum. - \lo Label (key DATUM_LABEL) specify human readable name of the datum. - \lo Units of measure (key DATUM_UNITS) for given unit system. Attribute name consist of a name - of unit system and a keyword got from DDS_KeyWords by key DATUM_UNITS. For example for unit system - named SI and default keyword attribute name will be "SIunits". This attribute should be specified - for each deaclared unit system. Value of this attribute should be string describs units of measure. - Possible designations for units of measure and their multiple prefixes see in package UnitsAPI of - library OpenCascade (files Units.dat and Lexi_Expr.dat). Units of measure will be used for numeric - value conversion from one unit system to another one. - \lo Format (key DATUM_FORMAT) specify the format string which will be used during initial formatting - of value. This string should be specified in sprintf() format. - \lo Filter (key DATUM_FILTER) specify the regualr expression. Each user entered string will be checked up - on matching to this expression (if it defined). Non matched strings will be rejected. - \lo Required value (key DATUM_REQUIRED). If this attributed defined and value is true then user can't - leave a input filed blank (parameter must be always entered). - - Tag "description" (key DESCR) can be defined under the tag "datum". This tag contains two sub tags: - \lo "short description" (key SHORT_D) specify a brief datum description text - \lo "long description" (key LONG_D) specify a detailed description text - - Tag "options" (key OPTIONS) can be defined under the tag "datum". This tag contains one or more sub - tags "option" (key OPTION). Each of these XML elements should contain text option value and attribute - "name" (key OPTION_NAME) which specified option name. - - Each tag "datum" define most common parameters of phisical characteristic. - This parameters placed in two groups: - \lo Domain parameters under tag "domain" (key DY_DOMAIN). This tag can contains value description tag - (key VALUE_DESCR) for discrete data or list reference tag (key VALUE_LIST_REF) for enumerable data. - Discrete data described following parameters: - default value (key VD_DEFV) - maximum value (key VD_MAXV) - minimum value (key VD_MINV) - type of value (key VD_TYPE) - possible values: String, Integer, Float, List - Enumerable data described by "list reference" attribute (key VLR_LIST) which reference on - list (see "list definition" tag) by list id. - - \li One or several tag "list definition" (key VALUE_LIST). This tag define the list of items for enumerable - data. Attribute "list id" (key VALUE_LIST_ID) specify the identifier string for the list and attribute - "list name" (key VALUE_LIST_NAME) define a list name string. Each list item described by tag "list value" - (key VALUE_LIST_VALUE) under tag "list definition". Each this tag contains item string text and have - following attributes: - \lo "list item id" (key VALUE_LIST_VALUEID) - integer numerical identifier for item - \lo "list item icon" (key VALUE_LIST_VALUEICON) - icon file name for item - - Below the example of a XML file with use default keywords. - - - - - - - - - - - - - - - - - - - - X coordinate for object - X multiplier of object coordinates. Describe position of object in direction of X axis - - - - - - - - - Y coordinate for object - Y multiplier of object coordinates. Describe position of object in direction of Y axis - - - - - - - - - - - - Name of object - - - - - - - - - - - - - - Side of object - - - - - - left - right - top - bottom - undefined - - - - - - -*/ - -/*! - Constructor. Creates the instance of dictionary. Private method. Use DDS_Dictionary::Get() instead. -*/ -DDS_Dictionary::DDS_Dictionary() -: MMgt_TShared() -{ -} - -/*! - Copy constructor. Internal. -*/ -DDS_Dictionary::DDS_Dictionary( const DDS_Dictionary& ) -{ -} - -/*! - Assigment operator. Internal. -*/ -void DDS_Dictionary::operator=( const DDS_Dictionary& ) -{ -} - -/*! - Returns the names list of defined unit systems from all components. - Parameter \atheSystems will contains the sequence of string names. -*/ -void DDS_Dictionary::GetUnitSystems( TColStd_SequenceOfAsciiString& theSystems ) const -{ - theSystems.Clear(); - - NCollection_Map aMap; - for ( Standard_Integer i = 1; i <= myGroupMap.Extent(); i++ ) - { - TColStd_SequenceOfAsciiString theSeq; - myGroupMap.FindFromIndex( i )->GetUnitSystems( theSeq ); - for ( Standard_Integer s = 1; s <= theSeq.Length(); s++ ) - { - if ( aMap.Contains( theSeq.Value( s ) ) ) - continue; - - theSystems.Append( theSeq.Value( s ) ); - aMap.Add( theSeq.Value( s ) ); - } - } - -} - -/*! - Returns the names list of defined unit systems from the specified component \atheComponent. - Parameter \atheSystems will contains the sequence of string names. If component not found then - empty list returned. -*/ -void DDS_Dictionary::GetUnitSystems( TColStd_SequenceOfAsciiString& theSystems, - const TCollection_AsciiString& theComponent ) const -{ - theSystems.Clear(); - if ( myGroupMap.Contains( theComponent ) ) - myGroupMap.FindFromKey( theComponent )->GetUnitSystems( theSystems ); -} - -/*! - Returns the label of unit system \atheSystem. Function find the given unit system in - all components. If unit system not found in any component then empty string returned. -*/ -TCollection_ExtendedString DDS_Dictionary::GetUnitSystemLabel( const TCollection_AsciiString& theSystem ) const -{ - TCollection_ExtendedString aLabel; - for ( Standard_Integer i = 1; i <= myGroupMap.Extent() && !aLabel.Length(); i++ ) - aLabel = myGroupMap.FindFromIndex( i )->GetUnitSystemLabel( theSystem ); - return aLabel; -} - -/*! - Returns the label of unit system \atheSystem from component \atheComponent. Function find - the given unit system in the specified component only. If unit system not found in the - component then empty string returned. -*/ -TCollection_ExtendedString DDS_Dictionary::GetUnitSystemLabel( const TCollection_AsciiString& theSystem, - const TCollection_AsciiString& theComponent ) const -{ - TCollection_ExtendedString aLabel; - if ( myGroupMap.Contains( theComponent ) ) - aLabel = myGroupMap.FindFromKey( theComponent )->GetUnitSystemLabel( theSystem ); - return aLabel; -} - -/*! - Gets the name of active unit system from first got component. If any component exist then - active unit system name returned or empty string otherwise. -*/ -TCollection_AsciiString DDS_Dictionary::GetActiveUnitSystem() const -{ - TCollection_AsciiString aSystem; - if ( myGroupMap.Extent() ) - aSystem = myGroupMap.FindFromIndex( 1 )->GetActiveUnitSystem(); - return aSystem; -} - -/*! - Gets the name of active unit system from component \atheComponent. If this component exist - active unit system name returned or empty string otherwise. -*/ -TCollection_AsciiString DDS_Dictionary::GetActiveUnitSystem( const TCollection_AsciiString& theComponent ) const -{ - TCollection_AsciiString aSystem; - if ( myGroupMap.Contains( theComponent ) ) - aSystem = myGroupMap.FindFromKey( theComponent )->GetActiveUnitSystem(); - return aSystem; -} - -/*! - Sets the active unit system named \atheSystem. This unit system will be activated in all - existing components if component have it. -*/ -void DDS_Dictionary::SetActiveUnitSystem( const TCollection_AsciiString& theSystem ) -{ - for ( Standard_Integer i = 1; i <= myGroupMap.Extent(); i++ ) - myGroupMap.FindFromIndex( i )->SetActiveUnitSystem( theSystem ); -} - -/*! - Sets the active unit system named \atheSystem for component \atheComponent. If specified unit - system doesn't exist in the component then function do nothing. -*/ -void DDS_Dictionary::SetActiveUnitSystem( const TCollection_AsciiString& theSystem, - const TCollection_AsciiString& theComponent ) -{ - if ( myGroupMap.Contains( theComponent ) ) - myGroupMap.FindFromKey( theComponent )->SetActiveUnitSystem( theSystem ); -} - -/*! - Returns the instance of dictionary. Create instance if it is NULL. -*/ -Handle(DDS_Dictionary) DDS_Dictionary::Get() -{ - static Handle(DDS_Dictionary) sDictionary; - - if ( sDictionary.IsNull() ) - sDictionary = new DDS_Dictionary(); - - return sDictionary; -} - -/*! - Load datum definitions in the dictionary from XML file \atheFileName. Returns true if load - successed or false otherwise. -*/ -Standard_Boolean DDS_Dictionary::Load( const TCollection_AsciiString theFileName ) -{ - static NCollection_Map _LoadMap; - - if ( _LoadMap.Contains( theFileName ) ) - return Standard_True; - - Handle(DDS_Dictionary) aDic = Get(); - if ( aDic.IsNull() ) - return Standard_False; - - LDOMParser aParser; - if ( aParser.parse( theFileName.ToCString() ) ) - return Standard_False; - - LDOM_Document aDoc = aParser.getDocument(); - LDOM_Element aDocElement = aDoc.getDocumentElement(); - for ( LDOM_Element aComponentElem = aDocElement.GetChildByTagName( KeyWord( "COMPONENT" ) ); - !aComponentElem.isNull(); aComponentElem = aComponentElem.GetSiblingByTagName() ) - aDic->FillDataMap( aComponentElem, aDocElement ); - - _LoadMap.Add( theFileName ); - - return Standard_True; -} - -/*! - Gets XML keyword as LDOMString by specified \akey. If key doesn't exist then empty string - returned. This function provided for convenience. -*/ -LDOMString DDS_Dictionary::KeyWord( const TCollection_AsciiString& key ) -{ - LDOMString keyWord; - Handle(DDS_KeyWords) aKeyWords = DDS_KeyWords::Get(); - if ( !aKeyWords.IsNull() ) - { - TCollection_AsciiString aStr = aKeyWords->GetKeyWord( key ); - if ( aStr.Length() ) - keyWord = LDOMString( aStr.ToCString() ); - } - return keyWord; -} - -/*! - Gets dictionary item with specified identifier \atheID from specified component \atheComponent. - If component or item not found then null handle returned. -*/ -Handle(DDS_DicItem) DDS_Dictionary::GetDicItem( const TCollection_AsciiString& theID, - const TCollection_AsciiString& theComponent ) const -{ - Handle(DDS_DicItem) aDicItem; - Handle(DDS_DicGroup) aDicGroup; - if ( myGroupMap.Contains( theComponent ) ) - aDicGroup = myGroupMap.FindFromKey( theComponent ); - if ( !aDicGroup.IsNull() ) - aDicItem = aDicGroup->GetDicItem( theID ); - return aDicItem; -} - -/*! - Gets dictionary item with specified identifier \atheID. Function find the item in all components. - If item not found in any component then null handle returned. -*/ -Handle(DDS_DicItem) DDS_Dictionary::GetDicItem( const TCollection_AsciiString& theID ) const -{ - Handle(DDS_DicItem) aDicItem; - for ( Standard_Integer i = 1; i <= myGroupMap.Extent() && aDicItem.IsNull(); i++ ) - aDicItem = myGroupMap.FindFromIndex( i )->GetDicItem( theID ); - return aDicItem; -} - -/*! - Fill the internal data structures from XML parsed structures. Internal. -*/ -void DDS_Dictionary::FillDataMap( const LDOM_Element& theComponentData, const LDOM_Element& theDocElement ) -{ - TCollection_AsciiString aCompName = theComponentData.getAttribute( KeyWord( "COMPONENT_NAME" ) ); - if ( !myGroupMap.Contains( aCompName ) ) - myGroupMap.Add( aCompName, new DDS_DicGroup( aCompName ) ); - Handle(DDS_DicGroup) aDicGroup = myGroupMap.FindFromKey( aCompName ); - aDicGroup->FillDataMap( theComponentData, theDocElement ); - myGroupMap.Add( aCompName, aDicGroup ); -} - -/*! - Convert numeric value \atheValue from specified unit of measure \atheUnits to SI unit of measure - (mm for Length, radians for Angles, etc). Converted value returned. -*/ -Standard_Real DDS_Dictionary::ToSI( const Standard_Real theValue, const Standard_CString theUnits ) -{ - Standard_Real aRetValue = theValue; - if ( theUnits && *theUnits && strcmp( theUnits, "%" ) ) - { - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - aRetValue = UnitsAPI::AnyToSI( theValue, theUnits ); - } - catch( Standard_Failure ) { - } - } - else if ( theUnits && *theUnits ) - aRetValue = theValue / 100.0; - - return aRetValue; -} - -/*! - Convert numeric value \atheValue to specified unit of measure \atheUnits from SI unit of measure - (mm for Length, radians for Angles, etc). Converted value returned. -*/ -Standard_Real DDS_Dictionary::FromSI( const Standard_Real theValue, const Standard_CString theUnits ) -{ - Standard_Real aRetValue = theValue; - if ( theUnits && *theUnits && strcmp( theUnits, "%" ) ) - { - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - aRetValue = UnitsAPI::AnyFromSI( theValue, theUnits ); - } - catch( Standard_Failure ) { - } - } - else if ( theUnits && *theUnits ) - aRetValue = theValue * 100.0; - - return aRetValue; -} diff --git a/src/DDS/DDS_Dictionary.h b/src/DDS/DDS_Dictionary.h deleted file mode 100644 index 9a5d5a886..000000000 --- a/src/DDS/DDS_Dictionary.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef DDS_DICTIONARY_H -#define DDS_DICTIONARY_H - -#include "DDS_DicGroup.h" - -#include - -#include - -class LDOM_Element; -class TCollection_AsciiString; - -DEFINE_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) - -class DDS_Dictionary : public MMgt_TShared -{ -public: - Standard_EXPORT static Handle(DDS_Dictionary) Get(); - - // Return instance of data dictionary. Create instance if it is NULL. - - Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString& ) const; - Standard_EXPORT Handle(DDS_DicItem) GetDicItem( const TCollection_AsciiString&, - const TCollection_AsciiString& ) const; - - Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString& ) const; - Standard_EXPORT void GetUnitSystems( TColStd_SequenceOfAsciiString&, - const TCollection_AsciiString& ) const; - Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString& ) const; - Standard_EXPORT TCollection_ExtendedString GetUnitSystemLabel( const TCollection_AsciiString&, - const TCollection_AsciiString& ) const; - Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem() const; - Standard_EXPORT TCollection_AsciiString GetActiveUnitSystem( const TCollection_AsciiString& ) const; - Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString& ); - Standard_EXPORT void SetActiveUnitSystem( const TCollection_AsciiString&, - const TCollection_AsciiString& ); - - - static Standard_EXPORT Standard_Boolean Load( const TCollection_AsciiString ); - - static Standard_EXPORT Standard_Real ToSI( const Standard_Real, const Standard_CString ); - static Standard_EXPORT Standard_Real FromSI( const Standard_Real, const Standard_CString ); - - static Standard_EXPORT LDOMString KeyWord( const TCollection_AsciiString& ); - -private: - DDS_Dictionary(); - DDS_Dictionary( const DDS_Dictionary& ); - - void operator=( const DDS_Dictionary& ); - - void FillDataMap( const LDOM_Element&, const LDOM_Element& ); - -private: - DDS_IndexedDataMapOfDicGroups myGroupMap; - -public: - DEFINE_STANDARD_RTTI(DDS_Dictionary) -}; - -#endif diff --git a/src/DDS/DDS_KeyWords.cxx b/src/DDS/DDS_KeyWords.cxx deleted file mode 100644 index 626bd0fd0..000000000 --- a/src/DDS/DDS_KeyWords.cxx +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "DDS_KeyWords.h" - -IMPLEMENT_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared) -IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared) - -/*! - \class DDS_KeyWords - - This object contains the pairs of internal keys and XML tag or attribute names. This class allow to user - define set of XML keywords used in datums definition file. - - Default keywords table: - \li D_URI - dictionary - \li COMPONENT - component - \li COMPONENT_NAME - name - \li UNIT_SYSTEMS - unitSystems - \li UNIT_SYSTEM - system - \li UNIT_SYSTEM_NAME - name - \li UNIT_SYSTEM_LABEL - label - \li DATUM - datum - \li DATUM_ID - id - \li DATUM_LABEL - label - \li DATUM_UNITS - units - \li DATUM_FORMAT - format - \li DATUM_FILTER - filter - \li DATUM_REQUIRED - required - \li VALUE_LIST - valueList - \li VALUE_LIST_ID - listid - \li VALUE_LIST_NAME - name - \li VALUE_LIST_TYPE - type - \li VALUE_LIST_VALUE - value - \li VALUE_LIST_VALUEID - id - \li VALUE_LIST_VALUEICON - icon - \li DY_DOMAIN - domain - \li WARNING_LEVEL - warningLevel - \li WRONG_VALUE - wrongValue - \li VALUE_DESCR - valueDescr - \li VALUE_LIST_REF - listRef - \li DESCR - description - \li LONG_D - longDescr - \li SHORT_D - shortDescr - \li VD_TYPE - type - \li VD_DEFV - default - \li VD_MAXV - max - \li VD_MINV - min - \li VD_SPEC - specVal - \li VLR_LIST - list - \li PRS - presentation - \li LATERAL_ZOOM - lateralZoom - \li LZ_MINV - min - \li LZ_MAXV - max - \li LZ_ORDER - order - \li OPTIONS - options - \li OPTION - option - \li OPTION_NAME - name -*/ - -/*! - Constructor -*/ - -DDS_KeyWords::DDS_KeyWords() -: MMgt_TShared() -{ - SetKeyWord( "D_URI", "dictionary" ); - - SetKeyWord( "COMPONENT", "component" ); - SetKeyWord( "COMPONENT_NAME", "name" ); - - SetKeyWord( "UNIT_SYSTEMS", "unitSystems" ); - SetKeyWord( "UNIT_SYSTEM", "system" ); - SetKeyWord( "UNIT_SYSTEM_NAME", "name" ); - SetKeyWord( "UNIT_SYSTEM_LABEL", "label" ); - - SetKeyWord( "DATUM", "datum" ); - SetKeyWord( "DATUM_ID", "id" ); - SetKeyWord( "DATUM_LABEL", "label" ); - SetKeyWord( "DATUM_UNITS", "units" ); - SetKeyWord( "DATUM_FORMAT", "format" ); - SetKeyWord( "DATUM_FILTER", "filter" ); - SetKeyWord( "DATUM_REQUIRED", "required" ); - - SetKeyWord( "VALUE_LIST", "valueList" ); - SetKeyWord( "VALUE_LIST_ID", "listid" ); - SetKeyWord( "VALUE_LIST_NAME", "name" ); - SetKeyWord( "VALUE_LIST_TYPE", "type" ); - SetKeyWord( "VALUE_LIST_VALUE", "value" ); - SetKeyWord( "VALUE_LIST_VALUEID", "id" ); - SetKeyWord( "VALUE_LIST_VALUEICON", "icon" ); - - SetKeyWord( "DY_DOMAIN", "domain" ); - SetKeyWord( "WARNING_LEVEL", "warningLevel" ); - SetKeyWord( "WRONG_VALUE", "wrongValue" ); - SetKeyWord( "VALUE_DESCR", "valueDescr" ); - SetKeyWord( "VALUE_LIST_REF", "listRef" ); - - SetKeyWord( "DESCR", "description" ); - SetKeyWord( "LONG_D", "longDescr" ); - SetKeyWord( "SHORT_D", "shortDescr" ); - - SetKeyWord( "VD_TYPE", "type" ); - SetKeyWord( "VD_DEFV", "default" ); - SetKeyWord( "VD_MAXV", "max" ); - SetKeyWord( "VD_MINV", "min" ); - SetKeyWord( "VD_SPEC", "specVal" ); - SetKeyWord( "VLR_LIST", "list" ); - SetKeyWord( "PRS", "presentation" ); - SetKeyWord( "LATERAL_ZOOM", "lateralZoom" ); - SetKeyWord( "LZ_MINV", "min" ); - SetKeyWord( "LZ_MAXV", "max" ); - SetKeyWord( "LZ_ORDER", "order" ); - - SetKeyWord( "OPTIONS", "options" ); - SetKeyWord( "OPTION", "option" ); - SetKeyWord( "OPTION_NAME", "name" ); -} - -/*! - Returns the static instance of the class DDS_KeyWords -*/ - -Handle(DDS_KeyWords) DDS_KeyWords::Get() -{ - static Handle(DDS_KeyWords) keyWords; - - if ( keyWords.IsNull() ) - keyWords = new DDS_KeyWords(); - - return keyWords; -} - -/*! - Returns the XML keyword by specified internal key \a key. If the internal key isn't registered - then empty string will be returned. -*/ - -TCollection_AsciiString DDS_KeyWords::GetKeyWord( const TCollection_AsciiString& key ) const -{ - TCollection_AsciiString keyWord; - if ( myKeyWord.IsBound( key ) ) - keyWord = myKeyWord.Find( key ); - return keyWord; -} - -/*! - Register the pair of the internal key \a key and XML keyword \a keyWord. -*/ - -void DDS_KeyWords::SetKeyWord( const TCollection_AsciiString& key, - const TCollection_AsciiString& keyWord ) -{ - if ( myKeyWord.IsBound( key ) ) - myKeyWord.UnBind( key ); - - myKeyWord.Bind( key, keyWord ); -} diff --git a/src/DDS/DDS_KeyWords.h b/src/DDS/DDS_KeyWords.h deleted file mode 100644 index 2161f71f3..000000000 --- a/src/DDS/DDS_KeyWords.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef DDS_KEYWORDS_H -#define DDS_KEYWORDS_H - -#include "DDS.h" - -#include - -#include - -DEFINE_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared) - -class TCollection_AsciiString; - -class DDS_KeyWords : public MMgt_TShared -{ -public: - Standard_EXPORT static Handle(DDS_KeyWords) Get(); - - Standard_EXPORT TCollection_AsciiString GetKeyWord( const TCollection_AsciiString& ) const; - Standard_EXPORT void SetKeyWord( const TCollection_AsciiString&, - const TCollection_AsciiString& ); - -private: - DDS_KeyWords(); - -private: - typedef NCollection_DataMap KeyWordMap; - -private: - KeyWordMap myKeyWord; - -public: - DEFINE_STANDARD_RTTI(DDS_KeyWords) -}; - -#endif diff --git a/src/DDS/Makefile.in b/src/DDS/Makefile.in deleted file mode 100755 index 1d42a6c75..000000000 --- a/src/DDS/Makefile.in +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Alexander SOLOVYOV (OCN) -# Module : DDS -# $Header: /home/server/cvs/GUI/GUI_SRC/src/DDS/Makefile.in - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@ - -@COMMENCE@ - -# header files -EXPORT_HEADERS= DDS.h \ - DDS_DicGroup.h \ - DDS_DicItem.h \ - DDS_Dictionary.h \ - DDS_KeyWords.h - -# Libraries targets -LIB = libDDS.la - -LIB_SRC= DDS_DicGroup.cxx \ - DDS_DicItem.cxx \ - DDS_Dictionary.cxx \ - DDS_KeyWords.cxx - -CPPFLAGS+= $(OCC_INCLUDES) - -LDFLAGS+= $(CAS_KERNEL) $(CAS_OCAF) - -@CONCLUDE@ - - diff --git a/src/Event/Event.h b/src/Event/Event.h deleted file mode 100755 index 8df1a71b1..000000000 --- a/src/Event/Event.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File: SalomeApp.h -// Created: November, 2004 -// Author: OCC team -// Copyright (C) CEA 2004 - - -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the SalomeApp_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// SalomeApp_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -#ifdef WNT - -#ifdef EVENT_EXPORTS -#define EVENT_EXPORT __declspec(dllexport) -#else -#define EVENT_EXPORT __declspec(dllimport) -#endif - -#else -#define EVENT_EXPORT -#endif //WNT - -#define APP_VERSION "0.1" - -#if defined WNT -#pragma warning ( disable: 4251 ) -#endif - diff --git a/src/Event/Makefile.in b/src/Event/Makefile.in deleted file mode 100755 index 02aaa2bca..000000000 --- a/src/Event/Makefile.in +++ /dev/null @@ -1,53 +0,0 @@ -# SALOME Utils : general SALOME's definitions and tools -# -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# -# -# File : Makefile.in -# Author : Marc Tajchman (CEA) -# Module : SALOME -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= \ - Event.h \ - SALOME_Event.hxx - -EXPORT_PYSCRIPTS = -# Libraries targets - -LIB = libEvent.la -LIB_SRC = SALOME_Event.cxx - -CPPFLAGS+=$(QT_INCLUDES) $(KERNEL_CXXFLAGS) -LDFLAGS+=$(QT_MT_LIBS) - -@CONCLUDE@ - - diff --git a/src/Event/SALOME_Event.cxx b/src/Event/SALOME_Event.cxx deleted file mode 100755 index 928cd2341..000000000 --- a/src/Event/SALOME_Event.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// KERNEL SALOME_Event : Define event posting mechanism -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SALOME_Event.cxx -// Author : Sergey ANIKIN -// Module : KERNEL -// $Header$ - -#include "SALOME_Event.hxx" - -//#include "utilities.h" - -#include -#include -#include - -// asv 21.02.05 : introducing multi-platform approach of thread comparison -// on Unix using pthread_t type for storing ThreadId -// on Win32 using integer type for storing ThreadId -// NOT using integer ThreadId on both Unix and Win32 because (from documentation): -// "...Do not allow your program to rely on the internal structure or size of the pthread_t..." - -#ifdef WIN32 -#include - -static DWORD myThread; -#else -#include -#include - -static pthread_t myThread; -#endif - -/*! - \return thread id -*/ -void SALOME_Event::GetSessionThread(){ -#ifdef WIN32 - myThread = ::GetCurrentThreadId(); -#else - myThread = pthread_self(); -#endif -} - -/*! - \return true if it is session thread -*/ -bool SALOME_Event::IsSessionThread(){ - bool aResult = false; -#ifdef WIN32 - aResult = myThread == ::GetCurrentThreadId(); -#else - aResult = myThread == pthread_self(); -#endif -// if(MYDEBUG) INFOS("IsSessionThread() - "< 0 ) - { - myLineWidth = width; - return 0; - } - return 1; -} - -/*! - \return colors of line - \param nc - variable for normal color - \param hc - variable for hilighting color - \param sc - variable for selection color -*/ -void GLViewer_AspectLine::getLineColors( QColor& nc, QColor& hc, QColor& sc ) const -{ - nc = myNColor; - hc = myHColor; - sc = mySColor; -} - -/*! - \return binary representation of line aspect -*/ -QByteArray GLViewer_AspectLine::getByteCopy() const -{ - int anISize = sizeof( int ); - int aFSize = sizeof( float ); - int aNR = myNColor.red(), aNG = myNColor.green(), aNB = myNColor.blue(); - int aHR = myHColor.red(), aHG = myHColor.green(), aHB = myHColor.blue(); - int aSR = mySColor.red(), aSG = mySColor.green(), aSB = mySColor.blue(); - - QByteArray aResult( anISize * 10 + aFSize ); - - int i = 0; - - char* aPointer = (char*)&aNR; - for( i = 0; i < anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aNG; - for( ; i < 2*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aNB; - for( ; i < 3*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&aHR; - for( ; i < 4*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aHG; - for( ; i < 5*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aHB; - for( ; i < 6*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&aSR; - for( ; i < 7*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aSG; - for( ; i < 8*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aSB; - for( ; i < 9*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&myLineWidth; - for( ; i < 9*anISize + aFSize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&myLineType; - for( ; i < 10*anISize + aFSize; i++, aPointer++ ) - aResult[i] = *aPointer; - - return aResult; -} - -/*! - Sets line aspect from binary representation -*/ -GLViewer_AspectLine* GLViewer_AspectLine::fromByteCopy( QByteArray theBytes ) -{ - - int anISize = sizeof( int ); - int aFSize = sizeof( float ); - int aNR = 0, aNG = 0, aNB = 0; - int aHR = 0, aHG = 0, aHB = 0; - int aSR = 0, aSG = 0, aSB = 0; - int aLineType = 0; - float aLineWidth = 0; - - int i = 0; - - char* aPointer = (char*)&aNR; - for( i = 0; i < anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aNG; - for( ; i < 2*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aNB; - for( ; i < 3*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - - aPointer = (char*)&aHR; - for( ; i < 4*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aHG; - for( ; i < 5*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aHB; - for( ; i < 6*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - - aPointer = (char*)&aSR; - for( ; i < 7*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aSG; - for( ; i < 8*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - aPointer = (char*)&aSB; - for( ; i < 9*anISize; i++, aPointer++ ) - *aPointer = theBytes[i]; - - aPointer = (char*)&aLineWidth; - for( ; i < 9*anISize + aFSize; i++, aPointer++ ) - *aPointer = theBytes[i]; - - aPointer = (char*)&aLineType; - for( ; i < 10*anISize + aFSize; i++, aPointer++ ) - *aPointer = theBytes[i]; - - GLViewer_AspectLine* anAspect = new GLViewer_AspectLine( aLineType, aLineWidth ); - anAspect->setLineColors( QColor( aNR, aNG, aNB ), - QColor( aHR, aHG, aHB ), - QColor( aSR, aSG, aSB ) ); - return anAspect; -} diff --git a/src/GLViewer/GLViewer_AspectLine.h b/src/GLViewer/GLViewer_AspectLine.h deleted file mode 100644 index 99cdbcd97..000000000 --- a/src/GLViewer/GLViewer_AspectLine.h +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_AspectLine.h -// Created: November, 2004 - -#ifndef GLVIEWER_ASPECTLINE_H -#define GLVIEWER_ASPECTLINE_H - -#include "GLViewer.h" - -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \Class GLViewer_AspectLine - Substitution of Prs2d_AspectLine for OpenGL -*/ - -class GLVIEWER_API GLViewer_AspectLine -{ -public: - //! A default constructor - /* Line is Non strip - * Normal color is white - * Highlight color is cyan - * Select color is red - */ - GLViewer_AspectLine(); - //! A conctructor by type and width of line - /*! - \param theType equals 0 for normal line and 1 for strip line - \param theWidth is a width of new line - */ - GLViewer_AspectLine( int theType, float theWidth ); - - //! A destructor - ~GLViewer_AspectLine(); - - //! A function for installing the line colors - /*! - \param nc is normal color - \param hc is highlight color - \param sc is select color - */ - void setLineColors( QColor nc = Qt::black, - QColor hc = Qt::cyan, - QColor sc = Qt::red ); - //! A function for installing the line width - int setLineWidth( const float theWidth ); - //! A function for installing the line type - /*! - \param theType equals 0 for normal line and 1 for strip line - */ - int setLineType( const int theType ); - - //! A function for getting line colors information - /*! - \param theNC is normal color - \param theHC is highlight color - \param theSC is select color - */ - void getLineColors( QColor& theNC, QColor& theHC, QColor& theSC ) const; - //! A function for getting information about line width - float getLineWidth() const { return myLineWidth; }; - //! A function for getting information about line type - int getLineType() const { return myLineType; }; - - //! A function for coding object to the byte copy - /*! - A function is used for copy-past technollogy in copy method - */ - QByteArray getByteCopy() const; - - //! A function for decoding object from the byte copy - /*! - A function is used for copy-past technollogy in past method - */ - static GLViewer_AspectLine* fromByteCopy( QByteArray ); - -protected: - //! A normal color - QColor myNColor; - //! A highlight color - QColor myHColor; - //! A select color - QColor mySColor; - //! A line width - float myLineWidth; - //! A line type - /*! equals 0 for normal line and 1 for strip line */ - int myLineType; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_BaseDrawers.cxx b/src/GLViewer/GLViewer_BaseDrawers.cxx deleted file mode 100644 index 80dfa1329..000000000 --- a/src/GLViewer/GLViewer_BaseDrawers.cxx +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_BaseDrawers.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_BaseDrawers.h" -#include "GLViewer_Object.h" -#include "GLViewer_Text.h" -#include "GLViewer_AspectLine.h" -#include "GLViewer_BaseObjects.h" - -#ifndef WIN32 -#include -#endif - -GLfloat sin_table[SEGMENTS]; -GLfloat cos_table[SEGMENTS]; - -/*! - Default constructor -*/ -GLViewer_MarkerDrawer::GLViewer_MarkerDrawer() -: GLViewer_Drawer() -{ - GLfloat angle = 0.0; - for ( int i = 0; i < SEGMENTS; i++ ) - { - sin_table[i] = sin( angle ); - cos_table[i] = cos( angle ); - angle += float( STEP ); - } - myObjectType = "GLViewer_MarkerSet"; -} - -/*! - Destructor -*/ -GLViewer_MarkerDrawer::~GLViewer_MarkerDrawer() -{ -} - -/*! Draws object in GLViewer - \param xScale - current scale along X-direction - \param yScale - current scale along Y-direction - \param onlyUpdate - = true if only update highlight-select information -*/ -void GLViewer_MarkerDrawer::create( float xScale, float yScale, bool onlyUpdate ) -{ - QValueList::Iterator it; - QValueList::Iterator EndIt; - QValueList::Iterator anObjectIt = myObjects.begin(); - QValueList::Iterator anEndObjectIt = myObjects.end(); - - myXScale = xScale; - myYScale = yScale; - - QColor colorN, colorH, colorS; - - GLViewer_MarkerSet* aMarkerSet = NULL; - GLViewer_AspectLine* anAspectLine = NULL; - - for( ; anObjectIt != anEndObjectIt; anObjectIt++ ) - { - aMarkerSet = ( GLViewer_MarkerSet* )(*anObjectIt); - anAspectLine = aMarkerSet->getAspectLine(); - anAspectLine->getLineColors( colorN, colorH, colorS ); - - float* aXCoord = aMarkerSet->getXCoord(); - float* anYCoord = aMarkerSet->getYCoord(); - float aRadius = aMarkerSet->getMarkerSize(); - - QValueList aHNumbers, anUHNumbers, aSelNumbers, anUSelNumbers; - aMarkerSet->exportNumbers( aHNumbers, anUHNumbers, aSelNumbers, anUSelNumbers ); - - if( onlyUpdate ) - { - EndIt = anUHNumbers.end(); - for( it = anUHNumbers.begin(); it != EndIt; ++it ) - { - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorN, anAspectLine ); - } - - EndIt = anUSelNumbers.end(); - for( it = anUSelNumbers.begin(); it != EndIt; ++it ) - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorN, anAspectLine ); - - EndIt = aSelNumbers.end(); - for( it = aSelNumbers.begin(); it != EndIt; ++it ) - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorS, anAspectLine ); - - EndIt = aHNumbers.end(); - for( it = aHNumbers.begin(); it != EndIt; ++it ) - { - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorH, anAspectLine ); - } - } - else - { - int aNumber = aMarkerSet->getNumMarkers(); - for( int i = 0; i < aNumber; i++ ) - drawMarker( aXCoord[i], anYCoord[i], aRadius, colorN, anAspectLine ); - - EndIt = anUSelNumbers.end(); - for( it = anUSelNumbers.begin(); it != EndIt; ++it ) - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorN, anAspectLine ); - - EndIt = aSelNumbers.end(); - for( it = aSelNumbers.begin(); it != EndIt; ++it ) - drawMarker( aXCoord[*it], anYCoord[*it], aRadius, colorS, anAspectLine ); - } - if( aMarkerSet->getGLText()->getText() != "" ) - { - //float aXPos = 0, anYPos = 0; - //aMarkerSet->getGLText()->getPosition( aXPos, anYPos ); - //drawText( aMarkerSet->getGLText()->getText(), aXPos, anYPos, colorN, &aMarkerSet->getGLText()->getFont(), aMarkerSet->getGLText()->getSeparator() ); - drawText( aMarkerSet ); - } - } -} - -/*! Draws marker - \param theXCoord - X position - \param theYCoord - Y position - \param theRadius - radius - \param theColor - color - \param theAspectLine - line aspect -*/ -void GLViewer_MarkerDrawer::drawMarker( float& theXCoord, float& theYCoord, - float& theRadius, QColor& theColor, GLViewer_AspectLine* theAspectLine ) -{ - glColor3f( ( GLfloat )theColor.red() / 255, - ( GLfloat )theColor.green() / 255, - ( GLfloat )theColor.blue() / 255 ); - - glLineWidth( theAspectLine->getLineWidth() ); - - if ( theAspectLine->getLineType() == 0 ) - glBegin( GL_LINE_LOOP ); - else - glBegin( GL_LINE_STRIP); - - for ( int i = 0; i < SEGMENTS; i++ ) - glVertex2f( theXCoord + cos_table[i] * theRadius / myXScale, - theYCoord + sin_table[i] * theRadius / myYScale ); - glEnd(); -} - - -/*! - Default constructor -*/ -GLViewer_PolylineDrawer::GLViewer_PolylineDrawer() -:GLViewer_Drawer() -{ - myObjectType = "GLViewer_Polyline"; -} - -/*! - Destructor -*/ -GLViewer_PolylineDrawer::~GLViewer_PolylineDrawer() -{ -} - -/*! Draws object in GLViewer - \param xScale - current scale along X-direction - \param yScale - current scale along Y-direction - \param onlyUpdate - = true if only update highlight-select information -*/ -void GLViewer_PolylineDrawer::create( float xScale, float yScale, bool onlyUpdate ) -{ - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); - - myXScale = xScale; - myYScale = yScale; - - QColor color, colorN, colorH, colorS; - GLViewer_AspectLine* anAspect = NULL; - GLViewer_Polyline* aPolyline = NULL; - for( ; aObjectIt != aObjectEndIt; aObjectIt++ ) - { - anAspect = (*aObjectIt)->getAspectLine(); - aPolyline = (GLViewer_Polyline*)(*aObjectIt); - - - anAspect->getLineColors( colorN, colorH, colorS ); - if( onlyUpdate ) - { - if( aPolyline->isHighlighted() ) - color = colorH; - else if( aPolyline->isSelected() ) - color = colorS; - else - color = colorN; - } - else - { - if( aPolyline->isSelected() ) - color = colorS; - else - color = colorN; - } - - float* aXCoord = aPolyline->getXCoord(); - float* anYCoord = aPolyline->getYCoord(); - int aSize = aPolyline->getNumber(); - - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - - glLineWidth( anAspect->getLineWidth() ); - - if ( anAspect->getLineType() == 0 ) - glBegin( GL_LINE_LOOP ); - else - glBegin( GL_LINE_STRIP); - - for( int i = 0; i < aSize ; i++ ) - glVertex2f( aXCoord[ i ], anYCoord[ i ] ); - - if( aPolyline->isClosed() ) - glVertex2f( aXCoord[ 0 ], anYCoord[ 0 ] ); - - glEnd(); - - if( aPolyline->getGLText()->getText() != "" ) - { - //float aXPos = 0, anYPos = 0; - //aPolyline->getGLText()->getPosition( aXPos, anYPos ); - //drawText( aPolyline->getGLText()->getText(), aXPos, anYPos, color, &aPolyline->getGLText()->getFont(), aPolyline->getGLText()->getSeparator() ); - drawText( aPolyline ); - } - } -} - -/*! - Default constructor -*/ -GLViewer_TextDrawer::GLViewer_TextDrawer() -: GLViewer_Drawer() -{ - myObjectType = "GLViewer_TextObject"; -} - -/*! - Destructor -*/ -GLViewer_TextDrawer::~GLViewer_TextDrawer() -{ -} - -/*! Draws object in GLViewer - \param xScale - current scale along X-direction - \param yScale - current scale along Y-direction - \param onlyUpdate - = true if only update highlight-select information -*/ -void GLViewer_TextDrawer::create( float xScale, float yScale, bool onlyUpdate ) -{ - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); - - myXScale = xScale; - myYScale = yScale; - - QColor color, colorN, colorH, colorS; - GLViewer_AspectLine* anAspect = NULL; - GLViewer_TextObject* anObject = NULL; - //float aXPos = 0, anYPos = 0; - for( ; aObjectIt != aObjectEndIt; aObjectIt++ ) - { - anObject = (GLViewer_TextObject*)(*aObjectIt); - anAspect = anObject->getAspectLine(); - - anAspect->getLineColors( colorN, colorH, colorS ); - if( onlyUpdate ) - { - if( anObject->isHighlighted() ) - color = colorH; - else if( anObject->isSelected() ) - color = colorS; - else - color = colorN; - } - else - { - if( anObject->isSelected() ) - color = colorS; - else - color = colorN; - } - - //anObject->getGLText()->getPosition( aXPos, anYPos ); - //drawText( anObject->getGLText()->getText(), aXPos, anYPos, color, &(anObject->getGLText()->getFont()), anObject->getGLText()->getSeparator() ); - drawText( anObject ); - } -} - -/*! - Updates objects after updating font -*/ -void GLViewer_TextDrawer::updateObjects() -{ - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); - for( ; aObjectIt != aObjectEndIt; aObjectIt++ ) - (*aObjectIt)->compute(); -} diff --git a/src/GLViewer/GLViewer_BaseDrawers.h b/src/GLViewer/GLViewer_BaseDrawers.h deleted file mode 100644 index d06311cf3..000000000 --- a/src/GLViewer/GLViewer_BaseDrawers.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_BaseDrawers.h -// Created: November, 2004 - -#ifndef GLVIEWER_BASEDRAWERS_H -#define GLVIEWER_BASEDRAWERS_H - -#include -#include -#include -#include -#include - -#include "GLViewer.h" -#include "GLViewer_Drawer.h" - -class GLViewer_AspectLine; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_MarkerDrawer - Drawer for GLViewer_MarkerSet -*/ - -class GLVIEWER_API GLViewer_MarkerDrawer : public GLViewer_Drawer -{ -public: - GLViewer_MarkerDrawer(); - ~GLViewer_MarkerDrawer(); - - //! Redefined method - virtual void create( float, float, bool ); - -private: - //! Draws marker in point (x,y) of \param radius with \param color and \param aspect - void drawMarker( float& x, float& y, float& radius, QColor& color, GLViewer_AspectLine* aspect ); -}; - -/*! - \class GLViewer_PolylineDrawer - Drawer for GLViewer_Polyline -*/ - -class GLVIEWER_API GLViewer_PolylineDrawer : public GLViewer_Drawer -{ -public: - GLViewer_PolylineDrawer(); - ~GLViewer_PolylineDrawer(); - //! Redefined method - virtual void create( float, float, bool ); -}; - -/*! - \class GLViewer_TextDrawer - Drawer for GLViewer_Text -*/ - -class GLVIEWER_API GLViewer_TextDrawer: public GLViewer_Drawer -{ - -public: - GLViewer_TextDrawer(); - ~GLViewer_TextDrawer(); - - //! Redefined method - virtual void create( float, float, bool ); - //! Updates objects after updating font - void updateObjects(); -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx deleted file mode 100644 index 338543ee3..000000000 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ /dev/null @@ -1,1711 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -//#include -#include "GLViewer_BaseObjects.h" -#include "GLViewer_BaseDrawers.h" -#include "GLViewer_AspectLine.h" -#include "GLViewer_CoordSystem.h" -#include "GLViewer_Text.h" -#include "GLViewer_Group.h" - -#include "GLViewer_Drawer.h" - -//#include -//using namespace std; - -/*! - Constructor -*/ -GLViewer_MarkerSet::GLViewer_MarkerSet( int number, float size, const QString& toolTip ) : - GLViewer_Object(), - myNumber( 0 ), - myXCoord( 0 ), - myYCoord( 0 ) -{ - - myMarkerSize = size; - myHNumbers.clear(); - myUHNumbers.clear(); - mySelNumbers.clear(); - myUSelNumbers.clear(); - myCurSelNumbers.clear(); - myPrevHNumbers.clear(); - - myType = "GLViewer_MarkerSet"; - myToolTipText = toolTip; - - setNumMarkers( number ); -} - -/*! - Destructor -*/ -GLViewer_MarkerSet::~GLViewer_MarkerSet() -{ - if ( myXCoord ) - delete[] myXCoord; - if ( myYCoord ) - delete[] myYCoord; -} - -/*! - Adds coords to text buffer in HPGL format - \param buffer - text buffer - \param command - command to be added with coords - \param aViewerCS - viewer co-ordinates system - \param aPaperCS - paper co-ordinates system - \param x - x co-ordinate - \param y - y co-ordinate - \param NewLine - adds new line to buffer -*/ -void AddCoordsToHPGL( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS, - GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true ) -{ - if( aViewerCS && aPaperCS ) - aViewerCS->transform( *aPaperCS, x, y ); - - QString temp = command + "%1, %2;"; - buffer += temp.arg( x ).arg( y ); - if( NewLine ) - buffer += ";\n"; -} - -/*! - Adds coords to text buffer in PostScript format - \param buffer - text buffer - \param command - command to be added with coords - \param aViewerCS - viewer co-ordinates system - \param aPaperCS - paper co-ordinates system - \param x - x co-ordinate - \param y - y co-ordinate - \param NewLine - adds new line to buffer -*/ -void AddCoordsToPS( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS, - GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true ) -{ - if( aViewerCS && aPaperCS ) - aViewerCS->transform( *aPaperCS, x, y ); - - QString temp = "%1 %2 "+command; - buffer += temp.arg( x ).arg( y ); - if( NewLine ) - buffer += "\n"; -} - -/*! - Adds line aspect description to text buffer in PostScript format - \param buffer - text buffer - \param anAspect - line aspect - \param aViewerCS - viewer co-ordinates system - \param aPaperCS - paper co-ordinates system -*/ -void AddLineAspectToPS( QString& buffer, GLViewer_AspectLine* anAspect, - GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS ) -{ - if( anAspect ) - { - QColor col1, col2, col3; - anAspect->getLineColors( col1, col2, col3 ); - - float aWidth = anAspect->getLineWidth(); - int aLineType = anAspect->getLineType(); - - QString temp = "%1 %2 %3 setrgbcolor\n"; - double rr = 1 - double( col1.red() ) / 255.0, //color inverting - gg = 1 - double( col1.green() ) / 255.0, - bb = 1 - double( col1.blue() ) / 255.0; - - buffer += temp.arg( rr ).arg( gg ).arg( bb ); - - double x_stretch, y_stretch; - aViewerCS->getStretching( *aPaperCS, x_stretch, y_stretch ); - buffer += temp.arg( x_stretch * aWidth )+" setlinewidth\n"; - - if( aLineType==0 ) //solid - buffer += "[] 0 setdash\n"; - else if( aLineType==1 ) //strip - buffer += "[2] 0 setdash\n"; - } -} - -#ifdef WIN32 -/*! - Adds line aspect description EMF image - \param hDC - descriptor of EMF - \param anAspect - line aspect - \param aViewerCS - viewer co-ordinates system - \param aPaperCS - paper co-ordinates system -*/ -HPEN AddLineAspectToEMF( HDC hDC, GLViewer_AspectLine* anAspect, - GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS ) -{ - if( anAspect ) - { - QColor col1, col2, col3; - anAspect->getLineColors( col1, col2, col3 ); - - double x_stretch, y_stretch; - aViewerCS->getStretching( *aPaperCS, x_stretch, y_stretch ); - - double aWidth = anAspect->getLineWidth()*x_stretch; - int aLineType = anAspect->getLineType(); - - return CreatePen( PS_SOLID, aWidth, RGB( 255-col1.red(), 255-col1.green(), 255-col1.blue() ) ); - } - else - return NULL; -} -#endif - -/*! - Saves to file PostScript set of markers - \param hFile - file instance - \param aViewerCS - viewer co-ordinates system - \param aPSCS - paper co-ordinates system -*/ -bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) -{ - int noPoints = 20; - - QString aBuffer = "newpath\n"; - - AddLineAspectToPS( aBuffer, getAspectLine(), aViewerCS, aPSCS ); - - for( int i=0; igetStretching( *aPSCS, x_stretch, y_stretch ); - - double x0 = myXCoord[i], - y0 = myYCoord[i], - r = myMarkerSize, - x, y; - - for( int j=0; j<=noPoints; j++ ) - { - x = x0 + r*cos( double(j)*2*PI/double(noPoints) ); - y = y0 + r*sin( double(j)*2*PI/double(noPoints) ); - if( j==0 ) - AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, x, y, true ); - else - AddCoordsToPS( aBuffer, "lineto", aViewerCS, aPSCS, x, y, true ); - } - } - aBuffer+="closepath\nstroke\n"; - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - - return true; -} - -/*! - Saves to file HPGL set of markers - \param hFile - file instance - \param aViewerCS - viewer co-ordinates system - \param aHPGLCS - paper co-ordinates system -*/ -bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, - GLViewer_CoordSystem* aHPGLCS ) -{ - int noPoints = 20; - QString aBuffer; - for( int i=0; igetStretching( *aHPGLCS, x_stretch, y_stretch ); - - double x0 = myXCoord[i], - y0 = myYCoord[i], - r = myMarkerSize, - x, y; - - AddCoordsToHPGL( aBuffer, "PA", aViewerCS, aHPGLCS, x0+r, y0 ); - aBuffer+="PD;\n"; - for( int j=1; j<=noPoints; j++ ) - { - x = x0 + r*cos( double(j)*2*PI/double(noPoints) ); - y = y0 + r*sin( double(j)*2*PI/double(noPoints) ); - AddCoordsToHPGL( aBuffer, "PD", aViewerCS, aHPGLCS, x, y ); - } - aBuffer+="PU;\n"; - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - } - - return true; -} - -#ifdef WIN32 -/*! - Saves to EMF image set of markers - \param dc - EMF image descriptor - \param aViewerCS - viewer co-ordinates system - \param aEMFCS - paper co-ordinates system -*/ -bool GLViewer_MarkerSet::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ) -{ - int noPoints = 20; - if( !aViewerCS || !aEMFCS ) - return false; - - HPEN pen = AddLineAspectToEMF( dc, getAspectLine(), aViewerCS, aEMFCS ); - HGDIOBJ old = SelectObject( dc, pen ); - - for( int i=0; itransform( *aEMFCS, x, y ); - if( j==0 ) - MoveToEx( dc, x, y, NULL ); - else - LineTo( dc, x, y ); - } - } - - SelectObject( dc, old ); - if( pen ) - DeleteObject( pen ); - return true; -} -#endif - -/*! - Computes all necessary information about object for presentation in drawer -*/ -void GLViewer_MarkerSet::compute() -{ -// cout << "GLViewer_MarkerSet::compute" << endl; - GLfloat xa = myXCoord[0]; - GLfloat xb = myXCoord[0]; - GLfloat ya = myYCoord[0]; - GLfloat yb = myYCoord[0]; - - for ( int i = 0; i < myNumber; i++ ) - { - xa = QMIN( xa, myXCoord[i] ); - xb = QMAX( xb, myXCoord[i] ); - ya = QMIN( ya, myYCoord[i] ); - yb = QMAX( yb, myYCoord[i] ); - } - - myXGap = ( xb - xa ) / 10; - myYGap = ( yb - ya ) / 10; - - myRect->setLeft( xa - myXGap ); - myRect->setTop( yb + myYGap ); - myRect->setRight( xb + myXGap ); - myRect->setBottom( ya - myYGap ); -} - -/*! - Creates corresponding drawer -*/ -GLViewer_Drawer* GLViewer_MarkerSet::createDrawer() -{ -// cout << "GLViewer_MarkerSet::createDrawer" << endl; - return myDrawer = new GLViewer_MarkerDrawer(); -} - -/*! - Computes highlight presentation - \param x - x coord - \param y - y coord - \param tol - tolerance of detecting - \param isCircle - true if sensitive area of detection is round - \return true if highlight status is changed -*/ -GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle ) -{ - if( !myIsVisible ) - return false; -// cout << "GLViewer_MarkerSet::highlight " << x <<" " << y << " " << tol << endl; - int count = 0; - GLfloat xdist, ydist, radius; - QValueList::Iterator it; - QValueList curHNumbers; - bool isFound; - GLboolean update; - int cnt = 0; - - radius = tol - myMarkerSize / 2.; - - myUHNumbers += myHNumbers; - myHNumbers.clear(); - - for ( int i = 0; i < myNumber; i++ ) - { - xdist = ( myXCoord[i] - x ) * myXScale; - ydist = ( myYCoord[i] - y ) * myYScale; - -// if ( isCircle && ( xdist * xdist + ydist * ydist <= radius * radius ) || - if ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) || - !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) - { - isFound = FALSE; - count++; - for ( it = myCurSelNumbers.begin(); it != myCurSelNumbers.end(); ++it ) - if( i == *it ) - { - isFound = TRUE; - curHNumbers.append( i ); - } - - if( !isFound ) - myHNumbers.append( i ); - else - cnt++; - } - } - myCurSelNumbers = curHNumbers; - - myIsHigh = ( GLboolean )count; - update = ( GLboolean )( myHNumbers != myPrevHNumbers ); - - myPrevHNumbers = myHNumbers; - - //cout << "GLViewer_MarkerSet::highlight complete with " << (int)myIsHigh << endl; - return update; -} - -/*! - Unhilights object -*/ -GLboolean GLViewer_MarkerSet::unhighlight() -{ - if( !myHNumbers.isEmpty() ) - { - myUHNumbers += myHNumbers; - myPrevHNumbers.clear(); - myHNumbers.clear(); - //??? myCurSelNumbers.clear(); - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - Selects marker set - /param x, y - co-ordinates of mouse - /param tol - tolerance - /param rect - rectangle (in case of rectangular selection) - /param isFull - if it is true, then object may selected only if it lays whole in selection zone - \param isCircle - true if sensitive area of detection is round - \param isShift - true if selection exec with append option -*/ -GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull, - GLboolean isCircle, GLboolean isShift ) -{ - if( !myIsVisible ) - return false; -// cout << "GLViewer_MarkerSet::select " << x << " " << y << endl; - int count = 0; - GLfloat xdist, ydist, radius; - QValueList::Iterator it; - QValueList::Iterator it1; - QValueList::Iterator remIt; - QValueList::Iterator curIt; - - radius = tol - myMarkerSize / 2.; - - if( radius < myMarkerSize / 2.) - radius = myMarkerSize / 2.; - - count = isShift ? mySelNumbers.count() : 0; - - myUSelNumbers = mySelNumbers; - - if ( !isShift ) - { - mySelNumbers.clear(); - myCurSelNumbers.clear(); - } - - for ( int i = 0; i < myNumber; i++ ) - { - xdist = ( myXCoord[i] - x ) * myXScale; - ydist = ( myYCoord[i] - y ) * myYScale; - - //if ( isCircle && ( xdist * xdist + ydist * ydist <= radius * radius ) || - if ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) || - !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) - { - count++; - if ( isShift ) - { - bool isFound = FALSE; - for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it ) - if ( *it == i ) - { - myUSelNumbers.append( *it ); - remIt = it; - isFound = TRUE; - break; - } - - if ( !isFound ) - { - mySelNumbers.append( i ); - myCurSelNumbers.append( i ); - for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myHNumbers.remove( it1 ); - break; - } - for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myUHNumbers.remove( it1 ); - break; - } - } - else - { - mySelNumbers.remove( remIt ); - for ( curIt = myCurSelNumbers.begin(); curIt != myCurSelNumbers.end(); ++curIt ) - if( *curIt == *remIt) - { - myCurSelNumbers.remove( curIt ); - break; - } - for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myHNumbers.remove( it1 ); - break; - } - for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myUHNumbers.remove( it1 ); - break; - } - } - } - else - { - mySelNumbers.append( i ); - myCurSelNumbers.append( i ); - for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myHNumbers.remove( it1 ); - break; - } - for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) - if( i == *it1 ) - { - myUHNumbers.remove( it1 ); - break; - } - } - } - } - - for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it ) - for( it1 = myUSelNumbers.begin(); it1 != myUSelNumbers.end(); ++it1 ) - if( *it == *it1 ) - { - it1 = myUSelNumbers.remove( it1 ); - it1--; - } - - myIsSel = (GLboolean)count; - -// cout << "GLViewer_MarkerSet::select complete with " << (int)myIsSel << endl; - return myIsSel; -} - -/*! - Unselects marker set -*/ -GLboolean GLViewer_MarkerSet::unselect() -{ - if( !mySelNumbers.isEmpty() ) - { - myUSelNumbers = mySelNumbers; - mySelNumbers.clear(); - myCurSelNumbers.clear(); - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - \return update object rectangle - Does not equal getRect() if object have a persistence to some viewer transformations -*/ -GLViewer_Rect* GLViewer_MarkerSet::getUpdateRect() -{ - GLViewer_Rect* rect = new GLViewer_Rect(); - - rect->setLeft( myRect->left() + myXGap - myMarkerSize / myXScale ); - rect->setTop( myRect->top() + myYGap + myMarkerSize / myYScale ); - rect->setRight( myRect->right() - myXGap + myMarkerSize / myXScale ); - rect->setBottom( myRect->bottom() - myYGap - myMarkerSize / myYScale ); - //cout << " Additional tolerance " << myMarkerSize / myYScale << endl; - //rect->setLeft( myRect->left() - myMarkerSize / myXScale ); - //rect->setTop( myRect->top() - myMarkerSize / myYScale ); - //rect->setRight( myRect->right() + myMarkerSize / myXScale ); - //rect->setBottom( myRect->bottom() + myMarkerSize / myYScale ); - - return rect; -} - -/*! - Sets array of x coords of points - \param xCoord - array of co-ordinates - \param size - array size -*/ -void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size ) -{ - myXCoord = new GLfloat[ size ]; - for( int i = 0; i < size; i++ ) - myXCoord[i] = xCoord[i]; -} - -/*! - Sets array of y coords of points - \param yCoord - array of co-ordinates - \param size - array size -*/ -void GLViewer_MarkerSet::setYCoord( GLfloat* yCoord, int size ) -{ - myYCoord = new GLfloat[ size ]; - for( int i = 0; i < size; i++ ) - myYCoord[i] = yCoord[i]; -} - -/*! - Sets number of markers - \param number - new number of markers -*/ -void GLViewer_MarkerSet::setNumMarkers( GLint number ) -{ - if ( myNumber == number ) - return; - - if ( myXCoord && myYCoord ) - { - delete[] myXCoord; - delete[] myYCoord; - } - - myNumber = number; - myXCoord = new GLfloat[ myNumber ]; - myYCoord = new GLfloat[ myNumber ]; -} - - -/*! - Export numbers of highlighted/selected lines -*/ -void GLViewer_MarkerSet::exportNumbers( QValueList& highlight, - QValueList& unhighlight, - QValueList& select, - QValueList& unselect ) -{ - highlight = myHNumbers; - unhighlight = myUHNumbers; - select = mySelNumbers; - unselect = myUSelNumbers; - - myUHNumbers = myHNumbers; -} - -/*! - Adds or remove selected number - \param index - selected index -*/ -bool GLViewer_MarkerSet::addOrRemoveSelected( int index ) -{ - if( index < 0 || index > myNumber ) - return FALSE; - - int n = mySelNumbers.findIndex( index ); - if( n == -1 ) - mySelNumbers.append( index ); - else - { - QValueList::Iterator it; - it = mySelNumbers.at( n ); - mySelNumbers.remove( it ); - myUSelNumbers.append( index ); - } - return TRUE; -} - -/*! - Adds some selected numbers - \param seq - sequence of indices -*/ -void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq ) -{ - for ( int i = 1; i <= seq.Length(); i++ ) - if( mySelNumbers.findIndex( seq.Value( i ) ) == -1 ) - mySelNumbers.append( seq.Value( i ) - 1 ); -} - -/*! - Sets some numbers as selected - \param seq - sequence of indices -*/ -void GLViewer_MarkerSet::setSelected( const TColStd_SequenceOfInteger& seq ) -{ -// for( QValueList::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it ) -// if( myUSelNumbers.findIndex( *it ) == -1 ) -// myUSelNumbers.append( *it ); - - myUSelNumbers = mySelNumbers; - mySelNumbers.clear(); - - for ( int i = 1; i <= seq.Length(); i++ ) - mySelNumbers.append( seq.Value( i ) - 1 ); -} - -/*! Moves object by recomputing - \param dx - moving along X coord - \param dy - moving along Y coord - \param fromGroup - is true if this method called from group -*/ -void GLViewer_MarkerSet::moveObject( float theX, float theY, bool fromGroup ) -{ - if( !fromGroup && myGroup) - { - myGroup->dragingObjects( theX, theY ); - return; - } - for( int i = 0; i < myNumber; i++ ) - { - myXCoord[i] = myXCoord[i] + theX; - myYCoord[i] = myYCoord[i] + theY; - } - compute(); -} - -/*! - Codes marker set as byte copy - \return byte array -*/ -QByteArray GLViewer_MarkerSet::getByteCopy() -{ - int i = 0; - int anISize = sizeof( GLint ); - int aFSize = sizeof( GLfloat ); - - QByteArray aObject = GLViewer_Object::getByteCopy(); - - QByteArray aResult( anISize + 2*aFSize*myNumber + aFSize + aObject.size()); - - char* aPointer = (char*)&myNumber; - for( i = 0; i < anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)myXCoord; - for( ; i < anISize + aFSize*myNumber; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)myYCoord; - for( ; i < anISize + 2*aFSize*myNumber; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&myMarkerSize; - for( ; i < anISize + 2*aFSize*myNumber + aFSize; i++, aPointer++ ) - aResult[i] = *aPointer; - - - for ( ; i < (int)aResult.size(); i++ ) - aResult[i] = aObject[i - anISize - 2*aFSize*myNumber - aFSize]; - - return aResult; -} - -/*! - Initialize marker set by byte array - \param theArray - byte array -*/ -bool GLViewer_MarkerSet::initializeFromByteCopy( QByteArray theArray ) -{ - int i = 0; - int anISize = sizeof( GLint ); - int aFSize = sizeof( GLfloat ); - - char* aPointer = (char*)&myNumber; - for( i = 0; i < anISize; i++, aPointer++ ) - *aPointer = theArray[i]; - - int aSize = theArray.size(); - if( aSize < anISize + 2*aFSize*myNumber + aFSize) - return false; - - myXCoord = new GLfloat[myNumber]; - myYCoord = new GLfloat[myNumber]; - aPointer = (char*)myXCoord; - for( ; i < anISize + aFSize*myNumber; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)myYCoord; - for( ; i < anISize + 2*aFSize*myNumber; i++, aPointer++ ) - *aPointer = theArray[i]; - - aPointer = (char*)&myMarkerSize; - for( ; i < anISize + 2*aFSize*myNumber + aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - - int aCurIndex = anISize + 2*aFSize*myNumber + aFSize; - QByteArray aObject( aSize - aCurIndex ); - for( ; i < aSize; i++ ) - aObject[i - aCurIndex] = theArray[i]; - - - if( !GLViewer_Object::initializeFromByteCopy( aObject ) || myType != "GLViewer_MarkerSet" ) - return false; - - myHNumbers.clear(); - myUHNumbers.clear(); - mySelNumbers.clear(); - myUSelNumbers.clear(); - myCurSelNumbers.clear(); - myPrevHNumbers.clear(); - - return true; -} - -/*! - \class GLViewer_Polyline - OpenGL Polyline -*/ - -#define SECTIONS 100 -#define DISTANTION 5 - -/*! - Constructor - \param number - number of segments - \param size - size of polyline - \param toolTip - tool tip of polyline -*/ -GLViewer_Polyline::GLViewer_Polyline( int number, float size, const QString& toolTip ): - GLViewer_Object(), - myNumber( 0 ), - myXCoord( 0 ), - myYCoord( 0 ) -{ - myHighFlag = GL_TRUE; - - myHNumbers.clear(); - myUHNumbers.clear(); - mySelNumbers.clear(); - myUSelNumbers.clear(); - myCurSelNumbers.clear(); - myPrevHNumbers.clear(); - - setNumber( number ); - - myType = "GLViewer_Polyline"; - myToolTipText = toolTip; -} - -/*! - Destructor, destroys internal arrays of co-ordinates -*/ -GLViewer_Polyline::~GLViewer_Polyline() -{ - if ( myXCoord ) - delete[] myXCoord; - if ( myYCoord ) - delete[] myYCoord; -} - -/*! - Saves polyline to file PostScript - \param hFile - file instance - \param aViewerCS - viewer co-ordinates system - \param aPSCS - paper co-ordinates system -*/ -bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) -{ - QString aBuffer = "newpath\n"; - - AddLineAspectToPS( aBuffer, getAspectLine(), aViewerCS, aPSCS ); - - for( int i=0; itransform( *aEMFCS, x, y ); - if( i==0 ) - MoveToEx( dc, x, y, NULL ); - else - LineTo( dc, x, y ); - } - - if( myIsClosed ) - { - x = myXCoord[0]; - y = myYCoord[0]; - aViewerCS->transform( *aEMFCS, x, y ); - LineTo( dc, x, y ); - } - - SelectObject( dc, old ); - if( pen ) - DeleteObject( pen ); - - return true; -} -#endif - -/*! - Computes all necessary information about object for presentation in drawer -*/ -void GLViewer_Polyline::compute() -{ -// cout << "GLViewer_MarkerSet::compute" << endl; - GLfloat xa = myXCoord[0]; - GLfloat xb = myXCoord[0]; - GLfloat ya = myYCoord[0]; - GLfloat yb = myYCoord[0]; - - for ( int i = 0; i < myNumber; i++ ) - { - xa = QMIN( xa, myXCoord[i] ); - xb = QMAX( xb, myXCoord[i] ); - ya = QMIN( ya, myYCoord[i] ); - yb = QMAX( yb, myYCoord[i] ); - } - - GLfloat xGap = ( xb - xa ) / 10; - GLfloat yGap = ( yb - ya ) / 10; - - myRect->setLeft( xa - xGap ); - myRect->setTop( yb + yGap ); - myRect->setRight( xb + xGap ); - myRect->setBottom( ya - yGap ); -} - -/*! - \return update object rectangle - Does not equal getRect() if object have a persistence to some viewer transformations -*/ -GLViewer_Rect* GLViewer_Polyline::getUpdateRect() -{ - GLViewer_Rect* rect = new GLViewer_Rect(); - - rect->setLeft( myRect->left() - myXGap ); - rect->setTop( myRect->top() + myYGap ); - rect->setRight( myRect->right() + myXGap ); - rect->setBottom( myRect->bottom() - myYGap ); - - return rect; -} - -/*! - Creates corresponding drawer -*/ -GLViewer_Drawer* GLViewer_Polyline::createDrawer() -{ -// cout << "GLViewer_MarkerSet::createDrawer" << endl; - return myDrawer = new GLViewer_PolylineDrawer(); -} - -/*! - Computes highlight presentation - \param x - x coord - \param y - y coord - \param tol - tolerance of detecting - \param isCircle - true if sensitive area of detection is round - \return true if highlight status is changed -*/ -GLboolean GLViewer_Polyline::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle ) -{ - if( !myIsVisible ) - return false; - GLfloat xa, xb, ya, yb, l; - GLfloat rsin, rcos, r, ra, rb; - GLboolean update; - GLboolean highlighted = myIsHigh; - - myIsHigh = GL_FALSE; - - int c = 0; - if( myIsClosed ) - c = 1; - - for( int i = 0; i < myNumber-1+c; i++ ) - { - xa = myXCoord[i]; - ya = myYCoord[i]; - if( i != myNumber-1 ) - { - xb = myXCoord[i+1]; - yb = myYCoord[i+1]; - } - else - { - xb = myXCoord[0]; - yb = myYCoord[0]; - } - - l = sqrt( (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya) ); - rsin = (yb-ya) / l; - rcos = (xb-xa) / l; - r = ( (x-xa)*(y-yb) - (x-xb)*(y-ya) ) / ( rsin*(ya-yb) + rcos*(xa-xb) ); - ra = sqrt( (x-xa)*(x-xa) + (y-ya)*(y-ya) ); - rb = sqrt( (x-xb)*(x-xb) + (y-yb)*(y-yb) ); - if( fabs( r ) * myXScale <= DISTANTION && ra <= l + DISTANTION && rb <= l + DISTANTION ) - { - myIsHigh = GL_TRUE; - break; - } - } - - if( !myHighFlag && myIsHigh ) - myIsHigh = GL_FALSE; - else - myHighFlag = GL_TRUE; - - update = ( GLboolean )( myIsHigh != highlighted ); - -// cout << "GLViewer_Polyline::highlight complete with " << (int)myIsHigh << endl; - return update; -} - -/*! - Unhilights object -*/ -GLboolean GLViewer_Polyline::unhighlight() -{ -// if( !myHNumbers.isEmpty() ) -// { -// myUHNumbers = myHNumbers; -// myHNumbers.clear(); -// return GL_TRUE; -// } - - if( myIsHigh ) - { - myIsHigh = GL_FALSE; - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - Selects polyline - /param x, y - co-ordinates of mouse - /param tol - tolerance - /param rect - rectangle (in case of rectangular selection) - /param isFull - if it is true, then object may selected only if it lays whole in selection zone - \param isCircle - true if sensitive area of detection is round - \param isShift - true if selection exec with append option -*/ -GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull, - GLboolean isCircle, GLboolean isShift ) -{ - if( !myIsVisible ) - return false; - GLfloat xa, xb, ya, yb, l; - GLfloat rsin, rcos, r, ra, rb; - GLboolean update; - GLboolean selected = myIsSel; - - myIsSel = GL_FALSE; - - int c = 0; - if( myIsClosed ) - c = 1; - - for( int i = 0; i < myNumber-1+c; i++ ) - { - xa = myXCoord[i]; - ya = myYCoord[i]; - if( i != myNumber-1 ) - { - xb = myXCoord[i+1]; - yb = myYCoord[i+1]; - } - else - { - xb = myXCoord[0]; - yb = myYCoord[0]; - } - - l = sqrt( (xb-xa)*(xb-xa) + (yb-ya)*(yb-ya) ); - rsin = (yb-ya) / l; - rcos = (xb-xa) / l; - r = ( (x-xa)*(y-yb) - (x-xb)*(y-ya) ) / ( rsin*(ya-yb) + rcos*(xa-xb) ); - ra = sqrt( (x-xa)*(x-xa) + (y-ya)*(y-ya) ); - rb = sqrt( (x-xb)*(x-xb) + (y-yb)*(y-yb) ); - if( fabs( r ) * myXScale <= DISTANTION && ra <= l + DISTANTION && rb <= l + DISTANTION ) - { - myIsSel = GL_TRUE; - break; - } - } - - if ( myIsSel ) - { - myHighFlag = GL_FALSE; - myIsHigh = GL_FALSE; - } - else - myHighFlag = GL_TRUE; - - update = ( GLboolean )( myIsSel != selected ); - - // cout << "GLViewer_Polyline::select complete with " << (int)myIsSel << endl; - - // return update; !!!!!!!!!!!!!!!!!!!!!!!!!!! no here - return myIsSel; -} - -/*! - Unselects polyline -*/ -GLboolean GLViewer_Polyline::unselect() -{ -// if( !mySelNumbers.isEmpty() ) -// { -// myUSelNumbers = mySelNumbers; -// mySelNumbers.clear(); -// myCurSelNumbers.clear(); -// return GL_TRUE; -// } - - if( myIsSel ) - { - myIsSel = GL_FALSE; - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - Sets array of abscisses for points of polyline - \param xCoord - array of of abscisses - \param size - size of array -*/ -void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size ) -{ - myXCoord = new GLfloat[ size ]; - for( int i = 0; i < size; i++ ) - myXCoord[i] = xCoord[i]; -} - -/*! - Sets array of ordinates for points of polyline - \param xCoord - array of of ordinates - \param size - size of array -*/ -void GLViewer_Polyline::setYCoord( GLfloat* yCoord, int size ) -{ - myYCoord = new GLfloat[ size ]; - for( int i = 0; i < size; i++ ) - myYCoord[i] = yCoord[i]; -} - -/*! - Sets number of points - \param number - new number of points -*/ -void GLViewer_Polyline::setNumber( GLint number ) -{ - if ( myNumber == number ) - return; - - if ( myXCoord && myYCoord ) - { - delete[] myXCoord; - delete[] myYCoord; - } - - myNumber = number; - myXCoord = new GLfloat[ myNumber ]; - myYCoord = new GLfloat[ myNumber ]; -} - -/*! - Export numbers of highlighted/selected lines -*/ -void GLViewer_Polyline::exportNumbers( QValueList& highlight, - QValueList& unhighlight, - QValueList& select, - QValueList& unselect ) -{ - highlight = myHNumbers; - unhighlight = myUHNumbers; - select = mySelNumbers; - unselect = myUSelNumbers; -} - -/*! - Moves object by recomputing - \param dx - moving along X coord - \param dy - moving along Y coord - \param fromGroup - is true if this method called from group -*/ -void GLViewer_Polyline::moveObject( float theX, float theY, bool fromGroup ) -{ - if( !fromGroup && myGroup) - { - myGroup->dragingObjects( theX, theY ); - return; - } - for( int i = 0; i < myNumber; i++ ) - { - myXCoord[i] = myXCoord[i] + theX; - myYCoord[i] = myYCoord[i] + theY; - } - compute(); -} - -/*! - Codes polyline as byte copy - \return byte array -*/ -QByteArray GLViewer_Polyline::getByteCopy() -{ - int i = 0; - int anISize = sizeof( GLint ); - int aFSize = sizeof( GLfloat ); - int aBSize = sizeof( GLboolean ); - - QByteArray aObject = GLViewer_Object::getByteCopy(); - - QByteArray aResult( aFSize*myNumber*2 + anISize + 2*aBSize + aObject.size()); - - char* aPointer = (char*)&myNumber; - for( i = 0; i < anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)myXCoord; - for( ; i < anISize + aFSize*myNumber; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)myYCoord; - for( ; i < anISize + 2*aFSize*myNumber; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&myIsClosed; - for( ; i < anISize + 2*aFSize*myNumber + aBSize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&myHighSelAll; - for( ; i < anISize + 2*aFSize*myNumber + 2*aBSize; i++, aPointer++ ) - aResult[i] = *aPointer; - - for ( ; i < (int)aResult.size(); i++ ) - aResult[i] = aObject[i - anISize - 2*aFSize*myNumber - 2*aBSize]; - - return aResult; -} - - -/*! - Initialize polyline by byte array - \param theArray - byte array -*/ -bool GLViewer_Polyline::initializeFromByteCopy( QByteArray theArray ) -{ - int i = 0; - int anISize = sizeof( GLint ); - int aFSize = sizeof( GLfloat ); - int aBSize = sizeof( GLboolean ); - - char* aPointer = (char*)&myNumber; - for( i = 0; i < anISize; i++, aPointer++ ) - *aPointer = theArray[i]; - - int aSize = theArray.size(); - if( aSize < aFSize*myNumber*2 + anISize + 2*aBSize ) - return false; - - myXCoord = new GLfloat[myNumber]; - myYCoord = new GLfloat[myNumber]; - aPointer = (char*)myXCoord; - for( ; i < anISize + aFSize*myNumber; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)myYCoord; - for( ; i < anISize + 2*aFSize*myNumber; i++, aPointer++ ) - *aPointer = theArray[i]; - - aPointer = (char*)&myIsClosed; - for( ; i < anISize + 2*aFSize*myNumber + aBSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&myHighSelAll; - for( ; i < anISize + 2*aFSize*myNumber + 2*aBSize; i++, aPointer++ ) - *aPointer = theArray[i]; - - int aCurIndex = anISize + 2*aFSize*myNumber + 2*aBSize; - QByteArray aObject( aSize - aCurIndex ); - for( ; i < aSize; i++ ) - aObject[i - aCurIndex] = theArray[i]; - - if( !GLViewer_Object::initializeFromByteCopy( aObject ) || myType != "GLViewer_Polyline" ) - return false; - - myHNumbers.clear(); - myUHNumbers.clear(); - mySelNumbers.clear(); - myUSelNumbers.clear(); - myCurSelNumbers.clear(); - myPrevHNumbers.clear(); - - return true; -} - - - -/*! - Constructor - \param theStr - text string - \param xPos - x position - \param yPos - y position - \param color - color of text - \param toolTip - tooltip of text object -*/ -GLViewer_TextObject::GLViewer_TextObject( const QString& theStr, float xPos, float yPos, - const QColor& color, const QString& toolTip ) - : GLViewer_Object() -{ - myGLText = new GLViewer_Text( theStr, xPos, yPos, color ); - myWidth = 0; - myHeight = 0; - - myHighFlag = GL_TRUE; - - myToolTipText = toolTip; -} - -/*! - Destructor -*/ -GLViewer_TextObject::~GLViewer_TextObject() -{ - if ( myGLText ) - delete myGLText; -} - -/*! - Saves text object to file PostScript - \param hFile - file instance - \param aViewerCS - viewer co-ordinates system - \param aPSCS - paper co-ordinates system -*/ -bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) -{ - QString aText = myGLText->getText(); - float xPos, yPos; - myGLText->getPosition( xPos, yPos ); - - QString aBuffer = "/Times-Roman findfont\n"; - aBuffer += "12 scalefont setfont\n"; - - AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) ); - aBuffer += "(" + aText + ") show\n"; - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - - return true; -} - -/*! - Saves text object to file HPGL - \param hFile - file instance - \param aViewerCS - viewer co-ordinates system - \param aHPGLCS - paper co-ordinates system -*/ -bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ) -{ - QString aText = myGLText->getText(); - float xPos, yPos; - myGLText->getPosition( xPos, yPos ); - - QString aBuffer = ""; - AddCoordsToHPGL( aBuffer, "PA", aViewerCS, aHPGLCS, double(xPos), double(yPos) ); - - aBuffer = "LB" + aText + "#;"; - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - - return true; -} - -#ifdef WIN32 -/*! - Saves text object to EMF image - \param dc - EMF image descriptor - \param aViewerCS - viewer co-ordinates system - \param aEMFCS - paper co-ordinates system -*/ -bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ) -{ - QString aText = myGLText->getText(); - float xPos, yPos; - myGLText->getPosition( xPos, yPos ); - - double x = double( xPos ), - y = double( yPos ); - - aViewerCS->transform( *aEMFCS, x, y ); - const char* str = aText.ascii(); - - int nHeight = 35*14; // height of font - int nWidth = 35*12; // average character width - int nEscapement = 0; // angle of escapement - int nOrientation = 0; // base-line orientation angle - int fnWeight = FW_NORMAL; // font weight - DWORD fdwItalic = FALSE; // italic attribute option - DWORD fdwUnderline = FALSE; // underline attribute option - DWORD fdwStrikeOut = FALSE; // strikeout attribute option - DWORD fdwCharSet = ANSI_CHARSET; // character set identifier - DWORD fdwOutputPrecision = OUT_DEFAULT_PRECIS; // output precision - DWORD fdwClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision - DWORD fdwQuality = PROOF_QUALITY; // output quality - DWORD fdwPitchAndFamily = FIXED_PITCH | FF_DONTCARE; // pitch and family - LPCTSTR lpszFace = NULL; // typeface name - - - HFONT aFont = CreateFont( nHeight, nWidth, nEscapement, nOrientation, fnWeight, fdwItalic, - fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision, - fdwClipPrecision, fdwQuality, fdwPitchAndFamily, lpszFace ); - LOGBRUSH aBrushData; - aBrushData.lbStyle = BS_HOLLOW; - - HBRUSH aBrush = CreateBrushIndirect( &aBrushData ); - - HGDIOBJ old1 = SelectObject( dc, aFont ); - HGDIOBJ old2 = SelectObject( dc, aBrush ); - - TextOut( dc, x, y, str, aText.length() ); - - SelectObject ( dc, old1 ); - SelectObject ( dc, old2 ); - - DeleteObject( aFont ); - - return true; -} -#endif - -/*! - Creates corresponding drawer -*/ -GLViewer_Drawer* GLViewer_TextObject::createDrawer() -{ - myDrawer = new GLViewer_TextDrawer(); - compute(); - return myDrawer; -} - -/*! - Computes all necessary information about object for presentation in drawer -*/ -void GLViewer_TextObject::compute() -{ - float xPos, yPos; - QString aStr = myGLText->getText(); - myGLText->getPosition( xPos, yPos ); - - myWidth = myGLText->getWidth(); - myHeight = myGLText->getHeight(); - myRect->setLeft( xPos ); - myRect->setTop( yPos + myHeight ); - myRect->setRight( xPos + myWidth ); - myRect->setBottom( yPos ); -} - -/*! - Installing already exist drawer with same type - \param theDrawer - new drawer -*/ -void GLViewer_TextObject::setDrawer( GLViewer_Drawer* theDrawer ) -{ - myDrawer = theDrawer; - //compute(); -} - -/*! - \return update object rectangle - Does not equal getRect() if object have a persistence to some viewer transformations -*/ -GLViewer_Rect* GLViewer_TextObject::getUpdateRect() -{ - GLViewer_Rect* rect = new GLViewer_Rect(); - - float xPos, yPos; - QString aStr = myGLText->getText(); - myGLText->getPosition( xPos, yPos ); - - rect->setLeft( myRect->left() + myXGap - myWidth / myXScale ); - rect->setTop( myRect->top() + myYGap + myHeight / myYScale ); - rect->setRight( myRect->right() - myXGap + myWidth / myXScale ); - rect->setBottom( myRect->bottom() - myYGap - myHeight / myYScale ); - - return rect; -} - -/*! - Computes highlight presentation - \param x - x coord - \param y - y coord - \param tol - tolerance of detecting - \param isCircle - true if sensitive area of detection is round - \return true if highlight status is changed -*/ -GLboolean GLViewer_TextObject::highlight( GLfloat theX, GLfloat theY, GLfloat theTol, GLboolean isCircle ) -{ - if( !myIsVisible ) - return false; - - float xPos, yPos; - myGLText->getPosition( xPos, yPos ); - - QRect aRect; - aRect.setLeft( (int)xPos ); - aRect.setRight( (int)(xPos + myWidth / myXScale) ); - aRect.setTop( (int)yPos );// - myHeight / myYScale ); - aRect.setBottom( (int)(yPos + myHeight / myYScale) ); - - //cout << "theX: " << theX << " theY: " << theY << endl; - //cout << "aRect.left(): " << aRect.left() << " aRect.right(): " << aRect.right() << endl; - //cout << "aRect.top(): " << aRect.top() << " aRect.bottom(): " << aRect.bottom() << endl; - - QRegion obj( aRect ); - QRegion intersection; - QRect region; - - region.setLeft( (int)(theX - theTol) ); - region.setRight( (int)(theX + theTol) ); - region.setTop( (int)(theY - theTol) ); - region.setBottom( (int)(theY + theTol) ); - - QRegion circle( (int)(theX - theTol), (int)(theY - theTol), - (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse ); - if( isCircle ) - intersection = obj.intersect( circle ); - else - intersection = obj.intersect( region ); - - if( intersection.isEmpty() ) - myIsHigh = false; - else - myIsHigh = true; - - if( !myHighFlag && myIsHigh ) - myIsHigh = GL_FALSE; - else - myHighFlag = GL_TRUE; - - return myIsHigh; -} - -/*! - Unhilights object -*/ -GLboolean GLViewer_TextObject::unhighlight() -{ - if( myIsHigh ) - { - myIsHigh = GL_FALSE; - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - Selects text object - /param x, y - co-ordinates of mouse - /param tol - tolerance - /param rect - rectangle (in case of rectangular selection) - /param isFull - if it is true, then object may selected only if it lays whole in selection zone - \param isCircle - true if sensitive area of detection is round - \param isShift - true if selection exec with append option -*/ -GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTol, GLViewer_Rect rect, - GLboolean isFull, GLboolean isCircle, GLboolean isShift ) -{ - if( !myIsVisible ) - return false; - - QRegion obj( myRect->toQRect() ); - QRegion intersection; - QRect region; - - region.setLeft( (int)(theX - theTol) ); - region.setRight( (int)(theX + theTol) ); - region.setTop( (int)(theY - theTol) ); - region.setBottom( (int)(theY + theTol) ); - - QRegion circle( (int)(theX - theTol), (int)(theY - theTol), - (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse ); - if( isCircle ) - intersection = obj.intersect( circle ); - else - intersection = obj.intersect( region ); - - if( intersection.isEmpty() ) - myIsSel = false; - else - myIsSel = true; - - if ( myIsSel ) - { - myHighFlag = GL_FALSE; - myIsHigh = GL_FALSE; - } - else - myHighFlag = GL_TRUE; - - return myIsSel; -} - -/*! - Unselects text object -*/ -GLboolean GLViewer_TextObject::unselect() -{ - if( myIsSel ) - { - myIsSel = GL_FALSE; - return GL_TRUE; - } - - return GL_FALSE; -} - -/*! - Moves object by recomputing - \param dx - moving along X coord - \param dy - moving along Y coord - \param fromGroup - is true if this method called from group -*/ -void GLViewer_TextObject::moveObject( float theX, float theY, bool fromGroup ) -{ - if( !fromGroup && myGroup) - { - myGroup->dragingObjects( theX, theY ); - return; - } - float aX, anY; - myGLText->getPosition( aX, anY ); - aX += theX; - anY += theY; - myGLText->setPosition( aX, anY ); - compute(); -} - -/*! - Codes text object as byte copy - \return byte array -*/ -QByteArray GLViewer_TextObject::getByteCopy() -{ - QByteArray aObject = GLViewer_Object::getByteCopy(); - - return aObject; -} - -/*! - Initialize text object by byte array - \param theArray - byte array -*/ -bool GLViewer_TextObject::initializeFromByteCopy( QByteArray theArray ) -{ - if( !GLViewer_Object::initializeFromByteCopy( theArray ) || myType != "GLViewer_TextObject" ) - return false; - - myHighFlag = true; - return true; -} diff --git a/src/GLViewer/GLViewer_BaseObjects.h b/src/GLViewer/GLViewer_BaseObjects.h deleted file mode 100644 index c0f45d328..000000000 --- a/src/GLViewer/GLViewer_BaseObjects.h +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_BaseObjects.h -// Created: November, 2004 - -#ifndef GLVIEWER_BASEOBJECTS_H -#define GLVIEWER_BASEOBJECTS_H - -#include "GLViewer.h" -#include "GLViewer_Object.h" - -#include -#include - -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_MarkerSet - OpenGL MarkerSet -*/ -class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object -{ -public: - //! A constructor - GLViewer_MarkerSet( int number = 1, float size = 5.0, const QString& toolTip = "GLMarker" ); - //! A destructor - ~GLViewer_MarkerSet(); - - // redefined methods - virtual void compute(); - virtual GLViewer_Drawer* createDrawer(); - - virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE ); - virtual GLboolean unhighlight(); - virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE, - GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE ); - virtual GLboolean unselect(); - - virtual GLViewer_Rect* getUpdateRect(); - - virtual void moveObject( float, float, bool fromGroup = false ); - - virtual QByteArray getByteCopy(); - virtual bool initializeFromByteCopy( QByteArray ); - - virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ); - virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ); - -#ifdef WIN32 - virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ); -#endif - - //! Sets array of x coords of markers - void setXCoord( GLfloat* xCoord, int size ); - //! Sets array of y coords of markers - void setYCoord( GLfloat* yCoord, int size ); - //! Returns x coords - GLfloat* getXCoord() const { return myXCoord; } - //! Returns y coords - GLfloat* getYCoord() const { return myYCoord; } - - //! Sets markers number - void setNumMarkers( GLint ); - //! returns markers number - GLint getNumMarkers() const { return myNumber; }; - //! Sets merker radius - void setMarkerSize( const float size ) { myMarkerSize = size; } - //! Returns merker radius - float getMarkerSize() const { return myMarkerSize; } - - //! Export numbers of heghlighted/selected markers - void exportNumbers( QValueList& high, QValueList& unhigh, - QValueList& sel, QValueList& unsel ); - - //! Returns selected numbers - QValueList getSelectedElements() { return mySelNumbers; } - //! Adds or remove selected number - bool addOrRemoveSelected( int index ); - //! Adds selected numbers - void addSelected( const TColStd_SequenceOfInteger& ); - //! Sets selected nembers - void setSelected( const TColStd_SequenceOfInteger& ); - -protected: - GLint myNumber; - GLfloat* myXCoord; - GLfloat* myYCoord; - GLfloat myMarkerSize; - QValueList myHNumbers; - QValueList myUHNumbers; - QValueList mySelNumbers; - QValueList myCurSelNumbers; - QValueList myUSelNumbers; - QValueList myPrevHNumbers; - TColStd_SequenceOfInteger mySelectedIndexes; -}; - -/*! - \class GLViewer_Polyline - OpenGL Polyline -*/ -class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object -{ -public: - GLViewer_Polyline( int number = 1, float size = 5.0, const QString& toolTip = "GLPolyline" ); - ~GLViewer_Polyline(); - - // redefined methods - virtual void compute(); - virtual GLViewer_Drawer* createDrawer(); - - virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol = 15.0, GLboolean isCircle = GL_FALSE ); - virtual GLboolean unhighlight(); - virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE, - GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE ); - virtual GLboolean unselect(); - - virtual GLViewer_Rect* getUpdateRect(); - - virtual void moveObject( float, float, bool fromGroup = false ); - - virtual QByteArray getByteCopy(); - virtual bool initializeFromByteCopy( QByteArray ); - - virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ); - virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ); - -#ifdef WIN32 - virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ); -#endif - - //! Sets array of x coords of points - void setXCoord( GLfloat* xCoord, int size ); - //! Sets array of y coords of points - void setYCoord( GLfloat* yCoord, int size ); - //! Returns x coords - GLfloat* getXCoord() const { return myXCoord; } - //! Returns y coords - GLfloat* getYCoord() const { return myYCoord; } - - //! SetS number of points - void setNumber( GLint ); - //! Returns number of points - GLint getNumber() const { return myNumber; }; - - //! On/off closed status of polyline - void setClosed( GLboolean closed ) { myIsClosed = closed; } - //! Checks closed status of polyline - GLboolean isClosed() const { return myIsClosed; } - - //! On/off highlight as whole object status - void setHighSelAll( GLboolean highSelAll ) { myHighSelAll = highSelAll; } - //! Checks highlight as whole object status - GLboolean isHighSelAll() const { return myHighSelAll; } - - //! Export numbers of highlighted/selected lines - void exportNumbers( QValueList& high, QValueList& unhigh, - QValueList& sel, QValueList& unsel ); - - //! Returns numbers of selected lines - QValueList getSelectedElements() { return mySelNumbers; } - -protected: - GLfloat* myXCoord; - GLfloat* myYCoord; - GLint myNumber; - GLboolean myIsClosed; - GLboolean myHighSelAll; - - QValueList myHNumbers; - QValueList myUHNumbers; - QValueList mySelNumbers; - QValueList myUSelNumbers; - QValueList myCurSelNumbers; - QValueList myPrevHNumbers; - TColStd_SequenceOfInteger mySelectedIndexes; - - GLboolean myHighFlag; -}; - -/*! - \class GLViewer_TextObject - Text as Object for OpenGL -*/ -class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object -{ -public: - GLViewer_TextObject( const QString&, float xPos = 0, float yPos = 0, - const QColor& color = QColor( 0, 255, 0 ), const QString& toolTip = "GLText" ); - ~GLViewer_TextObject(); - - virtual void compute(); - virtual GLViewer_Drawer* createDrawer(); - - virtual void setDrawer( GLViewer_Drawer* theDrawer ); - - virtual GLboolean highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle = GL_FALSE ); - virtual GLboolean unhighlight(); - virtual GLboolean select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull = GL_FALSE, - GLboolean isCircle = GL_FALSE, GLboolean isShift = GL_FALSE ); - virtual GLboolean unselect(); - - virtual GLViewer_Rect* getUpdateRect(); - - virtual void moveObject( float, float, bool fromGroup = false ); - - virtual QByteArray getByteCopy(); - virtual bool initializeFromByteCopy( QByteArray ); - - virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ); - virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ); - -#ifdef WIN32 - virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ); -#endif - - int getWidth(){ return myWidth; } - int getHeight(){ return myWidth; } - void setWidth( int w ){ myWidth=w; } - void setHeight( int h ){ myHeight=h; } - -protected: - bool myHighFlag; - int myWidth; - int myHeight; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Compass.cxx b/src/GLViewer/GLViewer_Compass.cxx deleted file mode 100644 index 00fae1c1f..000000000 --- a/src/GLViewer/GLViewer_Compass.cxx +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Compass.cxx -// Created: November, 2004 - -#include "GLViewer_Compass.h" -#include "GLViewer_Drawer.h" - -/*! - Constructor - \param color - a color of compass - \param size - a diameter of compass - \param pos - a position - \param WidthTop - width of wide part of arrow - \param WidthBottom - width of base part of arrow - \param HeightTop - height of arrow header - \param HeightBottom - height of arrow cut on bottom -*/ -GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos, - const int WidthTop, const int WidthBottom, const int HeightTop, - const int HeightBottom ) -{ - myCol = color; - mySize = size; - myPos = pos; - myArrowWidthTop = WidthTop; - myArrowWidthBottom = WidthBottom; - myArrowHeightTop = HeightTop; - myArrowHeightBottom = HeightBottom; - myIsVisible = true; - QFont* aFont = new QFont("Times",16); - myFont = new GLViewer_TexFont( aFont ); - isGenereted = false; - //myFont->generateTexture(); -} - -/*! - Destructor -*/ -GLViewer_Compass::~GLViewer_Compass() -{ - delete myFont; -} - -/*! - Sets parameters of compass - \param color - a color of compass - \param size - a diameter of compass - \param pos - a position -*/ -void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos ) -{ - myCol = color; - mySize = size; - myPos = pos; -} - -/*! - Sets visibility of compass - \param vis - new visibility state -*/ -void GLViewer_Compass::setVisible( const bool vis ) -{ - myIsVisible = vis; -} - -/*! - Sets size of compass - \param size - new size -*/ -void GLViewer_Compass::setSize( const int size ) -{ - if( size > 0 ) - mySize=size; -} - -/*! - Sets arrow width top - \param WidthTop - new arrow width top -*/ -void GLViewer_Compass::setArrowWidthTop( const int WidthTop ) -{ - if( WidthTop < myArrowWidthBottom || WidthTop > mySize ) - return; - myArrowWidthTop=WidthTop; -} - -/*! - Sets arrow width bottom - \param WidthBot - new arrow width bottom -*/ -void GLViewer_Compass::setArrowWidthBottom( const int WidthBot ) -{ - if( WidthBot > myArrowWidthTop || WidthBot < 1 ) - return; - myArrowWidthBottom=WidthBot; -} - -/*! - Sets arrow height top - \param HeightTop - new arrow height top -*/ -void GLViewer_Compass::setArrowHeightTop( const int HeightTop ) -{ - if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 ) - return; - myArrowHeightTop=HeightTop; -} - -/*! - Sets arrow height bottom - \param HeightBot - new arrow height bottom -*/ -void GLViewer_Compass::setArrowHeightBottom( const int HeightBot ) -{ - if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1) - return; - myArrowHeightBottom=HeightBot; -} - -/*! - \return font of compass -*/ -GLViewer_TexFont* GLViewer_Compass::getFont() -{ - if(!isGenereted) - { - myFont->generateTexture(); - isGenereted = true; - } - return myFont; -} - -/*! - Sets font of compass - \param theFont - new font -*/ -void GLViewer_Compass::setFont( QFont theFont ) -{ - delete myFont; - myFont = new GLViewer_TexFont( &theFont ); -} diff --git a/src/GLViewer/GLViewer_Compass.h b/src/GLViewer/GLViewer_Compass.h deleted file mode 100644 index 62dd4f257..000000000 --- a/src/GLViewer/GLViewer_Compass.h +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Compass.h -// Created: November, 2004 - -#ifndef GLVIEWER_COMPASS_H -#define GLVIEWER_COMPASS_H - -#include "GLViewer.h" - -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -class GLViewer_TexFont; - -/*! Class GLViewer_Compass - * Class implement representatiof of compass in one of corner in GLViewer. - * Compass it's a some round visual pointer rotated with view window and - * located in fixed place (in one fixed corner) - */ -class GLVIEWER_API GLViewer_Compass -{ -public: - //! Position of compass - enum Position - { - TopLeft, - TopRight, - BottomLeft, - BottomRight - }; - - //! A constructor - /*! - *\param color - a color of compass - *\param size - a diameter of compass - *\param pos - a position - *\param WidthTop - width of wide part of arrow - *\param WidthBottom - width of base part of arrow - *\param HeightTop - height of arrow header - *\param HeightBottom - height of arrow cut on bottom - */ - GLViewer_Compass( const QColor& color = QColor ( 0, 255, 0 ), - const int size = 60, - const Position pos = TopRight, - const int WidthTop = 20, - const int WidthBottom = 10, - const int HeightTop = 25, - const int HeightBottom = 7 ); - //! A destructor - ~GLViewer_Compass(); - - //! A function installing main parameters of compass - void setCompass( const QColor& color, const int size, const Position pos ); - //! A function installing a visible status - void setVisible( const bool vis = true ); - //! Returns visible status - bool getVisible(){ return myIsVisible; }; - - //! A function installing diameter - void setSize( const int size ); - //! Returns diameter - int getSize(){ return mySize; } - - //! A function installing position - void setPos( const Position pos ){ myPos = pos; } - //! Returns position - int getPos(){ return myPos; } - - //! A function installing color - void setColor( const QColor& color ){ myCol = color; } - //! Returns color - QColor getColor(){ return myCol; } - - //! A function installing width of wide part of arrow - void setArrowWidthTop( const int WidthTop ); - //! Returns width of wide part of arrow - int getArrowWidthTop(){ return myArrowWidthTop; } - - //! A function installing width of base part of arrow - void setArrowWidthBottom( const int WidthBot ); - //! Returns width of base part of arrow - int getArrowWidthBottom(){return myArrowWidthBottom;}; - - //! A function installing height of arrow header - void setArrowHeightTop( const int HeightTop ); - //! Returns height of arrow header - int getArrowHeightTop(){return myArrowHeightTop;}; - - //! A function installing height of arrow cut on bottom - void setArrowHeightBottom( const int HeightBot ); - //! Returns height of arrow cut on bottom - int getArrowHeightBottom(){return myArrowHeightBottom;}; - - //! A function installing - void setFont( QFont theFont ); - //! Returns - GLViewer_TexFont* getFont(); - -protected: - //! Compass color - QColor myCol; - //! Compass diameter - int mySize; - //! Compass position - int myPos; - //! Compass invisible status - bool myIsVisible; - //! Width of wide part of arrow - int myArrowWidthTop; - //! Width of base part of arrow - int myArrowWidthBottom; - //! Height of arrow header - int myArrowHeightTop; - //! Height of arrow cut on bottom - int myArrowHeightBottom; - //! Compass font - GLViewer_TexFont* myFont; - //! Status of generated font - bool isGenereted; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Context.cxx b/src/GLViewer/GLViewer_Context.cxx deleted file mode 100644 index 0383b0325..000000000 --- a/src/GLViewer/GLViewer_Context.cxx +++ /dev/null @@ -1,710 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Context.cxx -// Created: November, 2004 - -/*! - \class GLViewer_AspectLine - \brief Class for manage of presentations in GLViewer -*/ - -#include "GLViewer_Context.h" - -#include "GLViewer_Group.h" -#include "GLViewer_Object.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_ViewPort2d.h" - -#include - -#define TOLERANCE 12 - -/*! - Constructor -*/ -GLViewer_Context::GLViewer_Context( GLViewer_Viewer2d* v ) : - myGLViewer2d( v ), - myHighlightColor( Quantity_NOC_CYAN1 ), - mySelectionColor( Quantity_NOC_RED ), - myTolerance( TOLERANCE ) -{ - myUpdateAll = true; - - myLastPicked = 0; - myLastPickedChanged = false; - - myHFlag = GL_TRUE; - mySFlag = GL_TRUE; - - mySelCurIndex = 0; -} - -/*! - Destructor -*/ -GLViewer_Context::~GLViewer_Context() -{ - myActiveObjects.clear(); - myInactiveObjects.clear(); - mySelectedObjects.clear(); -} - -/*! - Hiilights objects under cursor - \param x - X coord of mouse cursor - \param y - Y coord of mouse cursor - \param byCircle - true if needs round sensitive area around mouse cursor, else rectangle - function search object rectangle which intersect with sensitive area and call object highlight method -*/ -int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle ) -{ - GLfloat x = (GLfloat)xi; - GLfloat y = (GLfloat)yi; - myGLViewer2d->transPoint( x, y ); - - myXhigh = x; - myYhigh = y; - - GLboolean isHigh = GL_FALSE; - GLboolean onObject = GL_FALSE; - - GLViewer_Object* aPrevLastPicked = myLastPicked; - GLViewer_Object* lastPicked = 0; - - ObjList anUpdatedObjects; - - if( myActiveObjects.isEmpty() ) - return -1; - - ObjList::iterator it = myActiveObjects.end(); - ObjList::iterator itEnd = myActiveObjects.begin(); - for( it--; ; --it ) - { - GLViewer_Object* object = *it; - - GLViewer_Rect* rect = object->getUpdateRect(); - if( rect->contains( GLViewer_Pnt( x, y ) ) ) - { - onObject = GL_TRUE; - object->highlight( x, y, myTolerance, GL_FALSE ); - isHigh = object->isHighlighted(); - } - - if( isHigh ) - { - lastPicked = object; - break; - } - - if( it == itEnd ) - break; - } - - if( !myHFlag ) - { - myLastPicked = lastPicked; - return -1; - } - - if ( !onObject ) - { - //cout << 0 << endl; - it = myActiveObjects.begin(); - itEnd = myActiveObjects.end(); - - for( ; it != itEnd; ++it ) - (*it)->unhighlight(); - - anUpdatedObjects.append( (*it) ); - - myLastPicked = 0; - myLastPickedChanged = aPrevLastPicked != myLastPicked; - - if( myLastPickedChanged ) - myGLViewer2d->updateAll(); - - return 0; - } - - if( !myLastPicked && isHigh ) - { - //cout << 1 << endl; - myLastPicked = lastPicked; - anUpdatedObjects.append( myLastPicked ); - } - else if( myLastPicked && !isHigh ) - { - //cout << 2 << endl; - myLastPicked->unhighlight(); - anUpdatedObjects.append( myLastPicked ); - myLastPicked = 0; - } - else if( myLastPicked && isHigh ) - { - //cout << 3 << endl; - myLastPicked->highlight( x, y, myTolerance, byCircle ); - anUpdatedObjects.append( myLastPicked ); - if( myLastPicked != lastPicked ) - { - myLastPicked->unhighlight(); - myLastPicked = lastPicked; - anUpdatedObjects.append( myLastPicked ); - } - } - - myLastPickedChanged = ( aPrevLastPicked != myLastPicked ); - - if( myLastPickedChanged || myUpdateAll ) - myGLViewer2d->updateAll(); - else - myGLViewer2d->activateDrawers( anUpdatedObjects, TRUE, TRUE ); - - return 0; -} - -/*! Selects already highlighting object by calling object method select - \param Append - true if new selection will be append to existing selection, false - another - \param byCircle - true if needs round selection area in complex object -*/ -int GLViewer_Context::Select( bool Append, bool byCircle ) -{ - ObjList::Iterator it, itEnd, oit, oitEnd; - SelectionStatus status = SS_Invalid; - - bool updateAll = false; - - ObjList aList; - - if ( !mySFlag ) - return status;//invalid - - if( myHFlag && myLastPicked ) - { - if( mySelectedObjects.count() == 1 && mySelectedObjects.first() == myLastPicked ) - status = SS_LocalChanged; - - if ( !Append ) - { - for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it ) - if( myLastPicked != *it ) - { - updateAll = (*it)->unselect() || updateAll; - aList.append( *it ); - } - - if( updateAll || myUpdateAll ) - myGLViewer2d->updateAll(); - else - myGLViewer2d->activateDrawers( aList, TRUE, TRUE ); - - if( mySelectedObjects.count() != 0 && status == SS_Invalid ) - status = SS_GlobalChanged; - mySelectedObjects.clear(); - } - else if( myLastPicked->isSelected() && status != SS_LocalChanged ) - { - mySelectedObjects.remove( myLastPicked ); - myLastPicked->unselect(); - myGLViewer2d->updateAll(); - - if( mySelectedObjects.count() != 0 && status == SS_Invalid ) - status = SS_GlobalChanged; - - return status; - } - - if ( myLastPicked->select( myXhigh, myYhigh, myTolerance, GLViewer_Rect(), false, byCircle, Append ) - && mySelectedObjects.findIndex( myLastPicked ) == -1 ) - { - mySelectedObjects.append( myLastPicked ); - myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE ); - - if( status == SS_Invalid ) - status = SS_GlobalChanged; - } - else if( status == SS_LocalChanged ) - status = SS_GlobalChanged; - - return status; - } - - if( myHFlag && !myLastPicked ) - { - if ( !Append ) - { - for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it ) - if ( myLastPicked != *it ) - { - updateAll = (*it)->unselect() || updateAll; - aList.append( *it ); - } - - if( updateAll || myUpdateAll ) - myGLViewer2d->updateAll(); - else - myGLViewer2d->activateDrawers( aList, TRUE, TRUE ); - - if( mySelectedObjects.count() != 0 ) - status = SS_GlobalChanged; - - mySelectedObjects.clear(); - } - return status; - } - - if( !myHFlag ) - { - bool isSel = false; - GLfloat aXScale; - GLfloat aYScale; - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )myGLViewer2d->getActiveView()->getViewPort(); - vp->getScale( aXScale, aYScale ); - - if ( !Append ) - { - for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end() ; it != itEnd; ++it ) - if( myLastPicked != *it ) - { - updateAll = (*it)->unselect() || updateAll; - aList.append( *it ); - } - - if( updateAll || myUpdateAll ) - myGLViewer2d->updateAll(); - else - myGLViewer2d->activateDrawers( aList, TRUE, TRUE ); - - if( mySelectedObjects.count() != 0 ) - status = SS_GlobalChanged; - - mySelectedObjects.clear(); - } - - for( oit = myActiveObjects.begin(), oitEnd = myActiveObjects.end(); oit != oitEnd; ++oit ) - { - (*oit)->setScale( aXScale, aYScale ); - GLViewer_Rect* rect = (*oit)->getUpdateRect(); - - if( rect->contains( GLViewer_Pnt( myXhigh, myXhigh ) ) ) - { - (*oit)->select( myXhigh, myYhigh, myTolerance, GLViewer_Rect(), false, byCircle, Append ); - isSel = (*oit)->isSelected(); - } - if( isSel ) - { - myLastPicked = *oit; - mySelectedObjects.append( myLastPicked ); - myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE ); - status = SS_GlobalChanged; - return status; - } - } - } - - return SS_NoChanged; -} - -/*! Selects objects on scene by rectangle - \param theRect - rectangle of selection - \param Append - true if new selection will be append to existing selection, false - another - function search object rectangle which intersect with theRect and call object select method -*/ -int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append ) -{ - GLfloat aXScale; - GLfloat aYScale; - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )myGLViewer2d->getActiveView()->getViewPort(); - vp->getScale( aXScale, aYScale ); - - SelectionStatus status = SS_NoChanged; - - ObjList aList; - ObjList::Iterator it, itEnd; - - if ( !mySFlag || myActiveObjects.empty() ) - return SS_Invalid; - - bool updateAll = false; - if( !Append ) - { - if( mySelectedObjects.count() != 0 ) - status = SS_GlobalChanged; - - for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end(); it != itEnd; ++it ) - { - updateAll = (*it)->unselect() || updateAll; - aList.append( *it ); - } - mySelectedObjects.clear(); - } - - for( it = myActiveObjects.begin(), itEnd = myActiveObjects.end(); it != itEnd; ++it ) - { - bool isSel = false; - (*it)->setScale( aXScale, aYScale ); - QRect rect = myGLViewer2d->getQRect( *( (*it)->getRect() ) ); - - if( rect.intersects( theRect ) ) - { - GLViewer_Rect aRect = myGLViewer2d->getGLVRect( theRect ); - (*it)->select( myXhigh, myYhigh, myTolerance, aRect, false, false, Append ); - isSel = (*it)->isSelected(); - } - - if( isSel && mySelectedObjects.findIndex( *it ) == -1 ) - { - aList.append( *it ); - mySelectedObjects.append( *it ); - status = SS_GlobalChanged; - } - } - - if( updateAll || myUpdateAll ) - myGLViewer2d->updateAll(); - else - myGLViewer2d->activateDrawers( aList, TRUE, TRUE ); - - return status; -} - -/*! - Sets color of hilighting - \param aCol - new color of highlighting -*/ -void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol ) -{ - myHighlightColor = aCol; - - Quantity_Color colorH( aCol ); - int redH = 255 * (int)colorH.Red(); - int greenH = 255 * (int)colorH.Green(); - int blueH = 255 * (int)colorH.Blue(); - QColor colH = QColor( redH, greenH, blueH ); - - Quantity_Color colorS( mySelectionColor ); - int redS = 255 * (int)colorS.Red(); - int greenS = 255 * (int)colorS.Green(); - int blueS = 255 * (int)colorS.Blue(); - QColor colS = QColor( redS, greenS, blueS ); - - myGLViewer2d->updateColors( colH, colS); -} - -/*! - Sets color of selection - \param aCol - new color of selection -*/ -void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol ) -{ - mySelectionColor = aCol; - - Quantity_Color colorH( myHighlightColor ); - int redH = 255 * (int)colorH.Red(); - int greenH = 255 * (int)colorH.Green(); - int blueH = 255 * (int)colorH.Blue(); - QColor colH = QColor( redH, greenH, blueH ); - - Quantity_Color colorS( aCol ); - int redS = 255 * (int)colorS.Red(); - int greenS = 255 * (int)colorS.Green(); - int blueS = 255 * (int)colorS.Blue(); - QColor colS = QColor( redS, greenS, blueS ); - - myGLViewer2d->updateColors( colH, colS); -} - -/*! - \return number of selected objects -*/ -int GLViewer_Context::NbSelected() -{ - return mySelectedObjects.count(); -} - -/*! - Inits iteration through selected objects -*/ -void GLViewer_Context::InitSelected() -{ - mySelCurIndex = 0; -} - -/*! - Checks if iteration through selected objects may be continued -*/ -bool GLViewer_Context::MoreSelected() -{ - return ( mySelCurIndex < NbSelected() ); -} - -/*! - Iterates to next selected object -*/ -bool GLViewer_Context::NextSelected() -{ - if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() ) - { - mySelCurIndex++; - return TRUE; - } - - return FALSE; -} - -/*! - \return current selected object (must be used only in cycle as "for( InitSelected(); MoreSelected(); NextSelected() ) {...}" ) -*/ -GLViewer_Object* GLViewer_Context::SelectedObject() -{ - return mySelectedObjects[ mySelCurIndex ]; -} - -/*! - \return true if object is selected - \param theObj - object to be checked -*/ -bool GLViewer_Context::isSelected( GLViewer_Object* theObj ) -{ - return mySelectedObjects.contains( theObj ); -} - -/*! Inserts new object in context - \param theObject - object to be inserted - \param display - true if needs display object immediatly after inserting, else false - \param isActive - true if needs inserting object in active list -*/ -int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive ) -{ -// cout << "GLViewer_Context::insertObject" << endl; - - if( !object ) - return -1; - - if( isActive ) - { - myActiveObjects.append( object ); - if( display ) - { - //QRect* rect = object->getRect()->toQRect(); - //myGLViewer2d->updateBorders( *rect ); - myGLViewer2d->activateDrawer( object, FALSE ); - } - } - else - myInactiveObjects.append( object ); - - return myActiveObjects.count() + myInactiveObjects.count(); -} - -/*! - Replaces object in context - \param oldObject - object to be replaced - \param newObject - object for replacing -*/ -bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject ) -{ - if( !oldObject || !newObject ) - return false; - - if( myActiveObjects.contains( oldObject ) ) - { - myActiveObjects.remove( oldObject ); - myActiveObjects.append( newObject ); - return true; - } - - if( myInactiveObjects.contains( oldObject ) ) - { - myInactiveObjects.remove( oldObject ); - myInactiveObjects.append( newObject ); - return true; - } - - return false; -} - -/*! - Updates scales of all objects in context -*/ -void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY ) -{ - if( scX <= 0 || scY <= 0 ) - return; - - ObjList::iterator it, itEnd; - - for( it = myActiveObjects.begin(), itEnd = myActiveObjects.end(); it != itEnd; ++it ) - (*it)->setScale( scX, scY ); - - for( it = myInactiveObjects.begin(), itEnd = myInactiveObjects.end(); it != itEnd; ++it ) - (*it)->setScale( scX, scY ); -} - -/*! - Clears hilighting of objects - \param updateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::clearHighlighted( bool updateViewer ) -{ - if( myHFlag && myLastPicked ) - { - myLastPicked->unhighlight(); - myLastPicked = 0; - - if( updateViewer ) - myGLViewer2d->updateAll(); - } -} - -/*! - Clears selection of objects - \param updateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::clearSelected( bool updateViewer ) -{ - if( !mySFlag ) - return; - - ObjList::Iterator it, itEnd; - ObjList aList; - - for( it = mySelectedObjects.begin(), itEnd = mySelectedObjects.end(); it != itEnd; ++it ) - { - (*it)->unselect(); - aList.append( *it ); - } - - if( updateViewer ) - myGLViewer2d->activateDrawers( aList, TRUE ); - mySelectedObjects.clear(); -} - -/*! - Selects object, other selected objects are left as selected - \param updateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer ) -{ - if( !object ) - return; - - if( myActiveObjects.contains( object ) && !mySelectedObjects.contains( object ) ) - { - object->setSelected( TRUE ); - mySelectedObjects.append( object ); - } - - if( updateViewer ) - myGLViewer2d->activateDrawer( object, TRUE, TRUE ); -} - -/*! - Unselects object, other selected objects are left as selected - \param updateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer ) -{ - if( !object || !mySelectedObjects.contains( object ) ) - return; - - mySelectedObjects.remove( object ); - object->unselect(); - - if( updateViewer ) - myGLViewer2d->activateDrawer( object, TRUE, TRUE ); -} - -/*! - Erases object in viewer - \param theUpdateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer ) -{ - if( !theObject || !myActiveObjects.contains( theObject ) ) - return; - - theObject->unhighlight(); - theObject->unselect(); - theObject->setVisible( false ); - - if( theUpdateViewer ) - myGLViewer2d->updateAll(); -} - -/*! - Deletes object in - \param updateViewer - if it is true, viewer must be updated -*/ -void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer ) -{ - if( !theObject || - ( !myActiveObjects.contains( theObject ) && !myInactiveObjects.contains( theObject ) ) ) - return; - - if( myActiveObjects.contains( theObject ) ) - myActiveObjects.remove( theObject ); - else if( myInactiveObjects.contains( theObject ) ) - myInactiveObjects.remove( theObject ); - else - return; - - if( mySelectedObjects.contains( theObject ) ) - mySelectedObjects.remove( theObject ); - - GLViewer_Group* aGroup = theObject->getGroup(); - if( aGroup ) - aGroup->removeObject( theObject ); - - if( myLastPicked == theObject ) - myLastPicked = 0; - - if ( updateViewer ) - myGLViewer2d->updateAll(); -} - -/*! - Installs active status to object - \param theObject -*/ -bool GLViewer_Context::setActive( GLViewer_Object* theObject ) -{ - if( !theObject || !myInactiveObjects.contains( theObject ) ) - return false; - - myInactiveObjects.remove( theObject ); - myActiveObjects.append( theObject ); - return true; -} - -/*! - Installs inactive status to object - \param theObject -*/ -bool GLViewer_Context::setInactive( GLViewer_Object* theObject ) -{ - if( !theObject || !myActiveObjects.contains( theObject ) ) - return false; - - myActiveObjects.remove( theObject ); - myInactiveObjects.append( theObject ); - return true; -} diff --git a/src/GLViewer/GLViewer_Context.h b/src/GLViewer/GLViewer_Context.h deleted file mode 100644 index 5a9df2ceb..000000000 --- a/src/GLViewer/GLViewer_Context.h +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Context.h -// Created: November, 2004 - - -#ifndef GLVIEWER_CONTEXT_H -#define GLVIEWER_CONTEXT_H - -#ifdef WNT -#include "windows.h" -#endif - -#include "GLViewer_Defs.h" -#include "GLViewer_Object.h" - -#include -#include -#include - -#include -#include - -#include - -class GLViewer_Viewer2d; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! \class GLViewer_Context - * Class for manage of presentations in GLViewer - */ -class GLVIEWER_API GLViewer_Context -{ -public: - //! A constructor - GLViewer_Context( GLViewer_Viewer2d* ); - //! A desructor - ~GLViewer_Context(); - - //! A function installing update flag in highlighting technology - void setUpdateAll( bool on ) { myUpdateAll = on; } - //! Returns update flag in highlighting technology - bool isUpdateAll() const { return myUpdateAll; } - - //! Main interactive method. Trace mouse in viewer window - /*! - *\param x - X coord of mouse cursor - *\param y - Y coord of mouse cursor - *\paran byCircle - true if needs round sensitive area around mouse cursor, else rectangle - *function search object rectangle which intersect with sensitive area and call object highlight method - */ - int MoveTo( int x, int y, bool byCircle = FALSE ); - /*! A function selecting already highlighting object by calling object method select - *\param Append - true if new selection will be append to existing selection, false - another - *\param byCircle - true if needs round selection area in complex object - */ - int Select( bool Append = FALSE, bool byCircle = FALSE ); - /*! A function selecting objects on scene by rectangle - *\param theRect - rectangle of selection - *\param Append - true if new selection will be append to existing selection, false - another - *function search object rectangle which intersect with theRect and call object select method - */ - int SelectByRect( const QRect& theRect, bool Append = FALSE ); - - //! A function installing highlight color for all presentation (does not work) - void SetHighlightColor( Quantity_NameOfColor aCol ); - //! A function installing select color for all presentation (does not work) - void SetSelectionColor( Quantity_NameOfColor aCol ); - //! Returns highlight color - Quantity_NameOfColor HighlightColor() { return myHighlightColor; } - //! Returns select color - Quantity_NameOfColor SelectionColor() { return mySelectionColor; } - - //! Returns number of objects in current selection - int NbSelected(); - //! A function set iterator of selected objects on first object - void InitSelected(); - //! Retuns true if iterator of selected objects is not set on last object - bool MoreSelected(); - //! Increment of iterator of selected objects - bool NextSelected(); - //! Returns object corresponding the current iterator of selected objects - GLViewer_Object* SelectedObject(); - - //! Returns true if theObject is selected - bool isSelected( GLViewer_Object* theObject ); - - //! Insert new object in context - /*! - *\param theObject - inserting object - *\param display - true if needs display object immediatly after inserting, else false - *\param isActive - true if needs inserting object in active list - */ - int insertObject( GLViewer_Object* theObject, bool display = false, bool isActive = true ); - //! Replacing objects in context - /*! - * Function search active and incative objects - */ - bool replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject ); - //! A function updating scales of all objects in context - void updateScales( GLfloat theX, GLfloat theY ); - //! A function installing tolerance in window pixels for highlghting and selection methods - void setTolerance( int tol ) { myTolerance = tol; } - - //! Returns list of context objects - /*! - * \return active objects if isActive = true, else inactive objects - */ - const ObjList& getObjects( bool isActive = true ) - { return isActive ? myActiveObjects : myInactiveObjects; } - - //! Returns first active object - GLViewer_Object* getFirstObject() { return *( myActiveObjects.begin() ); } - - //! A function clear highlighted object information - void clearHighlighted( bool updateViewer ); - //! A function clear selection object information - void clearSelected( bool updateViewer ); - //! A function make theObject as selected object and update viewer if updateViewer = true - void setSelected( GLViewer_Object* theObject, bool updateViewer ); - //! A function make theObject as unselected object and update viewer if updateViewer = true - void remSelected( GLViewer_Object* theObject, bool updateViewer ); - - //! Returns highlighted object - GLViewer_Object* getCurrentObject() { return myLastPicked; } - //! Returns true if after last MoveTo method calling highlight object is changed - bool currentObjectIsChanged() { return myLastPickedChanged; } - - //! A function installing to theObject invisible status and update viewer if updateViewer = true - void eraseObject( GLViewer_Object* theObject, bool updateViewer = true ); - //! A function remove theObject from context and update viewer if updateViewer = true - void deleteObject( GLViewer_Object* theObject, bool updateViewer = true ); - - //! A function installing to theObject active status - bool setActive( GLViewer_Object* theObject ); - //! A function installing to theObject inactive status - bool setInactive( GLViewer_Object* theObject ); - -protected: - //! Flag of updating viewer after highlight - /*! - * if = true, the viewer update all objects after change of highlight object, - * else - only highlight object - */ - bool myUpdateAll; - - GLViewer_Viewer2d* myGLViewer2d; - //! Highlighted object - GLViewer_Object* myLastPicked; - //! = true if after last MoveTo method calling highlight object is changed - bool myLastPickedChanged; - - //! List of active object - /*!Active objects if consider in highlight and select methods*/ - ObjList myActiveObjects; - //! List of inactive object - /*!Active objects isn't consider in highlight and select methods*/ - ObjList myInactiveObjects; - - //! List of selected objects - ObjList mySelectedObjects; - //! Selected object iterator - int mySelCurIndex; - - //! X coordinate of mouse cursor - GLfloat myXhigh; - //! Y coordinate of mouse cursor - GLfloat myYhigh; - - //! Color for highlight - Quantity_NameOfColor myHighlightColor; - //! Color for selection - Quantity_NameOfColor mySelectionColor; - //! If = false - moveTo method is not any highlighting - GLboolean myHFlag; - //! If = false - select method is not any select - GLboolean mySFlag; - //! Tolerance in window pixels for highlghting and selection methods - int myTolerance; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_CoordSystem.cxx b/src/GLViewer/GLViewer_CoordSystem.cxx deleted file mode 100644 index 3889bdfe5..000000000 --- a/src/GLViewer/GLViewer_CoordSystem.cxx +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Context.cxx -// Created: November, 2004 - -#include "GLViewer_CoordSystem.h" -#include - -/*! - Constructor - \param aType - type of CS - \param X0 - X of origin in reference CS - \param Y0 - Y of origin in reference CS - \param XUnit - X unit in reference CS - \param YUnit - Y unit in reference CS - \param Rotation - rotation relative reference CS -*/ -GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0, - double XUnit, double YUnit, double Rotation ) -{ - setType( aType ); - setOrigin( X0, Y0 ); - setUnits( XUnit, YUnit ); - setRotation( Rotation ); -} - -/*! - \return origin in reference CS -*/ -void GLViewer_CoordSystem::getOrigin( double& x, double& y ) const -{ - x = myX0; - y = myY0; -} - -/*! - Sets origin in reference CS -*/ -void GLViewer_CoordSystem::setOrigin( double x, double y ) -{ - myX0 = x; - myY0 = y; -} - -/*! - \return units -*/ -void GLViewer_CoordSystem::getUnits( double& x, double& y ) const -{ - x = myXUnit; - y = myYUnit; -} - -/*! - Sets units -*/ -void GLViewer_CoordSystem::setUnits( double x, double y ) -{ - if( x>0 ) - myXUnit = x; - else - myXUnit = 1.0; - - if( y>0 ) - myYUnit = y; - else - myYUnit = 1.0; -} - -/*! - \return rotation -*/ -double GLViewer_CoordSystem::getRotation() const -{ - return myRotation; -} - -/*! - Sets rotation -*/ -void GLViewer_CoordSystem::setRotation( double rotation ) -{ - myRotation = rotation; -} - -/*! - \return type -*/ -GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType() const -{ - return myType; -} - -/*! - Sets type -*/ -void GLViewer_CoordSystem::setType( CSType type ) -{ - myType = type; -} - -/*! - Recalculate co-ordinates to reference co-ordinates - \param x, y - co-ordinates -*/ -void GLViewer_CoordSystem::toReference( double& x, double& y ) -{ - if( myType==Cartesian ) - { - double newx = myX0 + myXUnit*x*cos(myRotation) - myYUnit*y*sin(myRotation), - newy = myY0 + myXUnit*x*sin(myRotation) + myYUnit*y*cos(myRotation); - x = newx; - y = newy; - } - else if( myType==Polar ) - { - double r = x, phi = y; - x = myX0 + myXUnit*r*cos(phi+myRotation); - y = myY0 + myXUnit*r*sin(phi+myRotation); - } -} - -/*! - Recalculate co-ordinates from reference co-ordinates - \param x, y - co-ordinates -*/ -void GLViewer_CoordSystem::fromReference( double& x, double& y ) -{ - x = (x - myX0) / myXUnit; - y = (y - myY0) / myYUnit; - - if( myType==Cartesian ) - { - double newx = x*cos(myRotation) + y*sin(myRotation), - newy = -x*sin(myRotation) + y*cos(myRotation); - x = newx; - y = newy; - } - else if( myType==Polar ) - { - double r = sqrt( x*x+y*y ); - double phi = 0.0; - double eps = 1E-8, pi = 3.14159265; - - if( r>eps ) - if( fabs(x)>eps ) - { - double arg = y/x; - phi = atan(arg); - if( x<0 ) // 2-nd or 4-rd quarter - phi+=pi; - } - else if( y>0 ) - phi = pi/2.0; - else - phi = 3*pi/2.0; - - x = r; - y = phi-myRotation; - } -} - -/*! - Recalculate co-ordinates to co-ordinates of other CS - \param aSystem - other CS - \param x, y - co-ordinates -*/ -void GLViewer_CoordSystem::transform( GLViewer_CoordSystem& aSystem, double& x, double& y ) -{ - toReference( x, y ); - aSystem.fromReference( x, y ); -} - -/*! - \return stretching of CS along X and Y axis -*/ -void GLViewer_CoordSystem::getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY ) -{ - theX = myXUnit / aSystem.myXUnit; - theY = myYUnit / aSystem.myYUnit; -} diff --git a/src/GLViewer/GLViewer_CoordSystem.h b/src/GLViewer/GLViewer_CoordSystem.h deleted file mode 100644 index 6db89583b..000000000 --- a/src/GLViewer/GLViewer_CoordSystem.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_CoordSystem.h -// Created: November, 2004 - -/*! Class GLViewer_CoordSystem - * Class implementing mathematical model of 2D coordinate system - */ - -#ifndef GLVIEWER_COORDSYSTEM_H -#define GLVIEWER_COORDSYSTEM_H - -#include "GLViewer.h" - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_CoordSystem - \brief Class implementing mathematical model of 2D coordinate system -*/ -class GLVIEWER_API GLViewer_CoordSystem -{ -public: - //! A type of coordinate system - enum CSType - { - Cartesian, - Polar - }; - -private: - //! The coordinates of origin in the reference CS - double myX0, myY0; - //! The lengths of axis units in the reference unit - double myXUnit, myYUnit; - //! The rotation in radians relative to reference CS - double myRotation; - - //! In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius - CSType myType; - -public: - //! A constructor ( by default new system is identical to reference ) - GLViewer_CoordSystem( CSType aType, double X0 = 0.0, double Y0 = 0.0, - double XUnit = 1.0, double YUnit = 1.0, double Rotation = 0.0 ); - - //! Returns the origin in reference system - void getOrigin( double& x, double& y ) const; - //! A function installing the origin in reference system - void setOrigin( double x, double y ); - - //! Returns units along axes - void getUnits( double& x, double& y ) const; - //! A function installing units along axes - void setUnits( double x, double y ); - - //! Returns rotation angle of axes in reference system - double getRotation() const; - //! A function installing rotation angle of axes in reference system - void setRotation( double rotation ); - - //! Returns type of system - CSType getType() const; - //! A function installing type of system - void setType( CSType type ); - - //! Transform the coordinates x, y from current CS to aSystem - void transform( GLViewer_CoordSystem& aSystem, double& x, double& y ); - - - //! Return how many times line width in aSystem system bigger than in current - virtual void getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY ); - - -protected: - //! A function transforms system coords to coords in reference system - virtual void toReference( double& x, double& y ); - //! A function transforms from coords in reference system to system coords - virtual void fromReference( double& x, double& y ); -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Defs.h b/src/GLViewer/GLViewer_Defs.h deleted file mode 100644 index 411fb4a7a..000000000 --- a/src/GLViewer/GLViewer_Defs.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Defs.h -// Created: March, 2005 - -#ifndef GLVIEWER_DEFS_H -#define GLVIEWER_DEFS_H - -#include -#include - -class GLViewer_Object; -//Selection staus -enum SelectionChangeStatus -{ - SCS_Invalid, - SCS_Local, - SCS_Global -}; - -//! Fit Selection Rectangle -static const int SELECTION_RECT_GAP = 50; - -//! Display Text Format of Objects -enum DisplayTextFormat -{ - DTF_TEXTURE = 0, - DTF_TEXTURE_SCALABLE = 1, - DTF_BITMAP = 2 -}; - -enum SelectionStatus -{ - SS_Invalid, - SS_LocalChanged, - SS_GlobalChanged, - SS_NoChanged -}; - -typedef QMap ObjectMap; -typedef QValueList ObjList; - -#define SEGMENTS 32 -#define PI 3.14159265359 -#define STEP ( float )( 2 * PI / SEGMENTS ) - -#endif// GLVIEWER_DEFS_H diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx deleted file mode 100644 index d0001a49c..000000000 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ /dev/null @@ -1,1187 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Drawer.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Drawer.h" -#include "GLViewer_Object.h" -#include "GLViewer_Text.h" -#include "GLViewer_ViewFrame.h" -#include "GLViewer_ViewPort2d.h" - -#ifndef WIN32 -#include -#endif - -#include - -#include -#include - -#define TEXT_GAP 5 -// Two texture components for texmapped fonts: luminance and alpha -#define NB_TEX_COMP 2 -// A font is split into rows each containing 32 characters -#define TEX_ROW_LEN 32 -// Gap in pixels between two character rows in a font texture -#define TEX_ROW_GAP 2 - -GLfloat modelMatrix[16]; - - -//! code of first font symbol -static int FirstSymbolNumber = 32; -//! code of last font symbol -static int LastSymbolNumber = 127; - -QMap GLViewer_TexFont::TexFontBase; -QMap GLViewer_TexFont::BitmapFontCache; - -/*! - Clears all generated fonts -*/ -void GLViewer_TexFont::clearTextBases() -{ - //cout << "Clear font map" << endl; - TexFontBase.clear(); - BitmapFontCache.clear(); -} - -/*! - Default constructor -*/ -GLViewer_TexFont::GLViewer_TexFont() -: myMaxRowWidth( 0 ), myFontHeight( 0 ) -{ - myQFont = QFont::defaultFont(); - mySeparator = 2; - myIsResizeable = false; - myMinMagFilter = GL_LINEAR; - - init(); -} - -/*! - Constructor - \param theFont - a base font - \param theSeparator - separator between letters - \param theIsResizeable - specifies whether text drawn by this object can be scaled along with the scene - \param theMinMagFilter - min/mag filter, affects text sharpness -*/ -GLViewer_TexFont::GLViewer_TexFont( QFont* theFont, int theSeparator, bool theIsResizeable, GLuint theMinMagFilter ) -: myMaxRowWidth( 0 ), myFontHeight( 0 ) -{ - myQFont = *theFont; - mySeparator = theSeparator; - myIsResizeable = theIsResizeable; - myMinMagFilter = theMinMagFilter; - - init(); -} - -/*! - Destructor -*/ -GLViewer_TexFont::~GLViewer_TexFont() -{ - delete[] myWidths; - delete[] myPositions; -} - -/*! - Initializes font parameters -*/ -void GLViewer_TexFont::init() -{ - myNbSymbols = LastSymbolNumber - FirstSymbolNumber + 1; - - // It is unsafe to draw all characters in a single row - - // this leads to problems on some graphic cards with small GL_MAX_TEXTURE_SIZE. - // So splitting the characters into rows each containing 32 characters (or less). - // Assuming contant height of each row (64 pixels) to simplify texture mapping. - // However, this can be improved if necessary. - QFontMetrics aFM( myQFont ); - myFontHeight = aFM.height(); - - myWidths = new int[myNbSymbols]; - myPositions = new int[myNbSymbols]; - - for( int i = 0, k = FirstSymbolNumber, aWidth = 0; i < myNbSymbols; i++, k++ ) - { - // is it time to start a new row? - if ( !( i % TEX_ROW_LEN ) ) - { - if( aWidth > myMaxRowWidth ) - myMaxRowWidth = aWidth; - aWidth = 0; - } - myWidths[i] = aFM.width( k ); - myPositions[i] = aWidth; - aWidth += myWidths[i] + 2; - } - - myTexFontWidth = 0; - myTexFontHeight = 0; -} - -/*! - Generating font texture -*/ -bool GLViewer_TexFont::generateTexture() -{ - GLViewer_TexFindId aFindFont; - aFindFont.myFontFamily = myQFont.family();//myQFont.toString(); - aFindFont.myIsBold = myQFont.bold(); - aFindFont.myIsItal = myQFont.italic(); - aFindFont.myIsUndl = myQFont.underline(); - aFindFont.myPointSize = myQFont.pointSize(); - aFindFont.myViewPortId = size_t(QGLContext::currentContext()); - - if( TexFontBase.contains( aFindFont ) ) - { - GLViewer_TexIdStored aTexture = TexFontBase[ aFindFont ]; - myTexFont = aTexture.myTexFontId; - myTexFontWidth = aTexture.myTexFontWidth; - myTexFontHeight = aTexture.myTexFontHeight; - } - else - { - // Adding some pixels to have a gap between rows - int aRowPixelHeight = myFontHeight + TEX_ROW_GAP; - int aDescent = QFontMetrics( myQFont ).descent(); - - int aNumRows = myNbSymbols / TEX_ROW_LEN; - if ( myNbSymbols % TEX_ROW_LEN ) - aNumRows++; - int pixelsHight = aNumRows * aRowPixelHeight; - - myTexFontWidth = 64; - myTexFontHeight = 64; - - while( myTexFontWidth < myMaxRowWidth ) - myTexFontWidth <<= 1; - while( myTexFontHeight < pixelsHight ) - myTexFontHeight <<= 1; - - // Checking whether the texture dimensions for the requested font - // do not exceed the maximum size supported by the OpenGL implementation - int maxSize; - glGetIntegerv( GL_MAX_TEXTURE_SIZE, &maxSize ); - if ( myTexFontWidth > maxSize || myTexFontHeight > maxSize ) - return false; - - QPixmap aPixmap( myTexFontWidth, myTexFontHeight ); - aPixmap.fill( QColor( 0, 0, 0) ); - QPainter aPainter( &aPixmap ); - aPainter.setFont( myQFont ); - int row; - for( int l = 0; l < myNbSymbols; l++ ) - { - row = l / TEX_ROW_LEN; - QString aLetter; - aLetter += (char)(FirstSymbolNumber + l); - aPainter.setPen( QColor( 255,255,255) ); - aPainter.drawText( myPositions[l], ( row + 1 ) * aRowPixelHeight - aDescent, aLetter ); - } - - QImage aImage = aPixmap.convertToImage(); - - //int qqq = 0; - //if (qqq) - // aImage.save("w:\\work\\CATHARE\\texture.png", "PNG"); - - char* pixels = new char[myTexFontWidth * myTexFontHeight * NB_TEX_COMP]; - - for( int i = 0; i < myTexFontHeight; i++ ) - { - for( int j = 0; j < myTexFontWidth; j++ ) - { - int aRed = qRed( aImage.pixel( j, myTexFontHeight - i - 1 ) ); - int aGreen = qGreen( aImage.pixel( j, myTexFontHeight - i - 1 ) ); - int aBlue = qBlue( aImage.pixel( j, myTexFontHeight - i - 1 ) ); - - if( aRed != 0 || aGreen != 0 || aBlue != 0 ) - { - pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP] = (GLubyte)( (aRed + aGreen + aBlue)/3 ); - pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP + 1]= (GLubyte) 255; - } - else - { - pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP] = (GLubyte) 0; - pixels[i * myTexFontWidth * NB_TEX_COMP + j * NB_TEX_COMP + 1]= (GLubyte) 0; - } - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glGenTextures(1, &myTexFont); - glBindTexture(GL_TEXTURE_2D, myTexFont); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, myMinMagFilter); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, myMinMagFilter); - glTexImage2D(GL_TEXTURE_2D, - 0, - GL_INTENSITY, - myTexFontWidth, - myTexFontHeight, - 0, - GL_LUMINANCE_ALPHA, - GL_UNSIGNED_BYTE, - pixels); - - delete[] pixels; - - GLViewer_TexIdStored aTexture; - aTexture.myTexFontId = myTexFont; - aTexture.myTexFontWidth = myTexFontWidth; - aTexture.myTexFontHeight = myTexFontHeight; - - TexFontBase.insert( aFindFont, aTexture ); - } - return true; -} - -/*! - Drawing string in viewer - \param theStr - string to be drawn - \param theX - X position - \param theY - Y position - \param theScale - scale coefficient -*/ -void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY, GLfloat theScale ) -{ - // Adding some pixels to have a gap between rows - int aRowPixelHeight = myFontHeight + TEX_ROW_GAP; - - float aXScale = 1.f, aYScale = 1.f; - if ( !myIsResizeable ) - { - glGetFloatv (GL_MODELVIEW_MATRIX, modelMatrix); - aXScale = modelMatrix[0]; - aYScale = modelMatrix[5]; - } - else if ( theScale > 0.f ) - { - aXScale = aXScale / theScale; - aYScale = aYScale / theScale; - } - - // store attributes - glPushAttrib( GL_ENABLE_BIT | GL_TEXTURE_BIT ); - - glEnable(GL_TEXTURE_2D); - glPixelTransferi(GL_MAP_COLOR, 0); - - glAlphaFunc(GL_GEQUAL, 0.05F); - glEnable(GL_ALPHA_TEST); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); - - glBindTexture(GL_TEXTURE_2D, myTexFont); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glBegin(GL_QUADS); - - float aLettBeginS, aLettEndS, aLettBeginT, aLettEndT; - float aDY = ( aRowPixelHeight - 1 ) / aYScale, aDX; - char aLetter; - int aLettIndex, row; - for ( int i = 0; i < (int)theStr.length(); i++ ) - { - aLetter = theStr.data()[i]; - aLettIndex = (int)aLetter - FirstSymbolNumber; - row = aLettIndex / TEX_ROW_LEN; - - aLettBeginS = (float)myPositions[aLettIndex] / ( (float)myTexFontWidth - 1.f ); - aLettEndS = aLettBeginS + ( (float)myWidths[aLettIndex] - 1.f ) / ( (float)myTexFontWidth - 1.f ); - aLettBeginT = ( myTexFontHeight - ( row + 1 ) * aRowPixelHeight ) / ( (float)myTexFontHeight - 1.f ); - aLettEndT = aLettBeginT + ( (float)aRowPixelHeight - 1.f ) / ( (float)myTexFontHeight - 1.f ); - - aDX = ( (float)myWidths[aLettIndex] - 1.f ) / aXScale; - - glTexCoord2f( aLettBeginS, aLettBeginT ); glVertex3f( theX, theY, 1.f ); - glTexCoord2f( aLettBeginS, aLettEndT ); glVertex3f( theX, theY + aDY, 1.f ); - glTexCoord2f( aLettEndS, aLettEndT ); glVertex3f( theX + aDX, theY + aDY, 1.f ); - glTexCoord2f( aLettEndS, aLettBeginT ); glVertex3f( theX + aDX, theY, 1.f ); - - theX += aDX + mySeparator / aXScale; - } - - glEnd(); - // restore attributes - glPopAttrib(); -} - -/*! - \return width of string in pixels -*/ -int GLViewer_TexFont::getStringWidth( QString theStr ) -{ - int aWidth = 0; - for ( int i = 0; i < (int)theStr.length(); i ++ ) - { - char aLetter = theStr.data()[i]; - int aLettIndex = (int)aLetter - FirstSymbolNumber; - aWidth += myWidths[aLettIndex] + mySeparator; - } - - return aWidth; -} - -/*! - \return height of string in pixels -*/ -int GLViewer_TexFont::getStringHeight() -{ - QFontMetrics aFM( myQFont ); - return aFM.height(); -} - -/*! - Generates list base for bitmap fonts -*/ -static GLuint displayListBase( QFont* theFont ) -{ - if ( !theFont ) - return 0; - GLuint aList = 0; - //static QMap fontCache; - GLViewer_TexFindId aFindFont; - aFindFont.myFontFamily = theFont->family();//theFont->toString(); - aFindFont.myIsBold = theFont->bold(); - aFindFont.myIsItal = theFont->italic(); - aFindFont.myIsUndl = theFont->underline(); - aFindFont.myPointSize = theFont->pointSize(); - -#ifdef WIN32 - HGLRC ctx = ::wglGetCurrentContext(); - if ( !ctx ) - return aList; - - aFindFont.myViewPortId = (int)ctx; - - if ( GLViewer_TexFont::BitmapFontCache.contains( aFindFont ) ) - aList = GLViewer_TexFont::BitmapFontCache[aFindFont]; - else - { - GLuint listBase = 0; - QMap::iterator it = GLViewer_TexFont::BitmapFontCache.begin(); - for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it ) - { - if ( it.key().myViewPortId == (int)ctx && it.data() > listBase ) - listBase = it.data(); - } - listBase += 256; - - HDC glHdc = ::wglGetCurrentDC(); - ::SelectObject( glHdc, theFont->handle() ); - if ( !::wglUseFontBitmaps( glHdc, 0, 256, listBase ) ) - listBase = 0; - aList = listBase; - GLViewer_TexFont::BitmapFontCache[aFindFont] = aList; - } -#else //X Window - Display* aDisp = glXGetCurrentDisplay(); - if( !aDisp ) - { -#ifdef _DEBUG_ - printf( "Can't find current dislay\n" ); -#endif - return aList; - } - - GLXContext aCont = glXGetCurrentContext(); - if( !aCont ) - { -#ifdef _DEBUG_ - printf( "Can't find current context\n" ); -#endif - return aList; - } - - aFindFont.myViewPortId = size_t(aCont); - - if ( GLViewer_TexFont::BitmapFontCache.contains( aFindFont ) ) - aList = GLViewer_TexFont::BitmapFontCache[aFindFont]; - else - { - GLuint listBase = 0; - QMap::iterator it = GLViewer_TexFont::BitmapFontCache.begin(); - for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it ) - { - if ( it.key().myViewPortId == size_t(aCont) && it.data() > listBase ) - listBase = it.data(); - } - listBase += 256; - - //glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase ); - int aFontCont = 0; - QString aFontDef = theFont->toString(); - char** xFontList = XListFonts( aDisp, aFontDef.latin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont ); - if( !theFont->handle() ) - { -#ifdef _DEBUG_ - printf( "Can't load font %s. loading default font....\n", aFontDef.latin1()/*aFindFont.myFontString.data()*/ ); -#endif - QString aFontMask ("-*-*-*-r-*-*-"); - aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); -#ifdef _DEBUG_ - printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); -#endif - aFontMask += "-*-*-*-m-*-*-*"; - xFontList = XListFonts( aDisp, aFontMask.data()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); - if( aFontCont == 0 ) - { -#ifdef _DEBUG_ - printf( "Can't load default font\n" ); -#endif - return 0; - } - glXUseXFont( (Font)(XLoadFont( aDisp,xFontList[0] )), 0, 256, listBase ); - } - else - glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase ); - - aList = listBase; - GLViewer_TexFont::BitmapFontCache[aFindFont] = aList; - } - -#endif - - return aList; -} - -/*! - Default constructor -*/ -GLViewer_Drawer::GLViewer_Drawer() -: myFont( "Helvetica", 10, QFont::Bold ) -{ - myXScale = myYScale = 0.0; - myObjects.clear(); - myTextList = 0/*-1*/; - myObjectType = "GLViewer_Object"; - myPriority = 0; - myTextFormat = DTF_BITMAP; - myTextScale = 0.125; -} - -/*! - Destructor -*/ -GLViewer_Drawer::~GLViewer_Drawer() -{ - myObjects.clear(); - glDeleteLists( myTextList, 1 ); -} - -/*! - Clears all generated textures -*/ -void GLViewer_Drawer::destroyAllTextures() -{ - QMap::Iterator anIt= GLViewer_TexFont::TexFontBase.begin(); - QMap::Iterator anEndIt= GLViewer_TexFont::TexFontBase.end(); - - for( ; anIt != anEndIt; anIt++ ) - glDeleteTextures( 1, &(anIt.data().myTexFontId) ); -} - -/*! - Enables and disables antialiasing in Open GL (for points, lines and polygons). - \param on - if it is true, antialiasing is enabled -*/ -void GLViewer_Drawer::setAntialiasing(const bool on) -{ - if (on) - { - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); - - glEnable(GL_POINT_SMOOTH); - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POLYGON_SMOOTH); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable (GL_BLEND); - } - else - { - glDisable(GL_POINT_SMOOTH); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POLYGON_SMOOTH); - glBlendFunc (GL_ONE, GL_ZERO); - glDisable (GL_BLEND); - } -} - -/*! Loads texture from file - \param fileName - the name of texture file - \param x_size - the horizontal size of picture ( less or equal texture horizontal size ) - \param y_size - the vertical size of picture ( less or equal texture vertical size ) - \param t_size - the size of texture ( texture vertical size equals texture horizontal size ) -*/ -GLuint GLViewer_Drawer::loadTexture( const QString& fileName, - GLint* x_size, - GLint* y_size, - GLint* t_size ) -{ - QImage buf; - if ( fileName.isEmpty() || !buf.load( fileName ) ) - return 0; - - int w = buf.width(); - int h = buf.height(); - - int size = 16; - while( size < w || size < h ) - size = size * 2; - - GLuint texture; - GLubyte* pixels = new GLubyte[ size * size * 4 ]; - - for( int i = 0; i < size; i++ ) - { - for( int j = 0; j < size; j++ ) - { - GLubyte r, g, b, a; - if( j < w && i < h ) - { - QRgb pixel = buf.pixel( j, h - i - 1 ); - r = (GLubyte)qRed( pixel ); - g = (GLubyte)qGreen( pixel ); - b = (GLubyte)qBlue( pixel ); - a = (GLubyte)qAlpha( pixel ); - } - else - { - r = (GLubyte)255; - g = (GLubyte)255; - b = (GLubyte)255; - a = (GLubyte)255; - } - - int index = 4 * ( i * size + j ); - pixels[ index ] = r; - pixels[ index + 1 ] = g; - pixels[ index + 2 ] = b; - pixels[ index + 3 ] = a; - } - } - - //initialize texture - glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); - glGenTextures( 1, &texture ); - glBindTexture( GL_TEXTURE_2D, texture ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, size, size, 0, - GL_RGBA, GL_UNSIGNED_BYTE, pixels ); - - delete[] pixels; - - if ( x_size ) - *(x_size) = w; - - if ( y_size ) - *(y_size) = h; - - if ( t_size ) - *(t_size) = size; - - return texture; -} - -/*! Draw square texture - \param texture - the texture ID - \param size - the size of square texture - \param x - x coord - \param y - y coord -*/ -void GLViewer_Drawer::drawTexture( GLuint texture, GLint size, GLfloat x, GLfloat y ) -{ - /*float xScale = myXScale; - float yScale = myYScale; - - glColor4f( 1.0, 1.0, 1.0, 1.0 ); - - glEnable( GL_TEXTURE_2D ); - glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - glAlphaFunc( GL_GREATER, 0.95F ); - glEnable( GL_ALPHA_TEST ); - - glBindTexture( GL_TEXTURE_2D, texture ); - glBegin( GL_QUADS ); - - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( x-size/2./xScale, y-size/2./yScale, 0.0 ); - - glTexCoord2f( 0.0, 1.0 ); - glVertex3f( x-size/2./xScale, y+size/2./yScale, 0.0 ); - - glTexCoord2f( 1.0, 1.0 ); - glVertex3f( x+size/2./xScale, y+size/2./yScale, 0.0 ); - - glTexCoord2f( 1.0, 0.0 ); - glVertex3f( x+size/2./xScale, y-size/2./yScale, 0.0 ); - - glEnd(); - glFlush(); - - glDisable( GL_ALPHA_TEST ); - glDisable( GL_TEXTURE_2D );*/ - - drawTexture( texture, size, size, x, y ); -} - -/*! Draw texture - \param texture - the texture ID - \param x_size - the horizontal size of texture - \param y_size - the vertical size of texture - \param x - x coord - \param y - y coord -*/ -void GLViewer_Drawer::drawTexture( GLuint texture, GLint x_size, GLint y_size, GLfloat x, GLfloat y ) -{ - /*float xScale = myXScale; - float yScale = myYScale; - - glColor4f( 1.0, 1.0, 1.0, 1.0 ); - - glEnable( GL_TEXTURE_2D ); - glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); - glAlphaFunc( GL_GREATER, 0.95F ); - glEnable( GL_ALPHA_TEST ); - - glBindTexture( GL_TEXTURE_2D, texture ); - glBegin( GL_QUADS ); - - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( x-x_size/2./xScale, y-y_size/2./yScale, 0.0 ); - - glTexCoord2f( 0.0, 1.0 ); - glVertex3f( x-x_size/2./xScale, y+y_size/2./yScale, 0.0 ); - - glTexCoord2f( 1.0, 1.0 ); - glVertex3f( x+x_size/2./xScale, y+y_size/2./yScale, 0.0 ); - - glTexCoord2f( 1.0, 0.0 ); - glVertex3f( x+x_size/2./xScale, y-y_size/2./yScale, 0.0 ); - - glEnd(); - glFlush(); - - glDisable( GL_ALPHA_TEST ); - glDisable( GL_TEXTURE_2D );*/ - drawTexturePart( texture, 1.0, 1.0, x_size, y_size, x, y ); -} - -/*! Draw texture part - \param texture - the texture ID - \param x_ratio - the horizontal ratio of texture part - \param y_ratio - the vertical ratio of texture part - \param x_size - the horizontal size of texture - \param y_size - the vertical size of texture - \param x - x coord - \param y - y coord - \param scale - common scale factor ( if = 0, use drawer scales ) -*/ -void GLViewer_Drawer::drawTexturePart( GLuint texture, - GLfloat x_ratio, - GLfloat y_ratio, - GLfloat x_size, - GLfloat y_size, - GLfloat x, - GLfloat y, - GLfloat scale ) -{ - if( !texture ) - return; - - float xScale = scale > 0. ? 1./scale : myXScale; - float yScale = scale > 0. ? 1./scale : myYScale; - - glColor4f( 1.0, 1.0, 1.0, 1.0 ); - - - glEnable( GL_TEXTURE_2D ); - glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); - bool hasAlpha = glIsEnabled( GL_ALPHA_TEST ); - glDisable( GL_ALPHA_TEST ); - - glBindTexture( GL_TEXTURE_2D, texture ); - glBegin( GL_QUADS ); - - glTexCoord2f( 0.0, 0.0 ); - glVertex3f( x-x_size/2./xScale, y-y_size/2./yScale, 0.0 ); - - glTexCoord2f( 0.0, y_ratio ); - glVertex3f( x-x_size/2./xScale, y+y_size/2./yScale, 0.0 ); - - glTexCoord2f( x_ratio, y_ratio ); - glVertex3f( x+x_size/2./xScale, y+y_size/2./yScale, 0.0 ); - - glTexCoord2f( x_ratio, 0.0 ); - glVertex3f( x+x_size/2./xScale, y-y_size/2./yScale, 0.0 ); - - glEnd(); - glFlush(); - - if ( hasAlpha ) - glEnable( GL_ALPHA_TEST ); - - glDisable( GL_TEXTURE_2D ); -} - -/*! - Draw text - \param text - text to be drawn - \param xPos - x position - \param yPos - y position - \param color - color of text - \param theFont - font of text - \param theSeparator - letter separator - \param theFormat - text format (by default DTF_BITMAP) -*/ -void GLViewer_Drawer::drawText( const QString& text, GLfloat xPos, GLfloat yPos, - const QColor& color, QFont* theFont, int theSeparator, DisplayTextFormat theFormat ) -{ - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - - if( theFormat != DTF_BITMAP ) - { - GLViewer_TexFont aTexFont( theFont, theSeparator, theFormat == DTF_TEXTURE_SCALABLE, GL_LINEAR ); - // Font texture was not found or generated --> cannot draw text - if ( !aTexFont.generateTexture() ) - return; - - if ( theFormat == DTF_TEXTURE_SCALABLE ) - aTexFont.drawString( text, xPos, yPos, textScale() ); - else - aTexFont.drawString( text, xPos, yPos ); - } - else - { - glRasterPos2f( xPos, yPos ); - glListBase( displayListBase( theFont ) ); - glCallLists( text.length(), GL_UNSIGNED_BYTE, text.local8Bit().data() ); - } -} - -/*! - Draws object-text -*/ -void GLViewer_Drawer::drawText( GLViewer_Object* theObject ) -{ - if( !theObject ) - return; - - GLViewer_Text* aText = theObject->getGLText(); - if( !aText ) - return; - - GLfloat aPosX, aPosY; - aText->getPosition( aPosX, aPosY ); - // get temporary copy of font - QFont aTmpVarFont = aText->getFont(); - drawText( aText->getText(), aPosX, aPosY, aText->getColor(), &aTmpVarFont, aText->getSeparator(), aText->getDisplayTextFormat() ); -} - -/*! Draw text - \param text - the text string - \param x - x coord - \param y - y coord - \param hPosition - horizontal alignment - \param vPosition - vertical alignment - \param color - text color - \param smallFont - font format -*/ -void GLViewer_Drawer::drawGLText( QString text, float x, float y, - int hPosition, int vPosition, QColor color, bool smallFont ) -{ - QFont aFont( myFont ); - if( smallFont ) - aFont.setPointSize( int(aFont.pointSize() * 0.8) ); - - GLfloat scale = textScale() > 0. ? textScale() : 1.; - - QFontMetrics aFontMetrics( aFont ); - float width = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.width( text ) * scale : aFontMetrics.width( text ) / myXScale; - float height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() * scale : aFontMetrics.height() / myYScale; - float gap = 5 / myXScale; - - switch( hPosition ) - { - case GLText_Left : x -= ( gap + width ); break; - case GLText_Center : x -= width / 2; break; - case GLText_Right : x += gap; break; - default : break; - } - - switch( vPosition ) - { - case GLText_Top : y += height * 0.5; break; - case GLText_Center : y -= height * 0.5; break; - case GLText_Bottom : y -= height * 1.5; break; - default : break; - } - - drawText( text, x, y, color, &aFont, 2, myTextFormat ); -} - -/*! - \return a rectangle of text (without viewer scale) -*/ -GLViewer_Rect GLViewer_Drawer::textRect( const QString& text ) const -{ - GLfloat scale = textScale() > 0. ? textScale() : 1.; - - QFontMetrics aFontMetrics( myFont ); - float width = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.width( text ) * scale : aFontMetrics.width( text ); - float height = myTextFormat == DTF_TEXTURE_SCALABLE ? aFontMetrics.height() * scale : aFontMetrics.height(); - - return GLViewer_Rect( 0, width, height, 0 ); -} - -/*! - Draws rectangle - \param rect - instance of primitive - \param color - color of primitive -*/ -void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, QColor color ) -{ - if( !rect ) - return; - - float x1 = rect->left(); - float x2 = rect->right(); - float y1 = rect->bottom(); - float y2 = rect->top(); - - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - glLineWidth( 1.0 ); - - glBegin( GL_LINE_LOOP ); - glVertex2f( x1, y1 ); - glVertex2f( x1, y2 ); - glVertex2f( x2, y2 ); - glVertex2f( x2, y1 ); - glEnd(); -} - -/*! - Saves object to file with format of HPGL - \param hFile - file - \param aViewerCS - viewer co-ordinate system - \param aHPGLCS - paper co-ordinate system -*/ -bool GLViewer_Drawer::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ) -{ - bool result = true; - for( int i=0, n=myObjects.count(); itranslateToHPGL( hFile, aViewerCS, aHPGLCS ); - return result; -} - -/*! - Saves object to file with format of PostScript - \param hFile - file - \param aViewerCS - viewer co-ordinate system - \param aPSCS - paper co-ordinate system -*/ -bool GLViewer_Drawer::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) -{ - bool result = true; - for( int i=0, n=myObjects.count(); itranslateToPS( hFile, aViewerCS, aPSCS ); - return result; -} - -#ifdef WIN32 -/*! - Saves object to file with format of EMF - \param hFile - file - \param aViewerCS - viewer co-ordinate system - \param aEMFCS - paper co-ordinate system -*/ -bool GLViewer_Drawer::translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ) -{ - bool result = true; - for( int i=0, n=myObjects.count(); itranslateToEMF( hDC, aViewerCS, aEMFCS ); - return result; -} -#endif - -/*! - Draws rectangle - \param rect - instance of primitive - \param lineWidth - width of line - \param gap - gap of rectangle - \param color - color of primitive - \param filled - if it is true, then rectangle will be drawn filled with color "fillingColor" - \param fillingColor - color of filling -*/ -void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, GLfloat lineWidth, GLfloat gap, - QColor color, bool filled, QColor fillingColor ) -{ - if( !rect ) - return; - - float x1 = rect->left() - gap; - float x2 = rect->right() + gap; - float y1 = rect->bottom() - gap; - float y2 = rect->top() + gap; - - if( filled ) - { - glColor3f( ( GLfloat )fillingColor.red() / 255, - ( GLfloat )fillingColor.green() / 255, - ( GLfloat )fillingColor.blue() / 255 ); - glBegin( GL_POLYGON ); - glVertex2f( x1, y1 ); - glVertex2f( x1, y2 ); - glVertex2f( x2, y2 ); - glVertex2f( x2, y1 ); - glEnd(); - } - - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - glLineWidth( lineWidth ); - - glBegin( GL_LINE_LOOP ); - glVertex2f( x1, y1 ); - glVertex2f( x1, y2 ); - glVertex2f( x2, y2 ); - glVertex2f( x2, y1 ); - glEnd(); -} - -/*! - Draws contour - \param pntList - list of points - \param color - color of contour - \param lineWidth - width of line -*/ -void GLViewer_Drawer::drawContour( const GLViewer_PntList& pntList, QColor color, GLfloat lineWidth ) -{ - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - glLineWidth( lineWidth ); - - glBegin( GL_LINES ); - QValueList::const_iterator it = pntList.begin(); - for( ; it != pntList.end(); ++it ) - glVertex2f( (*it).x(), (*it).y() ); - glEnd(); -} - -/*! - Draws rectangular contour - \param rect - instance of rectangle - \param color - color of primitive - \param lineWidth - width of line - \param pattern - pattern of line - \param isStripe - enables line stipple -*/ -void GLViewer_Drawer::drawContour( GLViewer_Rect* rect, QColor color, GLfloat lineWidth, - GLushort pattern, bool isStripe ) -{ - float x1 = rect->left(); - float x2 = rect->right(); - float y1 = rect->bottom(); - float y2 = rect->top(); - - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - glLineWidth( lineWidth ); - - if ( isStripe ) - { - glEnable( GL_LINE_STIPPLE ); - glLineStipple( 1, pattern ); - } - - glBegin( GL_LINE_LOOP ); - - glVertex2f( x1, y1 ); - glVertex2f( x1, y2 ); - glVertex2f( x2, y2 ); - glVertex2f( x2, y1 ); - - glEnd(); - glDisable( GL_LINE_STIPPLE ); -} - -/*! - Draws polygon - \param pntList - list of points - \param color - color of polygon -*/ -void GLViewer_Drawer::drawPolygon( const GLViewer_PntList& pntList, QColor color ) -{ - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - glBegin( GL_POLYGON ); - QValueList::const_iterator it = pntList.begin(); - for( ; it != pntList.end(); ++it ) - glVertex2f( (*it).x(), (*it).y() ); - glEnd(); -} - -/*! - Draws rectangle - \param rect - instance of rectangle - \param color - color of polygon - \param pattern - pattern of line - \param isStripe - enables line stipple -*/ -void GLViewer_Drawer::drawPolygon( GLViewer_Rect* rect, QColor color, - GLushort pattern, bool isStripe ) -{ - float x1 = rect->left(); - float x2 = rect->right(); - float y1 = rect->bottom(); - float y2 = rect->top(); - glColor3f( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255 ); - - if ( isStripe ) - { - glEnable( GL_LINE_STIPPLE ); - glLineStipple( 1, pattern ); - } - glBegin( GL_POLYGON ); - - glVertex2f( x1, y1 ); - glVertex2f( x1, y2 ); - glVertex2f( x2, y2 ); - glVertex2f( x2, y1 ); - - glEnd(); - glDisable( GL_LINE_STIPPLE ); -} - -GLubyte rasterVertex[5] = { 0x70, 0xf8, 0xf8, 0xf8, 0x70 }; - -/*! - Draws vertex - \param x - x position - \param y - y position - \param color - color of vertex -*/ -void GLViewer_Drawer::drawVertex( GLfloat x, GLfloat y, QColor color ) -{ - glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 ); - glRasterPos2f( x, y ); - glBitmap( 5, 5, 2, 2, 0, 0, rasterVertex ); -} - -GLubyte rasterCross[7] = { 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 }; - -/*! - Draws cross - \param x - x position - \param y - y position - \param color - color of cross -*/ -void GLViewer_Drawer::drawCross( GLfloat x, GLfloat y, QColor color ) -{ - glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 ); - glRasterPos2f( x, y ); - glBitmap( 7, 7, 3, 3, 0, 0, rasterCross ); -} - -/*! - Draws arrow - \param red, green, blue - components of color - \param lineWidth - width of line - \param staff - - \param length - length of arrow - \param width - width of arrow - \param x - x position - \param y - y position - \param angle - angle of arrow - \param filled - drawn as filled -*/ -void GLViewer_Drawer::drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue, - GLfloat lineWidth, - GLfloat staff, GLfloat length, GLfloat width, - GLfloat x, GLfloat y, GLfloat angle, GLboolean filled ) -{ - GLfloat vx1 = x; - GLfloat vy1 = y + staff + length; - GLfloat vx2 = vx1 - width / 2; - GLfloat vy2 = vy1 - length; - GLfloat vx3 = vx1 + width / 2; - GLfloat vy3 = vy1 - length; - - gp_Pnt2d p0( x, y ); - gp_Pnt2d p1( vx1, vy1 ); - gp_Pnt2d p2( vx2, vy2 ); - gp_Pnt2d p3( vx3, vy3 ); - - p1.Rotate( p0, angle ); - p2.Rotate( p0, angle ); - p3.Rotate( p0, angle ); - - vx1 = p1.X(); vy1 = p1.Y(); - vx2 = p2.X(); vy2 = p2.Y(); - vx3 = p3.X(); vy3 = p3.Y(); - - glColor3f( red, green, blue ); - glLineWidth( lineWidth ); - - glBegin( GL_LINES ); - glVertex2f( x, y ); - glVertex2f( vx1, vy1 ); - glEnd(); - - filled = true; - if( !filled ) - { - glBegin( GL_LINES ); - glVertex2f( vx1, vy1 ); - glVertex2f( vx2, vy2 ); - glVertex2f( vx1, vy1 ); - glVertex2f( vx3, vy3 ); - glEnd(); - } - else - { - glBegin( GL_POLYGON ); - glVertex2f( vx1, vy1 ); - glVertex2f( vx2, vy2 ); - glVertex2f( vx3, vy3 ); - glEnd(); - } -} diff --git a/src/GLViewer/GLViewer_Drawer.h b/src/GLViewer/GLViewer_Drawer.h deleted file mode 100644 index 21c6386ce..000000000 --- a/src/GLViewer/GLViewer_Drawer.h +++ /dev/null @@ -1,450 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Drawer.h -// Created: November, 2004 - -#ifndef GLVIEWER_DRAWER_H -#define GLVIEWER_DRAWER_H - -#ifdef WNT -#include "windows.h" -#endif - -#include -#include -#include -#include -#include - -#include - -#include "GLViewer.h" -#include "GLViewer_Defs.h" -#include "GLViewer_Geom.h" - -class GLViewer_Object; -class GLViewer_Rect; -class GLViewer_CoordSystem; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif -/*! - * Struct GLViewer_TexIdStored - * Structure for store information about texture - */ -struct GLVIEWER_API GLViewer_TexIdStored -{ - //! Texture ID - GLuint myTexFontId; - //! Texture width - int myTexFontWidth; - //! texture height - int myTexFontHeight; -}; - -/*! - * Struct GLViewer_TexFindId - * Structure for srorage information about texture font - */ -struct GLVIEWER_API GLViewer_TexFindId -{ - //! Font family description - QString myFontFamily; - //! Bold parameter - bool myIsBold; - //! Italic parameter - bool myIsItal; - //! Underline parameter - bool myIsUndl; - //! Font Size - int myPointSize; - //! View POrt ID - int myViewPortId; - //! Overloaded operator for using struct as MAP key - bool operator < (const GLViewer_TexFindId theStruct) const - { - if ( myViewPortId != theStruct.myViewPortId ) - return myViewPortId < theStruct.myViewPortId; - else if ( myPointSize != theStruct.myPointSize ) - return myPointSize < theStruct.myPointSize; - else if ( myIsBold != theStruct.myIsBold ) - return myIsBold < theStruct.myIsBold; - else if ( myIsItal != theStruct.myIsItal ) - return myIsItal < theStruct.myIsItal; - else if ( myIsUndl != theStruct.myIsUndl ) - return myIsUndl < theStruct.myIsUndl; - else - return myFontFamily < theStruct.myFontFamily; - } -}; - -/*! - \class GLViewer_TexFont - Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer -*/ - -class GLVIEWER_API GLViewer_TexFont -{ -public: - //! A default constructor - GLViewer_TexFont(); - //! A constructor - /* - * \param theFont - a base font - * \param theSeparator - separator between letters - * \param theIsResizeable - specifies whether text drawn by this object can be scaled along with the scene - * \param theMinMagFilter - min/mag filter, affects text sharpness - */ - GLViewer_TexFont( QFont* theFont, - int theSeparator = 2, - bool theIsResizeable = false, - GLuint theMinMagFilter = GL_LINEAR/*_ATTENUATION*/ ); - //! A destructor - ~GLViewer_TexFont(); - - //! Generating font texture - bool generateTexture(); - //! Drawing string theStr in point with coords theX and theY - void drawString( QString theStr, - GLdouble theX = 0.0, - GLdouble theY = 0.0, - GLfloat theScale = 1.0 ); - - //! Returns separator between letters - int getSeparator(){ return mySeparator; } - //! Installing separator between letters - void setSeparator( int theSeparator ){ mySeparator = theSeparator; } - - //! Returns width of string in pixels - int getStringWidth( QString theString ); - //! Returns height of string in pixels - int getStringHeight(); - - //! Clears all generated fonts - static void clearTextBases(); - - //! Map for strorage generated texture fonts - static QMap TexFontBase; - //! Map for strorage generated bitmaps fonts - static QMap BitmapFontCache; - -private: - //! Initializes font parameters - void init(); - -private: - //! Number of characters in the font texture - int myNbSymbols; - //! Array of letter width - int* myWidths; - //! Array of letter positions in texture - int* myPositions; - //! Pointer to base font - QFont myQFont; - //! Font texture ID - GLuint myTexFont; - //! Font texture width - int myTexFontWidth; - //! Font texture height - int myTexFontHeight; - //! Separator between letters - int mySeparator; - //! Flag controlling scalability of this texmapped font - bool myIsResizeable; - //! Min/mag filter - GLuint myMinMagFilter; - //! Font height - int myFontHeight; - //! Diagnostic information - int myMaxRowWidth; -}; - -/*! - \class GLViewer_Drawer - Drawer for GLViewer_Objects. - Drawer creates only one times per one type of object -*/ -class GLVIEWER_API GLViewer_Drawer -{ -public: - //! Text position relatively object - enum - { - GLText_Center = 0, - GLText_Left, - GLText_Right, - GLText_Top, - GLText_Bottom - }; - - // Objects status ( needs for change colors ) - //enum ObjectStatus - //{ - // OS_Normal = 0, - // OS_Highlighted, - // OS_Selected - //}; - - // - //enum ClosedStatus - //{ - // CS_CLOSED = 0, - // CS_OPEN = 1 - //}; - - //! A constructor - GLViewer_Drawer(); - //! A destructor - virtual ~GLViewer_Drawer(); - - //! Main method which drawing object in GLViewer - /* - *\param xScale - current scale along X-direction - *\param yScale - current scale along Y-direction - *\param onlyUpdate - = true if only update highlight-select information - */ - virtual void create( float xScale, float yScale, bool onlyUpdate ) = 0; - - //! Adds object to drawer display list - virtual void addObject( GLViewer_Object* theObject ){ myObjects.append( theObject ); } - //! Clears drawer display list - virtual void clear(){ myObjects.clear(); } - - //! Returns object type (needs for dynamic search of right drawer ) - QString getObjectType() const { return myObjectType; } - - //! Returns object priority - int getPriority() const { return myPriority; } - - //! The function enables and disables antialiasing in Open GL (for points, lines and polygons). - void setAntialiasing(const bool on); - - //! Clears all generated textures - static void destroyAllTextures(); - - //! A function translate object in to HPGL file on disk - /*! - *\param hFile the name of PostScript file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aHPGLCS the GLViewer_CoordSystem of PostScript page - */ - virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ); - - //! A function translate object in to PostScript file on disk - /*! - *\param hFile the name of PostScript file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aPSCS the GLViewer_CoordSystem of PostScript page - */ - virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ); - -#ifdef WIN32 - //! A function translate object in to EMF file on disk - /*! - *\warning WIN32 only - * - *\param dc the name of HDC associated with file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aEMFCS the GLViewer_CoordSystem of EMF page - */ - virtual bool translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ); -#endif - - //! Loads texture from file - /*! - *\param fileName - the name of texture file - *\param x_size - the horizontal size of picture ( less or equal texture horizontal size ) - *\param y_size - the vertical size of picture ( less or equal texture vertical size ) - *\param t_size - the size of texture ( texture vertical size equals texture horizontal size ) - */ - static GLuint loadTexture( const QString& fileName, - GLint* x_size = 0, - GLint* y_size = 0, - GLint* t_size = 0); - - //! Draw square texture - /*! - *\param texture - the texture ID - *\param size - the size of square texture - *\param x - x coord - *\param y - y coord - */ - void drawTexture( GLuint texture, - GLint size, - GLfloat x, - GLfloat y ); - - //! Draw texture - /*! - *\param texture - the texture ID - *\param x_size - the horizontal size of texture - *\param y_size - the vertical size of texture - *\param x - x coord - *\param y - y coord - */ - void drawTexture( GLuint texture, - GLint x_size, - GLint y_size, - GLfloat x, - GLfloat y ); - - //! Draw texture part - /*! - *\param texture - the texture ID - *\param x_ratio - the horizontal ratio of texture part - *\param y_ratio - the vertical ratio of texture part - *\param x_size - the horizontal size of texture - *\param y_size - the vertical size of texture - *\param x - x coord - *\param y - y coord - *\param scale - common scale factor ( if = 0, use drawer scales ) - */ - void drawTexturePart( GLuint texture, - GLfloat x_ratio, - GLfloat y_ratio, - GLfloat x_size, - GLfloat y_size, - GLfloat x, - GLfloat y, - GLfloat scale = 0 ); - - - - //! Draw text string - /*! - *\param text - the text string - *\param xPos - x coord - *\param yPos - y coord - *\param color - text color - *\param aFont - base font of text - *\param theSeparator - letter separator - *\param DisplayTextFormat - text format - */ - void drawText( const QString& text, - GLfloat xPos, - GLfloat yPos, - const QColor& color, - QFont* aFont, - int theSeparator, - DisplayTextFormat = DTF_BITMAP ); - - //! Draw text string - /*! - *\param text - the text string - *\param x - x coord - *\param y - y coord - *\param hPosition - horizontal alignment - *\param vPosition - vertical alignment - *\param color - text color - *\param smallFont - font format - */ - void drawGLText( QString text, - float x, - float y, - int hPosition = GLText_Center, - int vPosition = GLText_Center, - QColor color = Qt::black, - bool smallFont = false ); - - //! Sets a default font to be used by drawGLText method - /*! - *\param font - the default font - */ - inline void setFont( const QFont& font ) { myFont = font; } - - //! Returns a default font used by drawGLText method - inline QFont font() const { return myFont; } - - //! Sets a default text displaying format to be used by drawGLText method - /*! - *\param format - the default text displaying format - */ - inline void setTextFormat( const DisplayTextFormat format ) { myTextFormat = format; } - - //! Returns a default text displaying format used by drawGLText method - inline DisplayTextFormat textFormat() const { return myTextFormat; } - - //! Sets a text string displaying scale factor (used only with text format DTF_TEXTURE_SCALABLE) - /*! - *\param factor - scale factor - */ - inline void setTextScale( const GLfloat factor ) { myTextScale = factor; } - - //! Returns a text string displaying scale factor - inline GLfloat textScale() const { return myTextScale; } - - //! Returns a rectangle of text (without viewer scale) - GLViewer_Rect textRect( const QString& ) const; - - - //! Draw rectangle with predefined color - static void drawRectangle( GLViewer_Rect* theRect, QColor = Qt::black ); - -protected: - //! Draw basic primitives: rectangle, contour, polygon, vertex, cross, arrow - //* with predefined color - static void drawRectangle( GLViewer_Rect*, GLfloat, GLfloat = 0, QColor = Qt::black, - bool = false, QColor = Qt::white ); - static void drawContour( GLViewer_Rect*, QColor, GLfloat, GLushort, bool ); - static void drawContour( const GLViewer_PntList&, QColor, GLfloat ); - static void drawPolygon( GLViewer_Rect*, QColor, GLushort, bool ); - static void drawPolygon( const GLViewer_PntList&, QColor ); - static void drawVertex( GLfloat, GLfloat, QColor ); - static void drawCross( GLfloat, GLfloat, QColor ); - static void drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue, - GLfloat, GLfloat, GLfloat, GLfloat, - GLfloat, GLfloat, GLfloat, GLboolean = GL_FALSE ); - - //! Draw object text - virtual void drawText( GLViewer_Object* theObject ); - - //! X Scale factor - float myXScale; - //! Y scale factor - float myYScale; - - //! List of objects - QValueList myObjects; - //! List generated textures - GLuint myTextList; - - //! Type of supporting object - QString myObjectType; - //! Dislay priority - int myPriority; - - //! Default font for drawGLText() method - QFont myFont; - //! Default text displaying format for drawGLText() method - DisplayTextFormat myTextFormat; - - //! Scale factor for text string draw, by default 0.125 - //! (used only with text format DTF_TEXTURE_SCALABLE) - GLfloat myTextScale; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif // GLVIEWER_DRAWER_H diff --git a/src/GLViewer/GLViewer_Geom.cxx b/src/GLViewer/GLViewer_Geom.cxx deleted file mode 100644 index ebd777e22..000000000 --- a/src/GLViewer/GLViewer_Geom.cxx +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -//#include -#include - -#define FAR_POINT 1e10 // Value used as a "very distant" co-ordinate -#define TOLERANCE 1e-3 - -/*! - constructs a real segment bounded by two points -*/ -GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt1, - const GLViewer_Pnt& thePnt2 ) -: myPnt1( thePnt1 ), - myPnt2( thePnt2 ) -{ - myA = myPnt1.y() - myPnt2.y(); - myB = myPnt2.x() - myPnt1.x(); - myC = myPnt1.x() * myPnt2.y() - myPnt2.x() * myPnt1.y(); -} - -/*! - constructs a ray starting at and directed along positive X axis direction (or Y axis if vertical ) -*/ -GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt, - const GLfloat theA, - const GLfloat theB, - const GLfloat theC ) -: myPnt1( thePnt ), - myA( theA ), - myB( theB ), - myC( theC ) -{ - if ( fabs( myB ) < TOLERANCE ) - myPnt2 = GLViewer_Pnt( myPnt1.x(), FAR_POINT ); - else - myPnt2 = GLViewer_Pnt( FAR_POINT, - myA / myB * FAR_POINT - myC / myB ); -} - -/*! - destructor, does nothing -*/ -GLViewer_Segment::~GLViewer_Segment() -{ -} - -/*! - detects intersection with segment -*/ -bool GLViewer_Segment::HasIntersection( const GLViewer_Segment& theOther ) const -{ - bool aRes = false; - GLfloat aDiv = myA * theOther.myB - myB * theOther.myA; - if ( fabs( aDiv ) > TOLERANCE ) - { - GLfloat aX = ( myB * theOther.myC - theOther.myB * myC ) / aDiv; - GLfloat aX11 = myPnt1.x() > myPnt2.x() ? myPnt2.x() : myPnt1.x(); - GLfloat aX12 = myPnt1.x() > myPnt2.x() ? myPnt1.x() : myPnt2.x(); - GLfloat aX21 = theOther.myPnt1.x() > theOther.myPnt2.x() ? theOther.myPnt2.x() : theOther.myPnt1.x(); - GLfloat aX22 = theOther.myPnt1.x() > theOther.myPnt2.x() ? theOther.myPnt1.x() : theOther.myPnt2.x(); - - GLfloat aY = ( myC * theOther.myA - theOther.myC * myA ) / aDiv; - GLfloat aY11 = myPnt1.y() > myPnt2.y() ? myPnt2.y() : myPnt1.y(); - GLfloat aY12 = myPnt1.y() > myPnt2.y() ? myPnt1.y() : myPnt2.y(); - GLfloat aY21 = theOther.myPnt1.y() > theOther.myPnt2.y() ? theOther.myPnt2.y() : theOther.myPnt1.y(); - GLfloat aY22 = theOther.myPnt1.y() > theOther.myPnt2.y() ? theOther.myPnt1.y() : theOther.myPnt2.y(); - - if ( fabs( aX11 - aX12 ) > TOLERANCE ) - aRes = aX11 < aX && aX < aX12; - else - aRes = aY11 < aY && aY < aY12; - - if ( aRes ) - { - if ( fabs( aX21 - aX22 ) > TOLERANCE ) - aRes = aX21 < aX && aX < aX22; - else - aRes = aY21 < aY && aY < aY22; - } - } - - return aRes; -} - -/*! - constructs a closed polygon from the given ordered list of points -*/ -GLViewer_Poly::GLViewer_Poly( const GLViewer_PntList* thePoints ) -: myPoints( (GLViewer_PntList*)thePoints ) -{ -} - -/*! - destructor, mustn't be deleted here! -*/ -GLViewer_Poly::~GLViewer_Poly() -{ -} - -/*! - \return true if lies within this polygon -*/ -bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt ) const -{ - if ( !myPoints ) - return false; - - //cout << thePnt.x() << endl; - //cout << thePnt.y() << endl << endl; - - int aNbInter = 0; - GLViewer_Segment aRay( thePnt, 0., 1., -thePnt.y() ); - - GLViewer_PntList::const_iterator it1 = myPoints->begin(); - GLViewer_PntList::const_iterator it2 = myPoints->begin(); - ++it2; - for ( ; it1 != myPoints->end(); ++it1, ++it2 ) - { - if ( it2 == myPoints->end() ) - it2 = myPoints->begin(); - - if ( aRay.HasIntersection( GLViewer_Segment( *it1, *it2 ) ) ) - aNbInter++; - } - - return ( aNbInter % 2 == 1 ); -} -/*! - \return true if lies within this polygon -*/ -/* -bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt, const float tolerance ) const -{ - if ( !myPoints ) - return false; - - float x = thePnt.x(); - float y = thePnt.y(); - bool res = false; - - GLViewer_Pnt p1( x - tolerance, y - tolerance ); - GLViewer_Pnt p2( x - tolerance, y + tolerance ); - GLViewer_Pnt p3( x + tolerance, y - tolerance ); - GLViewer_Pnt p4( x + tolerance, y + tolerance ); - - res = ( IsInPnt( thePnt ) || - IsInPnt( p1 ) || IsInPnt( p2 ) || IsInPnt( p3 ) || IsInPnt( p4 ) ); - - return res; -} -*/ -/*! - \return true if covers this polygon -*/ -bool GLViewer_Poly::IsCovers( const GLViewer_Poly& thePoly ) const -{ - if ( !myPoints || !thePoly.Count() ) - return false; - - GLViewer_PntList::const_iterator it = myPoints->begin(); - - for ( ; it != myPoints->end(); ++it ) - { - if( !thePoly.IsIn( *it ) ) - return false; - } - - return true; -} - -/*! - \return true if covers this polygon -*/ -bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const -{ - if ( !myPoints ) //needs check for - return false; - - GLViewer_PntList aList; - GLViewer_PntList::iterator it = aList.begin(); - - aList.insert( it, GLViewer_Pnt( theRect.left(), theRect.top() ) ); - aList.insert( it, GLViewer_Pnt( theRect.right(), theRect.top() ) ); - aList.insert( it, GLViewer_Pnt( theRect.right(), theRect.bottom() ) ); - aList.insert( it, GLViewer_Pnt( theRect.left(), theRect.bottom() ) ); - - return IsCovers( GLViewer_Poly( &aList ) ); -} - -/*! - \return true if polygon has intersection with segment or ray - \param theSegment - segment to check intersection -*/ -bool GLViewer_Poly::HasIntersection( const GLViewer_Segment& theSegment ) const -{ - if ( !myPoints ) - return false; - - bool aRes = false; - GLViewer_PntList::const_iterator it1 = myPoints->begin(); - GLViewer_PntList::const_iterator it2 = myPoints->begin(); - ++it2; - for ( ; !aRes && it1 != myPoints->end(); ++it1, ++it2 ) - { - if ( it2 == myPoints->end() ) - it2 = myPoints->begin(); - - aRes = theSegment.HasIntersection( GLViewer_Segment( *it1, *it2 ) ); - } - - return aRes; -} diff --git a/src/GLViewer/GLViewer_Geom.h b/src/GLViewer/GLViewer_Geom.h deleted file mode 100644 index 7ba4db69f..000000000 --- a/src/GLViewer/GLViewer_Geom.h +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Geom.h -// Created: November, 2004 - -#ifndef GLVIEWER_GEOM_H -#define GLVIEWER_GEOM_H - -#include "GLViewer.h" - -#include -#include -#include -#include - - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! Struct GLViewer_Pnt -* Substitution of QPoint for OpenGL -*/ - -struct GLVIEWER_API GLViewer_Pnt -{ -public: - GLViewer_Pnt() : myX( 0. ), myY( 0. ) {}; - GLViewer_Pnt( GLfloat theX, GLfloat theY ) : myX( theX ), myY( theY ) {} - - GLfloat x() const { return myX; } - GLfloat y() const { return myY; } - void setX( GLfloat theX ) { myX = theX; } - void setY( GLfloat theY ) { myY = theY; } - void setXY( GLfloat theX, GLfloat theY ) { myX = theX; myY = theY; } - void move( GLfloat theDX, GLfloat theDY ) { myX += theDX; myY += theDY; } - -private: - GLfloat myX; - GLfloat myY; -}; - -typedef QValueList GLViewer_PntList; - -/*! Class GLViewer_Rect -* Substitution of QRect for OpenGL -*/ - -class GLVIEWER_API GLViewer_Rect -{ -public: - GLViewer_Rect(): myLeft(0.0), myRight(0.0), myTop(0.0), myBottom(0.0){} - GLViewer_Rect( float theLeft, float theRight, float theTop, float theBottom ) - : myLeft(theLeft), myRight(theRight), myTop(theTop), myBottom(theBottom) {} - GLViewer_Rect( QRect theRect ) { - myLeft = ( float )theRect.left(); myRight = ( float )theRect.right(); - myTop = ( float )theRect.top(); myBottom = ( float )theRect.bottom(); } - - float left() const { return myLeft; } - float right() const { return myRight; } - float top() const { return myTop; } - float bottom() const { return myBottom; } - - float width() const { return fabs( myRight - myLeft ); } - float height() const { return fabs( myTop - myBottom ); } - - void setLeft( float theLeft ) { myLeft = theLeft; } - void setRight( float theRight ) { myRight = theRight; } - void setTop( float theTop ) { myTop = theTop; } - void setBottom( float theBottom ) { myBottom = theBottom; } - - void setCoords( float theLeft, float theRight, float theBottom, float theTop ) - { myLeft = theLeft; myRight = theRight; myBottom = theBottom; myTop = theTop; } - - //! \warning This method translate only rect format - QRect toQRect() { return QRect( ( int )myLeft, ( int )myBottom, - ( int )( myRight - myLeft ), - ( int )( myTop - myBottom ) ); } - - //! On/off empty status - void setIsEmpty( bool on ) { myIsEmpty = on; } - //! Checks empty status - bool isEmpty() const { return myIsEmpty; } - - //! Checks null status - bool isNull() const { return myLeft == 0.0 && myRight == 0.0 && myBottom == 0.0 && myTop == 0.0; } - //! Checks valid status - bool isValid() const { return ( myLeft < myRight && myBottom < myTop ); } - - //! Checks staus of contains point - bool contains( GLViewer_Pnt pnt ) { return ( pnt.x() > left() && - pnt.x() < right() && - pnt.y() > bottom() && - pnt.y() < top() ); } - - void move( const float x, const float y ) - { - myLeft += x; - myRight += x; - myTop += y; - myBottom += y; - } - -protected: - float myLeft; - float myRight; - float myTop; - float myBottom; - - bool myIsEmpty; -}; - -/*! Class GLViewer_Segment -* Segment for 2d detection -*/ - -class GLVIEWER_API GLViewer_Segment -{ -public: - GLViewer_Segment( const GLViewer_Pnt& thePnt1, - const GLViewer_Pnt& thePnt2 ); - - //! Ordinary segment construction - /*!Construction of a ray with given equation Ax + By + C = 0 */ - - GLViewer_Segment( const GLViewer_Pnt& thePnt, - const GLfloat theA, - const GLfloat theB, - const GLfloat theC ); - ~GLViewer_Segment(); - - bool HasIntersection( const GLViewer_Segment& theOther ) const; - // Detects intersection with another segment or ray - -private: - GLViewer_Pnt myPnt1; - GLViewer_Pnt myPnt2; - GLfloat myA; - GLfloat myB; - GLfloat myC; -}; - -/*! Class GLViewer_Poly -* Polygon for 2d detection -*/ - -class GLVIEWER_API GLViewer_Poly -{ -public: - GLViewer_Poly( const GLViewer_PntList* thePoints ); - virtual ~GLViewer_Poly(); - - //! Adds point to polygon - void AddPoint( GLViewer_Pnt& pnt ) { myPoints->append( pnt ); } - - //! Returns number of point - int Count() const { return myPoints->count(); } - - //! Returns true if a point lies inside this polygon - virtual bool IsIn( const GLViewer_Pnt& thePnt ) const; - - //! Returns true if a other polygon covers this polygon - virtual bool IsCovers( const GLViewer_Poly& thePoly ) const; - - //! Likes the above function - virtual bool IsCovers( const GLViewer_Rect& theRect ) const; - - // Returns true if intersection of this polygon with a segment or a ray not empty - virtual bool HasIntersection( const GLViewer_Segment& theSegment ) const; - -private: - GLViewer_PntList* myPoints; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Grid.cxx b/src/GLViewer/GLViewer_Grid.cxx deleted file mode 100644 index 13a661caf..000000000 --- a/src/GLViewer/GLViewer_Grid.cxx +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Grid.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Grid.h" -#include "GLViewer_Defs.h" - -#include -#include - -/*! - Default constructor -*/ -GLViewer_Grid::GLViewer_Grid() : - myGridList( 0 ), myGridHeight( (GLfloat)0.0 ), myGridWidth( (GLfloat)0.0 ), - myWinW( (GLfloat)0.0 ), myWinH( (GLfloat)0.0 ), myXSize( (GLfloat)0.0 ), myYSize( (GLfloat)0.0 ), - myXPan( (GLfloat)0.0 ), myYPan( (GLfloat)0.0 ), myXScale( (GLfloat)1.0 ), myYScale( (GLfloat)1.0 ), - myLineWidth( (GLfloat)0.05 ), myCenterWidth( (GLfloat)1.5 ), myCenterRadius( (GLfloat)5.0 ), - myScaleFactor( 10 ), myIsUpdate( GL_FALSE ) -{ - myGridColor[0] = 0.5; - myGridColor[1] = 0.5; - myGridColor[2] = 0.5; - myAxisColor[0] = 0.75; - myAxisColor[1] = 0.75; - myAxisColor[2] = 0.75; -} - -/*! - Constructor - \param width and \param height - width and height of grid - \param winW and \param winH - width and height of window - \param xSize and \param ySize - steps along x and y direction - \param xPan and \param yPan - offsets along x and y direction - \param xScale and \param yScal - scale factors along x and y direction -*/ -GLViewer_Grid::GLViewer_Grid( GLfloat width, GLfloat height, - GLfloat winW, GLfloat winH, - GLfloat xSize, GLfloat ySize, - GLfloat xPan, GLfloat yPan, - GLfloat xScale, GLfloat yScale ) : - myGridList( 0 ), myGridHeight( (GLfloat)0.0 ), myGridWidth( (GLfloat)0.0 ), - myWinW( (GLfloat)0.0 ), myWinH( (GLfloat)0.0 ), myXSize( (GLfloat)0.0 ), myYSize( (GLfloat)0.0 ), - myXPan( (GLfloat)0.0 ), myYPan( (GLfloat)0.0 ), myXScale( (GLfloat)1.0 ), myYScale( (GLfloat)1.0 ), - myLineWidth( (GLfloat)0.05 ), myCenterWidth( (GLfloat)1.5 ), myCenterRadius( (GLfloat)5.0 ), - myScaleFactor( 10 ), myIsUpdate( GL_FALSE ) -{ - myGridColor[0] = 0.5; - myGridColor[1] = 0.5; - myGridColor[2] = 0.5; - myAxisColor[0] = 0.75; - myAxisColor[1] = 0.75; - myAxisColor[2] = 0.75; -} - -/*! - Destructor -*/ -GLViewer_Grid::~GLViewer_Grid() -{ -} - -/*! - Performs OpenGL drawing -*/ -void GLViewer_Grid::draw() -{ - if ( myGridList == 0 || myIsUpdate ) - initList(); - - glCallList( myGridList ); -} - -/*! - Changes color of grid - \param r, g, b - components of color -*/ -void GLViewer_Grid::setGridColor( GLfloat r, GLfloat g, GLfloat b ) -{ - if( myGridColor[0] == r && myGridColor[1] == g && myGridColor[2] == b ) - return; - - myGridColor[0] = r; - myGridColor[1] = g; - myGridColor[2] = b; - myIsUpdate = GL_TRUE; -} - -/*! - Changes color of axis - \param r, g, b - components of color -*/ -void GLViewer_Grid::setAxisColor( GLfloat r, GLfloat g, GLfloat b ) -{ - if( myAxisColor[0] == r && myAxisColor[1] == g && myAxisColor[2] == b ) - return; - - myAxisColor[0] = r; - myAxisColor[1] = g; - myAxisColor[2] = b; - myIsUpdate = GL_TRUE; -} - -/*! - Changes grid width - \param w - new grid width -*/ -void GLViewer_Grid::setGridWidth( float w ) -{ - if( myGridWidth == w ) - return; - - myGridWidth = w; - myIsUpdate = GL_TRUE; -} - -/*! - Sets Radius of center point( begin coords ) - \param r - new radius -*/ -void GLViewer_Grid::setCenterRadius( int r ) -{ - if( myCenterRadius == r ) - return; - - myCenterRadius = r; - myIsUpdate = GL_TRUE; -} - -/*! - Sets grid size along X and Y axis - \param xSize - size along X axis - \param ySize - size along Y axis -*/ -void GLViewer_Grid::setSize( float xSize, float ySize ) -{ - if( myXSize == xSize && myYSize == ySize ) - return; - - myXSize = xSize; - myYSize = ySize; - myIsUpdate = GL_TRUE; -} - -/*! - Sets panning of grid - \param xPan - panning along X axis - \param yPan - panning along Y axis -*/ -void GLViewer_Grid::setPan( float xPan, float yPan ) -{ - if( myXPan == xPan && myYPan == yPan ) - return; - - myXPan = xPan; - myYPan = yPan; - myIsUpdate = GL_TRUE; -} - -/*! - Sets zoom - \param zoom - new coefficient of zooming -*/ -bool GLViewer_Grid::setZoom( float zoom ) -{ - if( zoom == 1.0 ) - return true; - - //backup values - float bXScale = myXScale; - float bYScale = myYScale; - - myXScale /= zoom; - myYScale /= zoom; - - if( fabs(myXScale) < Precision::Confusion() || fabs(myYScale) < Precision::Confusion() ) - { //undo - myXScale = bXScale; - myYScale = bYScale; - return false; - } - - myGridWidth /= zoom; - myGridHeight /= zoom; - myIsUpdate = GL_TRUE; - return true; -} - -/*! - Sets parameters of grid by zoom coefficient and window size - \param WinW - window width - \param WinH - window height - \param zoom - zoom coefficient -*/ -void GLViewer_Grid::setResize( float WinW, float WinH, float zoom ) -{ - if( myWinW == WinW && myWinH == WinH && zoom == 1.0 ) - return; - - myGridWidth = myGridWidth + ( WinW - myWinW ) * myXScale; - myGridHeight = myGridHeight + ( WinH - myWinH ) * myYScale; - myWinW = WinW; - myWinH = WinH; - setZoom( zoom ); - myIsUpdate = GL_TRUE; -} - -/*! - \return grid size along x and y axis - \param xSize - for size along x axis - \param ySize - for size along y axis -*/ -void GLViewer_Grid::getSize( float& xSize, float& ySize ) const -{ - xSize = myXSize; - ySize = myYSize; -} - -/*! - \return panning along x and y axis - \param xPan - for panning along x axis - \param yPan - for panning along y axis -*/ -void GLViewer_Grid::getPan( float& xPan, float& yPan ) const -{ - xPan = myXPan; - yPan = myYPan; -} - -/*! - \return scaling along x and y axis - \param xScale - for scaling along x axis - \param yScale - for scaling along y axis -*/ -void GLViewer_Grid::getScale( float& xScale, float& yScale ) const -{ - xScale = myXScale; - yScale = myYScale; -} - -/*! - Initialize grid display list -*/ -bool GLViewer_Grid::initList() -{ - myIsUpdate = GL_FALSE; - - if( myXSize == (GLfloat)0.0 ) - myXSize = (GLfloat)0.1; - if( myYSize == (GLfloat)0.0 ) - myYSize = (GLfloat)0.1; - -label: - if( ( myXSize >= myGridWidth/5 ) && ( myYSize >= myGridHeight/5 ) ) - { //zoom in - myXSize /= myScaleFactor; - myYSize /= myScaleFactor; - goto label; - } - else if( ( myXSize * myScaleFactor < myGridWidth/5 ) - || ( myYSize * myScaleFactor < myGridHeight/5 ) ) - { //zoom out - myXSize *= myScaleFactor; - myYSize *= myScaleFactor; - goto label; - } - - //int n = myGridWidth / myXSize; - //int m = myGridHeight / myYSize; - // do not initialise integer by float - //if( ( n != 0 ) || ( m != 0 ) ) - if( ( myGridWidth > 0.5 * myXSize ) || ( myGridHeight > 0.5 * myYSize ) ) - { - if ( myGridList != 0 ) - { - glDeleteLists( myGridList, 1 ); - if ( glGetError() != GL_NO_ERROR ) - return FALSE; - } - - float xLoc = (int)(myXPan / myXSize) * myXSize; - float yLoc = (int)(myYPan / myYSize) * myYSize; - - myGridList = glGenLists( 1 ); - glNewList( myGridList, GL_COMPILE ); - - glColor3f( myGridColor[0], myGridColor[1], myGridColor[2] ); - glLineWidth( myLineWidth ); - - glBegin( GL_LINES ); - for( int j = 0; ( j-1 ) * myXSize <= myGridWidth / 2 ; j++ ) - { - glVertex2d( -myXSize * j - xLoc, -myGridHeight / 2 - myYSize - yLoc ); - glVertex2d( -myXSize * j - xLoc, myGridHeight / 2 + myYSize - yLoc ); - glVertex2d( myXSize * j - xLoc, -myGridHeight / 2 - myYSize - yLoc ); - glVertex2d( myXSize * j - xLoc, myGridHeight / 2 + myYSize - yLoc ); - } - for( int i = 0; ( i-1 ) * myYSize <= myGridHeight / 2 ; i++) - { - glVertex2d( -myGridWidth / 2 - myXSize - xLoc, -myYSize * i - yLoc ); - glVertex2d( myGridWidth / 2 + myXSize - xLoc, -myYSize * i - yLoc ); - glVertex2d( -myGridWidth / 2 - myXSize - xLoc, myYSize * i - yLoc ); - glVertex2d( myGridWidth / 2 + myXSize - xLoc, myYSize * i - yLoc ); - } - glEnd(); - - glColor3f( myAxisColor[0], myAxisColor[1], myAxisColor[2] ); - glLineWidth( myCenterWidth ); - - glBegin( GL_LINES ); - glVertex2d( myGridWidth / 2 + myXSize - xLoc, 0); - glVertex2d( -myGridWidth / 2 - myXSize - xLoc, 0); - glVertex2d( 0, myGridHeight / 2 + myYSize - yLoc ); - glVertex2d( 0, -myGridHeight / 2 - myYSize - yLoc ); - glEnd(); - - glBegin( GL_LINE_LOOP ); - double angle = 0.0; - for ( int k = 0; k < SEGMENTS; k++ ) - { - glVertex2f( cos(angle) * myCenterRadius * myXScale, - sin(angle) * myCenterRadius * myYScale ); - angle += STEP; - } - glEnd(); - - glEndList(); - } - return TRUE; -} diff --git a/src/GLViewer/GLViewer_Grid.h b/src/GLViewer/GLViewer_Grid.h deleted file mode 100644 index d4a4567e4..000000000 --- a/src/GLViewer/GLViewer_Grid.h +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Grid.h -// Created: November, 2004 - -#ifndef GLVIEWER_GRID_H -#define GLVIEWER_GRID_H - -#ifdef WNT -#include "windows.h" -#endif - -#include "GLViewer.h" - -#include -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! Class GLViewer_Grid - 2D rectangular grid for GLViewer - Grid is adapt cells for current view -*/ - -class GLVIEWER_API GLViewer_Grid -{ -public: - //! A default constructor - GLViewer_Grid(); - //! A constructor - /* - * \param width and \param height - width and height of grid - * \param winW and \param winH - width and height of window - * \param xSize and \param ySize - steps along x and y direction - * \param xPan and \param yPan - offsets along x and y direction - * \param xScale and \param yScal - scale factors along x and y direction - */ - GLViewer_Grid( GLfloat width, GLfloat height, - GLfloat winW, GLfloat winH, - GLfloat xSize, GLfloat ySize, - GLfloat xPan, GLfloat yPan, - GLfloat xScale, GLfloat yScale ); - ~GLViewer_Grid(); - - //! Draws grid - void draw(); - - //! Sets color of grid in RGB format - void setGridColor( GLfloat r, GLfloat g, GLfloat b ); - //! Sets color of grid axes in RGB format - void setAxisColor( GLfloat r, GLfloat g, GLfloat b ); - void setGridWidth( float ); - //! Sets Radius of center point( begin coords ) - void setCenterRadius( int ); - - //! Sets steps along x and y directions - void setSize( float xs, float ys ); - //! Sets offset along x and y direction - void setPan( float xp, float yp ); - //! Sets common scale factor along x and y direction - bool setZoom( float zoom ); - //! Recomputes grid in new size and scale of view - void setResize( float winW, float winH, float Zoom ); - - void getSize( float&, float& ) const; - void getPan( float&, float& ) const; - void getScale( float&, float& ) const; - - //! Sets step of scale - void setScaleFactor( int ); - int getScaleFactor(); - -protected: - //! Initialize grid display list - bool initList(); - - GLuint myGridList; - GLfloat myGridColor[3]; - GLfloat myAxisColor[3]; - GLfloat myGridHeight; - GLfloat myGridWidth; - GLfloat myWinW; - GLfloat myWinH; - GLfloat myXSize; - GLfloat myYSize; - GLfloat myXPan; - GLfloat myYPan; - GLfloat myXScale; - GLfloat myYScale; - GLfloat myLineWidth; - GLfloat myCenterWidth; - GLint myCenterRadius; - GLint myScaleFactor; - GLboolean myIsUpdate; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Group.cxx b/src/GLViewer/GLViewer_Group.cxx deleted file mode 100644 index 646750490..000000000 --- a/src/GLViewer/GLViewer_Group.cxx +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Group.xx -// Created: March, 2005 - -//#include "GLViewerAfx.h" -#include "GLViewer_Group.h" -#include "GLViewer_Object.h" - -/*! - constructor -*/ -GLViewer_Group::GLViewer_Group() -{ - mySelObjNum = 0; -} - -/*! - destructor -*/ -GLViewer_Group::~GLViewer_Group() -{ -} - -/*! - detection of empty group -*/ -bool GLViewer_Group::isEmpty() -{ - return myList.empty(); -} - -/*! - \return number of elements -*/ -int GLViewer_Group::count() -{ - return myList.size(); -} - -/*! - \return the position of object if group contains it, else -1 -*/ -int GLViewer_Group::contains( GLViewer_Object* theObject ) -{ - if( !theObject ) - return -1; - - OGIterator it = myList.begin(); - OGIterator end_it = myList.end(); - for( int i = 0; it != end_it; ++it, i++ ) - if( *it == theObject ) - return i; - - return -1; -} - -/*! - adding object to group -*/ -int GLViewer_Group::addObject( GLViewer_Object* theObject ) -{ - if( theObject && contains( theObject ) == -1 ) - { - myList.push_back( theObject ); - theObject->setGroup( this ); - } - return count(); -} - -/*! - removing object from group -*/ -int GLViewer_Group::removeObject( GLViewer_Object* theObject ) -{ - if( theObject ) - { - myList.remove( theObject ); - //theObject->setGroup( NULL ); - } - - - if( isEmpty() ) - { - this->~GLViewer_Group(); - return -1; - } - else - return count(); -} - -/*! - Dragging operation - \param Once is true, if this operation calls only one time for all object - \param x, y - dragging position -*/ -void GLViewer_Group::dragingObjects( float x, float y, bool once ) -{ - if( !once ) - { - if( !mySelObjNum ) - { - OGIterator it = myList.begin(); - OGIterator end_it = myList.end(); - for( int i = 0; it != end_it; ++it, i++ ) - if( (*it)->isSelected() ) - mySelObjNum++; - - if( mySelObjNum ) - mySelObjNum--; - } - else - { - mySelObjNum--; - return; - } - } - - OGIterator it = myList.begin(); - OGIterator end_it = myList.end(); - for( int i = 0; it != end_it; ++it, i++ ) - (*it)->moveObject( x, y, true ); -} - -/*! - Updates zoom of object - \param sender - object to be updated - \param zoom - zoom coefficient -*/ -void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom ) -{ - OGIterator it = myList.begin(); - OGIterator end_it = myList.end(); - for( int i = 0; it != end_it; ++it, i++ ) - { - GLViewer_Object* anObject = *it; - if( anObject != sender ) - anObject->setZoom( zoom, true, true ); - } -} diff --git a/src/GLViewer/GLViewer_Group.h b/src/GLViewer/GLViewer_Group.h deleted file mode 100644 index 4382b06c9..000000000 --- a/src/GLViewer/GLViewer_Group.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Group.h -// Created: March, 2005 - -#ifndef GLVIEWER_GROUP_H -#define GLVIEWER_GROUP_H - -#include -#include "GLViewer.h" - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -class GLViewer_Object; - -typedef std::list OGList; -typedef std::list::iterator OGIterator; - -/*! Class GLViewer_Group -* Group of GLViewer_Objects for synchronized moving. -* If you move one or more objects from group, than all objects from group is moved -* If group is empty, it must be deleted -*/ - -class GLVIEWER_API GLViewer_Group -{ -public: - GLViewer_Group(); - ~GLViewer_Group(); - - bool isEmpty(); - //! Returns number ob objects - int count(); - - //! Returns index of position, else -1 - int contains( GLViewer_Object* ); - int addObject( GLViewer_Object* ); - int removeObject( GLViewer_Object* ); - - OGList getObjects() const { return myList; } - - //! Dragging operation - /*! Once = true, if this operation calls only one time for all object*/ - void dragingObjects( float x, float y, bool once = false ); - //!\warning it is for ouv - void updateZoom( GLViewer_Object* sender, float zoom ); - -private: - //! List of objects - OGList myList; - //! This number needs for synchranization group with viewport drag methods - int mySelObjNum; -}; - -#endif //GLVIEWER_GROUP_H diff --git a/src/GLViewer/GLViewer_MimeSource.cxx b/src/GLViewer/GLViewer_MimeSource.cxx deleted file mode 100644 index ca82fbacd..000000000 --- a/src/GLViewer/GLViewer_MimeSource.cxx +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -//#include -#include "GLViewer_MimeSource.h" -#include "GLViewer_BaseObjects.h" - -//#include -//using namespace std; - -/*! - Destructor -*/ -GLViewer_MimeSource::~GLViewer_MimeSource() -{ -} - -/*! - Translate objects to byte array - \param theObjects - list of objects -*/ -bool GLViewer_MimeSource::setObjects( QValueList theObjects ) -{ - if( !theObjects.empty() ) - { - QStringList aObjectsType; - QValueList aObjects; - QValueList::const_iterator anIt = theObjects.begin(); - QValueList::const_iterator anEndIt = theObjects.end(); - - int aObjByteSize = 0; - for( ; anIt != anEndIt; anIt++ ) - { - aObjects.append( (*anIt)->getByteCopy() ); - aObjByteSize += aObjects.last().size(); - aObjectsType.append( (*anIt)->getObjectType() ); - } - - int anISize = sizeof( int ); - QString aTypes = aObjectsType.join(""); - int aStrByteSize = aTypes.length(); - int aObjNum = aObjects.count(); - - myByteArray = QByteArray( anISize * (1 + 2*aObjNum) + aStrByteSize + aObjByteSize ); - - int anIndex = 0, j = 0; - char* aPointer = (char*)&aObjNum; - for( anIndex = 0; anIndex < anISize; anIndex++, aPointer++ ) - myByteArray[anIndex] = *aPointer; - - QStringList::const_iterator aStrIt = aObjectsType.begin(); - QStringList::const_iterator aEndStrIt = aObjectsType.end(); - for( j = 1; aStrIt != aEndStrIt; aStrIt++, j++ ) - { - int aStrLen = (*aStrIt).length(); - aPointer = (char*)&aStrLen; - for( ; anIndex < anISize*( 1 + j ); anIndex++, aPointer++ ) - myByteArray[anIndex] = *aPointer; - } - - int aCurIndex = anIndex; - const char* aStr = aTypes.data(); - - for( j = 0 ; anIndex < aCurIndex + aStrByteSize; aPointer++, anIndex++, j++ ) - myByteArray[anIndex] = aStr[j]; - - aCurIndex = anIndex; - QValueList::iterator anObjIt = aObjects.begin(); - QValueList::iterator anEndObjIt = aObjects.end(); - for( j = 1; anObjIt != anEndObjIt; anObjIt++, j++ ) - { - int aObjLen = (int)((*anObjIt).size()); - aPointer = (char*)&aObjLen; - for( ; anIndex < aCurIndex + anISize*j; anIndex++, aPointer++ ) - myByteArray[anIndex] = *aPointer; - } - - aCurIndex = anIndex; - anObjIt = aObjects.begin(); - - for( ; anObjIt != anEndObjIt; anObjIt++ ) - { - int aObjLen = (int)((*anObjIt).size()); - for( j = 0 ; anIndex < aCurIndex + aObjLen; anIndex++, aPointer++, j++ ) - myByteArray[anIndex] = (*anObjIt)[j]; - aCurIndex = anIndex; - } - - return true; - } - - return false; -} - -/*! - Creates object by it's representation (byte array) - \param theArray - byte array - \param theType - type of object -*/ -GLViewer_Object* GLViewer_MimeSource::getObject( QByteArray theArray, QString theType ) -{ - if( !theArray.isEmpty() ) - { - if( theType == "GLViewer_MarkerSet" ) - { - GLViewer_MarkerSet* aObject = new GLViewer_MarkerSet( 0, (float)0.0, 0 ); - if( aObject->initializeFromByteCopy( theArray ) ) - return aObject; - } - else if ( theType == "GLViewer_Polyline" ) - { - GLViewer_Polyline* aObject = new GLViewer_Polyline( 0, (float)0.0, 0 ); - if( aObject->initializeFromByteCopy( theArray ) ) - return aObject; - } - else if( theType == "GLViewer_TextObject" ) - { - GLViewer_TextObject* aObject = new GLViewer_TextObject( 0, 0, 0, QColor(255,255,255), 0 ); - if( aObject->initializeFromByteCopy( theArray ) ) - return aObject; - } - } - - return NULL; -} - -/*! - Creates list of objects by its representation (byte array) - \param theArray - byte array - \param theType - type of object -*/ -QValueList GLViewer_MimeSource::getObjects( QByteArray theArray, QString theType ) -{ - if( !theArray.isEmpty() ) - { - int anISize = sizeof( int ); - if( theType == "GLViewer_Objects" ) - { - QStringList aTypeList; - QValueList aObjects; - QValueList aObjectList; - - QValueList aTypeSizeList; - QValueList aObjSizeList; - int aObjNum = 0; - char* aPointer = (char*)&aObjNum; - - int anIndex = 0, j = 0; - for( anIndex = 0; anIndex < anISize; anIndex++, aPointer++ ) - *aPointer = theArray[anIndex]; - - for( j = 0; j < aObjNum; j++ ) - { - int aTempVal = 0; - aPointer = (char*)&aTempVal; - for( ; anIndex < anISize*(j+2); anIndex++, aPointer++ ) - *aPointer = theArray[anIndex]; - aTypeSizeList.append( aTempVal ); - } - - int aCurIndex = anIndex; - for( j = 0; j < aObjNum; j++ ) - { - QString aTempStr; - for( ; anIndex < aCurIndex + aTypeSizeList[j]; anIndex++ ) - { - char aLetter = theArray[anIndex]; - aTempStr.append( aLetter ); - } - aTypeList.append( aTempStr ); - aCurIndex = anIndex; - } - - for( j = 0; j < aObjNum; j++ ) - { - int aTempVal = 0; - aPointer = (char*)&aTempVal; - for( ; anIndex < aCurIndex + anISize*(j+1); anIndex++, aPointer++ ) - *aPointer = theArray[anIndex]; - aObjSizeList.append( aTempVal ); - } - - aCurIndex = anIndex; - for( j = 0; j < aObjNum; j++ ) - { - QByteArray aTempArray(aObjSizeList[j]); - for( ; anIndex < aCurIndex + aObjSizeList[j]; anIndex++ ) - aTempArray[anIndex-aCurIndex] = theArray[anIndex]; - aObjects.append( aTempArray ); - aCurIndex = anIndex; - } - - for( j = 0; j < aObjNum; j++ ) - aObjectList.append( getObject( aObjects[j], aTypeList[j] ) ); - - return aObjectList; - } - } - - return QValueList(); -} - -/*! - \return format by index - \param theIndex - index -*/ -const char* GLViewer_MimeSource::format( int theIndex ) const -{ - switch( theIndex ) - { - case 0: return "GLViewer_Objects"; - //case 1: return "GLViewer_MarkerSet"; - //case 2: return "GLViewer_Polyline"; - //case 3: return "GLViewer_TextObject"; - default: return 0; - } - -} - -/*! - \return internal byte array -*/ -QByteArray GLViewer_MimeSource::encodedData( const char* theObjectType ) const -{ - if( theObjectType == "GLViewer_Objects" ) - return myByteArray; - - return QByteArray(); -} diff --git a/src/GLViewer/GLViewer_MimeSource.h b/src/GLViewer/GLViewer_MimeSource.h deleted file mode 100644 index 55262d1d1..000000000 --- a/src/GLViewer/GLViewer_MimeSource.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_MimeSource.h -// Created: November, 2004 - -#ifndef GLVIEWER_MIMESOURCE_H -#define GLVIEWER_MIMESOURCE_H - -#ifdef WNT -#include -#endif - -#include "GLViewer.h" - -#include -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -class GLViewer_Object; - -/*! - \class GLViewer_MimeSource - Needs for a work with QClipboard -*/ -class GLVIEWER_API GLViewer_MimeSource: public QMimeSource -{ -public: - GLViewer_MimeSource():QMimeSource(){}; - ~GLViewer_MimeSource(); - - //! Translate objects to byte array - bool setObjects( QValueList ); - //! Gets objects from byte array - /*If you want to use new class, following two method must be redefined*/ - static QValueList getObjects( QByteArray, QString theType); - //! Get object from byte array - /*If you want to use new class, following two method must be redefined*/ - static GLViewer_Object* getObject( QByteArray, QString theType); - - // Redefined methods - virtual const char* format( int theIndex = 0 ) const; - virtual QByteArray encodedData( const char* ) const; - -private: - QByteArray myByteArray; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Object.cxx b/src/GLViewer/GLViewer_Object.cxx deleted file mode 100644 index 7de98ed37..000000000 --- a/src/GLViewer/GLViewer_Object.cxx +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -//#include -#include "GLViewer_Object.h" -#include "GLViewer_Drawer.h" -#include "GLViewer_AspectLine.h" -#include "GLViewer_Geom.h" -#include "GLViewer_Text.h" -#include "GLViewer_Group.h" - -//#include -//using namespace std; - -/*! - Default constructor -*/ -GLViewer_Object::GLViewer_Object() -{ - myXScale = 1.0; - myYScale = 1.0; - myXGap = 0; - myYGap = 0; - myZoom = 1.0; - - myIsHigh = GL_FALSE; - myIsSel = GL_FALSE; - - myRect = new GLViewer_Rect();; - myUpdateRect = new GLViewer_Rect();; - myGLText = new GLViewer_Text( 0, 0, 0, QColor(0,0,0) ); - - myAspectLine = new GLViewer_AspectLine(); - myType = "GLViewer_Object"; - - myOwner = NULL; - myDrawer = NULL; - - myIsVisible = true; - - isToolTipHTML = false; - - myGroup = NULL; -} - -/*! - Destructor -*/ -GLViewer_Object::~GLViewer_Object() -{ - if( myRect ) - delete myRect; - - if( myUpdateRect ) - delete myUpdateRect; - - if( myGLText ) - delete myGLText; - - if( myAspectLine ) - delete myAspectLine; -} - -/*! - \return priority of object -*/ -int GLViewer_Object::getPriority() const -{ - return myDrawer ? myDrawer->getPriority() : 0; -} - -/*! - \return true if object is inside rectangle - \param theRect - rectangle -*/ -GLboolean GLViewer_Object::isInside( GLViewer_Rect theRect ) -{ - return theRect.toQRect().contains( myRect->toQRect() ); -} - -/*! - Sets zoom factor - \param zoom - zoom factor -*/ -GLboolean GLViewer_Object::setZoom( GLfloat zoom, bool, bool ) -{ - if( myZoom == zoom ) - return GL_FALSE; - - myZoom = zoom; - return GL_TRUE; -} - -/*! - Performs zoom change by step - \param zoomIn - to increase to decrease zoom -*/ -GLboolean GLViewer_Object::updateZoom( bool zoomIn ) -{ - float newZoom; - float step = zoomIn ? 1 : -1; - double epsilon = 0.001; - - if( myZoom - 1 > epsilon ) - newZoom = ( myZoom * 2 + step ) / 2; - else if( 1 - myZoom > epsilon ) - newZoom = 2 / ( 2 / myZoom - step ); - else - newZoom = zoomIn ? 3./2. : 2./3.; - - if( newZoom < 0.01 || newZoom > 100.0 ) - return GL_FALSE; - - return setZoom( newZoom, true ); -} - -/*! - Codes object as byte copy - \return byte array -*/ -QByteArray GLViewer_Object::getByteCopy() -{ - int i = 0; - int anISize = sizeof( int ); - - const char* aTypeStr = myType.data(); - const char* aToolTipStr = myToolTipText.data(); - - int aTypeLength = myType.length(); - int aToolTipLength = myToolTipText.length(); - - - QByteArray aGLText = myGLText->getByteCopy(); - QByteArray aAspect = myAspectLine->getByteCopy(); - - float aRectData[8]; - aRectData[ 0 ] = myRect->left(); - aRectData[ 1 ] = myRect->top(); - aRectData[ 2 ] = myRect->right(); - aRectData[ 3 ] = myRect->bottom(); - aRectData[ 4 ] = myXScale; - aRectData[ 5 ] = myYScale; - aRectData[ 6 ] = myXGap; - aRectData[ 7 ] = myYGap; - - int sizeOf8Float = sizeof( aRectData ); - - QByteArray aResult( 2*anISize + sizeOf8Float + - aTypeLength + aToolTipLength + - aGLText.size() + aAspect.size() ); - // puts 8 float values into the byte array - char* aPointer = (char*)&aRectData; - for( i = 0; i < sizeOf8Float; i++, aPointer++ ) - aResult[i] = *aPointer; - // puts length of type string - aPointer = (char*)&aTypeLength; - for( ; i < anISize + sizeOf8Float; i++, aPointer++ ) - aResult[i] = *aPointer; - // puts type string - for( ; i < anISize + sizeOf8Float + aTypeLength; i++ ) - aResult[i] = aTypeStr[i - anISize - sizeOf8Float ]; - // puts length of tooltiptext string - aPointer = (char*)&aToolTipLength; - for( ; i < 2*anISize + sizeOf8Float + aTypeLength; i++, aPointer++ ) - aResult[i] = *aPointer; - // puts tooltiptext string - for( ; i < 2*anISize + sizeOf8Float + aTypeLength + aToolTipLength; i++ ) - aResult[ i] = aToolTipStr[i - 2*anISize - sizeOf8Float - aTypeLength]; - - int aCurPos = 2*anISize + sizeOf8Float + aTypeLength + aToolTipLength; - // adds aspect byte array - for ( i = aCurPos; i < (int)( aCurPos + aAspect.size() ); i++ ) - aResult[i] = aAspect[i - aCurPos]; - - aCurPos = aCurPos + aAspect.size(); - // adds GL text byte array - for ( i = aCurPos; i < (int)( aCurPos + aGLText.size() ); i++ ) - aResult[i] = aGLText[i - aCurPos]; - - aCurPos += aGLText.size(); - aPointer = (char*)&myOwner; - for( i = 0; i < sizeof( SUIT_DataOwner* ); i++, aPointer++ ) - aResult[ aCurPos + i ] = *aPointer; - - return aResult; -} - -/*! - Initialize object by byte array - \param theArray - byte array -*/ -bool GLViewer_Object::initializeFromByteCopy( QByteArray theArray ) -{ - int i = 0; - int anISize = sizeof( int ); - int aFSize = sizeof( GLfloat ); - - float aLeft = 0, aTop = 0, aRight = 0, aBottom = 0; - - //QString aTypeStr, aToolTipStr; - int aTypeLength = 0, aToolTipLength = 0; - - int aSize = theArray.size(); - - GLViewer_Text* aGLText = new GLViewer_Text( 0, 0, 0, QColor(255,255,255)); - int aGLTextMinSize = (aGLText->getByteCopy()).size(); - GLViewer_AspectLine* aAspectLine = new GLViewer_AspectLine(); - int aGLAspLineSize = (aAspectLine->getByteCopy()).size(); - - QByteArray aGLTextArray, aAspect( aGLAspLineSize ); - - if( aSize < 2*anISize + 8*aFSize + aGLTextMinSize + aGLAspLineSize ) - return false; - - char* aPointer = (char*)&aLeft; - for( i = 0; i < aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&aTop; - for( ; i < 2*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&aRight; - for( ; i < 3*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&aBottom; - for( ; i < 4*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - - //myRect = new QRect( aLeft, aTop, aRight - aLeft, aBottom - aTop ); - myRect = new GLViewer_Rect( aLeft, aRight, aTop, aBottom ); - - aPointer = (char*)&myXScale; - for( ; i < 5*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&myYScale; - for( ; i < 6*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&myXGap; - for( ; i < 7*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - aPointer = (char*)&myYGap; - for( ; i < 8*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - - myIsHigh = false; - myIsSel = false; - myIsVisible = true; - - aPointer = (char*)&aTypeLength; - for( ; i < anISize + 8*aFSize; i++, aPointer++ ) - *aPointer = theArray[i]; - myType = ""; - for( ; i < anISize + 8*aFSize + aTypeLength; i++ ) - { - QChar aChar( theArray[i] ); - myType += aChar; - } - - aPointer = (char*)&aToolTipLength; - for( ; i < 2*anISize + 8*aFSize + aTypeLength; i++, aPointer++ ) - *aPointer = theArray[i]; - myToolTipText= ""; - for( ; i < 2*anISize + 8*aFSize + aTypeLength + aToolTipLength; i++ ) - { - QChar aChar( theArray[i] ); - myToolTipText += aChar; - } - - int aCurPos = 2*anISize + 8*aFSize + aTypeLength + aToolTipLength; - if( aSize - aCurPos < aGLTextMinSize + aGLAspLineSize ) - return false; - - for( i = 0; i < aGLAspLineSize; i++ ) - aAspect[i] = theArray[ aCurPos + i ]; - myAspectLine = GLViewer_AspectLine::fromByteCopy( aAspect ); - - aCurPos = aCurPos + aGLAspLineSize; - aGLTextArray.resize( aSize - aCurPos ); - for( i = 0; i + aCurPos < aSize; i++ ) - aGLTextArray[i] = theArray[ aCurPos + i ]; - // replace gl_text pointer by other - if ( myGLText ) - delete myGLText; - myGLText = GLViewer_Text::fromByteCopy( aGLTextArray ); - - return true; -} - -/*! - Sets object's group - \param theGroup - group -*/ -void GLViewer_Object::setGroup( GLViewer_Group* theGroup ) -{ - if ( myGroup == theGroup ) - return; - - if( myGroup ) - myGroup->removeObject( this ); - - myGroup = theGroup; - if( theGroup ) - myGroup->addObject( this ); -} - -/*! - \return object's group -*/ -GLViewer_Group* GLViewer_Object::getGroup() const -{ - return myGroup; -} diff --git a/src/GLViewer/GLViewer_Object.h b/src/GLViewer/GLViewer_Object.h deleted file mode 100644 index 2384bb440..000000000 --- a/src/GLViewer/GLViewer_Object.h +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Object.h -// Created: November, 2004 - -#ifndef GLVIEWER_OBJECT_H -#define GLVIEWER_OBJECT_H - -#ifdef WNT -#include -#endif - -#include "GLViewer.h" -#include "GLViewer_Defs.h" -#include "GLViewer_Geom.h" - -#include - -#include - -#include -#include -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -class GLViewer_Drawer; -class GLViewer_AspectLine; -class GLViewer_Group; -class GLViewer_CoordSystem; -class GLViewer_Text; -//class GLViewer_Owner; - -/*! - * Class GLViewer_Object - * Base Object for all GLViewer objects - */ -class GLVIEWER_API GLViewer_Object -{ -public: - //! A constructor - GLViewer_Object(); - //! A destructor - virtual ~GLViewer_Object(); - - //! Main method. Computes all needed information about object for presentation in drawer - virtual void compute() = 0; - //! Creates correspond drawer - virtual GLViewer_Drawer* createDrawer() = 0; - - //! Installing already exist drawer with same type - virtual void setDrawer( GLViewer_Drawer* theDrawer ) { myDrawer = theDrawer; } - //! Returns current drawer - GLViewer_Drawer* getDrawer() const { return myDrawer; } - - //! Computes highlight presentation - /*! - *\param x - x coord - *\param y - y coord - *\param tol - tolerance of detecting - *\param isCircle - = true if sensitive area of detection is round - */ - virtual GLboolean highlight( GLfloat x, - GLfloat y, - GLfloat tol, - GLboolean isCircle = GL_FALSE ) = 0; - //! Clears all highlight information - virtual GLboolean unhighlight() = 0; - - //! Computes select presentation - /*! - *\param x - x coord - *\param y - y coord - *\param tol - tolerance of detecting - *\param rect - Non empty for rectangle selection - *\param isFull - = true if - *\param isCircle - = true if sensitive area of detection is round - *\param isShift - = true if selection exec with append option - */ - virtual GLboolean select( GLfloat x, - GLfloat y, - GLfloat tol, - GLViewer_Rect rect, - GLboolean isFull = GL_FALSE, - GLboolean isCircle = GL_FALSE, - GLboolean isShift = GL_FALSE ) = 0; - //! Clears all select information - virtual GLboolean unselect() = 0; - - //! Returns if theRect inside object - virtual GLboolean isInside( GLViewer_Rect theRect); - - //!\warning It is for ouv - virtual bool portContains( GLViewer_Pnt ) { return false; } - //!\warning It is for ouv - virtual bool startPulling( GLViewer_Pnt ) { return false; } - //!\warning It is for ouv - virtual void pull( GLViewer_Pnt, GLViewer_Object* ) {} - //!\warning It is for ouv - virtual void finishPulling() {} - //!\warning It is for ouv - virtual bool isPulling() { return false; } - //!\warning It is for ouv - virtual GLViewer_Rect getPullingRect() const { return GLViewer_Rect( - myRect->left(), myRect->right(), myRect->top(), myRect->bottom() ); } - - //! Installs object rectangle - virtual void setRect( GLViewer_Rect* rect) { myRect = rect; } - //! Returns object rectungle - virtual GLViewer_Rect* getRect() const { return myRect; } - //! Returns update object rectangle - /*! Does not equal getRect() if object have a persistence to some viewer transformations*/ - virtual GLViewer_Rect* getUpdateRect() = 0; - - //! Installs scale factors - virtual void setScale( GLfloat xScale, GLfloat yScale ) { myXScale = xScale; myYScale = yScale; } - //! Returns scale factors - virtual void getScale( GLfloat& xScale, GLfloat& yScale ) const { xScale = myXScale; yScale = myYScale;} - - //!\warning It is for ouv - virtual GLboolean setZoom( GLfloat zoom, bool recompute, bool fromGroup = false ); - //!\warning It is for ouv - virtual GLfloat getZoom() const { return myZoom; } - //!\warning It is for ouv - virtual GLboolean updateZoom( bool zoomIn ); - - //! Returns true if object is highlighted - virtual GLboolean isHighlighted() const { return myIsHigh; } - //! Returns true if object is selected - virtual GLboolean isSelected() const { return myIsSel; } - //! Installs select status to object - virtual void setSelected( GLboolean state ) { myIsSel = state; } - - //! Installs GLText to object - void setGLText( GLViewer_Text* glText ) { myGLText = glText; } - //! Returns object GLText - GLViewer_Text* getGLText() const { return myGLText; } - - //! Installs acpect line for object presentation - virtual void setAspectLine ( GLViewer_AspectLine* aspect ) { myAspectLine = aspect; } - //! Returns acpect line of object presentation - virtual GLViewer_AspectLine* getAspectLine() const { return myAspectLine; } - - //! Returns object type - /*! Needs for GLViewer_Drawer*/ - QString getObjectType() const { return myType; } - - //! Installs object name - void setName( QString name ) { myName = name; } - //! Returns object name - QString getName() const { return myName; } - - //! Returns object priority - virtual int getPriority() const; - - //! Moves object per by recomputing - /*! - *\param dx - moving along X coord - *\param dy - moving along Y coord - *\param fromGroup - = true if this method called from group - */ - virtual void moveObject( float dx, float dy, bool fromGroup = false ) = 0; - //! Finaly recomputing object after moving - virtual bool finishMove() { return true; } - - //! Returns visible object status - virtual bool getVisible() const { return myIsVisible; } - //! Installs visible object status - virtual void setVisible( bool theStatus ) { myIsVisible = theStatus; } - - //! Installs onject tool tip text - void setToolTipText( QString str ){ myToolTipText = str; } - //! Returns onject tool tip text - virtual QString getToolTipText(){ return myToolTipText; } - - //! Returns true if tool tip contains HTML tags - bool isTooTipHTML() const { return isToolTipHTML; } - //! Installs tool tip supporting of HTML tags - void setToolTipFormat( bool isHTML ) { isToolTipHTML = isHTML; } - - //! A function for coding object to the byte copy - /*! A function is used for copy-past technollogy in copy method */ - virtual QByteArray getByteCopy(); - //! A function for decoding object from the byte copy - /*! A function is used for copy-past technollogy in past method */ - virtual bool initializeFromByteCopy( QByteArray ); - - //! A function translate object in to PostScript file on disk - /*! - *\param hFile the name of PostScript file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aPSCS the GLViewer_CoordSystem of PostScript page - */ - virtual bool translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) = 0; - //! A function translate object in to HPGL file on disk - /*! - *\param hFile the name of PostScript file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aHPGLCS the GLViewer_CoordSystem of PostScript page - */ - virtual bool translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS ) = 0; - -#ifdef WIN32 - //! A function translate object in to EMF file on disk - /*! - *\warning WIN32 only - * - *\param dc the name of HDC associated with file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aEMFCS the GLViewer_CoordSystem of EMF page - */ - virtual bool translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ) = 0; -#endif - //!\warning It is for ouv - SUIT_DataOwner* owner() const { return myOwner; } - //!\warning It is for ouv - void setOwner( SUIT_DataOwner* owner ) { myOwner = owner; } - - //! Adds object to group theGroup - void setGroup( GLViewer_Group* theGroup ); - //! Returns object group - GLViewer_Group* getGroup() const; - - //!\warning It is for ouv - virtual GLViewer_Object* getOwner() { return this; } - - //! Returns true if object can be selected - virtual bool isSelectable() { return true; } - //!\warning It is for ouv - virtual bool isScalable() { return true; } - -protected: - //! Object name - QString myName; - //! Object type - QString myType; - - //! Object base rect - GLViewer_Rect* myRect; - //! Update object rect (after some viewer transformations) - GLViewer_Rect* myUpdateRect; - //! Object GLText - GLViewer_Text* myGLText; - - //! X scale factor - GLfloat myXScale; - //! Y scale factor - GLfloat myYScale; - //! Gap for X direction of rect - GLfloat myXGap; - //! Gap for Y direction of rect - GLfloat myYGap; - - //!\warning It is for ouv - GLfloat myZoom; - - //! Highlight status - /*! = true after right highlighting*/ - GLboolean myIsHigh; - //! Selectt status - /*! = true after right selection*/ - GLboolean myIsSel; - - //! Object drawer - GLViewer_Drawer* myDrawer; - //! Line aspect for object presentation - GLViewer_AspectLine* myAspectLine; - - //! Objet tool tip text - QString myToolTipText; - //! HTML object tool tip status - /*! = true if tool tip text contains HTML tags */ - bool isToolTipHTML; - - //! Object visibke status - bool myIsVisible; - - //!\warning It is for ouv - SUIT_DataOwner* myOwner; - - //! Object Group - GLViewer_Group* myGroup; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Selector.cxx b/src/GLViewer/GLViewer_Selector.cxx deleted file mode 100644 index 4e4c91aea..000000000 --- a/src/GLViewer/GLViewer_Selector.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Selector.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Selector.h" - -#include "GLViewer_Viewer.h" - -int GLViewer_Selector::apppendKey = Qt::ShiftButton; - -/*! - Constructor -*/ -GLViewer_Selector::GLViewer_Selector( GLViewer_Viewer* viewer ) -: QObject( 0 ), -myViewer( viewer ), -myLocked( false ), -myMinRectSize( 1, 1 ) -{ -} - -/*! - Destructor -*/ -GLViewer_Selector::~GLViewer_Selector() -{ -} - -/*! - Sets the min size of rectangle to treat it as a rectangle for multiple - selection( sensitivity ). If a rectangle size is less than that min size, - the right-bottom point of the rectangle will be used for single selection. - The default min size is ( 1,1 ). [ public ] -*/ -void GLViewer_Selector::setMinRectSize( const QSize& minSize ) -{ - myMinRectSize = minSize; -} - -/*! - Locks / unlocks the selector. If locked, nothing can be selected - regadless of the selection mode. [ public ] -*/ -void GLViewer_Selector::lock( bool locked ) -{ - myLocked = locked; -} diff --git a/src/GLViewer/GLViewer_Selector.h b/src/GLViewer/GLViewer_Selector.h deleted file mode 100644 index 6c0672843..000000000 --- a/src/GLViewer/GLViewer_Selector.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Selector.h -// Created: November, 2004 - -#ifndef GLVIEWER_SELECTOR_H -#define GLVIEWER_SELECTOR_H - -#include "GLViewer.h" -#include "GLViewer_Defs.h" - -#include -#include - -#include - -class GLViewer_Viewer; - -/*! - \Class GLViewer_Selector - Base class for object selection in SUIT-based application -*/ -class GLVIEWER_API GLViewer_Selector : public QObject -{ - Q_OBJECT - -public: - GLViewer_Selector( GLViewer_Viewer* ); - ~GLViewer_Selector(); - -public: - //! Sets lock status (enable/disable interavtive) - void lock( bool ); - void setMinRectSize( const QSize& minSize ); - - //! Highlights in point (x,y) - virtual void detect( int x, int y ) = 0; - virtual void undetectAll() = 0; - - //! Selects highlight objects - virtual void select( bool append = false ) = 0; - //! Selects by rect - virtual void select( const QRect&, bool append = false ) = 0; - virtual void unselectAll() = 0; - virtual int numSelected() const = 0; - - virtual void setHilightColor( Quantity_NameOfColor ) = 0; - virtual void setSelectColor( Quantity_NameOfColor ) = 0; - //!Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel' - /*!Should be called by after non-interactive selection. */ - virtual void checkSelection( int, bool, int ) = 0; - - /*! Sets/returns the key for appending selected objects ( SHIFT by default ) */ - static int appendKey() { return apppendKey; } - static void setAppendKey( int k ) { apppendKey = k; } - -signals: - void selSelectionCancel(); - void selSelectionDone( bool append, SelectionChangeStatus status ); - -protected: -// void setStatus( SelectionChangeStatus theStatus ){ myStatus = theStatus; } -// SelectionChangeStatus status( return myStatus; } - - GLViewer_Viewer* myViewer; - bool myLocked; - QSize myMinRectSize; - -private: -// SelectionChangeStatus myStatus; - static int apppendKey; -}; - -#endif diff --git a/src/GLViewer/GLViewer_Selector2d.cxx b/src/GLViewer/GLViewer_Selector2d.cxx deleted file mode 100644 index 067b29541..000000000 --- a/src/GLViewer/GLViewer_Selector2d.cxx +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Selector2d.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Selector2d.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_Context.h" -#include "GLViewer_ViewPort2d.h" - -/*! - Constructor -*/ -GLViewer_Selector2d::GLViewer_Selector2d( GLViewer_Viewer2d* v2d, GLViewer_Context* glc ) : -GLViewer_Selector( v2d ), -myGLContext( glc ) -{ -// myGLContext->SetHighlightColor( Quantity_NOC_CYAN1 ); -// myGLContext->SetSelectionColor( Quantity_NOC_RED ); -} - -/*! - Destructor -*/ -GLViewer_Selector2d::~GLViewer_Selector2d() -{ -} - -/*! - Changes hilight color of context - \param color - new hilight color -*/ -void GLViewer_Selector2d::setHilightColor( Quantity_NameOfColor color ) -{ - myGLContext->SetHighlightColor( color ); -} - -/*! - Changes selection color of context - \param color - new selection color -*/ -void GLViewer_Selector2d::setSelectColor( Quantity_NameOfColor color ) -{ - myGLContext->SetSelectionColor( color ); -} - -/*! - Detects object at point - \param x, y - point co-ordinates -*/ -void GLViewer_Selector2d::detect( int x, int y ) -{ - //cout << "GLViewer_Selector2d : detect ( " << x << " , " << y << " )" << endl; - if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() || - myViewer->getSelectionMode() == GLViewer_Viewer::NoSelection ) - return; - - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - if( !vp->inherits( "GLViewer_ViewPort2d" ) ) - return; - - myGLContext->MoveTo( x, y ); -} - -/*! - Undetects all objects -*/ -void GLViewer_Selector2d::undetectAll() -{ - if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() || - myViewer->getSelectionMode() == GLViewer_Viewer::NoSelection ) - return; - - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - if( !vp->inherits( "GLViewer_ViewPort2d" ) ) - return; - - myGLContext->clearHighlighted( true ); -} - -/*! - Selects previously hilighted objects - \param append - append objects to selection -*/ -void GLViewer_Selector2d::select( bool append ) -{ - //cout << "GLViewer_Selector2d : select ( " << (int)append << " )" << endl; - GLViewer_Viewer::SelectionMode selMode = myViewer->getSelectionMode(); - if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() || - selMode == GLViewer_Viewer::NoSelection ) - return; - - int selBefore = numSelected(); - if ( selBefore && append && selMode != GLViewer_Viewer::Multiple ) - return; - - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - if( !vp->inherits( "GLViewer_ViewPort2d" ) ) - return; - - int status = myGLContext->Select( append ); - checkSelection( selBefore, append, status ); -} - -/*! - Selects objects in rectangle - \param selRect - selection rectangle - \param append - append objects to selection -*/ -void GLViewer_Selector2d::select( const QRect& selRect, bool append ) -{ - GLViewer_Viewer::SelectionMode selMode = myViewer->getSelectionMode(); - if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() || - selMode == GLViewer_Viewer::NoSelection ) - return; - - int selBefore = numSelected(); - if ( selBefore && append && selMode != GLViewer_Viewer::Multiple ) - return; - - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - if( !vp->inherits( "GLViewer_ViewPort2d" ) ) - return; - - int aStatus = myGLContext->SelectByRect( selRect, append ); - checkSelection( selBefore, append, aStatus ); -} - -/*! - Unselects all objects -*/ -void GLViewer_Selector2d::unselectAll() -{ - if ( myLocked || !myViewer ) - return; - -// bool updateViewer = true; - bool hadSelection = ( numSelected() > 0 ); - -// bool lcOpen = ( myAISContext->IndexOfCurrentLocal() != -1 ); -// lcOpen ? myAISContext->ClearSelected( updateViewer ) : -// myAISContext->ClearCurrent( updateViewer ); - if ( hadSelection ) emit selSelectionCancel(); -} - -/*! - Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel' - Should be called by after non-interactive selection. -*/ -void GLViewer_Selector2d::checkSelection( int selBefore, bool append, int aStatus ) -{ - int selAfter = numSelected(); - if ( selBefore > 0 && selAfter < 1 ) - emit selSelectionCancel(); - else if ( selAfter > 0 ) - { - switch( aStatus ) - { - case SS_LocalChanged: - emit selSelectionDone( selAfter > 1, SCS_Local ); - break; - case SS_GlobalChanged: - emit selSelectionDone( selAfter > 1, SCS_Global ); - break; - } - } -} - -/*! - \return number of selected objects -*/ -int GLViewer_Selector2d::numSelected() const -{ - return myGLContext->NbSelected(); -} - diff --git a/src/GLViewer/GLViewer_Selector2d.h b/src/GLViewer/GLViewer_Selector2d.h deleted file mode 100644 index 34da93d59..000000000 --- a/src/GLViewer/GLViewer_Selector2d.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Selector2d.h -// Created: November, 2004 - -#ifndef GLVIEWER_SELECTOR2D_H -#define GLVIEWER_SELECTOR2D_H - -#ifdef WNT -#include "windows.h" -#endif - -#include "GLViewer_Selector.h" - -#include - -class GLViewer_Viewer2d; -class GLViewer_Context; - -/*! - \class GLViewer_Selector2d - 2D select manager for GLViewer -*/ -class GLVIEWER_API GLViewer_Selector2d : public GLViewer_Selector -{ - Q_OBJECT - -public: - GLViewer_Selector2d( GLViewer_Viewer2d*, GLViewer_Context* ); - ~GLViewer_Selector2d(); - -public: - //! Sets context from Viewer2d - void setContext( GLViewer_Context* glc ) { myGLContext = glc; } - GLViewer_Context* getContext() const { return myGLContext; } - - // Redefined methods - virtual void setHilightColor( Quantity_NameOfColor ); - virtual void setSelectColor( Quantity_NameOfColor ); - - virtual void detect( int, int ); - virtual void undetectAll(); - - virtual void select( bool append = false ); - virtual void select( const QRect&, bool append = false ); - virtual void unselectAll(); - virtual int numSelected() const; - - virtual void checkSelection( int, bool, int ); - -protected: - GLViewer_Context* myGLContext; -}; - -#endif diff --git a/src/GLViewer/GLViewer_Text.cxx b/src/GLViewer/GLViewer_Text.cxx deleted file mode 100644 index f4dba3a47..000000000 --- a/src/GLViewer/GLViewer_Text.cxx +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -//#include -#include "GLViewer_Text.h" - -/*! - Constructor -*/ -GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color ) -{ - myText = text; - myXPos = xPos; - myYPos = yPos; - myColor = color; - myQFont = QFont::defaultFont(); - mySeparator = 2; - myDTF = DTF_BITMAP; -} - -/*! - Constructor -*/ -GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color, QFont theFont, int theSeparator ) -{ - myText = text; - myXPos = xPos; - myYPos = yPos; - myColor = color; - myQFont = theFont; - mySeparator = theSeparator; - myDTF = DTF_BITMAP; -} - -/*! - Destructor -*/ -GLViewer_Text::~GLViewer_Text() -{ -} - -/*! - \return width of text -*/ -int GLViewer_Text::getWidth() -{ - int aResult = 0; - QFontMetrics aFM( myQFont ); - for( uint i = 0; i < myText.length(); i++ ) - aResult += aFM.width( myText.at(i) ) + mySeparator; - return aResult; -} - -/*! - \return height of text -*/ -int GLViewer_Text::getHeight() -{ - QFontMetrics aFM( myQFont ); - return aFM.height(); -} - -/*! - Codes object as byte copy - \return byte array -*/ -QByteArray GLViewer_Text::getByteCopy() const -{ - int i; - int aSize = 5*sizeof( int ) + myText.length(); - - int aR = myColor.red(); - int aG = myColor.green(); - int aB = myColor.blue(); - const char* aStr = myText.data(); - - int anISize = sizeof( int ); - QByteArray aResult( aSize ); - - char* aPointer = (char*)&myXPos; - for( i = 0; i < anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&myYPos; - for( ; i < 2*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - aPointer = (char*)&aR; - for( ; i < 3*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aG; - for( ; i < 4*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - aPointer = (char*)&aB; - for( ; i < 5*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - int aTextSize = myText.length(); - aPointer = (char*)&aTextSize; - for( ; i < 6*anISize; i++, aPointer++ ) - aResult[i] = *aPointer; - - for( i = 0; i < aTextSize; i++ ) - aResult[6*anISize + i] = aStr[i]; - - aPointer = (char*)&mySeparator; - for( ; i < 7*anISize + aTextSize; i++, aPointer++ ) - aResult[i] = *aPointer; - - const char* aFontStr = myQFont.toString().data(); - int aFontSize = myQFont.toString().length(); - - for( i = 0; i < aFontSize; i++ ) - aResult[7*anISize + aTextSize + i] = aFontStr[i]; - - return aResult; -} - -/*! - Initialize text from binary representation - \param theBuf - byte array -*/ -GLViewer_Text* GLViewer_Text::fromByteCopy( QByteArray theBuf ) -{ - int i = 0; - int aSize = (int)theBuf.size(); - int aR = 0, aG = 0, aB = 0; - - int xPos = 0, yPos = 0; - - int anISize = sizeof( int ); - char* aPointer = (char*)&xPos; - for ( i = 0; i < anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - - aPointer = (char*)&yPos; - for ( ; i < 2*anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - - aPointer = (char*)&aR; - for( ; i < 3*anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - aPointer = (char*)&aG; - for( ; i < 4*anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - aPointer = (char*)&aB; - for( ; i < 5*anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - - int aTextSize = 0; - aPointer = (char*)&aTextSize; - for( ; i < 6*anISize; i++, aPointer++ ) - *aPointer = theBuf[i]; - - QString aText; - for( ; i < 6*anISize + aTextSize; i++ ) - { - QChar aChar( theBuf[i] ); - aText += aChar; - } - - int aSeparator = 0; - aPointer = (char*)&aSeparator; - for( ; i < 7*anISize + aTextSize; i++, aPointer++ ) - *aPointer = theBuf[i]; - - QString aFontStr; - for( ; i < aSize; i++ ) - { - QChar aChar( theBuf[i] ); - aFontStr += aChar; - } - QFont aFont; - - if( !aFont.fromString( aFontStr ) ) - return NULL; - - GLViewer_Text* aGlText = new GLViewer_Text( aText, xPos, yPos, QColor( aR,aG,aB ), aFont, aSeparator ); - - return aGlText; -} diff --git a/src/GLViewer/GLViewer_Text.h b/src/GLViewer/GLViewer_Text.h deleted file mode 100644 index edf680e7b..000000000 --- a/src/GLViewer/GLViewer_Text.h +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Text.h -// Created: November, 2004 - -#ifndef GLVIEWER_TEXT_H -#define GLVIEWER_TEXT_H - -#ifdef WNT -#include -#endif - -#include "GLViewer.h" -#include "GLViewer_Defs.h" - -#include - -#include -#include -#include -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_Text - Substitution of Prs3d_Text for OpenGL -*/ -class GLVIEWER_API GLViewer_Text -{ -public: - GLViewer_Text( const QString&, float xPos = 0.0, float yPos = 0.0, const QColor& color = QColor( 0, 255, 0 ) ); - GLViewer_Text( const QString&, float xPos, float yPos, const QColor& , QFont theFont, int theSeparator); - ~GLViewer_Text(); - - //! Sets text - void setText( const QString& text ) { myText = text; } - //! Returns text - QString getText() const { return myText; } - - //! Sets text position - void setPosition( float xPos, float yPos ) { myXPos = xPos; myYPos = yPos; } - //! Returns text position - void getPosition( float& xPos, float& yPos ) { xPos = myXPos; yPos = myYPos; } - - //! Sets text color - void setColor( const QColor& color ) { myColor = color; } - //! Returns text color - QColor getColor() const { return myColor; } - - //! Sets text font - void setFont( const QFont theQFont) { myQFont = theQFont; } - //! Returns text font - QFont getFont() const { return myQFont; } - - //! Returns text separator - int getSeparator(){ return mySeparator; } - //! Sets text separator - void setSeparator( int theSep ){ mySeparator = theSep; } - - //! Returns text width - int getWidth(); - //! Returns text height - int getHeight(); - - //! A function for coding object to the byte copy - /*! A function is used for copy-past technollogy in copy method */ - QByteArray getByteCopy() const; - - //! A function for decoding object from the byte copy - /*! A function is used for copy-past technollogy in past method */ - static GLViewer_Text* fromByteCopy( QByteArray ); - - //! Sets text format BITMAP or TEXTURE - DisplayTextFormat getDisplayTextFormat() const { return myDTF; } - //! Returns text format BITMAP or TEXTURE - void setTextDisplayFormat( DisplayTextFormat theDTF ) { myDTF = theDTF; } - -protected: - QString myText; - float myXPos; - float myYPos; - QColor myColor; - QFont myQFont; - int mySeparator; - DisplayTextFormat myDTF; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_ToolTip.cxx b/src/GLViewer/GLViewer_ToolTip.cxx deleted file mode 100644 index c4449265c..000000000 --- a/src/GLViewer/GLViewer_ToolTip.cxx +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ToolTip.xx -// Created: March, 2005 - -//#include "GLViewerAfx.h" -#include "GLViewer_Context.h" -#include "GLViewer_ToolTip.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_ViewPort2d.h" - -#include -#include -#include -#include -#include - -/*! - constructor -*/ -GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent ) -:QObject(), - myText(), - myPoint( -1, -1 ) -{ - mypViewPort = theParent; - //mypLabel = NULL; - mypLabel = new QLabel( "Test", NULL, "ObjectTipText", - WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); - mypLabel->setMargin( 1 ); - mypLabel->setAutoMask( FALSE ); - mypLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); - mypLabel->setLineWidth( 1 ); - mypLabel->setAlignment( AlignAuto | AlignTop ); - mypLabel->setIndent( 0 ); - mypLabel->polish(); - - //mypLabel->setPalette( QToolTip::palette() ); - - mypTimer = new QTimer( this ); - - connect( mypTimer, SIGNAL( timeout() ), this, SLOT( showTip() ) ); -} - -/*! - destructor -*/ -GLViewer_ObjectTip::~GLViewer_ObjectTip() -{ -// delete mypRect; - if( mypLabel ) - delete mypLabel; - - //if( mypPoint ) - // delete mypPoint; - - //if( mypTimer ) - // delete mypTimer; -} - - -/*! - It is called when there is a possibility that a tool tip should be shown - \param p - position of tooltip -*/ -bool GLViewer_ObjectTip::maybeTip( const QPoint &p ) -{ - - - GLViewer_Context* aContext = ((GLViewer_Viewer2d*)mypViewPort->getViewFrame()->getViewer())->getGLContext(); - - /*if( !aContext->currentObjectIsChanged() ) - return false; - else - return true; - if( myPoint.x() == -1 && myPoint.y() == -1 || aContext->currentObjectIsChanged()) - { - myPoint = p; - } - else/if( abs(myPoint.y() - p.y()) < 16 ) - { - return; - } - else // > 16 - { - myPoint = p; - } -*/ - GLViewer_Object* anObj = aContext->getCurrentObject(); - if( anObj ) - { - setText( anObj->getName() ); - return true; - } - - return false; - /*if( anObj ) - { - //GLViewer_Rect* aRect = anObj->getRect(); - //QRect aWinRect = mypViewPort->GLV2win( *aRect ); - tip( QRect( p.x(), p.y(), 1, 1 ), anObj->getName() ); - //QFontMetrics aFM( font() ); - //showTip( aWinRect, anObj->getName(), QRect( 0, 0, aFM.width( anObj->getName() + " " ), aFM.height()*1.5 ) ); - //tip( aWinRect, anObj->getName(), aWinRect( aFM.width( anObj->getName() + " " ), aFM.height()*1.5 ) ); - } -// else -// clear(); - - //tip( QRect( 0, 0, mypViewPort->getGLWidget()->width(),mypViewPort->getGLWidget()->height() ) , "test Tool tip" ); - */ -} - -/*! - Custom event filter -*/ -bool GLViewer_ObjectTip::eventFilter( QObject* theObj, QEvent* e ) -{ - hideTipAndSleep(); - switch( e->type() ) - { - /*case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - case QEvent::KeyPress: - case QEvent::KeyRelease: - // input - turn off tool tip mode - hideTipAndSleep(); - break;*/ - case QEvent::MouseMove: - { - //hideTipAndSleep(); - /*if( mypTimer->isActive() ) - { - mypTimer->Stop(); - wakeUp(); - }*/ - QWidget* aWidget = (QWidget*) theObj; - if( aWidget == mypViewPort->getGLWidget() ) - { - wakeup(); - QMouseEvent* m = (QMouseEvent *)e; - //if( !mypPoint ) - // mypPoint = new QPoint(); - - myPoint.setX( m->x() ); - myPoint.setY( m->y() ); - } - } - } - return false; -} - -/*! - Hides tooltip and stops timer -*/ -void GLViewer_ObjectTip::hideTipAndSleep() -{ - //if( mypPoint ) - // delete mypPoint; - myPoint.setX(-1); - myPoint.setY(-1); - - if( mypLabel ) - { - mypLabel->hide(); - //delete mypLabel; - } - mypTimer->stop(); -} - -/*! - Shows tooltip -*/ -void GLViewer_ObjectTip::showTip() -{ - if( maybeTip( myPoint ) ) - { - - mypLabel->setText( myText ); - mypLabel->adjustSize( ); - - QPoint pos = mypViewPort->getGLWidget()->mapToGlobal( myPoint ); - - //mypLabel->show(); - int cur_height = 24; - QCursor* aCursor = QApplication::overrideCursor(); - if( aCursor ) - { - const QBitmap* aBitmap = aCursor->bitmap(); - if( aBitmap ) - cur_height = aBitmap->height(); - } - mypLabel->setGeometry( pos.x(), pos.y() + cur_height, mypLabel->width(), mypLabel->height() ); - mypLabel->setPalette( QToolTip::palette() ); - - mypLabel->show(); - - } -} - -/*! - Restarts timer -*/ -void GLViewer_ObjectTip::wakeup( int theTime ) -{ - if( mypTimer->isActive() ) - mypTimer->stop(); - mypTimer->start( theTime ); -} diff --git a/src/GLViewer/GLViewer_ToolTip.h b/src/GLViewer/GLViewer_ToolTip.h deleted file mode 100644 index 508679b6a..000000000 --- a/src/GLViewer/GLViewer_ToolTip.h +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ToolTip.h -// Created: March, 2005 - -#ifndef GLVIEWER_TOOLTIP_H -#define GLVIEWER_TOOLTIP_H - -#include "GLViewer.h" - -//#include -//#include -#include - -#define TIP_TIME 1000 - -class GLViewer_ViewPort2d; -class QLabel; -/*! - \class GLViewer_ObjectTip - ToolTip of GLViewer_Objects -*/ -class GLVIEWER_API GLViewer_ObjectTip: public QObject//QToolTip//QtxToolTip -{ - Q_OBJECT -public: - GLViewer_ObjectTip( GLViewer_ViewPort2d* ); - ~GLViewer_ObjectTip(); - -//protected: -// virtual void maybeTip( const QPoint& p ); - virtual bool eventFilter( QObject*, QEvent* ); - - virtual bool maybeTip( const QPoint&); - - void setText( const QString& theText ){ myText = theText; } - QString getText() const { return myText; } - -protected: - void timeIsOut(); - -private: - - void hideTipAndSleep(); - void wakeup( int mseconds = TIP_TIME ); - -private slots: - void showTip(); - -private: - GLViewer_ViewPort2d* mypViewPort; - - QTimer* mypTimer; - QPoint myPoint; - QLabel* mypLabel; - - QString myText; -}; - -#endif //GLVIEWER_TOOLTIP_H diff --git a/src/GLViewer/GLViewer_Tools.cxx b/src/GLViewer/GLViewer_Tools.cxx deleted file mode 100644 index 1f270a253..000000000 --- a/src/GLViewer/GLViewer_Tools.cxx +++ /dev/null @@ -1,1223 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Tools.cxx -// Created: April, 2005 - -#include "GLViewer_Tools.h" - -#include - -#include - -/*! - Constructor - \param size - size of internal array -*/ -GLViewer_LineList::GLViewer_LineList( int size ) -{ - myRealSize = 2*size; - mySegmentNumber = 0; - myMainCoord = 0.0; - - myArray = new double[myRealSize]; - - if( !myArray ) - { - std::cout << "Can't allocate memory: " << size << std::endl; - myRealSize = 0; - } - else - memset( myArray, 0, myRealSize*sizeof(double) ); -} - -/*! - Destructor -*/ -GLViewer_LineList::~GLViewer_LineList() -{ - delete myArray; -} - -/*! - Adds new line segment to list - \param coord1, coord2 - co-ordinates of points -*/ -bool GLViewer_LineList::addSegment( double coord1, double coord2 ) -{ - if( coord1 > coord2 ) - { - double temp = coord1; - coord1 = coord2; - coord2 = temp; - } - - if( 2*mySegmentNumber == myRealSize || !myArray ) - return false; - - int index = 0; - double c1, c2; - while( index < mySegmentNumber) - { - readSegment( index, c1, c2 ); - if( coord1 < c1 && coord2 < c1 ) - { - for( int i = mySegmentNumber; i > index - 1; i--) - { - myArray[2*i] = myArray[2*i-2]; //2*(i-1) - myArray[2*i+1] = myArray[2*i-1];//2*(i-1)+1 - } - myArray[0] = coord1; - myArray[1] = coord2; - // mySegmentNumber; what is means ? - return true; - } - else if( coord1 < c1 && coord2 < c2 ) - { - myArray[index*2] = coord1; - return true; - } - else if( c1 < coord1 && coord2 < c2 ) - { - return true; - } - else if( coord1 < c2 && c2 < coord2 ) - { - if( c1 > coord1 ) - myArray[2*index] = coord1; - - if( index != mySegmentNumber - 1 ) - { - for( int i = index+1; i < mySegmentNumber; i++ ) - { - if( coord2 < myArray[2*i] ) - { - myArray[2*index+1] = coord2; - if( index+1 != i ) - { - for( int j = 0; i+j < mySegmentNumber;j++ ) - { - myArray[2*(index+1+j)] = myArray[2*(i+j)]; - myArray[2*(index+1+j)+1] = myArray[2*(i+j)+1]; - } - for( int k = 0; k < mySegmentNumber - i; k++ ) - { - myArray[2*(mySegmentNumber - 1- k)] = 0.0; - myArray[2*(mySegmentNumber - 1- k)+1] = 0.0; - } - mySegmentNumber -= i - index-1; - } - return true; - } - else if( coord2 < myArray[2*i+1] ) - { - myArray[2*index+1] = myArray[2*i+1]; - - for( int j = index+1; j < mySegmentNumber-1;j++ ) - { - myArray[2*j] = myArray[2*(i+j-index)]; - myArray[2*j+1] = myArray[2*(i+j-index)+1]; - } - for( int k = 0; k < mySegmentNumber - i-1; k++ ) - { - myArray[2*(mySegmentNumber - 1- k)] = 0.0; - myArray[2*(mySegmentNumber - 1- k)+1] = 0.0; - } - mySegmentNumber -= i - index; - return true; - } - } - } - else - { - myArray[2*index+1] = coord2; - return true; - } - } - index++; - } - - myArray[mySegmentNumber*2] = coord1; - myArray[mySegmentNumber*2+1] = coord2; - mySegmentNumber++; - - return true; -} - -/*! - Gets info about segment - \param theIndex - index of segment - \param coord1, coord2 - co-ordinates of points -*/ -bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord2 ) -{ - if( theIndex > mySegmentNumber || !myArray) - return false; - - coord1 = myArray[theIndex*2]; - coord2 = myArray[theIndex*2+1]; - - return true; -} - -/*! - \return true if line list covers point - \param thePoint - point co-ordinate -*/ -int GLViewer_LineList::contains( double thePoint ) const -{ - if( !myArray || mySegmentNumber == 0 ) - return -1; - - for( int i = 0; i < mySegmentNumber; i++ ) - if( myArray[2*i] <= thePoint && thePoint <= myArray[2*i+1] ) - return i; - - return -1; - -} - -/*! - Removes segment - \param theIndex - segment index -*/ -bool GLViewer_LineList::removeSegment( int theIndex ) -{ - if( theIndex > mySegmentNumber || !myArray) - return false; - - for( int i = theIndex; i < mySegmentNumber; i++ ) - { - myArray[i*2] = myArray[(i+1)*2]; - myArray[i*2+1] = myArray[(i+1)*2+1]; - } - mySegmentNumber--; - myArray[mySegmentNumber*2] = 0.0; - myArray[mySegmentNumber*2+1] = 0.0; - return true; -} - -/*! - Removes segment from line list - \param coord1, coord2 - co-ordinates of points -*/ -bool GLViewer_LineList::removeSegment( double coord1, double coord2 ) -{ - if( coord1 > coord2 ) - { - double temp = coord1; - coord1 = coord2; - coord2 = temp; - } - - if( 2*mySegmentNumber == myRealSize || !myArray ) - return false; - - int index = 0; - double c1, c2; - while( index < mySegmentNumber) - { - readSegment( index, c1, c2 ); - if( coord1 < c1 && coord2 < c1 ) - { - //nothing - return true; - } - else if( coord1 < c1 && coord2 < c2 ) - { - myArray[index*2] = coord2; - return true; - } - else if( c1 < coord1 && coord2 < c2 ) - { - if( 2*mySegmentNumber == myRealSize ) - return false; - for( int i = mySegmentNumber; i > index + 1; i-- ) - { - myArray[2*i] = myArray[2*(i-1)]; - myArray[2*i+1] = myArray[2*(i-1)+1]; - } - myArray[2*(index+1)+1] = myArray[2*index+1]; - myArray[2*(index+1)] = coord2; - myArray[2*index+1] = coord1; - mySegmentNumber++; - return true; - } - else if( coord1 < c2 && c2 < coord2 ) - { - if( c1 < coord1 ) - { - myArray[2*index+1] = coord1; - } - - if( index != mySegmentNumber - 1 ) - { - for( int i = index+1; i < mySegmentNumber; i++ ) - { - if( coord2 < myArray[2*i] ) - { - if( index+1 != i ) - { - for( int j = 1; i+j-1 < mySegmentNumber;j++ ) - { - myArray[2*(index+j)] = myArray[2*(i+j-1)]; - myArray[2*(index+j)+1] = myArray[2*(i+j-1)+1]; - } - for( int k = 0; k < mySegmentNumber - i; k++ ) - { - myArray[2*(mySegmentNumber - 1- k)] = 0.0; - myArray[2*(mySegmentNumber - 1- k)+1] = 0.0; - } - mySegmentNumber -= i - index -1; - } - else - { - if( !(c1 < coord1) ) - { - for( int j = 0; index + j + 1 < mySegmentNumber;j++ ) - { - myArray[2*(index+j)] = myArray[2*(index+j+1)]; - myArray[2*(index+j)+1] = myArray[2*(index+j+1)+1]; - } - - myArray[2*(mySegmentNumber - 1)] = 0.0; - myArray[2*(mySegmentNumber - 1)+1] = 0.0; - - mySegmentNumber --; - } - - } - - return true; - - } - else if( coord2 < myArray[2*i+1] ) - { - if( index+1 != i ) - { - if( c1 < coord1 ) - index++; - - myArray[2*index] = coord2; - myArray[2*index+1] = myArray[2*i+1]; - - for( int j = 1; i+j < mySegmentNumber;j++ ) - { - myArray[2*(index+j)] = myArray[2*(i+j)]; - myArray[2*(index+j)+1] = myArray[2*(i+j)+1]; - } - for( int k = 0; k < mySegmentNumber - i - 1; k++ ) - { - myArray[2*(mySegmentNumber - 1- k)] = 0.0; - myArray[2*(mySegmentNumber - 1- k)+1] = 0.0; - } - mySegmentNumber -= i - index; - } - else - { - if( c1 < coord1 ) - { - myArray[2*(index+1)] = coord2; - return true; - } - else - { - myArray[2*(index)] = coord2; - myArray[2*(index)+1] = myArray[2*(index+1)+1]; - for( int j = index+1; j < mySegmentNumber-1; j++ ) - { - myArray[2*j] = myArray[2*(j+1)]; - myArray[2*j+1] = myArray[2*(j+1)+1]; - } - mySegmentNumber--; - myArray[2*mySegmentNumber] = 0.0; - myArray[2*mySegmentNumber+1] = 0.0; - } - } - return true; - } - } - } - else - { - if( !(c1 < coord1) ) - { - mySegmentNumber--; - myArray[2*index] = 0.0; - myArray[2*index+1] = 0.0; - } - } - } - index++; - } - return true; -} - -/*! - Clears line list -*/ -void GLViewer_LineList::clear() -{ - if( myArray ) - memset( myArray, 0, myRealSize*sizeof(double) ); -} - -/*! - Prints debug info about line list -*/ -void GLViewer_LineList::print() -{ - std::cout << "MainCoord: " << myMainCoord <<" SIZE: " << myRealSize << " ENum: " << mySegmentNumber << " :::"; - for( int i = 0; i < mySegmentNumber; i++ ) - std::cout << " " << myArray[2*i] << " " << myArray[2*i+1] << " | "; - - std::cout << std::endl; -} - -/*! - Draws line list with help of OpenGL - \param theDim - dimension -*/ -void GLViewer_LineList::show( FieldDim theDim ) -{ - if( !myArray ) - return; - - glColor3f( 1.0, 0.0, 1.0 ); - if( theDim == FD_X ) - { - glBegin( GL_LINES ); - for( int i = 0; i < mySegmentNumber; i++ ) - { - glVertex2d( myArray[2*i], myMainCoord ); - glVertex2d( myArray[2*i+1], myMainCoord ); - } - glEnd(); - } - else if( theDim == FD_Y ) - { - glBegin( GL_LINES ); - for( int i = 0; i < mySegmentNumber; i++ ) - { - glVertex2d( myMainCoord, myArray[2*i] ); - glVertex2d( myMainCoord, myArray[2*i+1] ); - } - glEnd(); - } -} - - -/*! - Constructor -*/ -GLViewer_LineField::GLViewer_LineField() -{ - myCurArrayIndex = 0; - myGraphArray1 = NULL; - myGraphArray2 = NULL; - - myCurCount = 0; - - myXSize = 0; - myYSize = 0; - myXLineArray = NULL; - myYLineArray = NULL; -} - -/*! - Constructor -*/ -GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN ) -{ - myCurArrayIndex = 0; - myGraphArray1 = NULL; - myGraphArray2 = NULL; - - myCurCount = 0; - - if( theXN <= 0 || theYN <= 0 ) - { - myXSize = 0; - myYSize = 0; - myXLineArray = NULL; - myYLineArray = NULL; - } - else - { - myXLineArray = new GLViewer_LineList*[theXN]; - myYLineArray = new GLViewer_LineList*[theYN]; - - for( int i = 0; i < theXN; i++ ) - myXLineArray[i] = new GLViewer_LineList( theMAXSize ); - - for( int j = 0; j < theYN; j++ ) - myYLineArray[j] = new GLViewer_LineList( theMAXSize ); - - myXSize = theXN; - myYSize = theYN; - } -} - -/*! - Destructor -*/ -GLViewer_LineField::~GLViewer_LineField() -{ - if( myXLineArray ) - { - for( int i = 0; i < myXSize; i++ ) - delete myXLineArray[i]; - - delete myXLineArray; - } - - if( myYLineArray ) - { - for( int j = 0; j < myYSize; j++ ) - delete myYLineArray[j]; - - delete myYLineArray; - } - - if( myGraphArray1 ) - delete myGraphArray1; - - if( myGraphArray2 ) - delete myGraphArray2; -} - -/*! - Adds line -*/ -void GLViewer_LineField::addLine( FieldDim theDim, GLViewer_LineList* ) -{ - //not implemented -} - -/*! - Adds line - \param theDim - dimension - \param theMC - main co-ordinate - \param theBegin - start co-ordinate - \param theEnd - end co-ordinate -*/ -void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegin, double theEnd ) -{ - GLViewer_LineList* aLL = new GLViewer_LineList( 1 ); - aLL->addSegment( theBegin, theEnd ); - aLL->setMainCoord( theMC ); - addLine( theDim, aLL ); -} - -/*! - Adds line - \param theDim - dimension - \param theLL - main co-ordinate - \param thePosition - index in list -*/ -int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, int thePosition ) -{ - if( !myXLineArray || !myYLineArray ) - return -1; - - GLViewer_LineList** anArray = getLLArray( theDim ); - if( !anArray ) - return -1; - - int size = getDimSize( theDim ); - - if( thePosition >= size ) - return -1; - else if( thePosition < 0 ) - { - if( anArray[size-1]->count() != 0 ) // no more space - return -1; - - for( int i = 0; i < size; i++ ) - { - if( anArray[i]->count() == 0 ) - { - delete anArray[i]; - anArray[i] = theLL; - return i; - } - - double cur_mc = anArray[i]->mainCoord(); - if( theLL->mainCoord() < cur_mc ) - { - for( int j = 0; j+i+1 < size; j++ ) - { - delete anArray[size-j-1]; - anArray[size-j-1] = anArray[size-j-2]; - } - delete anArray[i]; - anArray[i] = theLL; - return i; - } - } - } - else - { - delete anArray[thePosition]; - anArray[thePosition] = theLL; - return thePosition; - } - - return -1; -} - -/*! - Adds line - \param theDim - dimension - \param theMainCoord - main co-ordinate - \param theBegin - start co-ordinate - \param theEnd - end co-ordinate - \param thePosition - index in list -*/ -int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double theBegin, double theEnd, int thePosition ) -{ - GLViewer_LineList* aLL = new GLViewer_LineList( 1 ); - aLL->addSegment( theBegin, theEnd ); - aLL->setMainCoord( theMainCoord ); - return insertLine( theDim, aLL, thePosition ); -} - -/*! - \return other dimension -*/ -FieldDim GLViewer_LineField::invertDim( FieldDim theFD ) -{ - if( theFD == FD_X ) - return FD_Y; - else - return FD_X; -} - -/*! - \return line list - \param theIndex - index in list - \param tehFD - dimension -*/ -GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD ) -{ - if( !myXLineArray || !myYLineArray ) - return NULL; - - if( theFD == FD_X ) - { - if( theIndex > myXSize ) - return NULL; - - return myXLineArray[theIndex]; - } - else if( theFD == FD_Y ) - { - if( theIndex > myYSize ) - return NULL; - - return myYLineArray[theIndex]; - } - - return NULL; -} - -/*! - Sets borders of field - \param X1, X2 - minimal and maximal abscisses - \param Y1, Y2 - minimal and maximal ordinates -*/ -void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2 ) -{ - if( !myXLineArray || !myYLineArray ) - return; - - for( int i = 0; i < myXSize; i++ ) - { - myXLineArray[i]->clear(); - myXLineArray[i]->addSegment( X1, X2 ); - myXLineArray[i]->setMainCoord( Y1 + (Y2-Y1)*(double(i)/(myXSize-1)) ); - } - - for( int j = 0; j < myYSize; j++ ) - { - myYLineArray[j]->clear(); - myYLineArray[j]->addSegment( Y1, Y2 ); - myYLineArray[j]->setMainCoord( X1 + (X2-X1)*(double(j)/(myYSize-1)) ); - } -} - -/*! - Adds rectangle - \param top, right - a corner of rectangle - \param bottom, left - other corner of rectangle -*/ -void GLViewer_LineField::addRectangle( double top, double right, double bottom, double left ) -{ - if( !myXLineArray || !myYLineArray ) - return; - for( int i = 0; i < myXSize; i++ ) - { - double mainCoord = myXLineArray[i]->mainCoord(); - if( mainCoord < top && mainCoord > bottom ) - myXLineArray[i]->removeSegment( left, right ); - } - - for( int j = 0; j < myYSize; j++ ) - { - double mainCoord = myYLineArray[j]->mainCoord(); - if( mainCoord < right && mainCoord > left ) - myYLineArray[j]->removeSegment( bottom, top ); - } -} - -/*! - Prints debug info about line field -*/ -void GLViewer_LineField::print() -{ - std::cout << "My X matrix Number: " << myXSize << std::endl; - for( int i = 0; i < myXSize; i++ ) - myXLineArray[i]->print(); - - std::cout << "My Y matrix Number: " << myYSize << std::endl; - for( int j = 0; j < myYSize; j++ ) - myYLineArray[j]->print(); -} - -/*! - Draws field with help of OpenGL -*/ -void GLViewer_LineField::show() -{ - for( int i = 0; i < myXSize; i++ ) - getLine( i, FD_X )->show( FD_X ); - - for( int j = 0; j < myYSize; j++ ) - getLine( j, FD_Y )->show( FD_Y ); - int count = 0; - double* anArray = solution( count ); - glColor3f( 1.0, 0.0, 0.0 ); - glBegin( GL_LINES ); - for( int k = 0; k < count; k++ ) - { - glVertex2d( anArray[4*k], anArray[4*k+1] ); - glVertex2d( anArray[4*k+2], anArray[4*k+3] ); - } - glEnd(); - delete[] anArray; - std::cout << "Show function" << std::endl; -} - -/*! - \return size - \param theDim - dimension -*/ -int GLViewer_LineField::getDimSize( FieldDim theDim ) -{ - if( theDim == FD_X ) - return myXSize; - else if( theDim == FD_Y ) - return myYSize; - - return -1; -} - -/*! - \return array of intersected indexes - \param theDim - dimension - \param theIndex - index - \param theLL - line with that intersection is checked - \param theSize - to return value of array size -*/ -int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL, int& theSize ) -{ - theSize = 0; - if( !myXLineArray || !myYLineArray ) - return NULL; - - int aDimSize = getDimSize( theDim ); - int* anArray = new int[aDimSize*2 ]; - - for( int i = 0; i < aDimSize; i++ ) - { - GLViewer_LineList* aLL = getLine( i, theDim ); - int index = aLL->contains( theLL->mainCoord() ); - if( index != -1 && theLL->contains( aLL->mainCoord() ) == theIndex ) - { - anArray[theSize*2] = i; - anArray[theSize*2+1] = index; - theSize++; - } - } - - return anArray; -} - -/*! - Sets start/end search point - \param thePoint - type of point (start: FP_Start; end: FP_End ) - \param theX, theY - point co-ordinates -*/ -bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY ) -{ - if( !myXLineArray || !myYLineArray ) - return false; - - int i = -1, j = -1; - int xSeg = -1, ySeg = -1; - for( i = 0; i < myXSize; i++ ) - { - GLViewer_LineList* aLL = getLine( i, FD_X ); - if( aLL->mainCoord() == theY ) - { - xSeg = aLL->contains( theX ); - break; - } - } - - for( j = 0; j < myYSize; j++ ) - { - GLViewer_LineList* aLL = getLine( j, FD_Y ); - if( aLL->mainCoord() == theX ) - { - ySeg = aLL->contains( theY ); - break; - } - } - - if( xSeg != -1 && ySeg != -1 ) - { - if( thePoint == FP_Start ) - { - myStartPoint.myXLineIndex = i; - myStartPoint.myXSegmentIndex = xSeg; - myStartPoint.myYLineIndex = j; - myStartPoint.myYSegmentIndex = ySeg; - myStartPoint.mySolveIndex = -1; - } - else - { - myEndPoint.myXLineIndex = i; - myEndPoint.myXSegmentIndex = xSeg; - myEndPoint.myYLineIndex = j; - myEndPoint.myYSegmentIndex = ySeg; - myEndPoint.mySolveIndex = -1; - } - return true; - } - else - return false; -} - -/*! - \return number of segments -*/ -int GLViewer_LineField::segmentNumber() -{ - if( !(myXLineArray || myYLineArray) ) - return -1; - - int aNumber = 0; - for( int aDim = 0; aDim < 2; aDim++ ) - for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ ) - aNumber += getLine( i, (FieldDim)aDim )->count(); - - return aNumber; -} - -/*! - Removes all multiple segments -*/ -void GLViewer_LineField::optimize() -{ - if( !myXLineArray || !myYLineArray ) - return; - - for( int aDim = 0; aDim < 2; aDim++ ) - { - for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ ) - { - GLViewer_LineList* aLL = getLine( i, (FieldDim)aDim ); - for( int k =0, aSegNum = aLL->count(); k < aSegNum; k++ ) - { - // int index = i; unused - double a1, a2; - aLL->readSegment( k, a1, a2 ); - for( int l = i+1, m = getDimSize( (FieldDim)aDim ); l < m; l++ ) - { - int end = -1; - GLViewer_LineList* aCurLL = getLine( l, (FieldDim)aDim ); - for( int j = 0, count = aCurLL->count(); j < count; j++ ) - { - double c1, c2; - aCurLL->readSegment( j, c1, c2 ); - if( a1 == c1 && a2 == c2 ) - { - if( !(aDim == 0 && myStartPoint.myXLineIndex == l && myStartPoint.myXSegmentIndex == j) && - !(aDim == 0 && myEndPoint.myXLineIndex == l && myEndPoint.myXSegmentIndex == j) && - !(aDim == 1 && myStartPoint.myYLineIndex == l && myStartPoint.myYSegmentIndex == j) && - !(aDim == 1 && myEndPoint.myYLineIndex == l && myEndPoint.myYSegmentIndex == j) ) - aCurLL->removeSegment( j ); - end = 0; - break; - } - if( a1 < c1 ) - { - end = 1; - break; - } - } - if( end == -1 || end == 1) - break; - } - } - } - } -} - -/*! - Some prepare actions - Needs call setPoint before -*/ -void GLViewer_LineField::initialize() -{ - if( !myXLineArray || !myYLineArray ) - return; - - int size = segmentNumber(); - - myCurArrayIndex = 0; - myCurCount = 0; - - myGraphArray1 = new GraphNode[size]; - myGraphArray2 = new GraphNode[size]; - - int index = 0; - bool isXSet = false, - isYSet = false; - for( int aDim = 0; aDim < 2; aDim++ ) - { - for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ ) - { - GLViewer_LineList* aLL = getLine( i, (FieldDim)aDim ); - for( int k =0, aSegNum = aLL->count(); k < aSegNum; k++ ) - { - myGraphArray1[index].myCount = size; - myGraphArray1[index].myDim = (FieldDim)aDim; - myGraphArray1[index].myLineIndex = i; - myGraphArray1[index].mySegmentindex = k; - myGraphArray1[index].prevNodeIndex = -1; - - myGraphArray2[index].myCount = size; - myGraphArray2[index].myDim = (FieldDim)aDim; - myGraphArray2[index].myLineIndex = i; - myGraphArray2[index].mySegmentindex = k; - myGraphArray2[index].prevNodeIndex = -1; - - if( !isXSet && aDim == FD_X && myStartPoint.myXLineIndex == i && myStartPoint.myXSegmentIndex == k ) - { - myGraphArray1[index].myCount = 0; - isXSet = true; - } - - if( aDim == FD_Y && !isYSet && myStartPoint.myYLineIndex == i && myStartPoint.myYSegmentIndex == k ) - { - myGraphArray1[index].myCount = 0; - isYSet = true; - } - - index++; - } - } - } -} - -/*! - One iteration of algorithm -*/ -void GLViewer_LineField::iteration() -{ - int aParam = myCurCount; - myCurCount++; - - int* aNodes = findByCount( aParam ); - GraphNode* aCurArray = getCurArray(); - - for( int i = 0; i < aParam; i++ ) - { - GraphNode aCurNode = aCurArray[aNodes[i]]; - int aSize = 0; - int* aInterNodes = intersectIndexes( invertDim( aCurNode.myDim ), aCurNode.mySegmentindex, - getLine( aCurNode.myLineIndex, aCurNode.myDim ), aSize ); - for( int j = 0; j < aSize; j++ ) - { - int index = findBySegment( invertDim( aCurNode.myDim ), aInterNodes[2*j], aInterNodes[2*j+1], false ); - if( index != -1 ) - if( aCurArray[index].myCount > myCurCount ) - { - aCurArray[index].myCount = myCurCount; - aCurArray[index].prevNodeIndex = aNodes[i]; - } - } - - delete[] aInterNodes; - } - - delete[] aNodes; -} - -/*! - Checks for complete status -*/ -GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete() -{ - if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 ) - return IS_ERROR; - - int count = 0; - GraphNode* aCurArray = getCurArray(), - * aSecArray = getSecArray(); - - for( int i = 0, n = segmentNumber(); i < n; i++ ) - { - if( aCurArray[i].myCount != aSecArray[i].myCount ) - { - if( aCurArray[i].myDim == FD_X && - aCurArray[i].myLineIndex == myEndPoint.myXLineIndex && - aCurArray[i].mySegmentindex == myEndPoint.myXSegmentIndex ) - { - std::cout << "Algorithm complete X!!!!!!!" << std::endl; - myEndPoint.mySolveIndex = i; - return IS_SOLVED; - } - else if( aCurArray[i].myDim == FD_Y && - aCurArray[i].myLineIndex == myEndPoint.myYLineIndex && - aCurArray[i].mySegmentindex == myEndPoint.myYSegmentIndex ) - { - std::cout << "Algorithm complete Y!!!!!!!" << std::endl; - myEndPoint.mySolveIndex = i; - return IS_SOLVED; - } - else - { - count++; - aSecArray[i].myCount = aCurArray[i].myCount; - aSecArray[i].prevNodeIndex = aCurArray[i].prevNodeIndex; - } - } - } - - if( myCurArrayIndex == 0) - myCurArrayIndex = 1; - else - myCurArrayIndex = 0; - - std::cout << "Number of ways: " << count << std::endl; - if( count == 0 ) - return IS_LOOP; - - return IS_NOT_SOLVED; -} - -/*! - Finds LineList by counts and returns indexes -*/ -int* GLViewer_LineField::findByCount( int& theParam ) -{ - if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 ) - return NULL; - - int count = segmentNumber(); - int* anArray = new int[count]; - int aSize = 0; - - GraphNode* aCurArray = getCurArray(); - for( int i = 0; i < count; i++ ) - { - GraphNode aCurNode = aCurArray[i]; - if( aCurNode.myCount == theParam ) - { - anArray[aSize] = i; - aSize++; - } - } - - theParam = aSize; - return anArray; -} - -/*! - Finds LineList by segment and dimension -*/ -int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int theSegment, bool inCurArray ) -{ - if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 || getDimSize( theDim ) <= theLineIndex ) - return -1; - - GraphNode* aCurArray; - if( inCurArray ) - aCurArray = getCurArray(); - else - aCurArray = getSecArray(); - - for( int i = 0, n = segmentNumber(); i < n; i++ ) - { - GraphNode aCurNode = aCurArray[i]; - if( aCurNode.myDim == theDim && aCurNode.myLineIndex == theLineIndex && aCurNode.mySegmentindex == theSegment ) - return i; - } - - return -1; -} - -/*! - Main method, performs algorithm execution -*/ -GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm() -{ - if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 ) - return ES_ERROR; - - while( true ) - { - std::cout << "-----------Iteration #" << myCurCount << "-------------" << std::endl; - iteration(); - - IterationStatus is = checkComplete(); - if( is == IS_ERROR ) - return ES_ERROR; - else if( is == IS_LOOP ) - return ES_LOOP; - else if( is == IS_SOLVED ) - return ES_SOLVED; - } - return ES_SOLVED; -} - -/*! - \return solution and size of solution -*/ -double* GLViewer_LineField::solution( int& theSize ) -{ - if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 ) - return NULL; - - if( myEndPoint.mySolveIndex == -1 ) - return NULL; - - theSize = myCurCount+1; - double* anArray = new double[theSize*4]; - - GraphNode* aCurArray = getCurArray(); - - int index = myEndPoint.mySolveIndex; - for( int i = 0; i <= myCurCount; i++ ) - { - if( index == -1 ) - break; - double c1, c2; - GLViewer_LineList* aLL = getLine( aCurArray[index].myLineIndex, aCurArray[index].myDim ); - aLL->readSegment( aCurArray[index].mySegmentindex, c1, c2 ); - - if( aCurArray[index].myDim == FD_X ) - { - anArray[i*4] = c1; - anArray[i*4+1] = aLL->mainCoord(); - anArray[i*4+2] = c2; - anArray[i*4+3] = aLL->mainCoord(); - } - else - { - anArray[i*4] = aLL->mainCoord(); - anArray[i*4+1] = c1; - anArray[i*4+2] = aLL->mainCoord(); - anArray[i*4+3] = c2; - } - - index = aCurArray[index].prevNodeIndex; - } - - return anArray; -} - -/*! - \return current solution array -*/ -GraphNode* GLViewer_LineField::getCurArray() -{ - if( !myGraphArray1 || !myGraphArray2 ) - return NULL; - - if( myCurArrayIndex == 0) - return myGraphArray1; - else - return myGraphArray2; -} - -/*! - \return other solution array -*/ -GraphNode* GLViewer_LineField::getSecArray() -{ - if( !myGraphArray1 || !myGraphArray2 ) - return NULL; - - if( myCurArrayIndex == 0) - return myGraphArray2; - else - return myGraphArray1; -} - -/*! - \return maximum segment number -*/ -int GLViewer_LineField::maxSegmentNum() -{ - if( !myXLineArray || !myYLineArray ) - return -1; - - int max_num = -1; - for( int aDim = 0; aDim < 2; aDim++ ) - { - for( int i = 0, n = getDimSize( (FieldDim)aDim ); i < n; i++ ) - { - int count = getLine( i, (FieldDim)aDim )->count(); - if( count > max_num ) - max_num = count; - } - } - - return max_num; -} - -/*! - \return list of LileList by dimension - \param theDim - dimension -*/ -GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim ) -{ - if( theDim == FD_X ) - return myXLineArray; - else if( theDim == FD_Y ) - return myYLineArray; - else - return NULL; -} diff --git a/src/GLViewer/GLViewer_Tools.h b/src/GLViewer/GLViewer_Tools.h deleted file mode 100644 index b9add1f19..000000000 --- a/src/GLViewer/GLViewer_Tools.h +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Tools.h -// Created: April, 2005 - -#ifndef GLVIEWER_TOOLS_H -#define GLVIEWER_TOOLS_H - -#ifdef WNT -#include "windows.h" -#endif - -#include "GLViewer.h" -#include "GLViewer_Defs.h" - -class GLViewer_LineField; - -/*! - \class GLViewer_Tools - Tools for Viewer -*/ -class GLVIEWER_API GLViewer_Tools -{ -public: - //GLViewer_Tools(); - //virtual ~GLViewer_Tools(); - //static - -}; - -//! Dimension of line -enum FieldDim -{ - FD_X = 0, /*along x axis*/ - FD_Y /*along y axis*/ -}; - -/*! - \class GLViewer_LineList - Tools for distinct line - This class implmented interface for segment operations: - add, cut, remove and etc. - Memory does not changed and allocated only one time -*/ -class GLViewer_LineList -{ -public: - GLViewer_LineList( int ); - virtual ~GLViewer_LineList(); - - //! Returns number of segments - int count() const { return mySegmentNumber; } - //! Returns real size - int size() const { return myRealSize; } - - bool addSegment( double coord1, double coord2 ); - bool removeSegment( int index ); - bool removeSegment( double coord1, double coord2 ); - - bool readSegment( int index, double& coord1, double& coord2 ); - - //! Returns index of segment, else -1 - int contains( double thePoint ) const; - - //! Sets level of segments - void setMainCoord( double theVal ) { myMainCoord = theVal; } - double mainCoord() const { return myMainCoord; } - - void clear(); - void print(); - - void show( FieldDim ); - - GLViewer_LineList& operator = ( GLViewer_LineList ); - -private: - double* myArray; - int myRealSize; - int mySegmentNumber; - - double myMainCoord; -}; - -/*! struct GraphNode describe node in algorithm on rare grid*/ -struct GraphNode -{ - int myCount; - FieldDim myDim; - int myLineIndex; - int mySegmentindex; - int prevNodeIndex; //feedback for searching for solution -}; - -/*! struct SearchPoint describe node for solving algorithm*/ -struct SearchPoint -{ - int myXLineIndex; - int myXSegmentIndex; - int myYLineIndex; - int myYSegmentIndex; - int mySolveIndex; -}; - -/*! - \class GLViewer_LineField - Tools for solving algorithm of finding shortest path on rare grid with minimum of - line turns number -*/ -class GLViewer_LineField -{ -public: - //!Searched point - enum FieldPoint - { - FP_Start = 0, - FP_End = 1 - }; - - //! Status of interation - enum IterationStatus - { - IS_ERROR = 0, - IS_LOOP, - IS_NOT_SOLVED, - IS_SOLVED - }; - - //! Final status of solving - enum EndStatus - { - ES_ERROR = 0, - ES_LOOP, - ES_SOLVED - }; - - GLViewer_LineField(); - GLViewer_LineField( const int theMAXSize, const int xn, const int yn ); - virtual ~GLViewer_LineField(); - - //! Adds new line - /*!best way, if line is already sorted*/ - void addLine( FieldDim, GLViewer_LineList* ); - //! Calls previous - void addLine( FieldDim theDim, double theMC, double theBegin, double theEnd ); - - //! Adds new line and sorted field - /*! Returns position*/ - int insertLine( FieldDim theDim, GLViewer_LineList*, int thePosition ); - //! Calls previous - int insertLine( FieldDim theDim, double theMC, double theBegin, double theEnd, int thePosition ); - - //! Returns other dimension - static FieldDim invertDim( FieldDim ); - - //! Returns line by index and dimension - GLViewer_LineList* getLine( int index, FieldDim ); - - //! Nullifys field and sets same continued segments - void setBorders( double X1, double X2, double Y1, double Y2 ); - //! Cut rectangle in grid - void addRectangle( double top, double right, double bottom, double left ); - - //! returns arrey of intersects indexes with \param theLL - int* intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL , int& theSize ); - - void print(); - - void show(); - - int getDimSize( FieldDim ); - //! Returns number of segment - int segmentNumber(); - - //! Sets start/end search point - bool setPoint( FieldPoint, double x, double y ); - - //! Optimize field - /*! Removes all multiple segments*/ - void optimize(); - //! Some prepare actions - /*! Needs call setPoint before*/ - void initialize(); - //! Main method - EndStatus startAlgorithm(); - - //! Returns solution and size of solution - double* solution( int& size ); - -protected: - //! One iteration of algorithm - void iteration(); - //! Checks for complete status - IterationStatus checkComplete(); - - //! Finds LineList by counts and returns indexes - int* findByCount( int& theParam ); - //! Finds LineList by segment and dimension - int findBySegment( FieldDim, int coord1, int coord2, bool inCurArray = true ); - - //! Returns current solution array - GraphNode* getCurArray(); - //! Returns - GraphNode* getSecArray(); - - //! Returns maximum segment number - int maxSegmentNum(); - - //! Returns list of LileList by dimension - GLViewer_LineList** getLLArray( FieldDim ); - -private: - GLViewer_LineList** myXLineArray, - ** myYLineArray; - - int myXSize, - myYSize; - - GraphNode* myGraphArray1, - * myGraphArray2; - int myCurArrayIndex; - - SearchPoint myStartPoint, - myEndPoint; - int myCurCount; -}; - -#endif //GLVIEWER_TOOLS_H diff --git a/src/GLViewer/GLViewer_ViewFrame.cxx b/src/GLViewer/GLViewer_ViewFrame.cxx deleted file mode 100644 index d89922d48..000000000 --- a/src/GLViewer/GLViewer_ViewFrame.cxx +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewFrame.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_ViewFrame.h" -#include "GLViewer_Viewer.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_ViewPort2d.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/*! - Constructor -*/ -GLViewer_ViewFrame::GLViewer_ViewFrame( SUIT_Desktop* d, GLViewer_Viewer* vw ) -: SUIT_ViewWindow( d ), -myViewer( vw ), -myVP( 0 ) -{ - QFrame* client = new QFrame( this ); - setCentralWidget( client ); - - QBoxLayout* layout = new QHBoxLayout( client, 1, 1 ); - layout->setAutoAdd( true ); - - GLViewer_ViewPort2d* vp = new GLViewer_ViewPort2d( client, this ); - //vp->turnGrid( true ); - //vp->turnCompass( true ); - //vp->enablePopup( false ); - setViewPort( vp ); - setBackgroundColor( Qt::white ); - - myToolBar = new QToolBar(this); - myToolBar->setCloseMode(QDockWindow::Undocked); - myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); - createActions(); - createToolBar(); -} - -/*! - Destructor -*/ -GLViewer_ViewFrame::~GLViewer_ViewFrame() -{ -} - -/*! - Creates actions of GL view frame -*/ -void GLViewer_ViewFrame::createActions() -{ - if (!myActionsMap.isEmpty()) return; - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QAction* aAction; - - // Dump view - aAction = new QAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ), - tr( "MNU_DUMP_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_DUMP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewDump())); - myActionsMap[ DumpId ] = aAction; - - // FitAll - aAction = new QAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITALL" ) ), - tr( "MNU_FITALL" ), 0, this); - aAction->setStatusTip(tr("DSC_FITALL")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll())); - myActionsMap[ FitAllId ] = aAction; - - // FitRect - aAction = new QAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITAREA" ) ), - tr( "MNU_FITRECT" ), 0, this); - aAction->setStatusTip(tr("DSC_FITRECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea())); - myActionsMap[ FitRectId ] = aAction; - - // FitSelect - aAction = new QAction(tr("MNU_FITSELECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITSELECT" ) ), - tr( "MNU_FITSELECT" ), 0, this); - aAction->setStatusTip(tr("DSC_FITSELECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitSelect())); - myActionsMap[ FitSelectId ] = aAction; - - // Zoom - aAction = new QAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_ZOOM" ) ), - tr( "MNU_ZOOM_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom())); - myActionsMap[ ZoomId ] = aAction; - - // Panning - aAction = new QAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_PAN" ) ), - tr( "MNU_PAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan())); - myActionsMap[ PanId ] = aAction; - - // Global Panning - aAction = new QAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_GLOBALPAN" ) ), - tr( "MNU_GLOBALPAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan())); - myActionsMap[ GlobalPanId ] = aAction; - - aAction = new QAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset())); - myActionsMap[ ResetId ] = aAction; -} - -/*! - Creates toolbar of GL view frame -*/ -void GLViewer_ViewFrame::createToolBar() -{ - myActionsMap[DumpId]->addTo(myToolBar); - - SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar); - aScaleBtn->AddAction(myActionsMap[FitAllId]); - aScaleBtn->AddAction(myActionsMap[FitRectId]); - aScaleBtn->AddAction(myActionsMap[FitSelectId]); - aScaleBtn->AddAction(myActionsMap[ZoomId]); - - SUIT_ToolButton* aPanBtn = new SUIT_ToolButton(myToolBar); - aPanBtn->AddAction(myActionsMap[PanId]); - aPanBtn->AddAction(myActionsMap[GlobalPanId]); - - myActionsMap[ResetId]->addTo(myToolBar); -} - -/*! - Sets the viewport for this frame -*/ -void GLViewer_ViewFrame::setViewPort( GLViewer_ViewPort* vp ) -{ - if ( myVP == vp ) - return; - - if ( myVP ) - { - disconnect( myVP, SIGNAL( vpDrawExternal( QPainter* ) ), this, SIGNAL( vfDrawExternal( QPainter* ) ) ); - disconnect( myVP, SIGNAL( vpMouseEvent( QMouseEvent* ) ), this, SLOT( mouseEvent( QMouseEvent* ) ) ); - disconnect( myVP, SIGNAL( vpKeyEvent( QKeyEvent* ) ), this, SLOT( keyEvent( QKeyEvent* ) ) ); - disconnect( myVP, SIGNAL( vpWheelEvent( QWheelEvent* ) ), this, SLOT( wheelEvent( QWheelEvent* ) ) ); - disconnect( myVP, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ), - this, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) ); - } - myVP = vp; - if ( myVP ) - { - connect( myVP, SIGNAL( vpDrawExternal( QPainter* ) ), this, SIGNAL( vfDrawExternal( QPainter* ) ) ); - connect( myVP, SIGNAL( vpMouseEvent( QMouseEvent* ) ), this, SLOT( mouseEvent( QMouseEvent* ) ) ); - connect( myVP, SIGNAL( vpKeyEvent( QKeyEvent* ) ), this, SLOT( keyEvent( QKeyEvent* ) ) ); - connect( myVP, SIGNAL( vpWheelEvent( QWheelEvent* ) ), this, SLOT( wheelEvent( QWheelEvent* ) ) ); - connect( myVP, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ), - this, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) ); - } -} - -/*! - Returns the viewport of this frame. [ public ] -*/ -GLViewer_ViewPort* GLViewer_ViewFrame::getViewPort() const -{ - return myVP; -} - -/*! - Set background of the viewport. [ public ] -*/ -void GLViewer_ViewFrame::setBackgroundColor( const QColor& color ) -{ - if ( myVP ) - myVP->setBackgroundColor( color ); -} - -/*! - Returns background of the viewport. [ public ] -*/ -QColor GLViewer_ViewFrame::backgroundColor() const -{ - if ( myVP ) - return myVP->backgroundColor(); - return QMainWindow::backgroundColor(); -} - -/*! - Sets the viewer for this view. [ public ] -*/ -void GLViewer_ViewFrame::setViewer( GLViewer_Viewer* v ) -{ - myViewer = v; -} - -/*! - Returns the viewer of this view. [ public ] -*/ -GLViewer_Viewer* GLViewer_ViewFrame::getViewer() const -{ - return myViewer; -} - -/*! - Returns the preferred view size. [ virtual public ] -*/ -QSize GLViewer_ViewFrame::sizeHint() const -{ - QWidget* p = parentWidget(); - if ( p && p->inherits( "QWorkspaceChild" ) ) - p = p->parentWidget(); - if ( !p ) - return QMainWindow::sizeHint(); - return QSize( 9 * p->width() / 10 , 9 * p->height() / 10 ); -} - -/*! - Called by viewer's 'update()' method. Does nothing by default [ virtual public ] -*/ -void GLViewer_ViewFrame::onUpdate( int ) -{ -} - -//#include - -/*! - SLOT: called on dump view operation is activated, stores scene to raster file -*/ -void GLViewer_ViewFrame::onViewDump() -{ - GLViewer_Widget* aWidget = ((GLViewer_ViewPort2d*)myVP)->getGLWidget(); - int width, height; - width = aWidget->width(); - height = aWidget->height(); - - int imageSize = width*height*3; - unsigned char* imageBits = NULL; - - int reserve_bytes = width % 4; //32 bits platform - imageSize = (width+reserve_bytes)*height*3; - imageBits = new unsigned char[imageSize]; - - -#ifdef WNT - - int num; - HBITMAP hBmp; - HDC hdc_old, hdc; - HGLRC hglrc_old, hglrc; - - BITMAPINFO bi; - - hglrc_old = wglGetCurrentContext(); - hdc_old = wglGetCurrentDC(); - - hdc = CreateCompatibleDC( hdc_old ); - if( !hdc ) - { - cout << "Can't create compatible DC. Last Error Code: " << GetLastError() << endl; - return; - } - - int sizeBmi = Standard_Integer( sizeof(BITMAPINFO) + sizeof(RGBQUAD)*3 ); - PBITMAPINFO pBmi = (PBITMAPINFO)( new char[sizeBmi] ); - ZeroMemory( pBmi, sizeBmi ); - - pBmi->bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); //sizeBmi - pBmi->bmiHeader.biWidth = width; - pBmi->bmiHeader.biHeight = height; - pBmi->bmiHeader.biPlanes = 1; - pBmi->bmiHeader.biBitCount = 24; - pBmi->bmiHeader.biCompression = BI_RGB; - - LPVOID ppvBits; - hBmp = CreateDIBSection ( hdc, pBmi, DIB_RGB_COLORS, &ppvBits, NULL, 0 ); - SelectObject ( hdc, hBmp ); - delete[] pBmi; - - PIXELFORMATDESCRIPTOR pfd; - ZeroMemory( &pfd, sizeof( PIXELFORMATDESCRIPTOR ) ); - pfd.nSize = sizeof( PIXELFORMATDESCRIPTOR ); - pfd.nVersion = 1; - pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_BITMAP; - pfd.iPixelType = PFD_TYPE_RGBA; - pfd.cColorBits = 24; - pfd.cDepthBits = 32; - pfd.iLayerType = PFD_MAIN_PLANE; - - int iPf = ChoosePixelFormat( hdc, &pfd); - if( iPf == 0 ) - { - if ( !DescribePixelFormat ( hdc, iPf, sizeof(PIXELFORMATDESCRIPTOR), &pfd ) ) - { - cout << "Can't describe Pixel Format. Last Error Code: " << GetLastError() << endl; - } - } - if ( !SetPixelFormat(hdc, iPf, &pfd) ) - { - cout << "Can't set Pixel Format. Last Error Code: " << GetLastError() << endl; - } - - hglrc = wglCreateContext( hdc ); - if( !hglrc ) - { - cout << "Can't create new GL Context. Last Error Code: " << GetLastError() << endl; - return; - } - if( !wglMakeCurrent( hdc, hglrc) ) - { - cout << "Can't make current new context!" << endl; - return; - } - - glViewport( 0, 0, width, height ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - GLfloat w_c = width / 2., h_c = height / 2.; - - gluOrtho2D( -w_c, w_c, -h_c, h_c ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - //set background - QColor aColor = ((GLViewer_ViewPort2d*)myVP)->backgroundColor(); - glClearColor( ( GLfloat )aColor.red() / 255, - ( GLfloat )aColor.green() / 255, - ( GLfloat )aColor.blue() / 255, - 1.0 ); - - aWidget->exportRepaint(); - - memset(&bi, 0, sizeof(BITMAPINFOHEADER)); - bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bi.bmiHeader.biPlanes = 1; - bi.bmiHeader.biBitCount = 24; - bi.bmiHeader.biHeight = -height; - bi.bmiHeader.biWidth = width; - bi.bmiHeader.biCompression = BI_RGB; - - num = GetDIBits(hdc, hBmp, 0, height, imageBits, &bi, DIB_RGB_COLORS); - - wglMakeCurrent( hdc_old, hglrc_old ); - wglDeleteContext( hglrc ); - - -#else //XWindows -#endif - - unsigned int* aPix = NULL; - QImage anImage( width, height, 32 ); - for( int i = 0; i < height; i++ ) - { - memset( anImage.scanLine( i ), 0, sizeof(unsigned int)*width ); - unsigned char* pos; - for( int j = 0; j < width; j++ ) - { - pos = imageBits + i*width*3 + j*3 + reserve_bytes*i; - aPix = (unsigned int*)anImage.scanLine(i)+j; - *aPix = qRgb( *pos, *(pos+1), *(pos+2) ); - } - } - - delete [] imageBits; - - QString aFilter( "*.bmp\n*.png" ); - - QFileDialog aFileDlg( QDir::current().absPath(), aFilter, this ); - aFileDlg.setCaption( tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ) ); - aFileDlg.setMode( QFileDialog::AnyFile ); - - if( !aFileDlg.exec() ) - return; - - QString aFileName = aFileDlg.selectedFile(); - QString aFileExt = aFileDlg.selectedFilter(); - - if( aFileName.isEmpty() ) - { - SUIT_MessageBox::error1( this, - tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ), - tr( "DUMP_VIEW_ERROR_DLG_TEXT" ), - tr( "BUT_OK" ) ); - } - - QString aSaveOp = "BMP"; - QString aTypedFileExt = QFileInfo( aFileName ).extension( false ).lower(); - - if( aFileExt == "*.bmp" ) - { - if( aTypedFileExt.isEmpty() ) - aFileName += ".bmp"; - aSaveOp = "BMP"; - } - else if( aFileExt == "*.png" ) - if( aTypedFileExt.isEmpty() ) - aFileName += ".png"; - aSaveOp = "PNG"; - -//#ifdef WNT -// if( !anImage.save( aFileName, aSaveOp ) ) -//#else - if( !aWidget->grabFrameBuffer().save( aFileName, aSaveOp ) ) -//#endif - { - SUIT_MessageBox::error1( this, - tr( "DUMP_VIEW_ERROR_DLG_CAPTION" ), - tr( "DUMP_VIEW_ERROR_DLG_TEXT" ), - tr( "BUT_OK" ) ); - } -} - -/*! - Start panning -*/ -void GLViewer_ViewFrame::onViewPan() -{ - myViewer->activateTransform( GLViewer_Viewer::Pan ); -} - -/*! - Start zooming -*/ -void GLViewer_ViewFrame::onViewZoom() -{ - myViewer->activateTransform( GLViewer_Viewer::Zoom ); -} - -/*! - Start fit all -*/ -void GLViewer_ViewFrame::onViewFitAll() -{ - myViewer->activateTransform( GLViewer_Viewer::FitAll ); -} - -/*! - Start fit area -*/ -void GLViewer_ViewFrame::onViewFitArea() -{ - myViewer->activateTransform( GLViewer_Viewer::FitRect ); -} - -/*! - Start fit selected -*/ -void GLViewer_ViewFrame::onViewFitSelect() -{ - myViewer->activateTransform( GLViewer_Viewer::FitSelect ); -} - -/*! - Start global panning -*/ -void GLViewer_ViewFrame::onViewGlobalPan() -{ - myViewer->activateTransform( GLViewer_Viewer::PanGlobal ); -} - -/*! - Start rotating -*/ -void GLViewer_ViewFrame::onViewRotate() -{ - //myViewer->activateTransform( GLViewer_Viewer::Rotate ); -} - -/*! - Start reset default view aspects -*/ -void GLViewer_ViewFrame::onViewReset() -{ - myViewer->activateTransform( GLViewer_Viewer::Reset ); -} - -/*! - Dispatches mouse events -*/ -void GLViewer_ViewFrame::mouseEvent( QMouseEvent* e ) -{ - switch ( e->type() ) - { - case QEvent::MouseButtonPress: - emit mousePressed( this, e ); - break; - case QEvent::MouseButtonRelease: - emit mouseReleased( this, e ); - break; - case QEvent::MouseButtonDblClick: - emit mouseDoubleClicked( this, e ); - break; - case QEvent::MouseMove: - emit mouseMoving( this, e ); - break; - default: - break; - } -} - -/*! - Dispatches key events -*/ -void GLViewer_ViewFrame::keyEvent( QKeyEvent* e ) -{ - switch ( e->type() ) - { - case QEvent::KeyPress: - emit keyPressed( this, e ); - break; - case QEvent::KeyRelease: - emit keyReleased( this, e ); - break; - default: - break; - } -} - -/*! - Dispatches wheel events -*/ -void GLViewer_ViewFrame::wheelEvent( QWheelEvent* e ) -{ - switch ( e->type() ) - { - case QEvent::Wheel: - emit wheeling( this, e ); - break; - default: - break; - } -} - -/*! - \return the visual parameters of this view as a formated string -*/ -QString GLViewer_ViewFrame::getVisualParameters() -{ - QString retStr; - if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) ) { - GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP; - GLfloat xSc, ySc, xPan, yPan; - vp2d->getScale( xSc, ySc ); - vp2d->getPan( xPan, yPan ); - retStr.sprintf( "%.12e*%.12e*%.12e*%.12e", xSc, ySc, xPan, yPan ); - } - return retStr; -} - -/*! - The method restores visual parameters of this view from a formated string -*/ -void GLViewer_ViewFrame::setVisualParameters( const QString& parameters ) -{ - QStringList paramsLst = QStringList::split( '*', parameters, true ); - if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) && paramsLst.size() == 4) { - GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP; - - GLfloat xSc, ySc, xPan, yPan; - xSc = paramsLst[0].toDouble(); - ySc = paramsLst[1].toDouble(); - xPan = paramsLst[2].toDouble(); - yPan = paramsLst[3].toDouble(); - - vp2d->getGLWidget()->setScale( xSc, ySc, 1. ); - vp2d->getGLWidget()->setPan( xPan, yPan, 0. ); - } -} diff --git a/src/GLViewer/GLViewer_ViewFrame.h b/src/GLViewer/GLViewer_ViewFrame.h deleted file mode 100644 index 76b9fe55b..000000000 --- a/src/GLViewer/GLViewer_ViewFrame.h +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewFrame.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWFRAME_H -#define GLVIEWER_VIEWFRAME_H - -#include "SUIT_ViewWindow.h" -#include "GLViewer.h" - -class QColor; - -class SUIT_Desktop; - -class GLViewer_Viewer; -class GLViewer_ViewPort; - -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_ViewFrame - Frame window for viewport in QAD-based application -*/ - -class GLVIEWER_API GLViewer_ViewFrame: public SUIT_ViewWindow -{ - Q_OBJECT - -public: - GLViewer_ViewFrame( SUIT_Desktop* , GLViewer_Viewer* ); - ~GLViewer_ViewFrame(); - -public: - void setViewer( GLViewer_Viewer* ); - GLViewer_Viewer* getViewer() const; - - void setViewPort( GLViewer_ViewPort* ); - GLViewer_ViewPort* getViewPort() const; - - void setBackgroundColor( const QColor& ); - QColor backgroundColor() const; - - QSize sizeHint() const; - - virtual void onUpdate( int ); - - virtual QString getVisualParameters(); - virtual void setVisualParameters( const QString& parameters ); - -signals: - void vfDrawExternal( QPainter* ); - void vfViewClosing( QCloseEvent* ); - -protected: - GLViewer_Viewer* myViewer; - GLViewer_ViewPort* myVP; - -public: - //ViewType getTypeView() const { return VIEW_GL; }; - QWidget* getViewWidget() { return ( QWidget* )getViewPort(); }; - -protected slots: - void onViewDump(); - void onViewPan(); - void onViewZoom(); - void onViewFitAll(); - void onViewFitArea(); - void onViewFitSelect(); - void onViewGlobalPan(); - void onViewRotate(); - void onViewReset(); - void onViewFront() {}; - void onViewBack() {}; - void onViewRight() {}; - void onViewLeft() {}; - void onViewBottom() {}; - void onViewTop() {}; - void onViewTrihedron() {}; - -private slots: - void keyEvent( QKeyEvent* ); - void mouseEvent( QMouseEvent* ); - void wheelEvent( QWheelEvent* ); - -private: - void createActions(); - void createToolBar(); - -private: - //! Actions ID - enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId }; - typedef QMap ActionsMap; - -private: - ActionsMap myActionsMap; - QToolBar* myToolBar; -}; - - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_ViewManager.cxx b/src/GLViewer/GLViewer_ViewManager.cxx deleted file mode 100644 index 8e1f1e860..000000000 --- a/src/GLViewer/GLViewer_ViewManager.cxx +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewManager.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_ViewManager.h" -#include "GLViewer_ViewFrame.h" -#include "GLViewer_Viewer2d.h" -#include "SUIT_Desktop.h" - -/*!Constructor.*/ -GLViewer_ViewManager::GLViewer_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop ) -: SUIT_ViewManager( theStudy, theDesktop, new GLViewer_Viewer2d( "GLViewer" ) ) -{ - setTitle( tr( "GL_VIEW_TITLE" ) ); -} - -/*!Destructor.*/ -GLViewer_ViewManager::~GLViewer_ViewManager() -{ -} - -/*!Context menu popup for \a popup.*/ -void GLViewer_ViewManager::contextMenuPopup( QPopupMenu* popup ) -{ - SUIT_ViewManager::contextMenuPopup( popup ); - // if it is necessary invoke method CreatePopup of ViewPort - // be sure that existing QPopupMenu menu is used for that. -} diff --git a/src/GLViewer/GLViewer_ViewManager.h b/src/GLViewer/GLViewer_ViewManager.h deleted file mode 100644 index 3542d63f3..000000000 --- a/src/GLViewer/GLViewer_ViewManager.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewManager.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWMANAGER_H -#define GLVIEWER_VIEWMANAGER_H - -#include "GLViewer.h" -#include "SUIT_ViewManager.h" -#include "GLViewer_Viewer.h" - -class SUIT_Desktop; - -class GLVIEWER_API GLViewer_ViewManager : public SUIT_ViewManager -{ - Q_OBJECT -public: - GLViewer_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop ); - virtual ~GLViewer_ViewManager(); - - GLViewer_Viewer* getGLViewer() { return (GLViewer_Viewer*) myViewModel; } - - virtual void contextMenuPopup( QPopupMenu* ); -}; - -#endif // GLVIEWER_VIEWMANAGER_H diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx deleted file mode 100644 index 07de20242..000000000 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ /dev/null @@ -1,601 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewPort.cxx -// Created: November, 2004 - -//#include - -#if !(defined WNT) && !(defined QT_CLEAN_NAMESPACE) -#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */ -#endif - -#include "GLViewer_ViewPort.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#if !defined WNT -#include -#include -#include -#include -#include -#undef QT_CLEAN_NAMESPACE -#include -#include - -/*! - \struct CMapEntry - Map of indexed colors - For internal purposes -*/ -struct CMapEntry -{ - CMapEntry(); - ~CMapEntry(); - Colormap cmap; - bool alloc; - XStandardColormap scmap; -}; - -/*! - Constructor -*/ -CMapEntry::CMapEntry() -{ - cmap = 0; - alloc = false; - scmap.colormap = 0; -} - -/*! - Destructor -*/ -CMapEntry::~CMapEntry() -{ - if ( alloc ) - XFreeColormap( QPaintDevice::x11AppDisplay(), cmap ); -} - -static QIntDict *cmap_dict = 0; -static bool mesa_gl = false; - -static void cleanup_cmaps() -{ - if ( !cmap_dict ) - return; - cmap_dict->setAutoDelete( true ); - delete cmap_dict; - cmap_dict = 0; -} - -static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) -{ - if ( !cmap_dict ) - { - cmap_dict = new QIntDict; - const char *v = glXQueryServerString( dpy, vi->screen, GLX_VERSION ); - mesa_gl = strstr( v,"Mesa" ) != 0; - qAddPostRoutine( cleanup_cmaps ); - } - - CMapEntry *x = cmap_dict->find( (long)vi->visualid ); - if ( x ) // found colormap for visual - return x->cmap; - - x = new CMapEntry(); - - XStandardColormap *c; - int n, i; - -#ifdef DEBUG - cout << "Choosing cmap for vID = " << vi->visualid << endl; -#endif - - if ( vi->visualid == XVisualIDFromVisual( (Visual*)QPaintDevice::x11AppVisual() ) ) - { -#ifdef DEBUG - cout << "Using x11AppColormap" << endl; -#endif - return QPaintDevice::x11AppColormap(); - } - - if ( mesa_gl ) - { - Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true ); - if ( hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8 ) - { - if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) ) - { - i = 0; - while ( i < n && x->cmap == 0 ) - { - if ( c[i].visualid == vi->visual->visualid ) - { - x->cmap = c[i].colormap; - x->scmap = c[i]; - } - i++; - } - XFree( (char*)c ); - } - } - } -#if !defined( _OS_SOLARIS_ ) - if ( !x->cmap ) - { - if ( XmuLookupStandardColormap( dpy, vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, false, true ) ) - { - if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, XA_RGB_DEFAULT_MAP ) ) - { - i = 0; - while ( i < n && x->cmap == 0 ) - { - if ( c[i].visualid == vi->visualid ) - { - x->cmap = c[i].colormap; - x->scmap = c[i]; - } - i++; - } - XFree( (char *)c ); - } - } - } -#endif - if ( !x->cmap ) - { - // no shared cmap found - x->cmap = XCreateColormap( dpy, RootWindow( dpy, vi->screen ), vi->visual, AllocNone ); - x->alloc = true; - } - - cmap_dict->insert( (long)vi->visualid, x ); // associate cmap with visualid - return x->cmap; -} -#endif - -int GLViewer_ViewPort::nCounter = 0; -QCursor* GLViewer_ViewPort::defCursor = 0; -QCursor* GLViewer_ViewPort::panglCursor = 0; -QCursor* GLViewer_ViewPort::handCursor = 0; -QCursor* GLViewer_ViewPort::panCursor = 0; -QCursor* GLViewer_ViewPort::zoomCursor = 0; -QCursor* GLViewer_ViewPort::rotCursor = 0; -QCursor* GLViewer_ViewPort::sketchCursor = 0; - -/*! - Creates the necessary viewport cursors. [ static ] -*/ -void GLViewer_ViewPort::createCursors () -{ - defCursor = new QCursor( ArrowCursor ); - panglCursor = new QCursor( CrossCursor ); - handCursor = new QCursor( PointingHandCursor ); - panCursor = new QCursor( SizeAllCursor ); - - SUIT_ResourceMgr* rmgr = SUIT_Session::session()->resourceMgr(); - zoomCursor = new QCursor( rmgr->loadPixmap( "GLViewer", tr( "ICON_GL_CURSOR_ZOOM" ) ) ); - rotCursor = new QCursor( rmgr->loadPixmap( "GLViewer", tr( "ICON_GL_CURSOR_ROTATE" ) ) ); - sketchCursor = new QCursor( rmgr->loadPixmap( "GLViewer", tr( "ICON_GL_CURSOR_SKETCH" ) ) ); -} - -/*! - Destroys the viewport cursors. [ static ] -*/ -void GLViewer_ViewPort::destroyCursors() -{ - delete defCursor; defCursor = 0; - delete panglCursor; panglCursor = 0; - delete handCursor; handCursor = 0; - delete panCursor; panCursor = 0; - delete zoomCursor; zoomCursor = 0; - delete rotCursor; rotCursor = 0; - delete sketchCursor; sketchCursor = 0; -} - -/*! - Sets new default cursor. [ static ] -*/ -void GLViewer_ViewPort::setDefaultCursor( const QCursor& newCursor ) -{ - if ( !defCursor ) - defCursor = new QCursor(); - *defCursor = newCursor; -} - -/*! - Sets new cursor for drawing rectangle in the viewport. [ static ] -*/ -void GLViewer_ViewPort::setHandCursor( const QCursor& newCursor ) -{ - if ( !handCursor ) - handCursor = new QCursor(); - *handCursor = newCursor; -} - -/*! - Sets new cursor for panning. [ static ] -*/ -void GLViewer_ViewPort::setPanCursor( const QCursor& newCursor ) -{ - if ( !panCursor ) - panCursor = new QCursor(); - *panCursor = newCursor; -} - -/*! - Sets new cursor for global panning. [ static ] -*/ -void GLViewer_ViewPort::setPanglCursor( const QCursor& newCursor ) -{ - if ( !panglCursor ) - panglCursor = new QCursor(); - *panglCursor = newCursor; -} - -/*! - Sets new cursor for zooming. [ static ] -*/ -void GLViewer_ViewPort::setZoomCursor( const QCursor& newCursor ) -{ - if ( !zoomCursor ) - zoomCursor = new QCursor(); - *zoomCursor = newCursor; -} - -/*! - Sets new cursor for rotating. [ static ] -*/ -void GLViewer_ViewPort::setRotCursor( const QCursor& newCursor ) -{ - if ( !rotCursor ) - rotCursor = new QCursor(); - *rotCursor = newCursor; -} - -/*! - Sets new cursor for rotating. [ static ] -*/ -void GLViewer_ViewPort::setSketchCursor( const QCursor& newCursor ) -{ - if ( !rotCursor ) - sketchCursor = new QCursor(); - *sketchCursor = newCursor; -} - -/*! - Constructor -*/ -GLViewer_ViewPort::GLViewer_ViewPort( QWidget* parent ) -: QWidget( parent, 0, WRepaintNoErase | WResizeNoErase ) -{ - initialize(); -} - -/*! - Destructor -*/ -GLViewer_ViewPort::~GLViewer_ViewPort() -{ - cleanup(); -} - -/*! - Initializes viewport. [ private ] -*/ -void GLViewer_ViewPort::initialize() -{ - if ( nCounter++ == 0 ) - createCursors(); - - //myPopupActions.setAutoDelete( true ); - myPaintersRedrawing = false; - myEnableSketching = false; - myEnableTransform = true; - - setMouseTracking( true ); - setBackgroundMode( NoBackground ); - - setFocusPolicy( StrongFocus ); -} - -/*! - Cleans up the viewport. [ private ] -*/ -void GLViewer_ViewPort::cleanup() -{ - if ( --nCounter == 0 ) - destroyCursors(); -} - -/*! - Selects visual ID for OpenGL window ( X11 specific ). [ protected ] -*/ -void GLViewer_ViewPort::selectVisualId( ViewType type ) -{ -#if !defined WNT - XVisualInfo* pVisualInfo; - if ( x11Display() ) - { - /* Initialization with the default VisualID */ - //Visual *v = DefaultVisual( x11Display(), DefaultScreen( x11Display() ) ); - // int visualID = XVisualIDFromVisual( v ); unused - - /* Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */ - int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None }; - - pVisualInfo = ::glXChooseVisual( x11Display(), DefaultScreen( x11Display() ), visualAttr ); - - if ( isVisible() ) - hide(); - - XSetWindowAttributes a; - - a.colormap = choose_cmap( x11Display(), pVisualInfo ); /* find best colormap */ - a.background_pixel = backgroundColor().pixel(); - a.border_pixel = black.pixel(); - Window p = RootWindow( x11Display(), DefaultScreen( x11Display() ) ); - if ( parentWidget() ) - p = parentWidget()->winId(); - - Window w; - if ( type == Type2D ) // creating simple X window for 2d - { - unsigned long xbackground = - BlackPixel( x11Display(), DefaultScreen( x11Display() ) ); - unsigned long xforeground = - WhitePixel( x11Display(), DefaultScreen( x11Display() ) ); - - w = XCreateSimpleWindow ( x11Display(), p, x(), y(), width(), - height(), 0, xforeground, xbackground ); - } - else if ( type == Type3D ) - { - w = XCreateWindow( x11Display(), p, x(), y(), width(), height(), - 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual, - CWBackPixel | CWBorderPixel | CWColormap, &a ); - } - else - return; - - Window *cmw; - Window *cmwret; - int count; - if ( XGetWMColormapWindows( x11Display(), topLevelWidget()->winId(), &cmwret, &count ) ) - { - cmw = new Window[count+1]; - memcpy( (char*)cmw, (char*)cmwret, sizeof(Window) * count ); - XFree( (char*)cmwret ); - int i; - - for ( i = 0; i < count; i++ ) - { - if ( cmw[i] == winId() ) /* replace old window */ - { - cmw[i] = w; - break; - } - } - - if ( i >= count ) /* append new window */ - cmw[count++] = w; - } - else - { - count = 1; - cmw = new Window[count]; - cmw[0] = w; - } - - /* Creating new window (with good VisualID) for this widget */ - create(w); - XSetWMColormapWindows( x11Display(), topLevelWidget()->winId(), cmw, count ); - delete[] cmw; - - if ( isVisible() ) - show(); - - if ( pVisualInfo ) - { - XFree( (char *)pVisualInfo ); - } - XFlush( x11Display() ); - } -#endif -} - -/*! - Sets the background 'color'. [ virtual ] -*/ -void GLViewer_ViewPort::setBackgroundColor( const QColor& color ) -{ - QPalette pal = palette(); - pal.setColor( QColorGroup::Background, color ); - setPalette( pal ); - repaint(); -} - -/*! - Returns the background color. [ virtual ] -*/ -QColor GLViewer_ViewPort::backgroundColor() const -{ - return palette().active().background(); -} - -/*! - Returns 'true' if sketching is enabled in this viewport. [ public ] -*/ -bool GLViewer_ViewPort::isSketchingEnabled() const -{ - return myEnableSketching; -} - -/*! - Enables / disables sketching [ public ] -*/ -void GLViewer_ViewPort::setSketchingEnabled( bool enable ) -{ - myEnableSketching = enable; -} - -/*! - Returns 'true' if transformations ( rotation, zoom etc. ) - are enabled in this viewport. [ public ] -*/ -bool GLViewer_ViewPort::isTransformEnabled() const -{ - return myEnableTransform; -} - -/*! - Enables / disables transformations. [ public ] -*/ -void GLViewer_ViewPort::setTransformEnabled( bool enable ) -{ - myEnableTransform = enable; -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::mousePressEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::mouseMoveEvent( QMouseEvent* e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::mouseReleaseEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); - - /* show popup menu */ - if ( e->button() == Qt::RightButton ) - { - //QPopupMenu* popup = createPopup(); - //if ( popup && popup->count() ) - // popup->exec( QCursor::pos() ); - //destroyPopup( /*popup*/ ); - } -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::mouseDoubleClickEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'keyEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::keyPressEvent( QKeyEvent *e ) -{ - emit vpKeyEvent( e ); -} - -/*! - Emits 'keyEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::keyReleaseEvent( QKeyEvent *e ) -{ - emit vpKeyEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort::wheelEvent( QWheelEvent *e ) -{ - emit vpWheelEvent( e ); -} - -/*! - Repaints the viewport. [ virtual protected ] -*/ -void GLViewer_ViewPort::paintEvent( QPaintEvent* ) -{ - if ( myPaintersRedrawing ) - { - QPainter p( this ); - emit vpDrawExternal( &p ); - myPaintersRedrawing = false; - } -} - -/*! - Forces to redraw the viewport by an external painter. [ public ] -*/ -void GLViewer_ViewPort::redrawPainters() -{ - myPaintersRedrawing = true; - repaint(); -} - -/*! - Updates this view. Does nothing by default. [ virtual public ] -*/ -void GLViewer_ViewPort::onUpdate() -{ -} - -/*! - Sets the background color with color selection dialog. [ virtual protected slot ] -*/ -void GLViewer_ViewPort::onChangeBgColor() -{ - QColor selColor = QColorDialog::getColor ( backgroundColor(), this ); - if ( selColor.isValid() ) - setBackgroundColor( selColor ); -} - -/*! - Custom context menu event handler -*/ -void GLViewer_ViewPort::contextMenuEvent( QContextMenuEvent* e ) -{ - //if ( e->reason() != QContextMenuEvent::Mouse ) - emit contextMenuRequested( e ); -} diff --git a/src/GLViewer/GLViewer_ViewPort.h b/src/GLViewer/GLViewer_ViewPort.h deleted file mode 100644 index b7ceaf2dc..000000000 --- a/src/GLViewer/GLViewer_ViewPort.h +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewPort.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWPORT_H -#define GLVIEWER_VIEWPORT_H - -#include "GLViewer.h" - -#include -#include -#include -#include - -#include - -class QRect; -class QCursor; -class QPainter; -class GLViewer_ViewSketcher; -class GLViewer_ViewTransformer; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -enum BlockStatus -{ - BS_NoBlock = 0x0000, - BS_Highlighting = 0x0001, - BS_Selection = 0x0002, - BS_Dragging = 0x0004 -}; - -/*! - \class GLViewer_ViewPort - Visualisation canvas of GLViewer -*/ -class GLVIEWER_API GLViewer_ViewPort: public QWidget -{ - Q_OBJECT - friend class GLViewer_ViewSketcher; - friend class GLViewer_ViewTransformer; - -public: - GLViewer_ViewPort( QWidget* parent ); - ~GLViewer_ViewPort(); - -public: - //! Activates/deactivates sketching - void setSketchingEnabled( bool ); - //! Checks active status of sketcher - bool isSketchingEnabled() const; - //! Activates/deactivates transformer - void setTransformEnabled( bool ); - //! Checks active status of transformer - bool isTransformEnabled() const; - - //! Returns background color - virtual QColor backgroundColor() const; - //! Sets background color - virtual void setBackgroundColor( const QColor& ); - - //! Redraw external pa inters - void redrawPainters(); - - //! Updates view - virtual void onUpdate(); - - //! Returns blocking status for current started operations - virtual BlockStatus currentBlock(){ return BS_NoBlock; } - -protected: - enum ViewType { Type2D, Type3D }; - void selectVisualId( ViewType ); - - virtual QPaintDevice* getPaintDevice() { return this; } - virtual void contextMenuEvent( QContextMenuEvent * e ); - -//! STATICS - static void createCursors(); - static void destroyCursors(); - static QCursor* getHandCursor() { return handCursor; } - static void setHandCursor( const QCursor& newCursor ); - static QCursor* getPanCursor() { return panCursor; } - static void setPanCursor( const QCursor& newCursor ); - static QCursor* getPanglCursor() { return panglCursor; } - static void setPanglCursor( const QCursor& newCursor ); - static QCursor* getZoomCursor() { return zoomCursor; } - static void setZoomCursor( const QCursor& newCursor ); - -public://ouv - static QCursor* getDefaultCursor() { return defCursor; } - static void setDefaultCursor( const QCursor& newCursor ); - static QCursor* getRotCursor() { return rotCursor; } - static void setRotCursor( const QCursor& newCursor ); - static QCursor* getSketchCursor() { return sketchCursor; } - static void setSketchCursor( const QCursor& newCursor ); - -protected: -//! EVENTS - virtual void paintEvent( QPaintEvent *); - virtual void mouseMoveEvent( QMouseEvent *); - virtual void mouseReleaseEvent( QMouseEvent *); - virtual void mousePressEvent( QMouseEvent *); - virtual void mouseDoubleClickEvent( QMouseEvent *); - virtual void keyPressEvent( QKeyEvent *); - virtual void keyReleaseEvent( QKeyEvent *); - virtual void wheelEvent( QWheelEvent *); - -//! TO BE REDEFINED - virtual void reset() = 0; - virtual void pan( int, int ) = 0; - virtual void setCenter( int, int ) = 0; - virtual void zoom( int, int, int, int ) = 0; - virtual void fitRect( const QRect& ) = 0; - virtual void fitSelect() = 0; - virtual void fitAll( bool keepScale = false, bool withZ = true ) = 0; - -protected slots: - virtual void onChangeBgColor(); - -signals: - void vpKeyEvent( QKeyEvent* ); - void vpMouseEvent( QMouseEvent* ); - void vpWheelEvent( QWheelEvent* ); - void vpDrawExternal( QPainter* ); - - void contextMenuRequested( QContextMenuEvent* ); - -private: - void initialize(); - void cleanup(); - -protected: - //Handle(Aspect_Window) myWindow; - bool myEnableSketching; - bool myEnableTransform; - bool myPaintersRedrawing; /* set to draw externally */ - //QList myPopupActions; - -private: - static int nCounter; /* objects counter */ - static QCursor* defCursor; - static QCursor* panglCursor; - static QCursor* handCursor; - static QCursor* panCursor; - static QCursor* zoomCursor; - static QCursor* rotCursor; - static QCursor* sketchCursor; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx deleted file mode 100644 index 3055726ec..000000000 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ /dev/null @@ -1,1393 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewPort2d.cxx -// Created: November, 2004 - -/* GLViewer_ViewPort2d Source File */ - -//#include -#include "GLViewer_ViewPort2d.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_ViewFrame.h" -#include "GLViewer_MimeSource.h" -#include "GLViewer_Context.h" -#include "GLViewer_Compass.h" -#include "GLViewer_Grid.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define WIDTH 640 -#define HEIGHT 480 -#define MARGIN 100 - -#define GRID_XSIZE 100 -#define GRID_YSIZE 100 - -int static aLastViewPostId = 0; - -void rotate_point( float& theX, float& theY, float theAngle ) -{ - float aTempX = theX * cos(theAngle) - theY * sin(theAngle); - float aTempY = theX * sin(theAngle) + theY * cos(theAngle); - theX = aTempX; - theY = aTempY; -} - -/*! - Constructor -*/ -GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* theViewFrame ) : - GLViewer_ViewPort( parent ), - myMargin( MARGIN ), myWidth( WIDTH ), myHeight( HEIGHT ), - myXScale( 1.0 ), myYScale( 1.0 ), myXOldScale( 1.0 ), myYOldScale( 1.0 ), - myXPan( 0.0 ), myYPan( 0.0 ), - myIsMouseReleaseBlock( false ) -{ - if( theViewFrame == NULL ) - myViewFrame = ( GLViewer_ViewFrame* )parent; - else - myViewFrame = theViewFrame; - - myGrid = 0; - myCompass = 0; - myBorder = new GLViewer_Rect(); - - QBoxLayout* qbl = new QHBoxLayout( this ); - myGLWidget = new GLViewer_Widget( this, 0 ) ; - qbl->addWidget( myGLWidget ); - myGLWidget->setFocusProxy( this ); - setMouseTracking( TRUE ); - - myIsDragProcess = noDrag; - //myCurDragMousePos = QPoint(); - myCurDragPosX = NULL; - myCurDragPosY = NULL; - - myIsPulling = false; - - myViewPortId = aLastViewPostId; - aLastViewPostId++; - - mypFirstPoint = NULL; - mypLastPoint = NULL; - - myObjectTip = new QtxToolTip( myGLWidget );///GLViewer_ObjectTip( this ); - myObjectTip->setShowDelayTime( 60000 ); - connect( myObjectTip, SIGNAL( maybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ), - this, SLOT( onMaybeTip( QPoint, QString&, QFont&, QRect&, QRect& ) ) ); -// myGLWidget->installEventFilter( myObjectTip ); -} - -/*! - Destructor -*/ -GLViewer_ViewPort2d::~GLViewer_ViewPort2d() -{ - if( myCompass ) - delete myCompass; - - if( myGrid ) - delete myGrid; - - delete myBorder; - delete myGLWidget; -} - -/*! - SLOT: initializes drag process -*/ -void GLViewer_ViewPort2d::onStartDragObject( ) -{ - if( myIsDragProcess == noDrag ) - { - myIsDragProcess = initDrag; - QCursor::setPos( (int)(*myCurDragPosX), (int)(*myCurDragPosY) ); - //myCurDragMousePos = QPoint( 0, 0 ); - delete myCurDragPosX; - delete myCurDragPosY; - myCurDragPosX = NULL; - myCurDragPosY = NULL; - return; - } -} - -/*! - SLOT: cuts object to clipboard -*/ -void GLViewer_ViewPort2d::onCutObject() -{ - /*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject(); - if( aMovingObject ) - { - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); - aMimeSource->setObject( aMovingObject ); - - QClipboard *aClipboard = QApplication::clipboard(); - aClipboard->clear(); - aClipboard->setData( aMimeSource ); - - ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->deleteObject( aMovingObject ); - }*/ - GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext(); - int aObjNum = aContext->NbSelected(); - if( aObjNum > 0 ) - { - QValueList aObjects; - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); - aContext->InitSelected(); - for( ; aContext->MoreSelected(); aContext->NextSelected() ) - aObjects.append( aContext->SelectedObject() ); - - //aMimeSource->setObjects( aObjects ); ouv 6.05.04 - - QClipboard *aClipboard = QApplication::clipboard(); - aClipboard->clear(); - aClipboard->setData( aMimeSource ); - - for( int i = 0; i < aObjNum; i++ ) - aContext->deleteObject( aObjects[i] ); - } -} - -/*! - SLOT: copies object to clipboard -*/ -void GLViewer_ViewPort2d::onCopyObject() -{ - /*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject(); - if( aMovingObject ) - { - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); - aMimeSource->setObject( aMovingObject ); - - QClipboard *aClipboard = QApplication::clipboard(); - aClipboard->clear(); - aClipboard->setData( aMimeSource ); - } - */ - GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext(); - int aObjNum = aContext->NbSelected(); - if( aObjNum > 0 ) - { - QValueList aObjects; - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); - aContext->InitSelected(); - for( ; aContext->MoreSelected(); aContext->NextSelected() ) - aObjects.append( aContext->SelectedObject() ); - - //aMimeSource->setObjects( aObjects ); ouv 6.05.04 - - QClipboard *aClipboard = QApplication::clipboard(); - aClipboard->clear(); - aClipboard->setData( aMimeSource ); - } -} - -/*! - SLOT: pastes object from clipboard -*/ -void GLViewer_ViewPort2d::onPasteObject() -{ - /*QClipboard *aClipboard = QApplication::clipboard(); - QMimeSource* aMimeSource = aClipboard->data(); - if( aMimeSource->provides( "GLViewer_Object" ) ) - { - const char* aType; - int i = 1; - QByteArray anArray; - do - { - aType = aMimeSource->format( i ); - anArray = aMimeSource->encodedData( aType ); - if( anArray.size() != 0 ) - break; - i++; - } - while( aType != 0 ); - if( anArray.size() == 0 ) - return; - - GLViewer_Object* aObject = GLViewer_MimeSource::getObject( anArray, aType ); - if( !aObject ) - return; - - ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->insertObject( aObject, true ); - } - */ - /* ouv 6.05.04 - QClipboard *aClipboard = QApplication::clipboard(); - - QMimeSource* aMimeSource = aClipboard->data(); - if( aMimeSource->provides( "GLViewer_Objects" ) ) - { - QByteArray anArray = aMimeSource->encodedData( "GLViewer_Objects" ); - QValueList aObjects = GLViewer_MimeSource::getObjects( anArray, "GLViewer_Objects" ); - if( aObjects.empty() ) - return; - GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext(); - for( int i = 0; i < aObjects.count(); i++ ) - aContext->insertObject( aObjects[i], true ); - } - */ -} - -/*! - SLOT: called when object is being dragged -*/ -void GLViewer_ViewPort2d::onDragObject( QMouseEvent* e ) -{ - //cout << "---GLViewer_ViewPort2d::onDragObject()---" << endl; - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - GLViewer_Object* anObject = aContext->getCurrentObject(); - - if( !aContext ) - return; - - float aX = e->pos().x(); - float anY = e->pos().y(); - aViewer->transPoint( aX, anY ); - - if( myCurDragPosX == NULL && myCurDragPosY == NULL ) - { - myCurDragPosX = new float(aX); - myCurDragPosY = new float(anY); - return; - } - - //QPoint aNewPos = e->pos(); - //GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - - if( anObject && (e->state() & LeftButton ) ) - { - if( aContext->isSelected( anObject ) ) - { - for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) - { - GLViewer_Object* aMovingObject = aContext->SelectedObject(); - if( aMovingObject ) - aMovingObject->moveObject( aX - *myCurDragPosX, anY - *myCurDragPosY); - } - } - else - anObject->moveObject( aX - *myCurDragPosX, anY - *myCurDragPosY); - } - else if( aContext->NbSelected() && (e->state() & MidButton ) ) - for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) - (aContext->SelectedObject())->moveObject( aX - *myCurDragPosX, anY - *myCurDragPosY); - - delete myCurDragPosX; - delete myCurDragPosY; - myCurDragPosX = new float(aX); - myCurDragPosY = new float(anY); - - myGLWidget->updateGL(); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort2d::mousePressEvent( QMouseEvent* e ) -{ - emit vpMouseEvent( e ); - - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - - GLViewer_Object* anObject = NULL; - if( aContext ) - anObject = aContext->getCurrentObject(); - - bool accel = e->state() & GLViewer_ViewTransformer::accelKey(); - if( ( anObject && !( accel || e->button() == Qt::RightButton ) ) || - ( aContext->NbSelected() && !accel && e->button() == Qt::MidButton ) ) - { - myIsDragProcess = inDrag; - } -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort2d::mouseMoveEvent( QMouseEvent* e ) -{ - emit vpMouseEvent( e ); - - if( myIsDragProcess == inDrag ) - onDragObject( e ); - - /*GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - - GLViewer_Object* anObj = aContext->getCurrentObject(); - if( anObj && aContext->currentObjectIsChanged() ) - { - //cout << "GLViewer_ViewPort2d::mouseMoveEvent{QToolTip::add}" << endl; - //QToolTip::remove( myGLWidget ); - QRect* aRect = (aViewer->getWinObjectRect(anObj)); - //QToolTip::add( myGLWidget, *aRect, anObj->getToolTipText() ); - myGLWidget->addToolTip( anObj->getToolTipText(), *aRect ); - } - if(!anObj) - { - //cout << "GLViewer_ViewPort2d::mouseMoveEvent{QToolTip::remove}" << endl; - //QRect* aRect = (aViewer->getWinObjectRect(anObj)); - //QToolTip::remove( myGLWidget, *aRect ); - myGLWidget->removeToolTip(); - }*/ -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void GLViewer_ViewPort2d::mouseReleaseEvent( QMouseEvent* e ) -{ - if ( myIsMouseReleaseBlock ) - { - // skip mouse release after double click - myIsMouseReleaseBlock = false; - return; - } - - /* show popup menu */ - if ( e->button() == Qt::RightButton ) - { - //QPopupMenu* popup = createPopup(); - //if ( popup && popup->count() ) - // popup->exec( QCursor::pos() ); - //destroyPopup( /*popup*/ ); - } - emit vpMouseEvent( e ); - - if( myIsDragProcess == inDrag ) - { - bool isAnyMoved = false; - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - GLViewer_Object* aMovingObject; - for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) - { - aMovingObject = aContext->SelectedObject(); - if( aMovingObject ) - isAnyMoved = aMovingObject->finishMove() || isAnyMoved; - } - - aMovingObject = aContext->getCurrentObject(); - if( aMovingObject ) - isAnyMoved = aMovingObject->finishMove() || isAnyMoved; - - myIsDragProcess = noDrag; - //myCurDragMousePos.setX( 0 ); - //myCurDragMousePos.setY( 0 ); - delete myCurDragPosX; - delete myCurDragPosY; - myCurDragPosX = NULL; - myCurDragPosY = NULL; - - if( isAnyMoved ) - { - emit objectMoved(); - aViewer->updateBorders(); - } - } -} - -/*! - Custom mouse double click event handler -*/ -void GLViewer_ViewPort2d::mouseDoubleClickEvent( QMouseEvent * e ) -{ - //redefined to block mouse release after mouse double click - myIsMouseReleaseBlock = true; - // invoke base implementation - GLViewer_ViewPort::mouseDoubleClickEvent( e ); -} - -/*! - Creates or deletes compass - \param on - if it is true, then to create -*/ -void GLViewer_ViewPort2d::turnCompass( GLboolean on ) -{ - if( on ) - myCompass = new GLViewer_Compass( Qt::green, 30, GLViewer_Compass::TopRight, 10, 5, 12, 3 ); - else if( myCompass ) - delete myCompass; -} - -/*! - Creates or deletes grid - \param on - if it is true, then to create -*/ -void GLViewer_ViewPort2d::turnGrid( GLboolean on ) -{ - if( on ) - { - myGrid = new GLViewer_Grid( 2*WIDTH, 2*HEIGHT, - 2*WIDTH, 2*HEIGHT, - GRID_XSIZE, GRID_YSIZE, - myXPan, myYPan, - myXScale, myYScale ); - } - else if( myGrid ) - delete myGrid; -} - -/*! - Changes grid color - \param gridColor - new grid color - \param axisColor - new axis color -*/ -void GLViewer_ViewPort2d::setGridColor( const QColor gridColor, const QColor axisColor ) -{ - if( myGrid ) - { - myGrid->setGridColor( ( GLfloat )gridColor.red() / 255, - ( GLfloat )gridColor.green() / 255, - ( GLfloat )gridColor.blue() / 255 ); - myGrid->setAxisColor( ( GLfloat )axisColor.red() / 255, - ( GLfloat )axisColor.green() / 255, - ( GLfloat )axisColor.blue() / 255 ); - } -} - -/*! - Changes background color - \param color - new background color -*/ -void GLViewer_ViewPort2d::setBackgroundColor( const QColor& color ) -{ - GLViewer_ViewPort::setBackgroundColor( color ); - myGLWidget->makeCurrent(); - glClearColor( ( GLfloat )color.red() / 255, - ( GLfloat )color.green() / 255, - ( GLfloat )color.blue() / 255, 1.0 ); - myGLWidget->repaint(); -} - -/*! - \return background color -*/ -QColor GLViewer_ViewPort2d::backgroundColor() const -{ - return GLViewer_ViewPort::backgroundColor(); -} - -/*! - Resize view -*/ -void GLViewer_ViewPort2d::initResize( int x, int y ) -{ - float xa, xb, ya, yb; - xa = myBorder->left() - myMargin; - xb = myBorder->right() + myMargin; - ya = myBorder->top() - myMargin; - yb = myBorder->bottom() + myMargin; - - GLfloat zoom, xzoom, yzoom; - GLfloat w = x; - GLfloat h = y; - bool max = FALSE; - - xzoom = (GLfloat)x / myWidth; - yzoom = (GLfloat)y / myHeight; - - if ( ( xzoom < yzoom ) && ( xzoom < 1 ) ) - zoom = xzoom; - else if ( ( yzoom < xzoom ) && ( yzoom < 1 ) ) - zoom = yzoom; - else - { - max = TRUE; - zoom = xzoom > yzoom ? xzoom : yzoom; - } - - if ( !max && ( ! ( ( ( myXPan + w/2 ) < xb * myXScale * zoom ) || - ( ( myXPan - w/2 ) > xa * myXScale * zoom ) || - ( ( myYPan + h/2 ) < yb * myYScale * zoom ) || - ( ( myYPan - h/2 ) > ya * myYScale * zoom ) ) ) ) - zoom = 1; - - if ( max && ( ( ( myXPan + w/2 ) < xb * myXScale * zoom ) || - ( ( myXPan - w/2 ) > xa * myXScale * zoom ) || - ( ( myYPan + h/2 ) < yb * myYScale * zoom ) || - ( ( myYPan - h/2 ) > ya * myYScale * zoom ) ) ) - zoom = 1; - - myWidth = x; - myHeight = y; - - myXScale *= zoom; - myYScale = myXScale; - - if ( myGrid ) - myGrid->setResize( 2*x, 2*y, zoom ); - - myGLWidget->setScale( myXScale, myYScale, 1.0 ); -} - -/*! - Custom paint event handler -*/ -void GLViewer_ViewPort2d::paintEvent( QPaintEvent* e ) -{ - //cout << "GLViewer_ViewPort2d::paintEvent" << endl; - myGLWidget->updateGL(); - GLViewer_ViewPort::paintEvent( e ); -} - -/*! - Custom resize event handler -*/ -void GLViewer_ViewPort2d::resizeEvent( QResizeEvent* e ) -{ - //cout << "GLViewer_ViewPort2d::resizeEvent" << endl; - GLViewer_ViewPort::resizeEvent( e ); -} - -/*! - Resets view to start state -*/ -void GLViewer_ViewPort2d::reset() -{ - //cout << "GLViewer_ViewPort2d::reset" << endl; - - GLint val[4]; - GLint vpWidth, vpHeight; - - myGLWidget->makeCurrent(); - glGetIntegerv( GL_VIEWPORT, val ); - vpWidth = val[2]; - vpHeight = val[3]; - - GLint w = myGLWidget->getWidth(); - GLint h = myGLWidget->getHeight(); - GLfloat zoom = vpWidth / ( GLfloat )w < vpHeight / ( GLfloat )h ? - vpWidth / ( GLfloat )w : vpHeight / ( GLfloat )h; - - if( myGrid ) - { - myGrid->setPan( 0.0, 0.0 ); - myGrid->setZoom( zoom / myXScale ); - } - - myXPan = 0.0; - myYPan = 0.0; - myXScale = zoom; - myYScale = zoom; - - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->setRotationAngle( 0.0 ); - myGLWidget->setRotation( 0.0, 0.0, 0.0, 1.0 ); - myGLWidget->updateGL(); -} - -/*! - Sets offset to view - \param dx - X offset - \param dy - Y offset -*/ -void GLViewer_ViewPort2d::pan( int dx, int dy ) -{ - //cout << "GLViewer_ViewPort2d::pan " << dx << " " << dy << endl; - - /*myXPan += dx / myXScale; - myYPan += dy / myYScale; - - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - GLfloat angle = ra * PI / 180.; - - if( myGrid ) - myGrid->setPan( myXPan*cos(angle) + myYPan*sin(angle), - -myXPan*sin(angle) + myYPan*cos(angle) ); - - */ - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - GLfloat angle = ra * PI / 180.; - - myXPan += (dx*cos(angle) + dy*sin(angle)) / myXScale; - myYPan += (-dx*sin(angle) + dy*cos(angle)) / myXScale; - - if( myGrid ) - myGrid->setPan( myXPan, myYPan ); - - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); -} - -/*! - Sets view center in global coords - \param x, y - global co-ordinates of center -*/ -void GLViewer_ViewPort2d::setCenter( int x, int y ) -{ - //cout << "GLViewer_ViewPort2d::setCenter" << endl; - - GLint val[4]; - GLint vpWidth, vpHeight; - - myGLWidget->makeCurrent(); - glGetIntegerv( GL_VIEWPORT, val ); - vpWidth = val[2]; - vpHeight = val[3]; - - myXPan -= ( x - vpWidth/2 ) / myXScale; - myYPan += ( y - vpHeight/2 ) / myYScale; - - if( myGrid ) - { - myGrid->setPan( myXPan, myYPan ); - myGrid->setZoom( myXOldScale / myXScale ); - } - - myXScale = myXOldScale; - myYScale = myYOldScale; - - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); -} - -/*! - Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 ) -*/ -void GLViewer_ViewPort2d::zoom( int x0, int y0, int x, int y ) -{ - //cout << "GLViewer_ViewPort2d::zoom" << endl; - - float dx, dy, zm; - dx = x - x0; - dy = y - y0; - - if ( dx == 0. && dy == 0. ) - return; - - zm = sqrt(dx * dx + dy * dy) / 100. + 1; - zm = (dx > 0.) ? zm : 1. / zm; - - //backup values - float bX = myXScale; - float bY = myYScale; - myXScale *= zm; - myYScale *= zm; - - if( myGrid ) - { - if( myGrid->setZoom( zm ) ) - { - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); - } - else - {// undo - myXScale = bX; - myYScale = bY; - } - } - else - { - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); - } -} - -/*! - Transforms view by rectangle - \param rect - rectangle -*/ -void GLViewer_ViewPort2d::fitRect( const QRect& rect ) -{ - float x0, x1, y0, y1; - float dx, dy, zm, centerX, centerY; - - GLint val[4]; - GLint vpWidth, vpHeight; - - myGLWidget->makeCurrent(); - glGetIntegerv( GL_VIEWPORT, val ); - vpWidth = val[2]; - vpHeight = val[3]; - - x0 = rect.left(); - x1 = rect.right(); - y0 = rect.top(); - y1 = rect.bottom(); - - dx = fabs( x1 - x0 ); - dy = fabs( y1 - y0 ); - centerX = ( x0 + x1 ) / 2.; - centerY = ( y0 + y1 ) / 2.; - - if ( dx == 0. || dy == 0. ) - return; - - zm = vpWidth / dx < vpHeight / dy ? vpWidth / dx : vpHeight / dy; - - float aDX = ( vpWidth / 2. - centerX ) / myXScale; - float aDY = ( vpHeight / 2. - centerY ) / myYScale; - - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - GLfloat angle = ra * PI / 180.; - - myXPan += (aDX*cos(angle) - aDY*sin(angle)); - myYPan -= (aDX*sin(angle) + aDY*cos(angle)); - - if( myGrid ) - myGrid->setPan( myXPan, myYPan ); - - myXScale *= zm; - myYScale = myXScale; - - if( myGrid ) - myGrid->setZoom( zm ); - - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); -} - -/*! - Transforms view by selection -*/ -void GLViewer_ViewPort2d::fitSelect() -{ - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - if( !aContext ) - return; - - QRect aSelRect; - for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) - aSelRect |= *(aViewer->getWinObjectRect( aContext->SelectedObject() )); - - if( aSelRect.isValid() ) - { - aSelRect.setTop( aSelRect.top() - SELECTION_RECT_GAP ); - aSelRect.setBottom( aSelRect.bottom() + SELECTION_RECT_GAP ); - aSelRect.setLeft( aSelRect.left() - SELECTION_RECT_GAP ); - aSelRect.setRight( aSelRect.right() + SELECTION_RECT_GAP ); - fitRect( aSelRect ); - } -} - -/*! - Transform view by view borders - \param keepScale - if it is true, zoom does not change -*/ -void GLViewer_ViewPort2d::fitAll( bool keepScale, bool withZ ) -{ - //cout << "GLViewer_ViewPort2d::fitAll" << endl; - - float xa, xb, ya, yb; - float dx, dy, zm; - float xScale, yScale; - - myMargin = QMAX( myBorder->width(), myBorder->height() ) / 5; - - xa = myBorder->left() - myMargin; - xb = myBorder->right() + myMargin; - ya = myBorder->bottom() - myMargin; - yb = myBorder->top() + myMargin; - - float aPoints[8] = { xa, ya, xb, ya, xa, yb, xb, yb }; - - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - float angle = ra * PI / 180.; - - int i; - for( i = 0; i < 7; i = i + 2 ) - rotate_point( aPoints[i], aPoints[i+1], angle ); - - float aBorders[4] = { aPoints[0], aPoints[0], aPoints[1], aPoints[1] }; - - for( i = 2; i < 7; i = i + 2 ) - { - if( aBorders[0] < aPoints[i] ) - aBorders[0] = aPoints[i]; - if( aBorders[1] > aPoints[i] ) - aBorders[1] = aPoints[i]; - - if( aBorders[2] < aPoints[i+1] ) - aBorders[2] = aPoints[i+1]; - if( aBorders[3] > aPoints[i+1] ) - aBorders[3] = aPoints[i+1]; - } - - GLint val[4]; - GLint vpWidth, vpHeight; - - myGLWidget->makeCurrent(); - glGetIntegerv( GL_VIEWPORT, val ); - vpWidth = val[2]; - vpHeight = val[3]; - - dx = fabs( aBorders[1] - aBorders[0] ); - dy = fabs( aBorders[3] - aBorders[2] ); - - myXPan = -( aBorders[0] + aBorders[1] ) / 2; - myYPan = -( aBorders[2] + aBorders[3] ) / 2; - - - if( keepScale ) - { - myXOldScale = myXScale; - myYOldScale = myYScale; - } - - xScale = myXScale; - yScale = myYScale; - if( dx && dy ) - zm = vpWidth / dx < vpHeight / dy ? vpWidth / dx : vpHeight / dy; - else - zm = 1.0; - myXScale = zm; - myYScale = zm; - - - if( myGrid ) - { - myGrid->setPan( myXPan, myYPan ); - if( dx > dy ) - myGrid->setZoom( zm / xScale ); - else - myGrid->setZoom( zm / yScale ); - } - - myGLWidget->setPan( myXPan, myYPan, 0.0 ); - myGLWidget->setScale( myXScale, myYScale, 1.0 ); - myGLWidget->updateGL(); - - if( keepScale ) - emit vpUpdateValues(); -} - -/*! - Begins rotation - \param x, y - start point -*/ -void GLViewer_ViewPort2d::startRotation( int x, int y ) -{ - myGLWidget->setRotationStart( x, y, 1.0 ); -} - -/*! - Performs rotation - \param intX, intY - current point -*/ -void GLViewer_ViewPort2d::rotate( int intX, int intY ) -{ - GLint val[4]; - GLint vpWidth, vpHeight; - - myGLWidget->makeCurrent(); - glGetIntegerv( GL_VIEWPORT, val ); - vpWidth = val[2]; - vpHeight = val[3]; - - float x = intX, y = intY; - float x0 = vpWidth/2; - float y0 = vpHeight/2; - - float xs, ys, zs, dx, dy; - myGLWidget->getRotationStart( xs, ys, zs ); - - xs = xs - x0; - x = x - x0; - dx = x - xs; - ys = y0 - ys; - y = y0 - y; - dy = y - ys; - - float l1 = pow( double( xs*xs + ys*ys ), 0.5 ); - float l2 = pow( double( x*x + y*y ), 0.5 ); - float l = pow( double( dx*dx + dy*dy ), 0.5 ); - - double mult = xs * y - x * ys; - short sign; - if( mult > 0 ) sign = 1; - else if( mult < 0 ) sign = -1; - else sign = 0; - - float anglePrev = myGLWidget->getRotationAngle(); - float angleNew = sign * acos( ( l1*l1 + l2*l2 - l*l ) / ( 2 * l1 * l2 )) * 180. / PI; - float angle = anglePrev + angleNew; - - // GLfloat anAngle = angle * PI / 180.; unused - - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - myGLWidget->setRotation( angle, rx, ry, rz ); - myGLWidget->updateGL(); -} - -/*! - Finishes rotation -*/ -void GLViewer_ViewPort2d::endRotation() -{ - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - myGLWidget->setRotationAngle( ra ); -} - -/*! - Draws compass -*/ -void GLViewer_ViewPort2d::drawCompass() -{ - if( !myCompass->getVisible() ) - return; - - GLfloat xScale, yScale, xPan, yPan; - - int xPos = getWidth(); - int yPos = getHeight(); - - int cPos = myCompass->getPos(); - int cSize = myCompass->getSize(); - QColor cCol = myCompass->getColor(); - int cWidthTop = myCompass->getArrowWidthTop(); - int cWidthBot = myCompass->getArrowWidthBottom(); - int cHeightTop = myCompass->getArrowHeightTop(); - int cHeightBot = myCompass->getArrowHeightBottom(); - - GLfloat colorR = (cCol.red())/255; - GLfloat colorG = (cCol.green())/255; - GLfloat colorB = (cCol.blue())/255; - - float delX = cSize * 0.5; - float delY = cSize * 0.5; - - getScale( xScale, yScale ); - getPan( xPan, yPan); - - float centerX = (xPos/2 - delX - cSize)/xScale; - float centerY = (yPos/2 - delY - cSize)/yScale; - - switch ( cPos ) - { - case GLViewer_Compass::TopLeft: - centerX = -centerX; - break; - case GLViewer_Compass::BottomLeft: - centerX = -centerX; - centerY = -centerY; - break; - case GLViewer_Compass::BottomRight: - centerY = -centerY; - break; - default: break; - } - - float ra, rx, ry, rz; - myGLWidget->getRotation( ra, rx, ry, rz ); - GLfloat angle = ra * PI / 180.; - GLfloat /*r = 0.0,*/ x = 0.0 , y = 0.0; - - rotate_point( centerX, centerY, -angle ); - - centerX -= xPan; - centerY -= yPan; - - glColor3f( colorR, colorG, colorB ); - glBegin( GL_POLYGON ); - //arrow - x = centerX; y = centerY + cSize / yScale; - glVertex2f( x, y ); - //point #2 - x = centerX + cWidthTop / xScale; y = centerY + ( cSize - cHeightTop ) / yScale ; - glVertex2f( x, y ); - //point #3 - x = centerX + cWidthBot / xScale; y = centerY + ( cSize - cHeightTop ) / yScale ; - glVertex2f( x, y ); - //point #4 - x = centerX + cWidthBot / xScale; y = centerY - cSize/yScale; - glVertex2f( x, y ); - //point #5 - x = centerX; y = centerY - (cSize - cHeightBot) / yScale ; - glVertex2f( x, y ); - //point #6 - x = centerX - cWidthBot / xScale; y = centerY - cSize/yScale; - glVertex2f( x, y ); - //point #7 - x = centerX - cWidthBot / xScale; y = centerY + ( cSize - cHeightTop ) / yScale ; - glVertex2f( x, y ); - //point #8 - x = centerX - cWidthTop / xScale; y = centerY + ( cSize - cHeightTop ) / yScale ; - glVertex2f( x, y ); - glEnd(); - glLineWidth( 2.0 ); - glEnable( GL_LINE_SMOOTH ); - glBegin(GL_LINE_LOOP); - //circle - float aCircAngle = 0; - for ( int i = 0; i < 20 * SEGMENTS + 1; i++ ) - { - x = centerX + cos(aCircAngle) * cSize / xScale; - y = centerY + sin(aCircAngle) * cSize / yScale; - glVertex2f( x, y ); - aCircAngle += float( STEP ) / 2; - } - glEnd(); - - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - GLdouble winxN, winyN, winz; - GLdouble winxE, winyE; - GLdouble winxS, winyS; - GLdouble winxW, winyW; - GLuint aTextList; - - GLViewer_TexFont* aFont = myCompass->getFont(); - float widN = (float)aFont->getStringWidth( "N" ); - float widW = (float)aFont->getStringWidth( "W" ); - float widS = (float)aFont->getStringWidth( "S" ); - float widE = (float)aFont->getStringWidth( "E" ); - float heightL = (float)aFont->getStringHeight(); - - float xGapN = - widN/2 *( 1.0 + sin(angle) ); - float xGapS = - widS/2 *( 1.0 - sin(angle) ); - float xGapW = - widW/2 *( 1.0 + cos(angle) ); - float xGapE = - widE/2 *( 1.0 - cos(angle) ); - - float yGapN = - heightL/2 *( 1.0 - cos(angle) ) * 0.75; - float yGapS = - heightL/2 *( 1.0 + cos(angle) ) * 0.75; - float yGapW = - heightL/2 *( 1.0 + sin(angle) ) * 0.75; - float yGapE = - heightL/2 *( 1.0 - sin(angle) ) * 0.75; - - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - - gluProject (centerX, centerY + cSize / yScale, 0, modelMatrix, projMatrix, viewport, &winxN, &winyN, &winz); - gluProject (centerX + cSize / xScale, centerY, 0, modelMatrix, projMatrix, viewport, &winxE, &winyE, &winz); - gluProject (centerX, centerY - cSize / yScale, 0, modelMatrix, projMatrix, viewport, &winxS, &winyS, &winz); - gluProject (centerX - cSize / xScale, centerY, 0, modelMatrix, projMatrix, viewport, &winxW, &winyW, &winz); - - glColor3f( 1.0, 1.0, 1.0 ); - - aTextList = glGenLists( 1 ); - glNewList( aTextList, GL_COMPILE ); - - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(0,viewport[2],0,viewport[3],-100,100); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - - aFont->drawString( "N", winxN + xGapN, winyN + yGapN ); - aFont->drawString( "E", winxE + xGapE, winyE + yGapE ); - aFont->drawString( "S", winxS + xGapS, winyS + yGapS ); - aFont->drawString( "W", winxW + xGapW, winyW + yGapW ); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - - glEndList(); - - if ( aTextList != -1 ) - glCallList( aTextList ); -} - -/*! - \return blocking status for current started operations -*/ -BlockStatus GLViewer_ViewPort2d::currentBlock() -{ - if( myIsDragProcess == inDrag && myCurDragPosX != NULL && myCurDragPosY != NULL) - return BlockStatus(BS_Highlighting | BS_Selection); - - if( mypFirstPoint && mypLastPoint ) - return BlockStatus(BS_Highlighting | BS_Selection); - - return BS_NoBlock; -} - -/*! - Initializes rectangle selection - \param x, y - start point -*/ -void GLViewer_ViewPort2d::startSelectByRect( int x, int y ) -{ - if( !mypFirstPoint && !mypLastPoint ) - { - mypFirstPoint = new QPoint( x, y ); - mypLastPoint = new QPoint( x, y ); - } -} - -/*! - Draws rectangle selection - \param x, y - current point -*/ -void GLViewer_ViewPort2d::drawSelectByRect( int x, int y ) -{ - if( mypFirstPoint && mypLastPoint ) - { - - QPainter p( getPaintDevice() ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - - p.drawRect( selectionRect() ); /* erase */ - - mypLastPoint->setX( x ); - mypLastPoint->setY( y ); - - p.drawRect( selectionRect() ); /* draw */ - } - -} - -/*! - Finishes rectangle selection -*/ -void GLViewer_ViewPort2d::finishSelectByRect() -{ - if( mypFirstPoint && mypLastPoint ) - { - - QPainter p( getPaintDevice() ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - - p.drawRect( selectionRect() ); /* erase */ - - delete mypFirstPoint; - delete mypLastPoint; - - mypFirstPoint = NULL; - mypLastPoint = NULL; - } -} - -/*! - \return rectangle selection -*/ -QRect GLViewer_ViewPort2d::selectionRect() -{ - QRect aRect; - if( mypFirstPoint && mypLastPoint ) - { - aRect.setLeft( QMIN( mypFirstPoint->x(), mypLastPoint->x() ) ); - aRect.setTop( QMIN( mypFirstPoint->y(), mypLastPoint->y() ) ); - aRect.setRight( QMAX( mypFirstPoint->x(), mypLastPoint->x() ) ); - aRect.setBottom( QMAX( mypFirstPoint->y(), mypLastPoint->y() ) ); - } - - return aRect; -} - -/*! -*/ -bool GLViewer_ViewPort2d::startPulling( GLViewer_Pnt point ) -{ - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - ObjList anObjects = aContext->getObjects(); - - for( ObjList::Iterator it = anObjects.begin(); it != anObjects.end(); ++it ) - { - GLViewer_Object* anObject = *it; - GLViewer_Rect aRect = anObject->getPullingRect(); - - if( aRect.contains( point ) && anObject->startPulling( point ) ) - { - myIsPulling = true; - myPullingObject = anObject; - setCursor( *getHandCursor() ); - return true; - } - } - - return false; -} - -/*! -*/ -void GLViewer_ViewPort2d::drawPulling( GLViewer_Pnt point ) -{ - GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - GLViewer_Context* aContext = aViewer->getGLContext(); - ObjList anObjects = aContext->getObjects(); - - GLViewer_Object* aLockedObject = 0; - for( ObjList::Iterator it = anObjects.begin(); it != anObjects.end(); ++it ) - { - GLViewer_Object* anObject = *it; - if( !anObject->getVisible() ) - continue; - - GLViewer_Rect aRect = anObject->getPullingRect(); - - if( aRect.contains( point ) && anObject->portContains( point ) ) - { - aLockedObject = anObject; - break; - } - } - - myPullingObject->pull( point, aLockedObject ); -} - -/*! -*/ -void GLViewer_ViewPort2d::finishPulling() -{ - myIsPulling = false; - myPullingObject->finishPulling(); - setCursor( *getDefaultCursor() ); -} - -/*! - Convert rectangle in window co-ordinates to GL co-ordinates - \return converted rectangle -*/ -GLViewer_Rect GLViewer_ViewPort2d::win2GLV( const QRect& theRect ) const -{ - GLViewer_Rect aRect; - - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - - GLdouble objx1, objy1; - GLdouble objx2, objy2; - GLdouble objz; - - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - - gluUnProject( theRect.left(), viewport[3] - theRect.top(), 0, modelMatrix, projMatrix, viewport, &objx1, &objy1, &objz ); - gluUnProject( theRect.right(), viewport[3] - theRect.bottom(), 0, modelMatrix, projMatrix, viewport, &objx2, &objy2, &objz ); - - aRect.setLeft( objx1 ); - aRect.setTop( objy1 ); - aRect.setRight( objx2 ); - aRect.setBottom( objy2 ); - - return aRect; -} - -/*! - Convert rectangle in GL co-ordinates to window co-ordinates - \return converted rectangle -*/ -QRect GLViewer_ViewPort2d::GLV2win( const GLViewer_Rect& theRect ) const -{ - QRect aRect; - - GLdouble modelMatrix[16], projMatrix[16]; - GLint viewport[4]; - - GLdouble winx1, winy1; - GLdouble winx2, winy2; - GLdouble winz; - - glGetIntegerv (GL_VIEWPORT, viewport); - glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); - glGetDoublev (GL_PROJECTION_MATRIX, projMatrix); - - gluProject( theRect.left(), theRect.top(), 0, modelMatrix, projMatrix, viewport, &winx1, &winy1, &winz ); - gluProject( theRect.right(), theRect.bottom(), 0, modelMatrix, projMatrix, viewport, &winx2, &winy2, &winz ); - - aRect.setLeft( (int)winx1 ); - aRect.setTop( viewport[3] - (int)winy1 ); - aRect.setRight( (int)winx2 ); - aRect.setBottom( viewport[3] - (int)winy2 ); - - return aRect; -} - -/*! - SLOT: called when tooltip should be shown -*/ -void GLViewer_ViewPort2d::onMaybeTip( QPoint thePoint, QString& theText, QFont& theFont, QRect& theTextReg, QRect& theRegion ) -{ - GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext(); - - GLViewer_Object* anObj = aContext->getCurrentObject(); - if( anObj ) - { - theText = anObj->getToolTipText(); - if( theText.isEmpty() ) - theText = anObj->getName(); - - QStringList aList; - if( anObj->isTooTipHTML() ) - aList = QStringList::split( "
", theText ); - else - aList = QStringList::split( "\n", theText ); - - if( !aList.isEmpty() ) - { - int index = 0; - int str_size = aList.first().length(); - for( int i = 1, size = aList.count(); i < size; i++ ) - { - if ( str_size < (int)aList[i].length() ) - { - index = i; - str_size = aList[i].length(); - } - } - theFont = font(); - int cur_height = 24; - QCursor* aCursor = QApplication::overrideCursor(); - if( aCursor ) - { - const QBitmap* aBitmap = aCursor->bitmap(); - if( aBitmap ) - cur_height = aBitmap->height(); - } - - //temp - QSize aSize = QLabel( theText, 0 ).sizeHint(); - theTextReg = QRect( thePoint.x(), thePoint.y() + cur_height, - aSize.width(), aSize.height() ); - theRegion = QRect( thePoint.x(), thePoint.y(), 1, 1 ); - } - } -} diff --git a/src/GLViewer/GLViewer_ViewPort2d.h b/src/GLViewer/GLViewer_ViewPort2d.h deleted file mode 100644 index 76b59b6d4..000000000 --- a/src/GLViewer/GLViewer_ViewPort2d.h +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_ViewPort2d.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWPORT2D_H -#define GLVIEWER_VIEWPORT2D_H - -#ifdef WNT -#include -#endif - -#include -#include - -#include "GLViewer_ViewPort.h" -#include "GLViewer_Widget.h" -#include "GLViewer_Geom.h" - -#include -#include -#include -#include - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -class GLViewer_Compass; -class GLViewer_Grid; -class GLViewer_Object; -class GLViewer_ViewFrame; - -class QtxToolTip; -/*! - * Class GLViewer_ViewPort - * 2D visualisation canvas of GLViewer - */ -class GLViewer_ViewPort2d: public GLViewer_ViewPort -{ - Q_OBJECT - - //! Dragging states - enum vpDragState{ noDrag, initDrag, inDrag }; - -public: - GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* theViewFrame = NULL ); - ~GLViewer_ViewPort2d(); - - //! On/off rectangular grid - void turnGrid( GLboolean on ); - //! Returns rectangular grid - GLViewer_Grid* getGrid() const { return myGrid; } - //! Returns grid color - void setGridColor( const QColor gridColor, const QColor axisColor ); - - //! Returns parent window - GLViewer_ViewFrame* getViewFrame() const { return myViewFrame; } - //! Returns painted widget - GLViewer_Widget* getGLWidget() const { return myGLWidget; } - virtual QPaintDevice* getPaintDevice() { return myGLWidget; } - - //! Sets background color - void setBackgroundColor( const QColor& color); - //! Returns background color - QColor backgroundColor() const; - - //! Sets borders of scene - void setBorder( GLViewer_Rect* border ) { myBorder = border; } - //! Get current borders of scene - GLViewer_Rect* getBorder() const { return myBorder; } - - //! Sets margin of borders - void setMargin( GLfloat margin ) { myMargin = margin; } - //! Returns margin of borders - GLfloat getMargin() const { return myMargin; } - - //! Returns width of view - int getWidth() const { return myWidth; } - //! Returns height of view - int getHeight() const { return myHeight; } - - - //! Returns scale factors - void getScale( GLfloat& xSc, GLfloat& ySc ) const { xSc = myXScale; ySc = myYScale; } - //! returns offsets - void getPan( GLfloat& xPan, GLfloat& yPan ) const { xPan = myXPan; yPan = myYPan; } - - //! Resize view - void initResize( int width, int height ); - - //! Begins rotation - void startRotation( int, int ); - //! Process rotation - void rotate( int, int ); - //! Completes rotation - void endRotation(); - - //! Checks of dragging process state - bool isDragProcess(){ return myIsDragProcess; } - - //! On/off compass - void turnCompass( GLboolean on ); - //! Draws compass - void drawCompass(); - - //! Returns unique ID of ViewPort - int getViewPortId(){ return myViewPortId; } - - //! Redefined method - virtual BlockStatus currentBlock(); - - //! Initializes before selecting by rect - void startSelectByRect( int x, int y ); - //! Draw selecting rectandle - void drawSelectByRect( int x, int y ); - //! Pass rect into selector and update - void finishSelectByRect(); - - //! \warnign It is for ouv - bool startPulling( GLViewer_Pnt ); - //! \warnign It is for ouv - void drawPulling( GLViewer_Pnt ); - //! \warnign It is for ouv - void finishPulling(); - //! \warnign It is for ouv - bool isPulling() const { return myIsPulling; } - - //! Returns selection by rect - QRect selectionRect(); - - //! Transforms window rect to global rect - GLViewer_Rect win2GLV( const QRect& ) const; - //! Transforms global rect to window rect - QRect GLV2win( const GLViewer_Rect& ) const; - -signals: - //! Emits after any transformation - void vpUpdateValues(); - - void objectMoved(); - -protected: - void onDragObject( QMouseEvent* ); - - virtual void mouseMoveEvent( QMouseEvent *); - virtual void mousePressEvent( QMouseEvent *); - virtual void mouseReleaseEvent( QMouseEvent *); - virtual void mouseDoubleClickEvent( QMouseEvent *); - - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* ); - - //! Returns view to begin state - virtual void reset(); - //! Sets offset to view - virtual void pan( int dx, int dy ); - //! Sets view center in global coords - virtual void setCenter( int x, int y ); - //! Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 ) - virtual void zoom( int x0, int y0, int x1, int y1 ); - //! Transforms view by rectangle - virtual void fitRect( const QRect& ); - //! Transforms view by selection - virtual void fitSelect(); - //! Transform view by view borders ( if \param keepScale = true, zoom does not change ) - virtual void fitAll( bool keepScale = false, bool withZ = true ); - -protected slots: - //! Initializes drag process - void onStartDragObject(); - //! Pastes object from clipboard - void onPasteObject(); - //! Cuts object to clipboard - void onCutObject(); - //! Copies object to clipboard - void onCopyObject(); - - //! Sets tool tip with \param text to \param theTextReg and on \param theViewReg whan mouse is on \param thePoint - void onMaybeTip( QPoint thePoint, QString& text, QFont& font, QRect& theTextReg, QRect& theViewReg ); - -protected: - GLViewer_ViewFrame* myViewFrame; - GLViewer_Widget* myGLWidget; - GLViewer_Rect* myBorder; - QColor myBackgroundColor; - - GLfloat myMargin; - int myHeight; - int myWidth; - - GLfloat myXScale; - GLfloat myYScale; - GLfloat myXOldScale; - GLfloat myYOldScale; - GLfloat myXPan; - GLfloat myYPan; - - GLViewer_Grid* myGrid; - GLViewer_Compass* myCompass; - - //dragging - int myIsDragProcess; - float* myCurDragPosX; - float* myCurDragPosY; - - //selection by rect - QPoint* mypFirstPoint; - QPoint* mypLastPoint; - - //pulling - bool myIsPulling; - GLViewer_Object* myPullingObject; - - int myViewPortId; - - //GLViewer_ObjectTip* myObjectTip; - QtxToolTip* myObjectTip; - //! flag to block mouse release event just after mouse double-click - bool myIsMouseReleaseBlock; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx deleted file mode 100644 index 3363add16..000000000 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ /dev/null @@ -1,860 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Viewer.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Viewer.h" -#include "GLViewer_Selector.h" -#include "GLViewer_ViewPort.h" -#include "GLViewer_ViewFrame.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" - -#include -#include -#include -#include - -/* used for sketching */ -static QEvent* l_mbPressEvent = 0; - -/*! - Constructor -*/ -GLViewer_Viewer::GLViewer_Viewer( const QString& title ) -: SUIT_ViewModel(), -mySelector( 0 ), -mySketcher( 0 ), -myTransformer( 0 ), -mySelMode( NoSelection ) -{ -} - -/*! - Destructor -*/ -GLViewer_Viewer::~GLViewer_Viewer() -{ - delete mySelector; -} - -/*! - Sets new view manager - \param theViewManager - new view manager -*/ -void GLViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager) -{ - SUIT_ViewModel::setViewManager(theViewManager); - if (theViewManager) - { - connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseEvent(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseEvent(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseEvent(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(wheel(SUIT_ViewWindow*, QWheelEvent*)), - this, SLOT(onWheelEvent(SUIT_ViewWindow*, QWheelEvent*))); - } -} - -/*! - Builds popup for GL viewer -*/ -void GLViewer_Viewer::contextMenuPopup( QPopupMenu* thePopup ) -{ - if( thePopup->count() > 0 ) - thePopup->insertSeparator(); - - thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); -} - -/*! - Sets the background color with color selection dialog. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onChangeBgColor() -{ - GLViewer_ViewPort* vp = getActiveView()->getViewPort(); - QColor selColor = QColorDialog::getColor( vp->backgroundColor() ); - - if( selColor.isValid() ) - vp->setBackgroundColor( selColor ); -} - -/*! - Returns the active view. [ public ] -*/ -GLViewer_ViewFrame* GLViewer_Viewer::getActiveView() const -{ - SUIT_ViewManager* aMgr = getViewManager(); - return (GLViewer_ViewFrame*)( aMgr != 0 ? aMgr->getActiveView() : 0 ); -} - - -/*! - Sets the selection mode for this viewer. [ public ] -*/ -void GLViewer_Viewer::setSelectionMode( GLViewer_Viewer::SelectionMode mode ) -{ - if ( mySelMode != mode ) - { - mySelMode = mode; - onSelectionModeChanged(); - } -} - -/*! - Returns selector of this viewer. [ public ] -*/ -GLViewer_Selector* GLViewer_Viewer::getSelector() const -{ - if ( !mySelector ) - { - GLViewer_Viewer* mthis = (GLViewer_Viewer*)this; - mthis->mySelector = mthis->createSelector(); - if ( mySelector ) - { - connect( mySelector, SIGNAL( selSelectionDone( bool, SelectionChangeStatus ) ), SLOT( onSelectionDone( bool, SelectionChangeStatus ) ) ); - connect( mySelector, SIGNAL( selSelectionCancel() ), SLOT( onSelectionCancel() ) ); - } - } - return mySelector; -} - -/*! - Returns the selection mode of this viewer. [ public ] -*/ -GLViewer_Viewer::SelectionMode GLViewer_Viewer::getSelectionMode() const -{ - return mySelMode; -} - -/*! - Handles requests for sketching in the active view. [ virtual public ] -*/ -void GLViewer_Viewer::activateSketching( int type ) -{ - GLViewer_ViewPort* vp = 0; - if ( !getActiveView() || !( vp = getActiveView()->getViewPort() ) ) - return; - - if ( !vp->isSketchingEnabled() ) - return; - - /* Finish current sketching */ - if ( type == NoSketching ) - { - if ( mySketcher ) - { - onSketchingFinished(); - delete mySketcher; - mySketcher = 0; - } - } - /* Activate new sketching */ - else - { - activateSketching( NoSketching ); /* concurrency not suported */ - mySketcher = createSketcher( type ); - onSketchingStarted(); - } -} - -/*! - Handles requests for transformations in the active view. [ virtual public ] -*/ -void GLViewer_Viewer::activateTransform( int type ) -{ - GLViewer_ViewPort* vp = 0; - if ( !getActiveView() || !( vp = getActiveView()->getViewPort() ) ) - return; - - if ( !vp->isTransformEnabled() ) - return; - - /* Finish current transform */ - if ( type == NoTransform ) - { - if ( myTransformer ) - { - onTransformationFinished(); - delete myTransformer; - myTransformer = 0; - } - } - /* Activate new transform */ - else - { - activateTransform( NoTransform ); /* concurrency not suported */ - myTransformer = createTransformer( type ); - onTransformationStarted(); - myTransformer->exec(); - } -} - -/*! - Creates default transformer. [ virtual protected ] -*/ -GLViewer_ViewTransformer* GLViewer_Viewer::createTransformer( int type ) -{ - return new GLViewer_ViewTransformer( this, type ); -} - -/*! - Creates default sketcher. [ virtual protected ] -*/ -GLViewer_ViewSketcher* GLViewer_Viewer::createSketcher( int type ) -{ - return new GLViewer_ViewSketcher( this, type ); -} - -/*! - Returns null by default. [ virtual protected ] -*/ -GLViewer_Selector* GLViewer_Viewer::createSelector() -{ - return 0; -} - -/*! - Unhilights detected entities, lock selection, sets event filter - on the whole application. [ virtual protected ] -*/ -void GLViewer_Viewer::onTransformationStarted() -{ - unhilightDetected(); - if ( getSelector() ) - getSelector()->lock( true ); /* disable selection */ - - /* Watch events: any mouse/key event outside the - viewport will be considered as the end of - transform */ - if( !myTransformer ) - return; - qApp->installEventFilter( this ); -} - -/*! - Unlock selection, removes event filter. [ virtual protected ] -*/ -void GLViewer_Viewer::onTransformationFinished() -{ - if ( getSelector() ) - getSelector()->lock( false ); /* enable selection */ - - /* Stop watch events */ - if( !myTransformer ) - return; - qApp->removeEventFilter( this ); -} - -/*! - Unhilights detected entities. [ virtual protected ] -*/ -void GLViewer_Viewer::onSketchingStarted() -{ - unhilightDetected(); -} - -/*! - Selection by rectangle. [ virtual protected ] -*/ -void GLViewer_Viewer::onSketchingFinished() -{ - if ( !getSelector() ) - return; - - if( !mySketcher ) - return; - if ( mySketcher->type() == Rect ) - { - QRect* selRect = (QRect*)mySketcher->data(); - if ( selRect ) - { - bool append = bool( mySketcher->buttonState() & GLViewer_Selector::appendKey() ); - getSelector()->select( *selRect, append ); - } - } -} - -/*! - Installed while 'fit area' and 'global panning' operations are active. [ virtual protected ] -*/ -bool GLViewer_Viewer::eventFilter( QObject* o, QEvent* e ) -{ - if( !getActiveView() ) - return false; - - if( getActiveView()->getViewPort() == o->parent() ) - o = o->parent(); - - bool mouseClickedOutside = ( e->type() == QEvent::MouseButtonPress && - o != getActiveView()->getViewPort() ); - bool anyKeyPressed = ( e->type() == QEvent::KeyPress ); - if ( mouseClickedOutside || anyKeyPressed ) - { /* terminate all */ - activateTransform( NoTransform ); - activateSketching( NoSketching ); - //cout << "mouseClickedOutside || anyKeyPressed" << endl; - } - return QObject::eventFilter( o, e ); -} - -/*! - Called when smth is selected in this viewer. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onSelectionDone( bool bAdded, SelectionChangeStatus status ) -{ - emit selectionChanged( status ); -} - -/*! - Called when selection is cleared in this viewer. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onSelectionCancel() -{ - emit selectionChanged( SCS_Invalid ); -} - -/*! - Listens to key events of the active view. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onKeyEvent( SUIT_ViewWindow*, QKeyEvent* ) -{ -} - -/*! - Listens to mouse events of the active view. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onMouseEvent( SUIT_ViewWindow*, QMouseEvent* e ) -{ - //cout << "GLViewer_Viewer::onMouseEvent" << endl; - switch( e->type() ) - { - case QEvent::MouseButtonPress: - handleMousePress( e ); - break; - case QEvent::MouseMove: - handleMouseMove( e ); - break; - case QEvent::MouseButtonRelease: - handleMouseRelease( e ); - break; - default: break; - } -} - -/*! - Listens to mouse events of the active view. [ virtual protected slot ] -*/ -void GLViewer_Viewer::onWheelEvent( SUIT_ViewWindow*, QWheelEvent* e ) -{ - //cout << "GLViewer_Viewer::onMouseEvent" << endl; - switch( e->type() ) - { - case QEvent::Wheel: - handleWheel( e ); - break; - default: break; - } -} - -/*! - Enables / disables rectangle sketching. [ virtual protected ] -*/ -void GLViewer_Viewer::onSelectionModeChanged() -{ - bool enable = ( mySelMode == Multiple ); - QPtrVector views = getViewManager()->getViews(); - for ( int i = 0, n = views.count(); i < n; i++ ) - { - GLViewer_ViewPort* vp = ((GLViewer_ViewFrame*)views[i])->getViewPort(); - if ( vp ) - vp->setSketchingEnabled( enable ); - } -} - -/*! - Updates all views of this viewer. Use 'flags' to customize update process. [ virtual public ] -*/ -void GLViewer_Viewer::update( int flags ) -{ - QPtrVector views = getViewManager()->getViews(); - for ( int i = 0, n = views.count(); i < n; i++ ) - ((GLViewer_ViewFrame*)views[i])->onUpdate( flags ); -} - -/*! - Unhilights the currect detected objects. [ virtual private ] -*/ -void GLViewer_Viewer::unhilightDetected() -{ - if ( getSelector() ) - getSelector()->undetectAll(); -} - -/*! - Mouse press handler. If 'accelKey()' is pressed, activates default - transformations( Zoom or Pan ) in the active viewport. [ private ] -*/ -void GLViewer_Viewer::handleMousePress( QMouseEvent* e ) -{ - /* test accel for transforms */ - if ( e->state() & GLViewer_ViewTransformer::accelKey() ) - { - ButtonState bs = e->button(); - if ( bs == GLViewer_ViewTransformer::zoomButton() ) - activateTransform( Zoom ); - else if ( bs == GLViewer_ViewTransformer::panButton() ) - activateTransform( Pan ); - } - else - { - //checking for other operations before selection in release event - startOperations( e ); - } - - /* we may need it for sketching... */ - l_mbPressEvent = new QMouseEvent( *e ); - - //checking for other operations before selection in release event -// startOperations( e ); - - /*e->button() == LeftButton && getSelector() ) - { - bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); - getSelector()->select( append ); - }*/ -} - -/*! - Mouse move handler. If dragged with MB1, activates rectangle sketching in - the active viewport, otherwise highlights the selectable entities. [ private ] -*/ -void GLViewer_Viewer::handleMouseMove( QMouseEvent* e ) -{ - /* Highlight for selection */ - bool dragged = ( e->state() & ( LeftButton | MidButton | RightButton ) ); - if ( !dragged ) - { - if ( getSelector() ) - getSelector()->detect( e->x(), e->y() ); - } - /* Try to activate default sketching - */ - else if ( e->state() == GLViewer_ViewSketcher::sketchButton() ) - { - activateSketching( Rect ); - if ( mySketcher ) - { - /* Activated OK. We should not forget initial mousepress - event and this mousemove event to start sketching from - the point of initial click */ - if ( l_mbPressEvent ) - { - QApplication::sendEvent( getActiveView()->getViewPort(), l_mbPressEvent ); - delete l_mbPressEvent; - l_mbPressEvent = 0; - } - QApplication::sendEvent( getActiveView()->getViewPort(), e ); - } - } - - //Try to activate other operations - updateOperations( e ); -} - -/*! - Mouse move handler. Activates popup of the active view. [ private ] -*/ -void GLViewer_Viewer::handleMouseRelease( QMouseEvent* e ) -{ - /* selection */ - /* tmp - in handleMousePress*/ - if( e->button() == LeftButton && !(getActiveView()->getViewPort()->currentBlock() & BS_Selection) ) - { - if ( getSelector() ) - { - bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); - getSelector()->select( append ); - } - } - - //Try to done active operations - finishOperations( e ); - - if ( l_mbPressEvent ) - { - delete l_mbPressEvent; - l_mbPressEvent = 0; - } -} - -/*! - Wheel rolling handler -*/ -void GLViewer_Viewer::handleWheel( QWheelEvent* e ) -{ - startOperations( e ); -} - -int GLViewer_ViewTransformer::panBtn = Qt::MidButton; -int GLViewer_ViewTransformer::zoomBtn = Qt::LeftButton; -int GLViewer_ViewTransformer::fitRectBtn = Qt::LeftButton; -int GLViewer_ViewTransformer::panGlobalBtn = Qt::LeftButton; -int GLViewer_ViewTransformer::acccelKey = Qt::ControlButton; - -/*! - Constructor -*/ -GLViewer_ViewTransformer::GLViewer_ViewTransformer( GLViewer_Viewer* v, int type ) -: QObject( 0 ), -myViewer( v ), -myType( type ), -myMajorBtn( NoButton ), -myButtonState( 0 ) -{ - if ( myType == GLViewer_Viewer::Pan || - myType == GLViewer_Viewer::Zoom || - myType == GLViewer_Viewer::PanGlobal || - myType == GLViewer_Viewer::FitRect ) - { - /* 'long' transforms need this */ - initTransform( true ); - } -} - -/*! - Destructor -*/ -GLViewer_ViewTransformer::~GLViewer_ViewTransformer() -{ - if ( myType == GLViewer_Viewer::Pan || - myType == GLViewer_Viewer::Zoom || - myType == GLViewer_Viewer::PanGlobal || - myType == GLViewer_Viewer::FitRect ) - { - /* 'long' transforms need this */ - initTransform( false ); - } - - //QAD_Application::getDesktop()->clearInfo(); -} - -/*! - Inits long transformations ( Zoom, Pan etc ) [ protected ] - - Saves viewport state( cursor etc ) and installs event filter to process - mouse events if 'init' is true. Restores viewport state if 'init' is false. -*/ -void GLViewer_ViewTransformer::initTransform( bool init ) -{ - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - if ( init ) - { - mySavedCursor = avp->cursor(); - mySavedMouseTrack = avp->hasMouseTracking(); - avp->setMouseTracking( false ); - avp->installEventFilter( this ); - } - else - { - avp->removeEventFilter( this ); - avp->setMouseTracking( mySavedMouseTrack ); - avp->setCursor( mySavedCursor ); - } -} - -/*! - Runs transfomation. Redefine to add your own 'instant' transforms - ( for ex., 'FitAll' is an instant transform ). [ virtual public ] -*/ -void GLViewer_ViewTransformer::exec() -{ - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - if( !avp ) - return; - - switch( myType ) - { - case GLViewer_Viewer::Zoom: - myMajorBtn = zoomButton(); - avp->setCursor( *avp->getZoomCursor() ); - break; - case GLViewer_Viewer::Pan: - myMajorBtn = panButton(); - avp->setCursor( *avp->getPanCursor() ); - break; - case GLViewer_Viewer::PanGlobal: - myMajorBtn = panGlobalButton(); - avp->setCursor( *avp->getPanglCursor() ); - avp->fitAll( true, false ); /* view is ready now */ - break; - case GLViewer_Viewer::FitRect: - myMajorBtn = fitRectButton(); - avp->setCursor( *avp->getHandCursor() ); - break; - case GLViewer_Viewer::Reset: - avp->reset(); onTransform( Fin ); - break; - case GLViewer_Viewer::FitAll: - avp->fitAll(); onTransform( Fin ); - break; - case GLViewer_Viewer::FitSelect: - avp->fitSelect(); onTransform( Fin ); - break; - default: break; - } -} - -/*! - Catches mouse events for the viewport. [ virtual protected ] -*/ -bool GLViewer_ViewTransformer::eventFilter( QObject* o, QEvent* e ) -{ - switch ( e->type() ) - { - case QEvent::MouseMove: - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - { - TransformState state = EnTrain; - QMouseEvent* me = ( QMouseEvent* )e; - - myButtonState = me->state(); - if ( e->type() == QEvent::MouseButtonPress ) - myButtonState |= me->button(); /* add pressed button */ - - int mouseOnlyState = ( myButtonState & ( LeftButton | MidButton | RightButton ) ); - if ( myStart.isNull() ) - { - state = Debut; - myStart = me->pos(); - myMajorBtn = mouseOnlyState; - } - - if ( e->type() == QEvent::MouseButtonRelease && mouseOnlyState == myMajorBtn ) - { - state = Fin; - } - myCurr = me->pos(); - onTransform( state ); - return true; - } - default: break; - } - return QObject::eventFilter( o, e ); -} - -/*! - Transforms the viewport. Used for 'non-instant' transforms - only( ex. Rotate, Pan etc ). [ virtual protected ] -*/ -void GLViewer_ViewTransformer::onTransform( TransformState state ) -{ - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - bool doTrsf = ( myButtonState & myMajorBtn ); - switch ( myType ) - { - case GLViewer_Viewer::Zoom: - if ( state != Fin && doTrsf ) - { - avp->zoom( myStart.x(), myStart.y(), myCurr.x(), myCurr.y() ); - myStart = myCurr; - } - break; - case GLViewer_Viewer::Pan: - if ( state != Fin && doTrsf ) - { - avp->pan( myCurr.x() - myStart.x(), myStart.y() - myCurr.y() ); - myStart = myCurr; - } - break; - case GLViewer_Viewer::PanGlobal: - { - if ( state == Fin ) - avp->setCenter( myCurr.x(), myCurr.y() ); - break; - } - case GLViewer_Viewer::FitRect: - { - if ( doTrsf ) - { - QRect rect( QMIN( myStart.x(), myCurr.x() ), QMIN( myStart.y(), myCurr.y() ), - QABS( myStart.x() - myCurr.x() ), QABS( myStart.y() - myCurr.y() ) ); - if ( !rect.isEmpty() ) - { - switch ( state ) - { - case Fin: - avp->fitRect( rect ); - break; - default: - { - QPainter p( avp->getPaintDevice() ); // for QAD_GLWidget - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - if ( !myDrawRect.isEmpty() ) - p.drawRect( myDrawRect ); /* erase */ - p.drawRect( rect ); - myDrawRect = rect; - break; - } - } - } - } - break; - } - default: - break; - } - - if ( state == Fin ) - myViewer->activateTransform( GLViewer_Viewer::NoTransform ); -} - -/*! - Returns the type of the transformer. [ public ] -*/ -int GLViewer_ViewTransformer::type() const -{ - return myType; -} - - -int GLViewer_ViewSketcher::sketchBtn = LeftButton; - -/*! - Constructor -*/ -GLViewer_ViewSketcher::GLViewer_ViewSketcher( GLViewer_Viewer* viewer, int type ) -: QObject( 0 ), -myViewer( viewer ), -myData( 0 ), -myType( type ) -{ - if( !myViewer ) - return; - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - if( !avp ) - return; - - mySavedCursor = avp->cursor(); - avp->setCursor( *GLViewer_ViewPort::getHandCursor() ); - avp->installEventFilter( this ); - - if ( myType == GLViewer_Viewer::Rect ) - myData = new QRect(); -} - -/*! - Destructor -*/ -GLViewer_ViewSketcher::~GLViewer_ViewSketcher() -{ - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - avp->removeEventFilter( this ); - avp->setCursor( mySavedCursor ); - - if ( myType == GLViewer_Viewer::Rect ) - delete ( QRect* ) myData; -} - -/*! - Catches mouse events for the viewport. [ virtual protected ] -*/ -bool GLViewer_ViewSketcher::eventFilter( QObject* o, QEvent* e ) -{ - switch ( e->type() ) - { - case QEvent::MouseMove: - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - { - SketchState state = EnTrain; - QMouseEvent* me = (QMouseEvent*)e; - - myButtonState = me->state(); - if ( e->type() == QEvent::MouseButtonPress ) - myButtonState |= me->button(); /* add pressed button */ - - if ( myStart.isNull() ) - { - state = Debut; - myStart = me->pos(); - } - - int mouseOnlyState = ( myButtonState & ( LeftButton | MidButton | RightButton ) ); - if ( e->type() == QEvent::MouseButtonRelease && mouseOnlyState == sketchButton() ) - { - state = Fin; - } - myCurr = me->pos(); - onSketch( state ); - return true; - } - default: break; - } - return QObject::eventFilter( o, e ); -} - -/*! - Draws in the viewport. [ virtual protected ] -*/ -void GLViewer_ViewSketcher::onSketch( SketchState state ) -{ - GLViewer_ViewPort* avp = myViewer->getActiveView()->getViewPort(); - if( !avp ) - return; - - if( myType == GLViewer_Viewer::Rect ) - { - QRect* sketchRect = ( QRect* )data(); - if ( myButtonState & sketchButton() ) - { - QRect rect( QMIN( myStart.x(), myCurr.x() ), QMIN( myStart.y(), myCurr.y() ), - QABS( myStart.x() - myCurr.x() ), QABS( myStart.y() - myCurr.y() ) ); - if ( !rect.isEmpty() ) - { - QPainter p( avp ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - if ( !sketchRect->isEmpty() ) - p.drawRect( *sketchRect ); /* erase */ - *sketchRect = rect; - if ( state != Fin ) - p.drawRect( *sketchRect ); - } - } - } - - if ( state == Fin ) - { - QApplication::syncX(); /* force rectangle redrawing */ - myViewer->activateSketching( GLViewer_Viewer::NoSketching ); - } -} diff --git a/src/GLViewer/GLViewer_Viewer.h b/src/GLViewer/GLViewer_Viewer.h deleted file mode 100644 index 0d68a450d..000000000 --- a/src/GLViewer/GLViewer_Viewer.h +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Viewer.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWER_H -#define GLVIEWER_VIEWER_H - -#include "GLViewer_Defs.h" -#include "GLViewer_ViewFrame.h" -#include - -#include -#include -#include -#include - -class GLViewer_Selector; -class GLViewer_ViewSketcher; -class GLViewer_ViewTransformer; - -class SUIT_Desktop; -class SUIT_ViewWindow; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_Object - Base Viewer for GLViewer -*/ -class GLVIEWER_API GLViewer_Viewer: public SUIT_ViewModel -{ - Q_OBJECT - -public: - enum SelectionMode { NoSelection, Single, Multiple }; - enum TransformType { NoTransform, Reset, FitAll, FitRect, FitSelect, - Zoom, PanGlobal, Pan, Rotate, UserTransform = 100 }; - enum SketchingType { NoSketching, Rect, UserSketching = 100 }; - -public: - GLViewer_Viewer( const QString& title ); - ~GLViewer_Viewer(); - -public: - virtual void setViewManager( SUIT_ViewManager* theViewManager ); - virtual QString getType() const { return Type(); } - static QString Type() { return "GLViewer_ViewModel"; } - - virtual void contextMenuPopup( QPopupMenu* ); - -public: - void setSelectionMode( SelectionMode ); - SelectionMode getSelectionMode() const; - GLViewer_Selector* getSelector() const; - - virtual void update( int = 0 ); - - void activateTransform( int ); - void activateSketching( int ); - - GLViewer_ViewFrame* getActiveView() const; - -signals: - void selectionChanged( SelectionChangeStatus ); - -protected: - virtual void onSketchingStarted(); - virtual void onSketchingFinished(); - virtual void onTransformationStarted(); - virtual void onTransformationFinished(); - virtual void onSelectionModeChanged(); - - virtual void unhilightDetected(); - virtual bool eventFilter( QObject*, QEvent* ); - - /* virtual constructors */ - virtual GLViewer_ViewTransformer* createTransformer( int ); - virtual GLViewer_ViewSketcher* createSketcher( int ); - virtual GLViewer_Selector* createSelector(); - - virtual void startOperations( QMouseEvent* ) {} - virtual bool updateOperations( QMouseEvent* ) { return false; } - virtual void finishOperations( QMouseEvent* ) {} - virtual void startOperations( QWheelEvent* ) {} - -protected slots: - virtual void onKeyEvent( SUIT_ViewWindow*, QKeyEvent* ); - virtual void onMouseEvent( SUIT_ViewWindow*, QMouseEvent* ); - virtual void onWheelEvent( SUIT_ViewWindow*, QWheelEvent* ); - - virtual void onSelectionCancel(); - virtual void onSelectionDone( bool add, SelectionChangeStatus status ); - - virtual void onChangeBgColor(); - -private: - void handleMouseMove( QMouseEvent* ); - void handleMousePress( QMouseEvent* ); - void handleMouseRelease( QMouseEvent* ); - void handleWheel( QWheelEvent* ); - -protected: - GLViewer_Selector* mySelector; /* selector */ - SelectionMode mySelMode; /* current selection mode */ - GLViewer_ViewSketcher* mySketcher; /* sketch manipulator */ - GLViewer_ViewTransformer* myTransformer; /* transform manipulator */ -}; - -class GLVIEWER_API GLViewer_ViewTransformer : public QObject -{ -public: - GLViewer_ViewTransformer( GLViewer_Viewer*, int type ); - ~GLViewer_ViewTransformer(); - -public: - /*! Returns transformer type */ - int type() const; - - /*! Sets/returns acceleration key ( CTRL by default ) */ - static int accelKey() { return acccelKey; } - static void setAccelKey( int k ) { acccelKey = k; } - - /*! Sets/returns mouse button used for zooming ( MB1 by default ) */ - static int zoomButton() { return zoomBtn; } - static void setZoomButton( int b ) { zoomBtn = b; } - - /*! Sets/returns mouse button used for panning ( MB2 by default ) */ - static int panButton() { return panBtn; } - static void setPanButton( int b ) { panBtn = b; } - - /*! Sets/returns mouse button used for global pan ( MB1 by default ) */ - static int panGlobalButton() { return panGlobalBtn; } - static void setPanGlobalButton( int b ) { panGlobalBtn = b; } - - /*! Sets/returns mouse button used for fit area ( MB1 by default ) */ - static int fitRectButton() { return fitRectBtn; } - static void setFitRectButton( int b ) { fitRectBtn = b; } - - virtual void exec(); - virtual bool eventFilter( QObject*, QEvent* ); - -protected: - enum TransformState { Debut, EnTrain, Fin }; - virtual void onTransform( TransformState ); - void initTransform( bool ); - -protected: - static int panBtn; - static int zoomBtn; - static int fitRectBtn; - static int panGlobalBtn; - - static int acccelKey; - - GLViewer_Viewer* myViewer; - int myType; - QCursor mySavedCursor; - bool mySavedMouseTrack; - QPoint myStart, myCurr; - int myButtonState; - QRect myDrawRect; - int myMajorBtn; -}; - -class GLVIEWER_API GLViewer_ViewSketcher : public QObject -{ -public: - GLViewer_ViewSketcher( GLViewer_Viewer*, int type ); - ~GLViewer_ViewSketcher(); - -public: - /*! Returns sketcher type */ - int type() const { return myType; } - - /*! Returns result of sketching */ - void* data() const { return myData; } - - /*! Returns current state of mouse/sys kbd buttons */ - int buttonState() const { return myButtonState; } - - /*! Sets/returns mouse button used for sketching ( MB1 by default ) */ - static int sketchButton() { return sketchBtn; } - static void setSketchButton( int b ) { sketchBtn = b; } - - virtual bool eventFilter( QObject*, QEvent* ); - -protected: - enum SketchState { Debut, EnTrain, Fin }; - virtual void onSketch( SketchState ); - -protected: - static int sketchBtn; - GLViewer_Viewer* myViewer; - int myType; - void* myData; - QCursor mySavedCursor; - QPoint myStart, myCurr; - int myButtonState; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx deleted file mode 100644 index 7d03218ba..000000000 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ /dev/null @@ -1,1092 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Viewer2d.cxx -// Created: November, 2004 - -//#include -#include "GLViewer_Viewer2d.h" -#include "GLViewer_Object.h" -#include "GLViewer_BaseObjects.h" -#include "GLViewer_CoordSystem.h" -#include "GLViewer_Context.h" -#include "GLViewer_Drawer.h" -#include "GLViewer_Selector2d.h" -//#include "GLViewer_Sketcher.h" -#include "GLViewer_ViewPort2d.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" - -#include "OSD_Timer.hxx" -#include - -#include -#include -#include - -/*! - Constructor - \param title - viewer title -*/ -GLViewer_Viewer2d::GLViewer_Viewer2d( const QString& title) : -GLViewer_Viewer( title ) -{ - myGLContext = new GLViewer_Context( this ); - - //myGLSketcher = new GLViewer_Sketcher( this ); - - createSelector(); - - mySelMode = GLViewer_Viewer::Multiple; - - myDrawers.clear(); -} - -/*! - Destructor -*/ -GLViewer_Viewer2d::~GLViewer_Viewer2d() -{ - //myGLSketcher = 0; - //delete myGLSketcher; - GLViewer_TexFont::clearTextBases(); -} - -/*!Create new instance of view window on desktop \a theDesktop. - *\retval SUIT_ViewWindow* - created view window pointer. - */ -SUIT_ViewWindow* GLViewer_Viewer2d::createView( SUIT_Desktop* theDesktop ) -{ - return new GLViewer_ViewFrame( theDesktop, this ); -} - -/*! - Adds item for change background color - \param thePopup - menu -*/ -void GLViewer_Viewer2d::addPopupItems( QPopupMenu* thePopup ) -{ - // CTH8434. "Change background color" menu item is available if there are no selected objects - if ( getSelector() == 0 || getSelector()->numSelected() == 0 ) - { - if( thePopup->count() > 0 ) - thePopup->insertSeparator(); - thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); - } -} - -/*! - Changes background color -*/ -void GLViewer_Viewer2d::onChangeBgColor() -{ - if( !getActiveView() ) - return; - GLViewer_ViewPort2d* vp = ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() ); - - QColor selColor = QColorDialog::getColor( vp->backgroundColor(), vp ); - if ( selColor.isValid() ) { - vp->setBackgroundColor( selColor ); - } -} - -/*! - Updates colors for all drawers (does not work) -*/ -void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS ) -{ -// cout << "GLViewer_Viewer2d::updateColors" << endl; - -/* - for ( DrawerMap::Iterator it = myDrawers.begin(); it != myDrawers.end(); ++it ) - { - it.key()->setHColor( colorH ); - it.key()->setSColor( colorS ); - } -*/ - /* - ObjList anObjects = myGLContext->getObjects(); - ObjList::Iterator beginIt = anObjects.begin(); - ObjList::Iterator endIt = anObjects.end(); - for ( ObjList::Iterator it = beginIt; it != endIt; ++it ) - { - //GLViewer_Drawer* aDrawer = (*it)->getDrawer(); - //aDrawer->setHColor( colorH ); - //aDrawer->setSColor( colorS ); - } - */ - - - activateAllDrawers( TRUE ); -} - -/*! - Updates rect of global scene by adding new rectangle - \param theRect - rectangle -*/ -void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect ) -{ - QPtrVector views = getViewManager()->getViews(); - for ( int i = 0, n = views.count(); i < n; i++ ) - { - GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder(); - - border->setLeft( QMIN( border->left(), theRect->left() ) ); - border->setRight( QMAX( border->right(), theRect->right() ) ); - border->setBottom( QMIN( border->bottom(), theRect->bottom() ) ); - border->setTop( QMAX( border->top(), theRect->top() ) ); - } -} - -/*! - Recomputes global scene rect -*/ -void GLViewer_Viewer2d::updateBorders() -{ - QPtrVector views = getViewManager()->getViews(); - - ObjList anObjects = myGLContext->getObjects(); - ObjList::Iterator beginIt = anObjects.begin(); - ObjList::Iterator endIt = anObjects.end(); - for ( int i = 0, n = views.count(); i < n; i++ ) - { - GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder(); - if ( !border ) - continue; - border->setIsEmpty( true ); - // initialise border by default values to avoid old values - border->setCoords( 0, 0, 0, 0 ); - for ( ObjList::Iterator it = beginIt; it != endIt; ++it ) - { - GLViewer_Object* anObject = *it; - GLViewer_Rect* aRect = anObject->getRect(); - if( !anObject->isSelectable() || !anObject->getVisible() ) - continue; - - if( border->isEmpty() ) - { - border->setIsEmpty( false ); - border->setCoords( aRect->left(), aRect->right(), aRect->bottom(), aRect->top() ); - } - else - { - border->setLeft( QMIN( border->left(), aRect->left() ) ); - border->setRight( QMAX( border->right(), aRect->right() ) ); - border->setBottom( QMIN( border->bottom(), aRect->bottom() ) ); - border->setTop( QMAX( border->top(), aRect->top() ) ); - } - } - } -} - -/*! - Redraws all active objects by updating all drawers in all views -*/ -void GLViewer_Viewer2d::updateAll() -{ - if ( !getActiveView() ) - return; - - QPtrVector views = getViewManager()->getViews(); - for ( int i = 0, n = views.count(); i < n; i++ ) - ( ( GLViewer_ViewPort2d* )( ( GLViewer_ViewFrame* )views[i] )->getViewPort() )->getGLWidget()->updateGL(); -} - -/*! - \param onlyUpdate is passed to method activateAllDrawers drawers -*/ -void GLViewer_Viewer2d::updateDrawers( GLboolean update, GLfloat scX, GLfloat scY ) -{ -// cout << "GLViewer_Viewer2d::updateDrawers" << endl; - - //myGLContext->updateScales( scX, scY ); - //myGLSketcher->drawContour(); - activateAllDrawers( update ); -} - -/*! - Activates drawers for objects from list \param theObjects only -*/ -void GLViewer_Viewer2d::activateDrawers( QValueList& theObjects, bool onlyUpdate, GLboolean swap ) -{ - //cout << "GLViewer_Viewer2d::activateDrawers " << (int)onlyUpdate << " " << (int)swap << endl; - QValueList::Iterator anIt = myDrawers.begin(); - QValueList::Iterator endDIt = myDrawers.end(); - for( ; anIt != endDIt; anIt++ ) - (*anIt)->clear(); - - QValueList anActiveDrawers; - QValueList::Iterator endOIt = theObjects.end(); - - for( QValueList::Iterator oit = theObjects.begin(); oit != endOIt; ++oit ) - { - GLViewer_Drawer* aDrawer = (*oit)->getDrawer(); - if( !aDrawer ) - { - anIt = myDrawers.begin(); - endDIt = myDrawers.end(); - - for( ; anIt != endDIt; anIt++ ) - if( (*anIt)->getObjectType() == (*oit)->getObjectType() ) - { - (*oit)->setDrawer( *anIt ); - aDrawer = *anIt; - break; - } - - if( !aDrawer ) - { - myDrawers.append( (*oit)->createDrawer() ); - aDrawer = (*oit)->getDrawer(); - } - } - if ( !aDrawer ) - continue; - aDrawer->addObject( (*oit) ); - - int aPriority = aDrawer->getPriority(); - - if( anActiveDrawers.findIndex( aDrawer ) != -1 ) - continue; - - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); - for( ; aDIt != aDEndIt; ++aDIt ) - if( (*aDIt)->getPriority() > aPriority ) - break; - - anActiveDrawers.insert( aDIt, aDrawer ); - } - - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); - - QPtrVector views = getViewManager()->getViews(); - for ( int i = 0, n = views.count(); i < n; i++ ) - { - float xScale, yScale; - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort(); - vp->getScale( xScale, yScale ); - vp->getGLWidget()->makeCurrent(); - - for( ; aDIt != aDEndIt; aDIt++ ) - { - GLViewer_Drawer* aDrawer = *aDIt; - if( aDrawer ) - aDrawer->create( xScale, yScale, onlyUpdate ); - } -/* - // draw border - GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder(); - (*aDIt)->drawRectangle( border, Qt::blue ); - - QString coords = QString::number( border->left() ) + " " + QString::number( border->right() ) + " " + - QString::number( border->bottom() ) + " " + QString::number( border->top() ); - (*aDIt)->drawText( "Border : " + coords, border->left(), border->top() + 10 / yScale, - Qt::blue, &QFont( "Courier", 8, QFont::Normal ), 2 ); -*/ - if ( swap ) - vp->getGLWidget()->swapBuffers(); - } - - ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent(); -} - -/*! - Activates drawer for \param theObject -*/ -void GLViewer_Viewer2d::activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap ) -{ - ObjList aList; - aList.append( theObject ); - activateDrawers( aList, onlyUpdate, swap ); -} - -/*! - \param onlyUpdate is passed to drawers -*/ -void GLViewer_Viewer2d::activateAllDrawers( bool onlyUpdate, GLboolean swap ) -{ - if ( !getActiveView() ) - return; - - ObjList anActiveObjs; - const ObjList& objs = myGLContext->getObjects(); - for( ObjList::const_iterator it = objs.begin(); it != objs.end(); ++it ) - { - GLViewer_Object* obj = (GLViewer_Object*)(*it); - if( obj->getVisible() ) - anActiveObjs.append( obj ); - } - - activateDrawers( anActiveObjs, onlyUpdate, swap ); -} - -/*! - Creates set of marker - \param theMarkersNum - number of markers - \param theMarkersRad - radius of markers -*/ -void GLViewer_Viewer2d::onCreateGLMarkers( int theMarkersNum, int theMarkersRad ) -{ - if ( !getActiveView() ) - return; - - GLViewer_MarkerSet* aMarkerSet = new GLViewer_MarkerSet( theMarkersNum, theMarkersRad ); - getGLContext()->insertObject( aMarkerSet ); - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - int vpWidth = vp->getWidth(); - int vpHeight = vp->getHeight(); - - float* aXCoord = new float[ theMarkersNum ]; - float* anYCoord = new float[ theMarkersNum ]; - - srand( 1 ); - for ( long i = 0; i < theMarkersNum; i++ ) - { - aXCoord[i] = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.); - anYCoord[i] = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.); - } - - aMarkerSet->setXCoord( aXCoord, theMarkersNum ); - aMarkerSet->setYCoord( anYCoord, theMarkersNum ); - aMarkerSet->compute(); - - updateBorders( aMarkerSet->getRect() ); - - activateAllDrawers( false ); - activateTransform( GLViewer_Viewer::FitAll ); - - delete[] aXCoord; - delete[] anYCoord; -} - -/*! - Creates GL polyline - \param theAnglesNum - number of angles - \param theRadius - radius - \param thePolylineNumber - number -*/ -void GLViewer_Viewer2d::onCreateGLPolyline( int theAnglesNum, int theRadius, int thePolylineNumber ) -{ - if ( !getActiveView() ) - return; - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - int vpWidth = vp->getWidth(); - int vpHeight = vp->getHeight(); - - float* aXCoord = new float[ theAnglesNum ]; - float* anYCoord = new float[ theAnglesNum ]; - - //srand( ( unsigned )time( NULL ) ); - srand( 1 ); - for( int j = 0; j < thePolylineNumber; j++) - { - GLViewer_Polyline* aPolyline = new GLViewer_Polyline( theAnglesNum, theRadius ); - getGLContext()->insertObject( aPolyline ); - - float aXOffset = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.); - float anYOffset = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.); - for( int i = 0; i < theAnglesNum; i++ ) - { - aXCoord[i] = cos( 2. * PI * i / theAnglesNum ) * theRadius + aXOffset; - anYCoord[i] = sin( 2. * PI * i / theAnglesNum ) * theRadius + anYOffset; - } - - aPolyline->setHighSelAll( true ); - aPolyline->setClosed( true ); - aPolyline->setXCoord( aXCoord, theAnglesNum ); - aPolyline->setYCoord( anYCoord, theAnglesNum ); - aPolyline->compute(); - - updateBorders( aPolyline->getRect() ); - } - - activateAllDrawers( false ); - activateTransform( GLViewer_Viewer::FitAll ); - - delete[] aXCoord; - delete[] anYCoord; -} - -/*! - Creates text - \param theStr - text string - \param theTextNumber - number -*/ -void GLViewer_Viewer2d::onCreateGLText( QString theStr, int theTextNumber ) -{ - if ( !getActiveView() ) - return; - - if( theTextNumber <= 0 ) - return; - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - int vpWidth = vp->getWidth(); - int vpHeight = vp->getHeight(); - - //srand( ( unsigned )time( NULL ) ); - srand( 1 ); - for( int j = 0; j < theTextNumber; j++) - { - float aXPos = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpWidth / 2.); - float anYPos = cos( PI * (rand() / (GLfloat)RAND_MAX) ) * ((GLfloat)vpHeight / 2.); - QColor aColor( 255, 0, 255 ); - - GLViewer_TextObject* aText = new GLViewer_TextObject( theStr, aXPos, anYPos, aColor ); - aText->compute(); - getGLContext()->insertObject( aText ); - - updateBorders( aText->getRect() ); - } - - activateAllDrawers( false ); -} - -/*! - Translates point from global CS to curreent viewer CS - \param x, y - co-ordinates to be translated -*/ -void GLViewer_Viewer2d::transPoint( GLfloat& x, GLfloat& y ) -{ - if ( !getActiveView() ) - return; - - GLfloat xScale, yScale; - GLfloat xPan, yPan; - - GLViewer_ViewPort2d* curvp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - - curvp->getScale( xScale, yScale ); - curvp->getPan( xPan, yPan ); - - GLfloat a = curvp->getGLWidget()->getRotationAngle() * PI / 180.; - - x = ( x - ( GLfloat )curvp->getWidth() / 2 ) / xScale; - y = ( -y + ( GLfloat )curvp->getHeight() / 2 ) / yScale; - - GLfloat x1 = x; - GLfloat y1 = y; - - x = x1 * cos(a) + y1 * sin(a); - y = -x1 * sin(a) + y1 * cos(a); - - x -= xPan; - y -= yPan; -} - -/*! - \return object rect in window CS - \param theObject - object -*/ -QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject ) -{ - if ( !getActiveView() ) - return 0; - - GLfloat xScale, yScale; - GLfloat xPan, yPan; - - GLViewer_ViewPort2d* curvp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - GLfloat aWidth = curvp->getWidth(); - GLfloat aHeight = curvp->getHeight(); - - - curvp->getScale( xScale, yScale ); - curvp->getPan( xPan, yPan ); - - QRect aObjRect = theObject->getRect()->toQRect(); - float aLeft = aObjRect.left() + xPan, aRight = aObjRect.right() + xPan; - float aTop = aObjRect.top() + yPan, aBot = aObjRect.bottom() + yPan; - - GLfloat anAngle = curvp->getGLWidget()->getRotationAngle() * PI / 180.; - - QPointArray aPointArray(4); - aPointArray[0] = QPoint( (int)(aLeft*cos(anAngle) - aTop*sin(anAngle)), - (int)(aLeft*sin(anAngle) + aTop*cos(anAngle)) ); - aPointArray[1] = QPoint( (int)(aRight*cos(anAngle) - aTop*sin(anAngle)), - (int)(aRight*sin(anAngle) + aTop*cos(anAngle)) ); - aPointArray[2] = QPoint( (int)(aRight*cos(anAngle) - aBot*sin(anAngle)), - (int)(aRight*sin(anAngle) + aBot*cos(anAngle)) ); - aPointArray[3] = QPoint( (int)(aLeft*cos(anAngle) - aBot*sin(anAngle)), - (int)(aLeft*sin(anAngle) + aBot*cos(anAngle)) ); - - int aMinLeft = aPointArray[0].x(), aMaxRight = aPointArray[0].x(), - aMinTop = aPointArray[0].y(), aMaxBottom = aPointArray[0].y(); - for( int i = 1; i < 4; i++ ) - { - int x = aPointArray[i].x(); - int y = aPointArray[i].y(); - aMinLeft = QMIN( aMinLeft,x ); - aMaxRight = QMAX( aMaxRight, x ); - aMinTop = QMIN( aMinTop, y ); - aMaxBottom = QMAX( aMaxBottom, y ); - } - - aLeft = (aMinLeft/* + xPan*/)*xScale + aWidth / 2; - aRight = (aMaxRight/* + xPan*/)*xScale + aWidth / 2; - - aTop = -( (aMaxBottom/* + yPan*/)*yScale - aHeight / 2 ); - aBot = -( (aMinTop/* + yPan*/)*yScale - aHeight / 2 ); - - QRect* newRect = new QRect( (int)aLeft, (int)aTop, (int)(aRight-aLeft), (int)(aBot-aTop) ); - - return newRect; -} - -/*! - Translates rect in window CS to rect in global CS - \param theRect - rectangle to be translated - \return transformed rect -*/ -GLViewer_Rect GLViewer_Viewer2d::getGLVRect( const QRect& theRect ) const -{ - if ( !getActiveView() ) - return GLViewer_Rect(); - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - - if( !vp ) - return GLViewer_Rect(); - - return vp->win2GLV( theRect ); -} - -/*! - Translates rect in global CS to rect in window CS - \param theRect - rectangle to be translated - \return transformed rect -*/ -QRect GLViewer_Viewer2d::getQRect( const GLViewer_Rect& theRect ) const -{ - if ( !getActiveView() ) - return QRect(); - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort(); - - if( !vp ) - return QRect(); - - return vp->GLV2win( theRect ); -} - -/*! - \return new selector -*/ -GLViewer_Selector* GLViewer_Viewer2d::createSelector() -{ - return new GLViewer_Selector2d( this, getGLContext() ); -} - -/*! - \return new Transformer - \param type - type of new transformer -*/ -GLViewer_ViewTransformer* GLViewer_Viewer2d::createTransformer( int type ) -{ - return new GLViewer_View2dTransformer( this, type ); -} - -/*! - Custom mouse event handler -*/ -void GLViewer_Viewer2d::onMouseEvent( SUIT_ViewWindow*, QMouseEvent* e ) -{ - if ( !getActiveView() ) - return; - - //if ( testRotation( e ) ) - // return; - - switch( e->type() ) - { - case QEvent::MouseButtonPress : - case QEvent::MouseMove : - case QEvent::MouseButtonRelease : - //if( myGLSketcher->getType() != None ) - // myGLSketcher->sketch( e ); - default: break; - } - - GLViewer_Viewer::onMouseEvent( 0, e ); -} - -/*! - Rotation transformation -*/ -bool GLViewer_Viewer2d::testRotation( QMouseEvent* e ) -{ - if ( ( e->button() == GLViewer_View2dTransformer::rotateButton() ) && - ( e->type() == QEvent::MouseButtonPress ) && - ( e->state() & GLViewer_ViewTransformer::accelKey() ) ) - { - activateTransform( GLViewer_Viewer::Rotate ); - return true; - } - return false; -} - -/*! - Inserts text lines as header for file - \param aType - file type - \param hFile - file instance -*/ -void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile ) -{ - if( aType == POST_SCRIPT ) - { - QString header = "%!PS-Adobe-3.0\n"; - header += "%%Creator: OpenCascade 2004\n"; - header += "%%Title: Our document\n"; - header += "%%PageOrder: Ascend\n"; - header += "%%Orientation: Portrait\n"; - header += "%%LanguageLevel: 2\n"; - - header += "%%Pages: 1\n"; - header += "%%Page: 1\n\n"; - - hFile.writeBlock( header.ascii(), header.length() ); - } - else if( aType == HPGL ) - { - QString header = "[Esc].(;\n"; - header += "[Esc].I81;;17:\n"; - header += "[Esc].N;19:\n"; - header += "IN;\n"; - header += "SC;\n"; - header += "PU;\n"; - header += "SP1;\n"; - header += "LT;\n"; - header += "VS36;\n"; - - hFile.writeBlock( header.ascii(), header.length() ); - } -} - -/*! - Inserts text lines as ending for file - \param aType - file type - \param hFile - file instance -*/ -void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile ) -{ - if( aType == POST_SCRIPT ) - { - QString ending = "showpage\n\n%%EOF"; - hFile.writeBlock( ending.ascii(), ending.length() ); - } - else if( aType == HPGL ) - { - QString ending = "PU;PA0,0;SP;EC;PG1;EC1;OE\n"; - hFile.writeBlock( ending.ascii(), ending.length() ); - } -} - -inline void mm2custom( GLViewer_Viewer2d::VectorFileType aType, double& value ) -{ - if( aType==GLViewer_Viewer2d::POST_SCRIPT ) - value*=2.8346; //mm to pt - - else if( aType==GLViewer_Viewer2d::HPGL ) - value*=40; //mm to plu (there are 40 plues in mm) -#ifdef WIN32 - else if( aType==GLViewer_Viewer2d::ENH_METAFILE ) - value*=100; //this unit is 1/100 mm -#endif -} - -/*! - Translates current view content to vector file - \param aType - type of file - \param FileName - name of file, - \param aPType - paper size type - \param mmLeft, mmRight, mmTop, mmBottom - margins -*/ -bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, PaperType aPType, - double mmLeft, double mmRight, double mmTop, double mmBottom ) -{ - if ( !getActiveView() ) - return false; - - QFile hFile( FileName.ascii() ); - -#ifdef WIN32 - HDC hMetaFileDC; -#endif - - GLViewer_ViewPort2d* aCurVP = (GLViewer_ViewPort2d*) getActiveView()->getViewPort(); - - GLfloat xPan, yPan; - aCurVP->getPan( xPan, yPan ); - GLfloat aRotation = aCurVP->getGLWidget()->getRotationAngle() * 3.14159265 / 180.0; - - GLViewer_CoordSystem aViewerCS( GLViewer_CoordSystem::Cartesian, xPan, yPan, 1.0, 1.0, aRotation ); - - double AW = Sizes[2*int(aPType)], - AH = Sizes[2*int(aPType)+1]; //size of Axx paper in mm - - mm2custom( aType, mmLeft ); //we translate mm to custom units - mm2custom( aType, mmRight ); - mm2custom( aType, mmTop ); - mm2custom( aType, mmBottom ); - mm2custom( aType, AW ); - mm2custom( aType, AH ); - - float xScale, yScale; - aCurVP->getScale( xScale, yScale ); - - double VPWidth = aCurVP->getWidth()/xScale, //the width in reference units - VPHeight = aCurVP->getHeight()/yScale; - - double k1 = ( AW-mmLeft-mmRight ) / VPWidth, - k2 = ( AH-mmTop-mmBottom ) / VPHeight; - - if( k1>k2 ) - k1 = k2; //We select the minimum - - double hdelta = ( AW-mmLeft-mmRight - VPWidth * k1 )/2.0, //addition in horizontal - vdelta = ( AH-mmTop-mmBottom - VPHeight * k1 )/2.0; //addition in vertical - - mmLeft += hdelta; //The real free space on the left and right borders - mmRight += hdelta; - mmTop += vdelta; - mmBottom += vdelta; - - GLViewer_CoordSystem aPaperCS( GLViewer_CoordSystem::Cartesian, - -(mmLeft/k1+VPWidth/2.0), -(mmBottom/k1+VPHeight/2.0), 1/k1, 1/k1 ); - - if( aType==POST_SCRIPT || aType==HPGL ) - { - hFile.open( IO_ReadWrite | IO_Truncate ); - hFile.at( 0 ); - insertHeader( aType, hFile ); - } -#ifdef WIN32 - else if( aType==ENH_METAFILE ) - { - RECT r; - r.left = 0; r.right = AW; - r.top = 0; r.bottom = AH; - HDC screen_dc = GetDC( 0 ); //The screen device context - HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen - - hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.ascii(), &r, "" ); - SetMapMode( hMetaFileDC, MM_HIMETRIC ); - SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL ); - HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH ); - SelectClipRgn( hMetaFileDC, ClipRgn ); - - LOGBRUSH aBrushData; - aBrushData.lbColor = RGB( 255, 255, 255 ); - aBrushData.lbStyle = BS_SOLID; - - FillRect( hMetaFileDC, &r, CreateBrushIndirect( &aBrushData ) ); - - ReleaseDC( 0, screen_dc ); - DeleteDC( bitDC ); - - aCurVP->getGLWidget()->translateBackgroundToEMF( hMetaFileDC, &aViewerCS, &aPaperCS ); - } -#endif - - if( aType==POST_SCRIPT ) - { - QString temp = "%1 %2 %3 %4 rectclip\n\n", - aBuffer = temp.arg( mmLeft ).arg( mmBottom ). - arg( AW-mmLeft-mmRight ).arg( AH-mmBottom-mmTop ); - //It is set clipping path - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - - aCurVP->getGLWidget()->translateBackgroundToPS( hFile, &aViewerCS, &aPaperCS ); - } - - bool result = true; - for( int i=0, n=myDrawers.count(); itranslateToPS( hFile, &aViewerCS, &aPaperCS ); - else if( aType==HPGL ) - result &= myDrawers[ i ]->translateToHPGL( hFile, &aViewerCS, &aPaperCS ); -#ifdef WIN32 - else if( aType==ENH_METAFILE ) - result &= myDrawers[ i ]->translateToEMF( hMetaFileDC, &aViewerCS, &aPaperCS ); -#endif - - if( aType==POST_SCRIPT || aType==HPGL ) - { - insertEnding( aType, hFile); - hFile.close(); - } -#ifdef WIN32 - else if( aType==ENH_METAFILE ) - DeleteEnhMetaFile( CloseEnhMetaFile( hMetaFileDC ) ); -#endif - - return true; -} - -/*! - Repaints view - \param theView - view to be repainted. If it is NULL then all views will be repainted -*/ -void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurrent ) -{ - GLViewer_ViewFrame* aCurView; - if( !theView ) - aCurView = (GLViewer_ViewFrame*)getActiveView(); - else - aCurView = theView; - - if ( !aCurView ) - return; - - ObjList anActiveObjs; - const ObjList& objs = myGLContext->getObjects(); - for( ObjList::const_iterator it = objs.begin(); it != objs.end(); ++it ) - { - GLViewer_Object* obj = (GLViewer_Object*)(*it); - if( obj->getVisible() ) - anActiveObjs.append( obj ); - } - - float xScale; - float yScale; - - QValueList::Iterator anIt = myDrawers.begin(); - QValueList::Iterator endDIt = myDrawers.end(); - for( ; anIt != endDIt; anIt++ ) - (*anIt)->clear(); - - QValueList anActiveDrawers; - QValueList::Iterator endOIt = anActiveObjs.end(); - - for( QValueList::Iterator oit = anActiveObjs.begin(); oit != endOIt; ++oit ) - { - GLViewer_Drawer* aDrawer = (*oit)->getDrawer(); - if( !aDrawer ) - { - anIt = myDrawers.begin(); - - for( ; anIt != endDIt; anIt++ ) - if( (*anIt)->getObjectType() == (*oit)->getObjectType() ) - { - (*oit)->setDrawer( *anIt ); - aDrawer = *anIt; - break; - } - - if( !aDrawer ) //are not exists - { - myDrawers.append( (*oit)->createDrawer() ); - aDrawer = (*oit)->getDrawer(); - } - } - aDrawer->addObject( (*oit) ); - if( anActiveDrawers.findIndex( aDrawer ) == -1 ) - anActiveDrawers.append( aDrawer ); - } - - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); - - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )aCurView->getViewPort(); - vp->getScale( xScale, yScale ); - - if( makeCurrent ) - vp->getGLWidget()->makeCurrent(); - - for( ; aDIt != aDEndIt; aDIt++ ) - (*aDIt)->create( xScale, yScale, false ); - -// if ( swap ) - vp->getGLWidget()->swapBuffers(); - -// ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent(); -} - -/*! - Starts some operation on mouse event -*/ -void GLViewer_Viewer2d::startOperations( QMouseEvent* e ) -{ - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort(); - - float x = e->pos().x(); - float y = e->pos().y(); - transPoint( x, y ); - GLViewer_Pnt point( x, y ); - - if( e->button() == Qt::LeftButton && !myGLContext->getCurrentObject() && vp->startPulling( point ) ) - return; - - if( e->button() == Qt::LeftButton && !(vp->currentBlock() & BS_Selection) && !myGLContext->getCurrentObject() ) - vp->startSelectByRect( e->x(), e->y() ); -} - -/*! - Updates started operation on mouse event -*/ -bool GLViewer_Viewer2d::updateOperations( QMouseEvent* e ) -{ - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort(); - - if( vp->isPulling() ) - { - float x = e->pos().x(); - float y = e->pos().y(); - transPoint( x, y ); - - vp->drawPulling( GLViewer_Pnt( x, y ) ); - updateAll(); - return true; - } - - if( !myGLContext->getCurrentObject() ) - { - vp->drawSelectByRect( e->x(), e->y() ); - return true; - } - return false; -} - -/*! - Completes started operation on mouse event -*/ -void GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) -{ - GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort(); - - if( vp->isPulling() ) - { - vp->finishPulling(); - updateAll(); - return; - } - - if( !myGLContext->getCurrentObject() ) - { - QRect aSelRect = vp->selectionRect(); - vp->finishSelectByRect(); - if ( getSelector() && !aSelRect.isNull() ) - { - bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); - getSelector()->select( aSelRect, append ); - } - } -} - -/*! - Starts some operation on mouse wheel event -*/ -void GLViewer_Viewer2d::startOperations( QWheelEvent* e ) -{ - bool zoomIn = e->delta() > 0; - bool update = false; - for( myGLContext->InitSelected(); myGLContext->MoreSelected(); myGLContext->NextSelected() ) - { - GLViewer_Object* anObject = myGLContext->SelectedObject(); - update = anObject->updateZoom( zoomIn ) || update; - } - - emit wheelZoomChange( zoomIn ); - - if( update ) - updateAll(); -} - - -int GLViewer_View2dTransformer::rotateBtn = RightButton; - -/*! - Constructor -*/ -GLViewer_View2dTransformer::GLViewer_View2dTransformer( GLViewer_Viewer* viewer, int typ ) -: GLViewer_ViewTransformer( viewer, typ ) -{ - if ( type() == GLViewer_Viewer::Rotate ) - initTransform( true ); -} - -/*! - Destructor -*/ -GLViewer_View2dTransformer::~GLViewer_View2dTransformer() -{ - if ( type() == GLViewer_Viewer::Rotate ) - initTransform( false ); -} - -/*! - Redefined to provide specific 3D transfomations. [ virtual public ] -*/ -void GLViewer_View2dTransformer::exec() -{ - if ( !myViewer->getActiveView() ) - return; - - /* additional transforms */ - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)vp; - switch ( myType ) - { - case GLViewer_Viewer::Rotate: - myMajorBtn = rotateButton(); - avp->setCursor( *avp->getRotCursor() ); - break; - default: - GLViewer_ViewTransformer::exec(); - } -} - -/*! - Handles rotation. [ protected virtual ] -*/ -void GLViewer_View2dTransformer::onTransform( TransformState state ) -{ - if ( !myViewer->getActiveView() ) - return; - - GLViewer_ViewPort* vp = myViewer->getActiveView()->getViewPort(); - GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)vp; - if ( type() == GLViewer_Viewer::Rotate ) - { - switch ( state ) - { - case Debut: - if ( myButtonState & myMajorBtn ) - avp->startRotation( myStart.x(), myStart.y() ); - break; - case EnTrain: - if ( myButtonState & myMajorBtn ) - avp->rotate( myCurr.x(), myCurr.y() ); - break; - case Fin: - avp->endRotation(); - break; - default: break; - } - } - GLViewer_ViewTransformer::onTransform( state ); -} diff --git a/src/GLViewer/GLViewer_Viewer2d.h b/src/GLViewer/GLViewer_Viewer2d.h deleted file mode 100644 index 93c9d30f0..000000000 --- a/src/GLViewer/GLViewer_Viewer2d.h +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Viewer2d.h -// Created: November, 2004 - -#ifndef GLVIEWER_VIEWER2D_H -#define GLVIEWER_VIEWER2D_H - -#ifdef WNT -#include -#endif - -#include -#include - -#include "GLViewer_Viewer.h" -#include "GLViewer_Object.h" -#include "GLViewer_ViewFrame.h" -#include "GLViewer_Drawer.h" - -#include - -#include - -class GLViewer_Object; -class GLViewer_Context; -class GLViewer_Selector2d; -//class GLViewer_Sketcher; - -class SUIT_Desktop; -class SUIT_ViewWindow; - -//! Paper sizes array -const double Sizes[2*5] = { - /* A1 */ 594.0, 840.0, - /* A2 */ 420.0, 594.0, - /* A3 */ 297.0, 420.0, - /* A4 */ 210.0, 297.0, - /* A5 */ 148.5, 210.0 -}; - -#ifdef WNT -#pragma warning( disable:4251 ) -#endif - -/*! - \class GLViewer_Viewer2d - OpenGL Viewer 2D -*/ - -class GLVIEWER_API GLViewer_Viewer2d : public GLViewer_Viewer -{ - Q_OBJECT - -public: - //! Type of sketcher operation - enum GLSketchingType - { - None, - Polyline, - Arc, - Curve, - Scribble, - Oval, - Rectangle - }; - //! Type of export vector file - enum VectorFileType - { - POST_SCRIPT, - HPGL -#ifdef WIN32 - , ENH_METAFILE -#endif - }; - - //! Type of paper for export to vector format - enum PaperType - { - A1=0, - A2, - A3, - A4, - A5 - }; - -public: - //! A constructor - GLViewer_Viewer2d( const QString& title ); - //! A destructor - ~GLViewer_Viewer2d(); - -public: - //! Redefined method - /*Returns GLViewer_ViewFrame*/ - virtual SUIT_ViewWindow* createView( SUIT_Desktop* ); - - //! Adds item for change background color - void addPopupItems( QPopupMenu* ); - - //void activateGLSketching( int ); - - //! Returns all drawers - const QValueList& getDrawers() const { return myDrawers; } - - //! Returns context - GLViewer_Context* getGLContext() const { return myGLContext; } - //! Updates colors for all drawers (does not work) - void updateColors( QColor colorH, QColor colorS ); - - //! Updates rect of global scene by adding new rect - void updateBorders( GLViewer_Rect* theRect ); - //! Recomputes global scene rect - void updateBorders(); - - //! Redraws all active objects by updating all drawers in all views - void updateAll(); - //! Updates all drawers with new scale factor - /* \param onlyUpdate is passed to method activateAllDrawersdrawers*/ - void updateDrawers( GLboolean onlyUpdate, GLfloat scX = 0.0, GLfloat scY = 0.0 ); - //! Activates drawers for objects from list \param theObjects only - void activateDrawers( QValueList& theObjects, bool onlyUpdate, GLboolean swap = GL_FALSE ); - //! Activates drawer for \param theObject - void activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap = GL_FALSE ); - //! Updates all drawers with new scale factor - /* \param onlyUpdate is passed to drawers*/ - void activateAllDrawers( bool onlyUpdate, GLboolean swap = GL_FALSE ); - - //! Translates point (x,y) from global CS to curreent viewer CS - void transPoint( GLfloat& x, GLfloat& y ); - //! Returns object rect in window CS - QRect* getWinObjectRect( GLViewer_Object* theObject); - - //! Translates rect in window CS to rect in global CS - GLViewer_Rect getGLVRect( const QRect& ) const; - //! Translates rect in global CS to rect in window CS - QRect getQRect( const GLViewer_Rect& ) const; - - //! Inserts common text lines starting file of \param aType - virtual void insertHeader( VectorFileType aType, QFile& hFile ); - //! Inserts common text lines ending file of \param aType - virtual void insertEnding( VectorFileType aType, QFile& hFile ); - //! Translates current view content to vector file - /* Translates current view content to vector file with type \param aType, name \param FileName, - * output paper size \param aPType, with margins in mm - */ - virtual bool translateTo( VectorFileType aType, QString FileName, PaperType aPType, - double mmLeft, double mmRight, double mmTop, double mmBottom ); - - //bool isSketchingActive(); - //int getSketchingType(); - - //virtual void startSketching(); - //virtual void finishSketching(); - - //! Repaints view \param theView. If \param theView = NULL repaints all views. - void repaintView( GLViewer_ViewFrame* theView = NULL, bool makeCurrent = false ); - -signals: - //! Signal needs for optimum recompute of zoom depending objects - //! Warning: use recompute without update viewer - void wheelZoomChange( bool ); - -public slots: - //void onSketchDelObject(); - //void onSketchUndoLast(); - //void onSketchFinish(); - - //! Changes background color - void onChangeBgColor(); - //! Creates set of marker number \param number and radius = \param size - void onCreateGLMarkers( int number = 1000, int size = 5 ); - //! Creates set of polyline number \param number, number of angles = \param angles and diameter = \param size - void onCreateGLPolyline( int number = 100, int angles = 10, int size = 100 ); - //! Creates set of text number \param number and with text = \param text - void onCreateGLText( QString text = "Text", int number = 1 ); - -protected: - //! Returns new selector - GLViewer_Selector* createSelector(); - //! Returns new Transformer with type \param type - GLViewer_ViewTransformer* createTransformer( int type); - - //! Transforms point (x,y) in Viewer CS to Post Script CS - void transformCoordsToPS( double& x, double& y ); - //! Transforms point (x,y) in Viewer CS to HPGL CS - void transformCoordsToHPGL( double& x, double& y ); - - //! Starts any operations on mouse event - virtual void startOperations( QMouseEvent* ); - //! Updates started operations on mouse event - virtual bool updateOperations( QMouseEvent* ); - //! Completes started operations on mouse event - virtual void finishOperations( QMouseEvent* ); - //! Starts any operations on mouse wheel event - virtual void startOperations( QWheelEvent* ); - -protected slots: - void onMouseEvent( SUIT_ViewWindow*, QMouseEvent* ); - -private: - //! Rotation transformation - bool testRotation( QMouseEvent* ); -protected: - //! Current context - GLViewer_Context* myGLContext; - //! Map of active drawers - QValueList myDrawers; - - //GLViewer_Sketcher* myGLSketcher; -}; - -class GLVIEWER_API GLViewer_View2dTransformer : public GLViewer_ViewTransformer -{ -public: - GLViewer_View2dTransformer( GLViewer_Viewer*, int ); - ~GLViewer_View2dTransformer(); - - virtual void exec(); - - /*! Sets/returns mouse butto which will be used for rotation ( MB1 by default ) */ - static int rotateButton() { return rotateBtn; } - static void setRotateButton( int b ) { rotateBtn = b; } - -protected: - void onTransform( TransformState ); - - static int rotateBtn; -}; - -#ifdef WNT -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/GLViewer/GLViewer_Widget.cxx b/src/GLViewer/GLViewer_Widget.cxx deleted file mode 100644 index 1fc069d20..000000000 --- a/src/GLViewer/GLViewer_Widget.cxx +++ /dev/null @@ -1,724 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Widget.cxx -// Created: November, 2004 - -#include "GLViewer_Widget.h" -#include "GLViewer_ViewPort2d.h" -#include "GLViewer_Viewer2d.h" -#include "GLViewer_Compass.h" -#include "GLViewer_Grid.h" -#include "GLViewer_Object.h" -#include "GLViewer_CoordSystem.h" - -#include -using namespace std; - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/*! - A constructor - Parameters using for QOGLWidget as is -*/ -GLViewer_Widget::GLViewer_Widget( QWidget* parent, const char* name ): -QGLWidget( parent, 0/*, WRepaintNoErase | WResizeNoErase*/ ) -{ - myViewPort = ( GLViewer_ViewPort2d* )parent; - - myXPan = 0.0; - myYPan = 0.0; - myZPan = 0.0; - myXScale = 1.0; - myYScale = 1.0; - myZScale = 1.0; - myRotationAngle = 0.0; - myRotationCenterX = 0.0; - myRotationCenterY = 0.0; - myRotationCenterZ = 1.0; - myRotationAnglePrev = 0.0; - - myStart = GL_TRUE; - - isExportMode = false; - - //init(); - setMouseTracking( true ); -} - -/*! - Destructor -*/ -GLViewer_Widget::~GLViewer_Widget() -{ -} - -/*! - \return offset parameters of Window in OpenGL global scene -*/ -void GLViewer_Widget::getPan( GLfloat& xPan, GLfloat& yPan, GLfloat& zPan ) -{ - xPan = myXPan; - yPan = myYPan; - zPan = myZPan; -} - -/*! - A function for installing the offset parameters of Window in OpenGL global scene -*/ -void GLViewer_Widget::setPan( GLfloat xPan, GLfloat yPan, GLfloat zPan ) -{ - myXPan = xPan; - myYPan = yPan; - myZPan = zPan; -} - -/*! - \return scales on OpenGL scene along 3 directions in 2d scene zScale = 1.0 -*/ -void GLViewer_Widget::getScale( GLfloat& xScale, GLfloat& yScale, GLfloat& zScale ) -{ - xScale = myXScale; - yScale = myYScale; - zScale = myZScale; -} - -/*! - A function for installing the scales of OpenGL scene -*/ -void GLViewer_Widget::setScale( GLfloat xScale, GLfloat yScale, GLfloat zScale ) -{ - if ( xScale > 0 && yScale > 0 && zScale > 0 ) - { - myXScale = xScale; - myYScale = yScale; - myZScale = zScale; - } -} - -/*! - \return start point of curren rotation of Window in OpenGL global scene -*/ -void GLViewer_Widget::getRotationStart( GLfloat& rotationStartX, - GLfloat& rotationStartY, - GLfloat& rotationStartZ ) -{ - rotationStartX = myRotationStartX; - rotationStartY = myRotationStartY; - rotationStartZ = myRotationStartZ; -} - -/*! - A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D) -*/ -void GLViewer_Widget::setRotationStart( GLfloat rotationStartX, - GLfloat rotationStartY, - GLfloat rotationStartZ ) -{ - myRotationStartX = rotationStartX; - myRotationStartY = rotationStartY; - myRotationStartZ = rotationStartZ; -} - -/*! - \return parameters of rotation - \param rotationAngle - angle - \param rotationCenterX - center x - \param rotationCenterY - center y - \param rotationCenterZ - center z -*/ -void GLViewer_Widget::getRotation( GLfloat& rotationAngle, - GLfloat& rotationCenterX, - GLfloat& rotationCenterY, - GLfloat& rotationCenterZ ) -{ - rotationAngle = myRotationAngle; - rotationCenterX = myRotationCenterX; - rotationCenterY = myRotationCenterY; - rotationCenterZ = myRotationCenterZ; -} - -/*! - Sets parameters of rotation - \param rotationAngle - angle - \param rotationCenterX - center x - \param rotationCenterY - center y - \param rotationCenterZ - center z -*/ -void GLViewer_Widget::setRotation( GLfloat rotationAngle, - GLfloat rotationCenterX, - GLfloat rotationCenterY, - GLfloat rotationCenterZ ) -{ - myRotationAngle = rotationAngle; - myRotationCenterX = rotationCenterX; - myRotationCenterY = rotationCenterY; - myRotationCenterZ = rotationCenterZ; -} - - -/*! - Sets image as background - \param filename - name of file -*/ -void GLViewer_Widget::setBackground( QString filename ) -{ - - //get image - QImage buf; - if ( !filename.isEmpty() && buf.load( filename ) ) - { // Load first image from file - isLoadBackground = true; - myBackgroundFile = filename; - - myIW = buf.width(); - myIH = buf.height(); - - myBackgroundSize = 64; - while( myBackgroundSize < myIW || myBackgroundSize < myIH) - myBackgroundSize = myBackgroundSize * 2; - - GLubyte* pixels = new GLubyte[myBackgroundSize * myBackgroundSize * 4]; - - for( int i = 0; i < myBackgroundSize; i++ ) - { - for( int j = 0; j < myBackgroundSize; j++ ) - { - if( j < myIW && i < myIH ) - { - pixels[i * myBackgroundSize * 4 + j * 4] = (GLubyte)qRed( buf.pixel(j,myIH - i - 1) ); - pixels[i * myBackgroundSize * 4 + j * 4 + 1]= (GLubyte)qGreen( buf.pixel(j,myIH - i - 1) ); - pixels[i * myBackgroundSize * 4 + j * 4 + 2] = (GLubyte)qBlue( buf.pixel(j,myIH - i - 1) ); - } - else - { - pixels[i * myBackgroundSize * 4 + j * 4] = (GLubyte)0; - pixels[i * myBackgroundSize * 4 + j * 4 + 1] = (GLubyte)0; - pixels[i * myBackgroundSize * 4 + j * 4 + 2] = (GLubyte)0; - } - pixels[i * myBackgroundSize* 4 + j * 4 + 3] = (GLubyte)255; - } - } - - //initialize texture - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glGenTextures(1, &texName); - glBindTexture(GL_TEXTURE_2D, texName); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myBackgroundSize , myBackgroundSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, - pixels); - - delete[] pixels; - } -} - -/*! - Adds tooltip - \param theString - tooltip text - \param theRect - tooltip rectangle -*/ -void GLViewer_Widget::addToolTip( QString theString, QRect theRect ) -{ - myToolTipRect = theRect; - QToolTip::add( this, myToolTipRect, theString ); -} - -/*! - Removes tooltip -*/ -void GLViewer_Widget::removeToolTip() -{ - QToolTip::remove( this, myToolTipRect ); -} - -/*! - Initialization (redefined virtual from QGLWidget) -*/ -void GLViewer_Widget::initializeGL() -{ - setAutoBufferSwap( true ); - - glShadeModel(GL_FLAT); - - //get image - QImage buf; - QString aPicturePath = getenv("GLViewer__Background_Picture"); - - if ( !aPicturePath.isEmpty() && buf.load( aPicturePath ) ) - { // Load first image from file - isLoadBackground = true; - setBackground( aPicturePath ); - - } - - else - isLoadBackground = false; -} - -/*! - Paints content -*/ -void GLViewer_Widget::paintGL() -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - - glRotatef( myRotationAngle, myRotationCenterX, myRotationCenterY, myRotationCenterZ ); - glScalef( myXScale, myYScale, myZScale ); - glTranslatef( myXPan, myYPan, myZPan ); - - if( isLoadBackground ) - { - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); - glBindTexture(GL_TEXTURE_2D, texName); - glBegin(GL_QUADS); - - glTexCoord2f( 0.0, 0.0); glVertex3f( -myIW/2, -myIH/2, 0.0); - glTexCoord2f( 0.0, (float)myIH/myBackgroundSize ); glVertex3f( -myIW/2, myIH/2, 0.0); - glTexCoord2f( (float)myIW/myBackgroundSize, (float)myIH/myBackgroundSize ); glVertex3f( myIW/2, myIH/2, 0.0); - glTexCoord2f( (float)myIW/myBackgroundSize, 0.0); glVertex3f( myIW/2, -myIH/2, 0.0); - - glEnd(); - glFlush(); - glDisable(GL_TEXTURE_2D); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } - - - GLViewer_Grid* grid = myViewPort->getGrid(); - if( grid ) - grid->draw(); - - GLViewer_Viewer2d* v = ( GLViewer_Viewer2d* )getViewPort()->getViewFrame()->getViewer(); - if( !isExportMode ) - v->updateDrawers( GL_FALSE, myXScale, myYScale ); - else - v->repaintView( getViewPort()->getViewFrame() ); -} - -/*! - Resets OpenGl parameters after resize - \param w - new width - \param h - new height -*/ -void GLViewer_Widget::resizeGL( int w, int h ) -{ - - if( h < 1 ) h = 1; - if( w < 1 ) w = 1; - glViewport( 0, 0, w, h); - - if( myStart ) - { - myWidth = w; - myHeight = h; - myStart = GL_FALSE; - } - - myViewPort->initResize( w, h ); - - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - GLfloat w_c = w / 2., h_c = h / 2.; - - gluOrtho2D( -w_c, w_c, -h_c, h_c ); - - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - -/*! - Provides repaint in export mode -*/ -void GLViewer_Widget::exportRepaint() -{ - isExportMode = true; - - paintGL(); - - isExportMode = false; -} - -/*! - Custom paint event handler -*/ -void GLViewer_Widget::paintEvent( QPaintEvent* e ) -{ - QApplication::sendEvent( myViewPort, e ); -} - -/*! - Custom mouse move event handler -*/ -void GLViewer_Widget::mouseMoveEvent( QMouseEvent* e ) -{ - QApplication::sendEvent( myViewPort, e ); -} - -/*! - Custom mouse press event handler -*/ -void GLViewer_Widget::mousePressEvent( QMouseEvent* e ) -{ - QApplication::sendEvent( myViewPort, e ); -} - -/*! - Custom mouse release event handler -*/ -void GLViewer_Widget::mouseReleaseEvent( QMouseEvent* e ) -{ - QApplication::sendEvent( myViewPort, e ); -} - -/*! - Custom enter event handler -*/ -void GLViewer_Widget::enterEvent( QEvent* e ) -{ - updateGL(); -} - -/*! - Custom leave event handler -*/ -void GLViewer_Widget::leaveEvent( QEvent* e ) -{ - updateGL(); -} - - -/*! - \return the hex code of digit < 16 - \param c - digit -*/ -inline char hex( uchar c ) -{ - if( c<=9 ) - return '0'+c; - else if( c < 16 ) - return 'a' + c - 10; - - return ' '; -} - -/*! - Translates part of image inside rectangle from w1 to w2 and from h2 to h1 to PS format - \param hFile - PostScript file - \param image - image to be tarnslated - \param w1 - x start position - \param w2 - x end position - \param h1 - y start position - \param h2 - y end position - \param aViewerCS - viewer co-ordinate system - \param aPSCS - paper co-ordinate system - \param a - \param b - \param c - \param d - \param dw - \param dh -*/ -void AddImagePart( QFile& hFile, QImage& image, int w1, int w2, int h1, int h2, - GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS, - double a, double b, double c, double d, double dw, double dh ) -{ - if( aViewerCS && aPSCS ) - { - double width = w2-w1+1, height = h2-h1+1; - QString aBuffer = "", temp = "%1 %2 8 [ %3 %4 %5 %6 %7 %8 ]\n"; - aBuffer += temp.arg( width ).arg( height ). - arg( a ).arg( b ).arg( c ).arg( d ). - arg( dw ).arg( dh ); - aBuffer += "<\n"; - - char line[81]; line[80] = '\0'; int cur_index = 0; - int full = 0; - for( int i=h2; i>=h1; i-- ) - { - uchar* theCurLine = image.scanLine( i ), cur; - for( int j=w1; j<=w2; j++ ) - for( int k=0; k<3; k++ ) - { - cur = *(theCurLine+4*j+2-k); - *(line+cur_index) = hex( cur/16 ); //HI - *(line+cur_index+1) = hex( cur%16 ); //LO - full++; - cur_index+=2; - if( cur_index>=80 ) - { - aBuffer += line; - aBuffer += "\n"; - cur_index = 0; - } - } - } - - aBuffer += "> false 3 colorimage\n\n"; - - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); - } -} - -/*! - \return background rectangle in viewer CS -*/ -void GLViewer_Widget::getBackgroundRectInViewerCS( double& left, double& top, double& right, double& bottom ) -{ - left = -myIW/2; right = myIW/2; - top = myIH/2; bottom = -myIH/2; -} - -/*! - Translates background to PostScript - \param hFile - PostScript file - \param aViewerCS - viewer co-ordinate system - \param aPSCS - paper co-ordinate system -*/ -void GLViewer_Widget::translateBackgroundToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ) -{ - QImage buf; - - if( aViewerCS && aPSCS && isLoadBackground && buf.load( myBackgroundFile ) ) - { - double a, b, c, d, dx, dy; //The preparation of transformation matrix - - double width = buf.width(), height = buf.height(); - - double left, top, right, bottom; - getBackgroundRectInViewerCS( left, top, right, bottom ); - - double aax = left, aay = bottom, - bbx = right, bby = bottom, - ccx = left, ccy = top; - - aViewerCS->transform( *aPSCS, aax, aay ); - aViewerCS->transform( *aPSCS, bbx, bby ); - aViewerCS->transform( *aPSCS, ccx, ccy ); - - a = ( bbx - aax ) / width; - b = ( ccx - aax ) / height; - c = ( bby - aay ) / width; - d = ( ccy - aay ) / height; - - //Now we must find invert matrix - double det = a*d-b*c, - newa = d/det, - newb = -c/det, - newc = -b/det, - newd = a/det; - - a = newa; b = newb; c = newc; d = newd; - - dx = -(a*aax+c*aay); - dy = -(b*aax+d*aay); //according to PS specification of coordinate transformation - - const int max = 133000; //The maximum length of string in PS - int dh = int( floor( double( max ) / ( 3.0*2.0*width ) ) ); - for( int k=buf.height()-1; k>=0; k-=dh ) - AddImagePart( hFile, buf, 0, buf.width()-1, QMAX( k-dh+1, 0 ), k, - aViewerCS, aPSCS, a, b, c, d, dx, dy-(buf.height()-1-k) ); - } -} - -/*! - Translates image line with one color depth to line with other depth -*/ -void DecodeScanLine( int width, uchar* dest, int dest_depth, uchar* source, int source_depth ) -{ -#ifndef WIN32 -typedef unsigned int WORD; -#endif - - int aSize = width*dest_depth, - dw = aSize % 8; - - if( dw ) - aSize+=dw; - - if( dest_depth==source_depth ) - memcpy( dest, source, aSize/8 ); - else - { - double r, g, b; WORD color; - for( int i=0; i> 5 ) / 63.0; - r = double( ( color & 0xF800 ) >> 11 ) / 31.0; - break; - case 24: - b = double( *(source + 3*i) ) / 255.0; - g = double( *(source + 3*i+1) ) / 255.0; - r = double( *(source + 3*i+2) ) / 255.0; - break; - case 32: - b = double( *(source + 4*i) ) / 255.0; - g = double( *(source + 4*i+1) ) / 255.0; - r = double( *(source + 4*i+2) ) / 255.0; - break; - } - switch( dest_depth ) - { - case 16: - color = WORD(b*31.0); - color += (WORD(g*63.0)<<5); - color += (WORD(r*31.0)<<11); - memcpy( dest + 2*i, &color, 2 ); - break; - case 24: - *( dest + 3*i ) = (uchar)(255*b); - *( dest + 3*i+1 ) = (uchar)(255*g); - *( dest + 3*i+2 ) = (uchar)(255*r); - break; - case 32: - *( dest + 4*i ) = (uchar)(255*b); - *( dest + 4*i+1 ) = (uchar)(255*g); - *( dest + 4*i+2 ) = (uchar)(255*r); - *( dest + 4*i+3 ) = 0; - break; - } - } - } -} - -#ifdef WIN32 -/*! - Translates background to EMF - \param dc - descriptor of EMF - \param aViewerCS - viewer co-ordinate system - \param aPSCS - paper co-ordinate system -*/ -void GLViewer_Widget::translateBackgroundToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ) -{ - QImage buf; - - if( aViewerCS && aEMFCS && isLoadBackground && buf.load( myBackgroundFile ) ) - { - double left, top, right, bottom; - getBackgroundRectInViewerCS( left, top, right, bottom ); - - double aRot = aViewerCS->getRotation(); - - double lx = left, ly = top; - aViewerCS->transform( *aEMFCS, lx, ly ); - - aViewerCS->setRotation( 0.0 ); //we switch off the rotation of CS - - aViewerCS->transform( *aEMFCS, left, top ); - aViewerCS->transform( *aEMFCS, right, bottom ); - - int w = buf.width(), - h = buf.height(); - - HDC aScrDC = GetDC( 0 ); - HDC aCompDC = CreateCompatibleDC( aScrDC ); - HBITMAP aBMP = CreateCompatibleBitmap( aScrDC, w, h ); - - BITMAP aBitInfo; - GetObject ( aBMP, sizeof(BITMAP), &aBitInfo ); - int depth = aBitInfo.bmBitsPixel; //how many bits represent a color of one pixel - - int aLineSize = w*depth; - int dw = aLineSize % 32; //scanline word aligning - - if( dw ) - aLineSize += 32-dw; - - aLineSize /= 8; - - BYTE* bits = new BYTE[aLineSize*h]; - memset( bits, 0, aLineSize*h ); - uchar* aLine = NULL; - - for( int i=0; i(lx,ly) - - aRotTrans.eDy = ly -(b*left+d*top); //the real image of left-top corner of picture - - SetWorldTransform( dc, &aRotTrans ); - int res = StretchBlt( dc, left, top, right-left, bottom-top, aCompDC, 0, 0, w, h, SRCCOPY ); - SetWorldTransform( dc, &aTrans ); - - SelectObject( aCompDC, old ); - - ReleaseDC( 0, aScrDC ); - DeleteDC( aCompDC ); - DeleteObject( aBMP ); - delete[] bits; - - aViewerCS->setRotation( aRot ); - } -} -#endif diff --git a/src/GLViewer/GLViewer_Widget.h b/src/GLViewer/GLViewer_Widget.h deleted file mode 100644 index 637beb5fb..000000000 --- a/src/GLViewer/GLViewer_Widget.h +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// Author : OPEN CASCADE -// - -// File: GLViewer_Widget.h -// Created: November, 2004 - -#ifndef GLVIEWER_WIDGET_H -#define GLVIEWER_WIDGET_H - -#include "GLViewer.h" - -#include -#include - -class GLViewer_ViewPort2d; -class GLViewer_CoordSystem; - -/*! - \class GLViewer_Widget - Widget for visualization of OpenGL scene -*/ -class GLVIEWER_API GLViewer_Widget : public QGLWidget -{ - Q_OBJECT - -public: - //! A constructor - /*! Parameters using for QOGLWidget as is - */ - GLViewer_Widget( QWidget* theParent, const char* theName = 0 ); - - //! A destructor - ~GLViewer_Widget(); - - //! Returns parent GLViewer_ViewPort2d - /*! ViewPort2d because this class is not use for 3D Viewer */ - GLViewer_ViewPort2d* getViewPort() const { return myViewPort; } - //! Returns width of OpenGl Window - GLint getWidth() const { return myWidth; } - //! Returns height of OpenGl Window - GLint getHeight() const { return myHeight; } - - //! Returns scales on OpenGL scene along 3 directions - /*! in 2d scene zScale = 1.0 */ - void getScale( GLfloat& xScale, - GLfloat& yScale, - GLfloat& zScale ); - //! A function for installing the scales of OpenGL scene - void setScale( GLfloat xScale, - GLfloat yScale, - GLfloat zScaleGLfloat ); - - //! Returns offset parameters of Window in OpenGL global scene - void getPan( GLfloat& xPan, GLfloat& yPan, GLfloat& zPan ); - //! A function for installing the offset parameters of Window in OpenGL global scene - void setPan( GLfloat xPan, GLfloat yPan, GLfloat zPan ); - - //! Returns rotation angle of Window in OpenGL global scene in degree - /*! Only in 2D */ - GLfloat getRotationAngle() const { return myRotationAnglePrev; } - //! A function for installing the rotation angle of Window in OpenGL global scene in degree - /*! Only in 2D */ - void setRotationAngle( GLfloat a ) { myRotationAnglePrev = a; } - - //! Returns start point of curren rotation of Window in OpenGL global scene - void getRotationStart( GLfloat& rotationStartX, - GLfloat& rotationStartY, - GLfloat& rotationStartZ ); - //! A function for installing the start point of curren rotation of Window in OpenGL global scene - void setRotationStart( GLfloat rotationStartX, - GLfloat rotationStartY, - GLfloat rotationStartZ ); - //! Returns parameters of current rotation - void getRotation( GLfloat& rotationAngle, - GLfloat& rotationCenterX, - GLfloat& rotationCenterY, - GLfloat& rotationCenterZ ); - //! A function for installing the parameters of current rotation - void setRotation( GLfloat, GLfloat, GLfloat, GLfloat ); - - //! A function load picture from file with name theFileName and post it in center of global OpenGL scene - void setBackground( QString theFileName ); - - //! A function add the tool tip with text theTTText on theTTRect rect to the widget window - void addToolTip( QString theTTText, QRect theTTRect ); - //! A function remove tool tip form widget window - void removeToolTip(); - - //! A function translate background of window in to PostScript file on disk - /*! - *\param hFile the name of PostScript file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aPSCS the GLViewer_CoordSystem of PostScript page - */ - virtual void translateBackgroundToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS ); - - //! A function repaints OpenGL scene in export mode - /* Repaints all objects in only current view */ - void exportRepaint(); - -#ifdef WIN32 - //! A function translate background of window in to EMF file on disk - //! - /*! - *\warning WIN32 only - * - *\param dc the name of HDC associated with file chosen by user - *\param aViewerCS the GLViewer_CoordSystem of window - *\param aEMFCS the GLViewer_CoordSystem of EMF page - */ - virtual void translateBackgroundToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS ); -#endif - -private: - //! Auxiliary function. Returns rect of window background in viewer coordinate system - void getBackgroundRectInViewerCS( double& left, double& top, double& right, double& bottom ); - -protected: - /* Redefined QT methods */ - //! A function is called before first display of window (create OpenGL scene) - virtual void initializeGL(); - //! A function is called in earch paint event of window - /* Calling by public method repaint() */ - virtual void paintGL(); - //! A function is called in earch resize event of window - virtual void resizeGL( int, int ); - - - virtual void paintEvent( QPaintEvent* ); - virtual void mouseMoveEvent( QMouseEvent* ); - virtual void mousePressEvent( QMouseEvent* ); - virtual void mouseReleaseEvent( QMouseEvent* ); - - /* Needs to redefine because Window must be updated highlight presentation when mouse enter window */ - virtual void enterEvent( QEvent* ); - /* Needs to redefine because Window must be updated highlight presentation when mouse leave window */ - virtual void leaveEvent( QEvent* ); - -private: - //! width of window - GLint myWidth; - //! height of window - GLint myHeight; - - //! Scale along X direction - GLfloat myXScale; - //! Scale along Y direction - GLfloat myYScale; - //! Scale along Z direction - /* equals 1 in 2D */ - GLfloat myZScale; - - //! Window offset along X direction - GLfloat myXPan; - //! Window offset along Y direction - GLfloat myYPan; - //! Window offset along Z direction - /* equals 0 in 2D */ - GLfloat myZPan; - - GLfloat myRotationStartX; - GLfloat myRotationStartY; - GLfloat myRotationStartZ; - GLfloat myRotationAngle; - GLfloat myRotationCenterX; - GLfloat myRotationCenterY; - GLfloat myRotationCenterZ; - GLfloat myRotationAnglePrev; - - GLboolean myStart; - GLViewer_ViewPort2d* myViewPort; - - //! True if background is loaded - bool isLoadBackground; - //! File name of background image - QString myBackgroundFile; - //! Texture id of loaded background image - GLuint texName; - //! Width of background image - int myIW; - //! Height of background image - int myIH; - //! Size of background image - int myBackgroundSize; - - QRect myToolTipRect; - - //! Needs for export repaint - bool isExportMode; -}; - -#endif // GLVIEWER_WIDGET_H diff --git a/src/GLViewer/Makefile.in b/src/GLViewer/Makefile.in deleted file mode 100644 index 76869431a..000000000 --- a/src/GLViewer/Makefile.in +++ /dev/null @@ -1,121 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Vladimir Klyachin (OCN) -# Module : caf -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@srcdir@/resources - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= GLViewer.h \ - GLViewer_AspectLine.h \ - GLViewer_BaseDrawers.h \ - GLViewer_BaseObjects.h \ - GLViewer_Compass.h \ - GLViewer_Context.h \ - GLViewer_CoordSystem.h \ - GLViewer_Defs.h \ - GLViewer_Drawer.h \ - GLViewer_Geom.h \ - GLViewer_Grid.h \ - GLViewer_Group.h \ - GLViewer_MimeSource.h \ - GLViewer_Object.h \ - GLViewer_Selector.h \ - GLViewer_Selector2d.h \ - GLViewer_Text.h \ - GLViewer_Tools.h \ - GLViewer_ToolTip.h \ - GLViewer_ViewFrame.h \ - GLViewer_ViewManager.h \ - GLViewer_ViewPort.h \ - GLViewer_ViewPort2d.h \ - GLViewer_Viewer.h \ - GLViewer_Viewer2d.h \ - GLViewer_Widget.h - -# .po files to transform in .qm -PO_FILES = GLViewer_images.po \ - GLViewer_msg_en.po - -# Libraries targets -LIB = libGLViewer.la - -LIB_SRC= GLViewer_AspectLine.cxx \ - GLViewer_BaseDrawers.cxx \ - GLViewer_BaseObjects.cxx \ - GLViewer_Compass.cxx \ - GLViewer_Context.cxx \ - GLViewer_CoordSystem.cxx \ - GLViewer_Drawer.cxx \ - GLViewer_Geom.cxx \ - GLViewer_Grid.cxx \ - GLViewer_Group.cxx \ - GLViewer_MimeSource.cxx \ - GLViewer_Object.cxx \ - GLViewer_Selector.cxx \ - GLViewer_Selector2d.cxx \ - GLViewer_Text.cxx \ - GLViewer_Tools.cxx \ - GLViewer_ToolTip.cxx \ - GLViewer_ViewFrame.cxx \ - GLViewer_ViewManager.cxx \ - GLViewer_ViewPort.cxx \ - GLViewer_ViewPort2d.cxx \ - GLViewer_Viewer.cxx \ - GLViewer_Viewer2d.cxx \ - GLViewer_Widget.cxx - -LIB_MOC = GLViewer_Selector.h \ - GLViewer_Selector2d.h \ - GLViewer_ToolTip.h \ - GLViewer_ViewFrame.h \ - GLViewer_ViewManager.h \ - GLViewer_ViewPort.h \ - GLViewer_ViewPort2d.h \ - GLViewer_Viewer.h \ - GLViewer_Viewer2d.h \ - GLViewer_Widget.h - -RESOURCES_FILES = cursor_rotate.png \ - cursor_sketch.png \ - cursor_zoom.png \ - view_dump.png \ - view_fitall.png \ - view_fitarea.png \ - view_fitselect.png \ - view_glpan.png \ - view_pan.png \ - view_reset.png \ - view_zoom.png - -CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) - -LDFLAGS+=$(QT_MT_LIBS) $(CAS_KERNEL) - -LIBS+= -lsuit -L/usr/X11R6/lib@LIB_LOCATION_SUFFIX@ -lGLU - -@CONCLUDE@ diff --git a/src/GLViewer/resources/GLViewer_images.po b/src/GLViewer/resources/GLViewer_images.po deleted file mode 100644 index 256c03317..000000000 --- a/src/GLViewer/resources/GLViewer_images.po +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: GLViewer_images.po -// Created: 10/25/2004 12:46:36 PM -// Author: Sergey Anikin -// Copyright (C) CEA 2004 - -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 2005-05-05 10:17+0400\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ICON_GL_FITALL" -msgstr "view_fitall.png" - -msgid "ICON_GL_FITAREA" -msgstr "view_fitarea.png" - -msgid "ICON_GL_FITSELECT" -msgstr "view_fitselect.png" - -msgid "ICON_GL_GLOBALPAN" -msgstr "view_glpan.png" - -msgid "ICON_GL_PAN" -msgstr "view_pan.png" - -msgid "ICON_GL_RESET" -msgstr "view_reset.png" - -msgid "ICON_GL_ZOOM" -msgstr "view_zoom.png" - -msgid "ICON_GL_DUMP" -msgstr "view_dump.png" - -msgid "ICON_GL_CURSOR_ZOOM" -msgstr "cursor_zoom.png" - -msgid "ICON_GL_CURSOR_ROTATE" -msgstr "cursor_rotate.png" - -msgid "ICON_GL_CURSOR_SKETCH" -msgstr "cursor_sketch.png" diff --git a/src/GLViewer/resources/GLViewer_msg_en.po b/src/GLViewer/resources/GLViewer_msg_en.po deleted file mode 100644 index d97840831..000000000 --- a/src/GLViewer/resources/GLViewer_msg_en.po +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: GLViewer_msg_en.po -// Created: 10/25/2004 12:46:36 PM -// Author: Sergey Anikin -// Copyright (C) CEA 2004 - -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "LBL_TOOLBAR_LABEL" -msgstr "View Operations" - -msgid "DSC_RESET_VIEW" -msgstr "Reset View Point" - -msgid "MNU_RESET_VIEW" -msgstr "Reset" - -msgid "DSC_FITALL" -msgstr "Fit all objects inside the view frame" - -msgid "MNU_FITALL" -msgstr "Fit All" - -msgid "DSC_FITRECT" -msgstr "Fit area within the view frame" - -msgid "MNU_FITRECT" -msgstr "Fit Area" - -msgid "DSC_FITSELECT" -msgstr "Fit area of selection within the view frame" - -msgid "MNU_FITSELECT" -msgstr "Fit Selection" - -msgid "DSC_ZOOM_VIEW" -msgstr "Zoom the view" - -msgid "MNU_ZOOM_VIEW" -msgstr "Zoom" - -msgid "DSC_PAN_VIEW" -msgstr "Panning the view" - -msgid "MNU_PAN_VIEW" -msgstr "Panning" - -msgid "DSC_GLOBALPAN_VIEW" -msgstr "Selection of a new center of the view" - -msgid "MNU_GLOBALPAN_VIEW" -msgstr "Global Panning" - -msgid "DSC_DUMP_VIEW" -msgstr "Saves the active view in the image file" - -msgid "MNU_DUMP_VIEW" -msgstr "Dump" - -msgid "GL_IMAGE_FILES" -msgstr "Images Files (*.bmp *.png)" - -msgid "INF_APP_DUMP_VIEW" -msgstr "Dump view" - -msgid "ERR_DOC_CANT_SAVE_FILE" -msgstr "Cannot save file" - -msgid "ERROR" -msgstr "Error" - -msgid "CHANGE_BGCOLOR" -msgstr "Change background..." - -msgid "GLViewer_ViewFrame::DUMP_VIEW_SAVE_FILE_DLG_CAPTION" -msgstr "Save Dump View in file" - -msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_CAPTION" -msgstr "Error" - -msgid "GLViewer_ViewFrame::DUMP_VIEW_ERROR_DLG_TEXT" -msgstr "Can't save Dump View in file" - -msgid "GLViewer_ViewManager::GL_VIEW_TITLE" -msgstr "GL Scene:%M - viewer:%V" diff --git a/src/GLViewer/resources/cursor_rotate.png b/src/GLViewer/resources/cursor_rotate.png deleted file mode 100755 index a3cb0c1ecc31ed66595b4387c55dd2731809a5e1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 291 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH%)r1{DZJ<-ki!|^6XJT{zyToh|NsBJ3q{m` zEXI-`zhDN3XE)M7oFs2|7lsa2Sq~sbti&~FS$q5M)5)u*~FeEXuNpvI#I2A}-X}F}rqr=I=%gfWlk;uj_@bD7j z6|DtF4jh=G!12UL&ENr>PlD1KMh`VE4Ti0yjJ+8Jj78ER4MKcUJUm)LTnfPsZpKOG zEV4cgmtt0nIY{(yPjhvQn8U-#ZQ{ry%Esx*uHnq2v$d(wm(@i-H9286!$zGf)iWM5 eQ+5h#~Zei#`hDW!d{qzoT09t(A+S%@5$1>k6; zb# zo2behy5}(Clz~nqzAEwS~Qouyq_X=hOOA@?L&Tay4KX40} z>iw?;oV~7&LqCsj0a5q_hyvh^CBWV}sPx#07*qoM6N<$g4hjg*8l(j diff --git a/src/GLViewer/resources/cursor_zoom.png b/src/GLViewer/resources/cursor_zoom.png deleted file mode 100755 index 0020fea39f8531230eb0c25c662b76ee98f696bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnH3?%tPCZz)@&H$ef*9{vs0Ga>)|F^Z8<^g0e zmIV0)GdMiEkp|?5mAFQf1m~xflqVLYGNfmw85QKED;Vh+=o#9^?aKhFU`h9MOJ`zW zkPLd4!Up7Lc)B=-RLn_EP!KOz+h7#dX4;UsjI)PRK$4w})1Y}W<0Lc-a$k!M*zN28VxpF`U#yCAY@F9!>Q{yu)SmYHks0PSS(boFyt=akR{08E}qwEzGB diff --git a/src/GLViewer/resources/view_dump.png b/src/GLViewer/resources/view_dump.png deleted file mode 100644 index 8eb63e09be9919e21d4c8e54482127881dfb5d29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 518 zcmV+h0{Q)kP)4z!7>1uK9(3SAf^^7GunHcs^$cDz)_6(iV({WI4*3It{)u>Xhxj~ti8*H|$zqZ} z5J<)wJji1p0cj{igW)BkJ?%Pv>zOQKhAcmy9|Z{bV&nXriRhkD0mYv?#0>V_!1=*0M=P_N#mTuI*XDD zDJ5oVP*Txqwy4!>IlS;^hIEpWoQ?8%zZa8EQd-RxU+cAeeKbrM3F&eEM51X zf!*F5=A6Sm*rh$|?7AbXz(%uynHuhH?od+YZ|a=GOiey?NmGd`E5Nmlot!6`eYB*L zH19X9_1cPr5NvO4BjpB{0YpI%7DIN*JLpduKl6C+=WZ6B9R&zQh$uddSAl=4-#bmH8`<`*2LJ#707*qo IM6N<$g7~BA;{X5v diff --git a/src/GLViewer/resources/view_fitall.png b/src/GLViewer/resources/view_fitall.png deleted file mode 100644 index c09ff94ad89b32483194de03275ece8844f985da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 523 zcmV+m0`&cfP)?PhR9q@fLZN1A`}f&DKuL#6x)fXr>83)#*`Z*DLNWx> zd|z|PU49gYeyKLzz5C?*-n~1GV)|F<_=+jVYW#P)ifeUwvJ$3M?|BI41;baV+C4ze+DhUx>sE#&ay0uli=5tOXJB{D>+os zPG2L#Hrow9Q?}fM{aIbH-4~bqZ$E<>xz@hl54Sx7r~Sb&L^0gNRz zG{hy9;RtH!{S%7=zT0gpVE|wuBsci%&gSzh zE{P0?$>*iRN2v;ihL$e@S@}&<077^hYA7y(Q(+3QD4a`?)?ctH{QyT@0vIgdd#3;Z N002ovPDHLkV1fY3?PhRGdP)2p#HH|33Q%C|O!E6r^~zZh;0?@J zRznD>ih9>Q3RZzetkEITfui?_;cyGVW%sH}v&R{K!#xzoF`uaimYT!$I%KZWv|ZOV z%EEO`wU76_ZgeP}98bo16C};iWJH(%0EV|iWA9{_QFuVB%Eu|IY4j11>$v5gQZa{F z1nKO)cew+pRat1-_G`=amaZ2LD=-vTU~nMovH&X!X&1l>OhyJU>9*7o;uP(oc08j7 z@B~b{?6zEE{;KY9uZ@(|O6evTZV1K(G6p=2X^jN^%3VgvOUhyMr#bycT8p3KYh^rF z;cLiWNLwBPI75B-nQDT{(??YMeDb}NwElus^$S4h`^wgq1%Utn002ovPDHLkV1kOB B=B@w$ diff --git a/src/GLViewer/resources/view_fitselect.png b/src/GLViewer/resources/view_fitselect.png deleted file mode 100755 index 7ff3e0a62ca7db8d8712a19dbc5dade1281dd369..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 808 zcmV+@1K0eCP)004R=004l4008;_004mK004C`008P>0026d000+nm#LZ50008B zNkl#>_Q{}^3I1ZAK->@uy8O4 z@CYz)@Nh5)iU=|+UA7dg4kXXU#`Y4ZKLx}G2q5e(1Okw2v^2F)ya@|K5CC}<23D?I zDf0Wr@7cn;g=Yf<5Kb3@yaNK~PM-rC4stCB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9!axJ^Vwa`{r2tbtilO`F^_O#g7HP z_B3_F@rPq(UuLZR8Xyit3~h zU1AGWRdk~rSVXXe?Q(Vk%S(q84?pNv-1`04&K|DrR}2`SnLdjBen4wG*G5%obh{EM z)&bigv~oXvK1qi3?SbT*>jmC>R`)9)-YB``NGAUW6cMBl1`KF)`@^?8mSVpEcL1+S TU5X{h00000NkvXXu0mjf?E%y8 diff --git a/src/GLViewer/resources/view_zoom.png b/src/GLViewer/resources/view_zoom.png deleted file mode 100644 index b46573914ded57ddbdbd0fdfdeca02dbe772beca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 488 zcmVP)R=vXa|KZLWj83QE`$^LZRkww0}TLmX=HfmqNPPq2N*whk_Xj$snY8 zUUSLanZyo0AYSg{$NTZzS(MUQb#Y!Ck$rN9RgpuQ&7K0LR35Y_KajzeZ%c~fn35!+ zWS{V~XL+grjmQ&lviz zrUWkmMZZx26Skmst4*RMsB_t&#p8naVLf;aiacwZf@lWrK%dKN2q9Ie-gS@sXFtVU zZG=b%3g1J9BU%VicCWhR%{~4`^iUK-WrPMyS_UwdVrYm{w9DF|VMn%Uf-$7!u&MEb!2y^*cm)hs zP^%%#DetTaV}N~#Mm7VmvRVhLRd%@w21A=K3xrpyc%8_&%Lse(z0s~!6HJZF=<I eF4Jm)Rp}3mY2qUGWh$%y0000 -#include - -#include -#include -#include -#include - -/*!Constructor.*/ -LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent ) -: QtxDialog( parent, "salome_about_dialog", true, false, None ) -{ - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - - QPixmap ico = resMgr->loadPixmap( "LightApp", tr( "ICO_ABOUT" ), false ); - if ( !ico.isNull() ) - setIcon( ico ); - - QPalette pal = palette(); - QColorGroup cg = pal.active(); - cg.setColor( QColorGroup::Foreground, Qt::darkBlue ); - cg.setColor( QColorGroup::Background, Qt::white ); - pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg ); - setPalette(pal); - - QVBoxLayout* main = new QVBoxLayout( mainFrame() ); - QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() ); - base->setFrameStyle( QFrame::NoFrame ); - base->setInsideMargin( 0 ); - main->addWidget( base ); - - QLabel* screen = new QLabel( base ); - screen->setScaledContents( true ); - screen->setAlignment( Qt::AlignCenter ); - screen->setFrameStyle( QFrame::Box | QFrame::Plain ); - - QLabel* title = new QLabel( base ); - title->setAlignment( Qt::AlignCenter ); - changeFont( title, true, false, false, 5 ); - - QLabel* version = new QLabel( base ); - version->setAlignment( Qt::AlignCenter ); - changeFont( version, false, true, false, 2 ); - - QLabel* copyright = new QLabel( base ); - copyright->setAlignment( Qt::AlignCenter ); - changeFont( copyright, false, false, false, 1 ); - - QLabel* license = new QLabel( base ); - license->setAlignment( Qt::AlignCenter ); - changeFont( license, false, false, false, 1 ); - - screen->setPixmap( resMgr->loadPixmap( "LightApp", tr( "ABOUT" ), false ) ); - checkLabel( screen ); - - QString titleText = tr( "ABOUT_TITLE" ); - if ( titleText == "ABOUT_TITLE" ) - titleText = defName; - title->setText( titleText ); - checkLabel( title ); - - QString verText = tr( "ABOUT_VERSION" ); - if ( verText.contains( "%1" ) ) - verText = verText.arg( defVer ); - version->setText( verText ); - checkLabel( version ); - - copyright->setText( tr( "ABOUT_COPYRIGHT" ) ); - checkLabel( copyright ); - - license->setText( tr( "ABOUT_LICENSE" ) ); - checkLabel( license ); - - QString capText = tr( "ABOUT_CAPTION" ); - if ( capText.contains( "%1" ) ) - capText = capText.arg( defName ); - setCaption( capText ); - - setSizeGripEnabled( false ); -} - -/*!Destructor.*/ -LightApp_AboutDlg::~LightApp_AboutDlg() -{ - //! Do nothing. -} - -/*!On mouse press event.*/ -void LightApp_AboutDlg::mousePressEvent( QMouseEvent* ) -{ - accept(); -} - -/*!Change font of widget \a wid. - *\param wid - QWidget - *\param bold - boolean value - *\param italic - boolean value - *\param underline - boolean value - *\param inc - integer increment for font point size. - */ -void LightApp_AboutDlg::changeFont( QWidget* wid, const bool bold, const bool italic, - const bool underline, const int inc ) const -{ - if ( !wid ) - return; - - QFont widFont = wid->font(); - widFont.setBold( bold ); - widFont.setItalic( italic ); - widFont.setUnderline( underline ); - widFont.setPointSize( widFont.pointSize() + inc ); -} - -/*!Check lable \a lab.*/ -void LightApp_AboutDlg::checkLabel( QLabel* lab ) const -{ - if ( !lab ) - return; - - bool vis = !lab->text().stripWhiteSpace().isEmpty() || - ( lab->pixmap() && !lab->pixmap()->isNull() ); - vis ? lab->show() : lab->hide(); -} diff --git a/src/LightApp/LightApp_AboutDlg.h b/src/LightApp/LightApp_AboutDlg.h deleted file mode 100644 index 8fb3b97f2..000000000 --- a/src/LightApp/LightApp_AboutDlg.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_AboutDlg.h -// Created: 03.06.2005 13:49:25 -// Author: Sergey TELKOV -// Copyright (C) CEA 2005 - -#ifndef LIGHTAPP_ABOUTDLG_H -#define LIGHTAPP_ABOUTDLG_H - -#include "LightApp.h" - -#include - -class QLabel; - -/*! - \class LightApp_AboutDlg - LightApp help about dialog -*/ -class LIGHTAPP_EXPORT LightApp_AboutDlg : public QtxDialog -{ - Q_OBJECT - -public: - LightApp_AboutDlg( const QString&, const QString&, QWidget* = 0 ); - virtual ~LightApp_AboutDlg(); - -protected: - virtual void mousePressEvent( QMouseEvent* ); - -private: - void checkLabel( QLabel* ) const; - void changeFont( QWidget*, const bool = false, const bool = false, - const bool = false, const int = 0 ) const; -}; - -#endif diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx deleted file mode 100644 index 8bee87a7e..000000000 --- a/src/LightApp/LightApp_Application.cxx +++ /dev/null @@ -1,2505 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Application.cxx -// Created: 6/20/2005 18:39:45 PM -// Author: Natalia Donis -// Copyright (C) CEA 2005 - -#ifndef DISABLE_PYCONSOLE - #include "PythonConsole_PyInterp.h" // WARNING! This include must be the first! - #include -#endif - -#include "LightApp_Application.h" -#include "LightApp_WidgetContainer.h" -#include "LightApp_Module.h" -#include "LightApp_DataModel.h" -#include "LightApp_Study.h" -#include "LightApp_Preferences.h" -#include "LightApp_PreferencesDlg.h" -#include "LightApp_ModuleDlg.h" -#include "LightApp_AboutDlg.h" - -#include "LightApp_OBFilter.h" - -#include "LightApp_EventFilter.h" - -#include "LightApp_OBSelector.h" -#include "LightApp_SelectionMgr.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#ifndef DISABLE_GLVIEWER - #include - #include - #include "LightApp_GLSelector.h" -#endif - -#ifndef DISABLE_PLOT2DVIEWER - #include - #include -#ifndef DISABLE_SALOMEOBJECT - #include -#else - #include -#endif -#endif - -#ifndef DISABLE_OCCVIEWER - #include -#ifndef DISABLE_SALOMEOBJECT - #include -#else - #include -#endif - #include "LightApp_OCCSelector.h" -#endif - -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT - #include - #include - #include "LightApp_VTKSelector.h" -#else - #include - #include -#endif - #include -#endif - -//#ifndef DISABLE_SUPERVGRAPHVIEWER -// #include -// #include -// #include -//#endif - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define FIRST_HELP_ID 1000000 - -#ifndef DISABLE_SALOMEOBJECT - #include "SALOME_InteractiveObject.hxx" - #include "SALOME_ListIO.hxx" -#endif - -static const char* imageEmptyIcon[] = { -"20 20 1 1", -". c None", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"....................", -"...................."}; - -int LightApp_Application::lastStudyId = 0; - -/*! - \return last global id of study -*/ -int LightApp_Application::studyId() -{ - return LightApp_Application::lastStudyId; -} - -/*!Create new instance of LightApp_Application.*/ -extern "C" LIGHTAPP_EXPORT SUIT_Application* createApplication() -{ - return new LightApp_Application(); -} - -/*! \var global preferences of LightApp */ -LightApp_Preferences* LightApp_Application::_prefs_ = 0; - -/*! - \class LightApp_Application - Application containing LightApp module -*/ - -/*!Constructor.*/ -LightApp_Application::LightApp_Application() -: CAM_Application( false ), -myPrefs( 0 ) -{ - STD_TabDesktop* desk = new STD_TabDesktop(); - - setDesktop( desk ); - - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QPixmap aLogo = aResMgr->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false ); - - desktop()->setIcon( aLogo ); - desktop()->setDockableMenuBar( true ); - desktop()->setDockableStatusBar( false ); - - // base logo (salome itself) - desktop()->addLogo( "_app_base", aResMgr->loadPixmap( "LightApp", tr( "APP_BASE_LOGO" ), false ) ); - // extra logo (salome-based application) - desktop()->addLogo( "_app_extra", aResMgr->loadPixmap( "LightApp", tr( "APP_EXTRA_LOGO" ), false ) ); - - clearViewManagers(); - - mySelMgr = new LightApp_SelectionMgr( this ); - - myAccel = SUIT_Accel::getAccel(); - -#ifndef DISABLE_OCCVIEWER - myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, OCCViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, OCCViewer_Viewer::Type() ); -#endif -#ifndef DISABLE_VTKVIEWER - myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateLeft, ALT+Key_Left, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateRight, ALT+Key_Right, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateUp, ALT+Key_Up, VTKViewer_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::RotateDown, ALT+Key_Down, VTKViewer_Viewer::Type() ); -#endif -#ifndef DISABLE_PLOT2DVIEWER - myAccel->setActionKey( SUIT_Accel::PanLeft, CTRL+Key_Left, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanRight, CTRL+Key_Right, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanUp, CTRL+Key_Up, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::PanDown, CTRL+Key_Down, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomIn, CTRL+Key_Plus, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomOut, CTRL+Key_Minus, Plot2d_Viewer::Type() ); - myAccel->setActionKey( SUIT_Accel::ZoomFit, CTRL+Key_Asterisk, Plot2d_Viewer::Type() ); -#endif - - connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) ); - - // Set existing font for the python console in resources - if( !aResMgr->hasValue( "PyConsole", "font" ) ) - return; - - QFont f = aResMgr->fontValue( "PyConsole", "font" ); - QFontDatabase fdb; - QStringList famdb = fdb.families(); - - if ( famdb.contains(f.family()) || !aResMgr->hasValue( "PyConsole", "additional_families" ) ) - return; - - QStringList anAddFamilies = QStringList::split( ";", aResMgr->stringValue( "PyConsole", "additional_families" ) ); - QString aFamily; - for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it ) - { - aFamily = *it; - if ( famdb.contains(aFamily) ) - { - f.setFamily( aFamily ); - aResMgr->setValue( "PyConsole", "font", f ); - break; - } - } -} - -/*!Destructor. - *\li Save window geometry. - *\li Save desktop geometry. - *\li Save resource maneger. - *\li Delete selection manager. - */ -LightApp_Application::~LightApp_Application() -{ - delete mySelMgr; -} - -/*!Start application.*/ -void LightApp_Application::start() -{ - if ( desktop() ) - desktop()->loadGeometry( resourceMgr(), "desktop" ); - - CAM_Application::start(); - - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - ((QtxDockAction*)a)->setAutoPlace( true ); - - updateWindows(); - updateViewManagers(); - - putInfo( "" ); - desktop()->statusBar()->message( "" ); - - LightApp_EventFilter::Init(); -} - -/*!Gets application name.*/ -QString LightApp_Application::applicationName() const -{ - return tr( "APP_NAME" ); -} - -/*!Gets application version.*/ -QString LightApp_Application::applicationVersion() const -{ - static QString _app_version; - - if ( _app_version.isEmpty() ) - { - QString resVersion = tr( "APP_VERSION" ); - if ( resVersion != "APP_VERSION" ) - { - _app_version = resVersion; - } - else - { - QString path( ::getenv( "GUI_ROOT_DIR" ) ); - if ( !path.isEmpty() ) - path += QDir::separator(); - path += QString( "bin/salome/VERSION" ); - - QFile vf( path ); - if ( vf.open( IO_ReadOnly ) ) - { - QString line; - vf.readLine( line, 1024 ); - vf.close(); - - if ( !line.isEmpty() ) - { - while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) - line.remove( line.length() - 1, 1 ); - - int idx = line.findRev( ":" ); - if ( idx != -1 ) - _app_version = line.mid( idx + 1 ).stripWhiteSpace(); - } - } - } - } - return _app_version; -} - -/*!Load module by \a name.*/ -CAM_Module* LightApp_Application::loadModule( const QString& name ) -{ - CAM_Module* mod = CAM_Application::loadModule( name ); - if ( mod ) - { - connect( this, SIGNAL( studyOpened() ), mod, SLOT( onModelOpened() ) ); - connect( this, SIGNAL( studySaved() ), mod, SLOT( onModelSaved() ) ); - connect( this, SIGNAL( studyClosed() ), mod, SLOT( onModelClosed() ) ); - } - return mod; -} - -/*!Activate module by \a modName*/ -bool LightApp_Application::activateModule( const QString& modName ) -{ - QString actName; - CAM_Module* prevMod = activeModule(); - - if ( prevMod ) - actName = prevMod->moduleName(); - - if ( actName == modName ) - return true; - - putInfo( tr( "ACTIVATING_MODULE" ).arg( modName ) ); - - saveWindowsGeometry(); - - bool status = CAM_Application::activateModule( modName ); - - updateModuleActions(); - - putInfo( "" ); - - if ( !status ) - return false; - - updateWindows(); - updateViewManagers(); - - return true; -} - -/*! - Opens other study into active Study. If Study is empty - creates it. - \param theName - name of study -*/ -bool LightApp_Application::useStudy(const QString& theName) -{ - createEmptyStudy(); - LightApp_Study* aStudy = dynamic_cast(activeStudy()); - bool res = false; - if (aStudy) - res = aStudy->loadDocument( theName ); - updateDesktopTitle(); - updateCommandsStatus(); - return res; -} - -/*!Gets selection manager.*/ -LightApp_SelectionMgr* LightApp_Application::selectionMgr() const -{ - return mySelMgr; -} - -/*!Creat action "New window" for certain type of viewer:*/ -void LightApp_Application::createActionForViewer( const int id, - const int parentId, - const QString& suffix, - const int accel ) -{ - QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), QIconSet(), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), - accel, desktop(), false, this, SLOT( onNewWindow() ) ); - createMenu( a, parentId, -1 ); -} - -/*!Create actions:*/ -void LightApp_Application::createActions() -{ - STD_Application::createActions(); - - SUIT_Desktop* desk = desktop(); - SUIT_ResourceMgr* resMgr = resourceMgr(); - - //! Preferences - createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIconSet(), - tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ), - CTRL+Key_F, desk, false, this, SLOT( onPreferences() ) ); - - //! Help for modules - int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 ); - int helpModuleMenu = createMenu( tr( "MEN_DESK_MODULE_HELP" ), helpMenu, -1, 0 ); - createMenu( separator(), helpMenu, -1, 1 ); - - QStringList aModuleList; - modules( aModuleList, false ); - - int id = LightApp_Application::UserID + FIRST_HELP_ID; - // help for KERNEL and GUI - QCString dir; - QString aFileName = "index.htm"; - QString root; - QAction* a; - if (dir = getenv("GUI_ROOT_DIR")) { - root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") + - Qtx::addSlash("gui") + Qtx::addSlash("GUI") ); - if ( QFileInfo( root + aFileName ).exists() ) { - a = createAction( id, tr( QString("GUI Help") ), QIconSet(), - tr( QString("GUI Help") ), - tr( QString("GUI Help") ), - 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( QString("GUI") ); - createMenu( a, helpModuleMenu, -1 ); - id++; - } - } - if (dir = getenv("KERNEL_ROOT_DIR")) { - QString aFN = "index.html"; - root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + - Qtx::addSlash("salome") ); - if ( QFileInfo( root + aFN ).exists() ) { - a = createAction( id, tr( QString("KERNEL Help") ), QIconSet(), - tr( QString("KERNEL Help") ), - tr( QString("KERNEL Help") ), - 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( QString("KERNEL") ); - createMenu( a, helpModuleMenu, -1 ); - id++; - } - } - // help for other existing modules - QStringList::Iterator it; - for ( it = aModuleList.begin(); it != aModuleList.end(); ++it ) - { - if ( (*it).isEmpty() ) - continue; - - QString modName = moduleName( *it ); - - if (dir = getenv( modName + "_ROOT_DIR")) { - root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") + - Qtx::addSlash("gui") + Qtx::addSlash(modName) ); - if ( QFileInfo( root + aFileName ).exists() ) { - - QAction* a = createAction( id, tr( moduleTitle(modName) + QString(" Help") ), QIconSet(), - tr( moduleTitle(modName) + QString(" Help") ), - tr( moduleTitle(modName) + QString(" Help") ), - 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( modName ); - createMenu( a, helpModuleMenu, -1 ); - id++; - } - } - } - - //! MRU - QtxMRUAction* mru = new QtxMRUAction( tr( "TOT_DESK_MRU" ), tr( "MEN_DESK_MRU" ), desk ); - connect( mru, SIGNAL( activated( QString ) ), this, SLOT( onMRUActivated( QString ) ) ); - registerAction( MRUId, mru ); - - // default icon for neutral point ('SALOME' module) - QPixmap defIcon = resMgr->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false ); - if ( defIcon.isNull() ) - defIcon = QPixmap( imageEmptyIcon ); - - //! default icon for any module - QPixmap modIcon = resMgr->loadPixmap( "LightApp", tr( "APP_MODULE_ICO" ), false ); - if ( modIcon.isNull() ) - modIcon = QPixmap( imageEmptyIcon ); - - QStringList modList; - modules( modList, false ); - - if( modList.count()>1 ) - { - QToolBar* modTBar = new QtxToolBar( true, desk ); - modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) ); - - QActionGroup* modGroup = new QActionGroup( this ); - modGroup->setExclusive( true ); - modGroup->setUsesDropDown( true ); - - a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ), - tr( "PRP_APP_MODULE" ), 0, desk, true ); - modGroup->add( a ); - myActions.insert( QString(), a ); - - QMap iconMap; - moduleIconNames( iconMap ); - - const int iconSize = 20; - - modGroup->addTo( modTBar ); - QObjectList *l = modTBar->queryList( "QComboBox" ); - QObjectListIt oit( *l ); - while ( QObject* obj = oit.current() ) { - QComboBox* cb = (QComboBox*)obj; - if ( cb ) cb->setFocusPolicy( QWidget::NoFocus ); - ++oit; - } - delete l; - - modTBar->addSeparator(); - - for ( it = modList.begin(); it != modList.end(); ++it ) - { - if ( !isLibExists( *it ) ) - continue; - - QString iconName; - if ( iconMap.contains( *it ) ) - iconName = iconMap[*it]; - - QString modName = moduleName( *it ); - - QPixmap icon = resMgr->loadPixmap( modName, iconName, false ); - if ( icon.isNull() ) - { - icon = modIcon; - printf( "****************************************************************\n" ); - printf( "* Icon for %s not found. Using the default one.\n", (*it).latin1() ); - printf( "****************************************************************\n" ); - } - - icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) ); - - QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true ); - a->addTo( modTBar ); - modGroup->add( a ); - - myActions.insert( *it, a ); - } - - SUIT_Tools::simplifySeparators( modTBar ); - connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) ); - } - - // New window - int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 ); - int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); - createMenu( separator(), windowMenu, -1, 1 ); - - -#ifndef DISABLE_GLVIEWER - createActionForViewer( NewGLViewId, newWinMenu, QString::number( 0 ), ALT+Key_G ); -#endif -#ifndef DISABLE_PLOT2DVIEWER - createActionForViewer( NewPlot2dId, newWinMenu, QString::number( 1 ), ALT+Key_P ); -#endif -#ifndef DISABLE_OCCVIEWER - createActionForViewer( NewOCCViewId, newWinMenu, QString::number( 2 ), ALT+Key_O ); -#endif -#ifndef DISABLE_VTKVIEWER - createActionForViewer( NewVTKViewId, newWinMenu, QString::number( 3 ), ALT+Key_K ); -#endif - - - createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ), - SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) ); - createMenu( RenameId, windowMenu, -1 ); - - int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); - createMenu( PreferencesId, fileMenu, 15, -1 ); - createMenu( separator(), fileMenu, -1, 15, -1 ); - - /* - createMenu( separator(), fileMenu, -1, 100, -1 ); - createMenu( MRUId, fileMenu, 100, -1 ); - createMenu( separator(), fileMenu, -1, 100, -1 ); - */ -} - -/*!On module activation action.*/ -void LightApp_Application::onModuleActivation( QAction* a ) -{ - if ( !a ) - return; - - QString modName = a->menuText(); - if ( modName == tr( "APP_NAME" ) ) - modName = QString::null; - - // Force user to create/open a study before module activation - QMap iconMap; - moduleIconNames( iconMap ); - QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ], false ); - if ( icon.isNull() ) - icon = resourceMgr()->loadPixmap( "LightApp", tr( "APP_MODULE_BIG_ICO" ), false ); // default icon for any module - - bool cancelled = false; - while ( !modName.isEmpty() && !activeStudy() && !cancelled ){ - LightApp_ModuleDlg aDlg( desktop(), modName, icon ); - int res = aDlg.exec(); - - switch ( res ){ - case 1: - onNewDoc(); - break; - case 2: - onOpenDoc(); - break; - case 3: - //onLoadStudy(); - //break; - case 0: - default: - putInfo( tr("INF_CANCELLED") ); - myActions[QString()]->setOn( true ); - cancelled = true; - } - } - - if ( !cancelled ) - activateModule( modName ); -} - -/*!Default module activation.*/ -QString LightApp_Application::defaultModule() const -{ - QStringList aModuleNames; - modules( aModuleNames, false ); // obtain a complete list of module names for the current configuration - //! If there's the one and only module --> activate it automatically - //! TODO: Possible improvement - default module can be taken from preferences - return aModuleNames.count() > 1 ? "" : ( aModuleNames.count() ? aModuleNames.first() : "" ); -} - -/*!On new window slot.*/ -void LightApp_Application::onNewWindow() -{ - const QObject* obj = sender(); - if ( !obj || !obj->inherits( "QAction" ) ) - return; - - QString type; - int id = actionId( (QAction*)obj ); - switch ( id ) - { -#ifndef DISABLE_GLVIEWER - case NewGLViewId: - type = GLViewer_Viewer::Type(); - break; -#endif -#ifndef DISABLE_PLOT2DVIEWER - case NewPlot2dId: - type = Plot2d_Viewer::Type(); - break; -#endif -#ifndef DISABLE_OCCVIEWER - case NewOCCViewId: - type = OCCViewer_Viewer::Type(); - break; -#endif -#ifndef DISABLE_VTKVIEWER - case NewVTKViewId: - type = VTKViewer_Viewer::Type(); - break; -#endif - } - - if ( !type.isEmpty() ) - createViewManager( type ); -} - -/*! - SLOT: Creates new document -*/ -void LightApp_Application::onNewDoc() -{ - SUIT_Study* study = activeStudy(); - - saveWindowsGeometry(); - - CAM_Application::onNewDoc(); - - if ( !study ) // new study will be create in THIS application - { - updateWindows(); - updateViewManagers(); - } -} - -/*! - SLOT: Opens new document -*/ -void LightApp_Application::onOpenDoc() -{ - SUIT_Study* study = activeStudy(); - saveWindowsGeometry(); - - CAM_Application::onOpenDoc(); - - if ( !study ) // new study will be create in THIS application - { - updateWindows(); - updateViewManagers(); - } -} - -#include "SUIT_MessageBox.h" - -/*! - SLOT: Opens new document. - \param aName - name of file -*/ -bool LightApp_Application::onOpenDoc( const QString& aName ) -{ - bool isAlreadyOpen = false; - - // Look among opened studies - if (activeStudy()) { // at least one study is opened - SUIT_Session* aSession = SUIT_Session::session(); - QPtrList aAppList = aSession->applications(); - QPtrListIterator it (aAppList); - SUIT_Application* aApp = 0; - // iterate on all applications - for (; (aApp = it.current()) && !isAlreadyOpen; ++it) { - if (aApp->activeStudy()->studyName() == aName) { - isAlreadyOpen = true; // Already opened, ask user what to do - - // The document ... is already open. - // Do you want to reload it? - int aAnswer = SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"), - tr("QUE_DOC_ALREADYOPEN").arg(aName), - tr("BUT_YES"), tr("BUT_NO"), 1, 2, 2); - if (aAnswer == 1) { // reload - if (activeStudy()->studyName() == aName && aAppList.count() > 1) { - // Opened in THIS (active) application. - STD_Application* app1 = (STD_Application*)aAppList.at(0); - STD_Application* app2 = (STD_Application*)aAppList.at(1); - if (!app1 || !app2) { - // Error - return false; - } - if (app1->activeStudy()->studyName() == aName) { - // app1 is this application, we need another one - app1 = app2; - } - // Close document of this application. This application will be destroyed. - onCloseDoc(/*ask = */false); - // Open the file with another application, as this one will be destroyed. - return app1->onOpenDoc(aName); - } else { - // Opened in another application. - STD_Application* app = (STD_Application*)aApp; - if (app) - app->onCloseDoc(/*ask = */false); - } - } else { // do not reload - // OK, the study will not be reloaded, but we call - // CAM_Application::onOpenDoc( aName ) all the same. - // It will activate a desktop of the study . - } - } - } - } - - bool res = CAM_Application::onOpenDoc( aName ); - - QAction* a = action( MRUId ); - if ( a && a->inherits( "QtxMRUAction" ) ) - { - QtxMRUAction* mru = (QtxMRUAction*)a; - if ( res ) - mru->insert( aName ); - else - mru->remove( aName ); - } - return res; -} - -/*! - SLOT: Displays "About" message box -*/ -void LightApp_Application::onHelpAbout() -{ - LightApp_AboutDlg* dlg = new LightApp_AboutDlg( applicationName(), applicationVersion(), desktop() ); - dlg->exec(); - delete dlg; -} - -/*! - SLOT: Loads document - \param aName - name of document -*/ -bool LightApp_Application::onLoadDoc( const QString& aName ) -{ - bool res = CAM_Application::onLoadDoc( aName ); - - /*jfa tmp:QAction* a = action( MRUId ); - if ( a && a->inherits( "QtxMRUAction" ) ) - { - QtxMRUAction* mru = (QtxMRUAction*)a; - if ( res ) - mru->insert( aName ); - else - mru->remove( aName ); - }*/ - return res; -} - -/*! - Private SLOT: Called on selection is changed - Dispatchs active module that selection is changed -*/ -void LightApp_Application::onSelection() -{ - onSelectionChanged(); - - if ( activeModule() && activeModule()->inherits( "LightApp_Module" ) ) - ((LightApp_Module*)activeModule())->selectionChanged(); -} - -/*! - Sets active study. - \param study - SUIT_Study. -*/ -void LightApp_Application::setActiveStudy( SUIT_Study* study ) -{ - CAM_Application::setActiveStudy( study ); - - activateWindows(); -} - -/*! - Enables/Disables menu items and toolbar buttons. Rebuild menu -*/ -void LightApp_Application::updateCommandsStatus() -{ - CAM_Application::updateCommandsStatus(); - QAction* a = 0; - -#ifndef DISABLE_GLVIEWER - a = action( NewGLViewId ); - if( a ) - a->setEnabled( activeStudy() ); -#endif - -#ifndef DISABLE_PLOT2DVIEWER - a = action( NewPlot2dId ); - if( a ) - a->setEnabled( activeStudy() ); -#endif - -#ifndef DISABLE_OCCVIEWER - a = action( NewOCCViewId ); - if( a ) - a->setEnabled( activeStudy() ); -#endif - -#ifndef DISABLE_VTKVIEWER - a = action( NewVTKViewId ); - if( a ) - a->setEnabled( activeStudy() ); -#endif -} - -/*! - \class RunBrowser - Runs system command in separate thread -*/ -class RunBrowser: public QThread { -public: - - RunBrowser( LightApp_Application* app, QString theApp, QString theParams, QString theHelpFile, QString theContext=NULL): - myApp(theApp), myParams(theParams), -#ifdef WIN32 - myHelpFile("file://" + theHelpFile + theContext), -#else - myHelpFile("file:" + theHelpFile + theContext), -#endif - myStatus(0), - myLApp( app ) -{ -}; - - virtual void run() - { - QString aCommand; - - if ( !myApp.isEmpty()) - { - aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); - - QProcess* proc = new QProcess(); - proc->addArgument( aCommand ); - //myStatus = system(aCommand); - - //if(myStatus != 0) - if(!proc->start()) - { - QCustomEvent* ce2000 = new QCustomEvent( 2000 ); - QString* msg = new QString( QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile) ); - ce2000->setData( msg ); - postEvent( myLApp, ce2000 ); - } - } - } - -private: - QString myApp; - QString myParams; - QString myHelpFile; - int myStatus; - LightApp_Application* myLApp; -}; - -/*! - SLOT: Displays help contents for choosen module -*/ -void LightApp_Application::onHelpContentsModule() -{ - const QAction* obj = (QAction*) sender(); - - QString aComponentName = obj->name(); - QString aFileName = "index.htm"; - QString aFileNameKernel = "index.html"; - - QCString dir = getenv( aComponentName + "_ROOT_DIR"); - QString homeDir = !aComponentName.compare(QString("KERNEL")) ? - Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") ) : - Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") + Qtx::addSlash(aComponentName) ); - - QString helpFile = QFileInfo( homeDir + (!aComponentName.compare(QString("KERNEL")) ? aFileNameKernel : aFileName) ).absFilePath(); - SUIT_ResourceMgr* resMgr = resourceMgr(); - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - QString anApp = resMgr->stringValue("ExternalBrowser", platform); -#ifdef WIN32 - QString quote("\""); - anApp.prepend( quote ); - anApp.append( quote ); -#endif - QString aParams = resMgr->stringValue("ExternalBrowser", "parameters"); - - if (!anApp.isEmpty()) { - RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile ); - rs->start(); - } - else { - if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"), - tr("DEFINE_EXTERNAL_BROWSER"), - tr("BUT_OK"),tr("BUT_CANCEL"),0,1,0 )==0 ) - onPreferences(); - } -} - -/*! - SLOT: Displays help contents for choosen dialog -*/ -void LightApp_Application::onHelpContextModule(const QString& theComponentName, const QString& theFileName) -{ - QCString dir = getenv( theComponentName + "_ROOT_DIR"); - QString homeDir = Qtx::addSlash(Qtx::addSlash(dir)+Qtx::addSlash("doc")+Qtx::addSlash("salome")+Qtx::addSlash("gui")+Qtx::addSlash(theComponentName)); - - QString helpFile = QFileInfo( homeDir + theFileName ).absFilePath(); - SUIT_ResourceMgr* resMgr = resourceMgr(); - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - QString anApp = resMgr->stringValue("ExternalBrowser", platform); -#ifdef WIN32 - QString quote("\""); - anApp.prepend( quote ); - anApp.append( quote ); -#endif - QString aParams = resMgr->stringValue("ExternalBrowser", "parameters"); - - if (!anApp.isEmpty()) { - RunBrowser* rs = new RunBrowser( this, anApp, aParams, helpFile ); - rs->start(); - } - else { - if( SUIT_MessageBox::warn2(desktop(), tr("WRN_WARNING"), - tr("DEFINE_EXTERNAL_BROWSER"), - tr("BUT_OK"), tr("BUT_CANCEL"),0,1,0)==0 ) - onPreferences(); - } -} - -/*! - Sets enable or disable some actions on selection changed. -*/ -void LightApp_Application::onSelectionChanged() -{ -} - -/*! - \return window by key - \param flag - key for window - \param studyId - study id - Flag used how identificator of window in windows list. -*/ -QWidget* LightApp_Application::window( const int flag, const int studyId ) const -{ - QWidget* wid = 0; - - int sId = studyId; - if ( sId < 0 ) - { - if ( !activeStudy() ) - return 0; - else - sId = activeStudy()->id(); - } - - if ( myWindows.contains( flag ) ) - wid = myWindows[flag]->widget( sId ); - - return wid; -} - -/*! - Adds window to application. - \param wid - QWidget - \param flag - key for window - \param studyId - study id - Flag used how identificator of window in windows list. -*/ -void LightApp_Application::addWindow( QWidget* wid, const int flag, const int studyId ) -{ - if ( !wid ) - return; - - int sId = studyId; - if ( sId < 0 ) - { - if ( !activeStudy() ) - return; - else - sId = activeStudy()->id(); - } - - if ( !myWindows.contains( flag ) ) - { - QMap winMap; - currentWindows( winMap ); - - LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() ); - connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) ); - // asv: connecting a slot for storing visibility flag of a window - connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) ); - myWindows.insert( flag, newWC ); - if ( winMap.contains( flag ) ) - desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] ); - - myWindows[flag]->setResizeEnabled( true ); - myWindows[flag]->setCloseMode( QDockWindow::Always ); - myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) ); - myWindows[flag]->setFixedExtentWidth( wid->width() ); - myWindows[flag]->setFixedExtentHeight( wid->height() ); - } - - QFont f; -#ifndef DISABLE_PYCONSOLE - if( wid->inherits( "PythonConsole" ) ) - { - if( resourceMgr()->hasValue( "PyConsole", "font" ) ) - f = resourceMgr()->fontValue( "PyConsole", "font" ); - else - { - f = ( ( PythonConsole* )wid )->font(); - resourceMgr()->setValue( "PyConsole", "font", f ); - } - } - else -#endif - f = wid->font(); - - myWindows[flag]->insert( sId, wid ); - wid->setFont(f); - - setWindowShown( flag, !myWindows[flag]->isEmpty() ); -} - -/*! - Removes window from application. - \param flag - key for window - \param studyId - study id - Flag used how identificator of window in windows list. -*/ -void LightApp_Application::removeWindow( const int flag, const int studyId ) -{ - if ( !myWindows.contains( flag ) ) - return; - - int sId = studyId; - if ( sId < 0 ) - { - if ( !activeStudy() ) - return; - else - sId = activeStudy()->id(); - } - - bool anIsEmpty = !myWindows[flag]->isEmpty(); - QWidget* wid = myWindows[flag]->widget( sId ); - myWindows[flag]->remove( sId ); - delete wid; - - //setWindowShown( flag, !myWindows[flag]->isEmpty() ); - setWindowShown( flag, anIsEmpty ); -} - -/*! - Gets window. - \param flag - key for window - \param studyId - study id - Flag used how identificator of window in windows list. -*/ -QWidget* LightApp_Application::getWindow( const int flag, const int studyId ) -{ - QWidget* wid = window( flag, studyId ); - if ( !wid ) - addWindow( wid = createWindow( flag ), flag, studyId ); - - return wid; -} - -/*! - \return is window visible - \param type - flag of window -*/ -bool LightApp_Application::isWindowVisible( const int type ) const -{ - bool res = false; - if ( myWindows.contains( type ) ) - { - SUIT_Desktop* desk = ((LightApp_Application*)this)->desktop(); - res = desk && desk->appropriate( myWindows[type] ); - } - return res; -} - -/*! - Sets window show or hide. - \param type - window identificator. - \param on - true/false (window show/hide) -*/ -void LightApp_Application::setWindowShown( const int type, const bool on ) -{ - if ( !desktop() || !myWindows.contains( type ) ) - return; - - QDockWindow* dw = myWindows[type]; - desktop()->setAppropriate( dw, on ); - if( on ) - dw->show(); - else if( dw->isShown() ) - { - dw->hide(); - myWindowsVisible[ type ] = true; - } -} - -/*! - \return Object Browser -*/ -OB_Browser* LightApp_Application::objectBrowser() -{ - OB_Browser* ob = 0; - QWidget* wid = window( WT_ObjectBrowser ); - if ( wid && wid->inherits( "OB_Browser" ) ) - ob = (OB_Browser*)wid; - return ob; -} - -/*! - \return Log Window -*/ -LogWindow* LightApp_Application::logWindow() -{ - LogWindow* lw = 0; - QWidget* wid = getWindow( WT_LogWindow ); - if ( wid->inherits( "LogWindow" ) ) - lw = (LogWindow*)wid; - return lw; -} - -#ifndef DISABLE_PYCONSOLE -/*! - \return Python Console -*/ -PythonConsole* LightApp_Application::pythonConsole() -{ - PythonConsole* console = 0; - QWidget* wid = getWindow( WT_PyConsole ); - if ( wid->inherits( "PythonConsole" ) ) - console = (PythonConsole*)wid; - return console; -} -#endif - -/*! - Updates object browser and maybe data models - \param updateModels - if it is true, then data models are updated -*/ -void LightApp_Application::updateObjectBrowser( const bool updateModels ) -{ - // update existing data models - if ( updateModels ) - { - const bool isAutoUpdate = objectBrowser() ? objectBrowser()->isAutoUpdate() : true; - if( objectBrowser() ) - objectBrowser()->setAutoUpdate( false ); - - LightApp_Study* study = dynamic_cast(activeStudy()); - if ( study ) { - CAM_Study::ModelList dm_list; - study->dataModels( dm_list ); - for ( CAM_Study::ModelListIterator it( dm_list ); it.current(); ++it ) { - CAM_DataModel* camDM = it.current(); - if ( camDM && camDM->inherits( "LightApp_DataModel" ) ) - ((LightApp_DataModel*)camDM)->update(); - } - } - - if( objectBrowser() ) - objectBrowser()->setAutoUpdate( isAutoUpdate ); - } - if ( objectBrowser() ) - { - objectBrowser()->updateGeometry(); - objectBrowser()->updateTree( 0, false ); - } -} - -/*! - \return preferences -*/ -LightApp_Preferences* LightApp_Application::preferences() const -{ - return preferences( false ); -} - -/*! - \return first view manager of some type - \param vmType - type of view manager - \param create - is it necessary to create view manager in case, when there is no manager of such type -*/ -SUIT_ViewManager* LightApp_Application::getViewManager( const QString& vmType, const bool create ) -{ - SUIT_ViewManager* aVM = viewManager( vmType ); - SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager(); - - if ( anActiveVM && anActiveVM->getType() == vmType ) - aVM = anActiveVM; - - if ( aVM && create ) - { - if ( !aVM->getActiveView() ) - aVM->createView(); - else - aVM->getActiveView()->setFocus(); - } - else if ( create ) - aVM = createViewManager( vmType ); - - return aVM; -} - -/*! - Creates view manager of some type - \param vmType - type of view manager -*/ -SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType ) -{ - SUIT_ResourceMgr* resMgr = resourceMgr(); - - SUIT_ViewManager* viewMgr = 0; -#ifndef DISABLE_GLVIEWER - if( vmType == GLViewer_Viewer::Type() ) - { - viewMgr = new GLViewer_ViewManager( activeStudy(), desktop() ); - new LightApp_GLSelector( (GLViewer_Viewer2d*)viewMgr->getViewModel(), mySelMgr ); - } -#endif -#ifndef DISABLE_PLOT2DVIEWER - if( vmType == Plot2d_Viewer::Type() ) - { - viewMgr = new Plot2d_ViewManager( activeStudy(), desktop() ); - Plot2d_Viewer* vm; -#ifndef DISABLE_SALOMEOBJECT - vm = new SPlot2d_Viewer(); -#else - vm = new Plot2d_Viewer(); -#endif - viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface - Plot2d_ViewWindow* wnd = dynamic_cast( viewMgr->getActiveView() ); - if( wnd ) - { - Plot2d_ViewFrame* frame = wnd->getViewFrame(); - frame->setBackgroundColor( resMgr->colorValue( "Plot2d", "Background", frame->backgroundColor() ) ); - } - } -#endif - //#ifndef DISABLE_SUPERVGRAPHVIEWER - // if( vmType == SUPERVGraph_Viewer::Type() ) - // { - // viewMgr = new SUPERVGraph_ViewManager( activeStudy(), desktop(), new SUPERVGraph_Viewer() ); - // } - //#endif -#ifndef DISABLE_OCCVIEWER - if( vmType == OCCViewer_Viewer::Type() ) - { - viewMgr = new OCCViewer_ViewManager( activeStudy(), desktop() ); - OCCViewer_Viewer* vm; -#ifndef DISABLE_SALOMEOBJECT - vm = new SOCC_Viewer(); -#else - vm = new OCCViewer_Viewer(); -#endif - vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) ); - vm->setTrihedronSize( resMgr->doubleValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) ); - int u( 1 ), v( 1 ); - vm->isos( u, v ); - u = resMgr->integerValue( "OCCViewer", "iso_number_u", u ); - v = resMgr->integerValue( "OCCViewer", "iso_number_v", v ); - vm->setIsos( u, v ); - viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface - new LightApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr ); - } -#endif -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT - if ( vmType == SVTK_Viewer::Type() ) -#else - if ( vmType == VTKViewer_Viewer::Type() ) -#endif - { -#ifndef DISABLE_SALOMEOBJECT - viewMgr = new SVTK_ViewManager( activeStudy(), desktop() ); - SVTK_Viewer* vm = dynamic_cast( viewMgr->getViewModel() ); - if( vm ) - { - vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) ); - vm->setTrihedronSize( resMgr->doubleValue( "VTKViewer", "trihedron_size", vm->trihedronSize() ), - resMgr->booleanValue( "VTKViewer", "relative_size", vm->trihedronRelative() ) ); - new LightApp_VTKSelector( vm, mySelMgr ); - } -#else - viewMgr = new VTKViewer_ViewManager( activeStudy(), desktop() ); - VTKViewer_Viewer* vm = dynamic_cast( viewMgr->getViewModel() ); - if ( vm ) - vm->setBackgroundColor( resMgr->colorValue( "VTKViewer", "background", vm->backgroundColor() ) ); -#endif - } -#endif - - if ( !viewMgr ) - return 0; - - addViewManager( viewMgr ); - SUIT_ViewWindow* viewWin = viewMgr->createViewWindow(); - - if ( viewWin && desktop() ) - viewWin->resize( (int)( desktop()->width() * 0.6 ), (int)( desktop()->height() * 0.6 ) ); - - return viewMgr; -} - -/*! - SLOT: Removes view manager from application -*/ -void LightApp_Application::onCloseView( SUIT_ViewManager* theVM ) -{ - removeViewManager( theVM ); -} - -/*! - Protected SLOT: On study created. - \param theStudy - just created study -*/ -void LightApp_Application::onStudyCreated( SUIT_Study* theStudy ) -{ - SUIT_DataObject* aRoot = 0; - if ( theStudy && theStudy->root() ) - { - aRoot = theStudy->root(); - //aRoot->setName( tr( "DATA_MODELS" ) ); - } - getWindow( WT_ObjectBrowser ); - if ( objectBrowser() != 0 ) - objectBrowser()->setRootObject( aRoot ); - - activateModule( defaultModule() ); - - if ( objectBrowser() ) - objectBrowser()->openLevels(); - - activateWindows(); -} - -/*! - Protected SLOT: On study opened. - \param theStudy - just opened study -*/ -void LightApp_Application::onStudyOpened( SUIT_Study* theStudy ) -{ - SUIT_DataObject* aRoot = 0; - if ( theStudy && theStudy->root() ) - { - aRoot = theStudy->root(); - //aRoot->dump(); - } - getWindow( WT_ObjectBrowser ); - if ( objectBrowser() ) - objectBrowser()->setRootObject( aRoot ); - - activateModule( defaultModule() ); - - if ( objectBrowser() ) - objectBrowser()->openLevels(); - - activateWindows(); - - emit studyOpened(); -} - -/*!Protected SLOT. On study saved.*/ -void LightApp_Application::onStudySaved( SUIT_Study* ) -{ - emit studySaved(); -} - -/*!Protected SLOT. On study closed.*/ -void LightApp_Application::onStudyClosed( SUIT_Study* s ) -{ - // Bug 10396: clear selection - mySelMgr->clearSelected(); - - // Bug 12944: emit signal only after clear selection - emit studyClosed(); - - activateModule( "" ); - - for ( WindowMap::ConstIterator itr = myWindows.begin(); s && itr != myWindows.end(); ++itr ) - removeWindow( itr.key(), s->id() ); -} - -/*!Protected SLOT.On desktop activated.*/ -void LightApp_Application::onDesktopActivated() -{ - CAM_Application::onDesktopActivated(); - LightApp_Module* aModule = dynamic_cast(activeModule()); - if(aModule) - aModule->studyActivated(); -} - -/*!Gets file filter. - *\retval QString "(*.bin)" - */ -QString LightApp_Application::getFileFilter() const -{ - //return "(*.bin)"; - // HDF persistence - return "(*.hdf)"; -} - -/*! - Shows file dialog and return user selected file name -*/ -QString LightApp_Application::getFileName( bool open, const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ) -{ - if ( !parent ) - parent = desktop(); - QStringList fls = QStringList::split( ";;", filters, false ); - return SUIT_FileDlg::getFileName( parent, initial, fls, caption, open, true ); -} - -/*! Gets directory*/ -QString LightApp_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent ) -{ - if ( !parent ) - parent = desktop(); - return SUIT_FileDlg::getExistingDirectory( parent, initial, caption, true ); -} - -/*! Get open file names*/ -QStringList LightApp_Application::getOpenFileNames( const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ) -{ - if ( !parent ) - parent = desktop(); - QStringList fls = QStringList::split( ";;", filters, false ); - return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true ); -} - -/*!Private SLOT. Update object browser.*/ -void LightApp_Application::onRefresh() -{ - updateObjectBrowser( true ); -} - -/*!Private SLOT. On preferences.*/ -void LightApp_Application::onPreferences() -{ - QApplication::setOverrideCursor( Qt::waitCursor ); - - LightApp_PreferencesDlg* prefDlg = new LightApp_PreferencesDlg( preferences( true ), desktop()); - - QApplication::restoreOverrideCursor(); - - if ( !prefDlg ) - return; - - if ( ( prefDlg->exec() == QDialog::Accepted || prefDlg->isSaved() ) && resourceMgr() ) { - if ( desktop() ) - desktop()->saveGeometry( resourceMgr(), "desktop" ); - resourceMgr()->save(); - } - - delete prefDlg; -} - -/*!Protected SLOT. On preferences changed.*/ -void LightApp_Application::onPreferenceChanged( QString& modName, QString& section, QString& param ) -{ - LightApp_Module* sMod = 0; - CAM_Module* mod = module( modName ); - if ( mod && mod->inherits( "LightApp_Module" ) ) - sMod = (LightApp_Module*)mod; - - if ( sMod ) - sMod->preferencesChanged( section, param ); - else - preferencesChanged( section, param ); -} - -/*!Private SLOT. On open document with name \a aName.*/ -void LightApp_Application::onMRUActivated( QString aName ) -{ - onOpenDoc( aName ); -} - -/*!Remove all windows from study.*/ -void LightApp_Application::beforeCloseDoc( SUIT_Study* s ) -{ - CAM_Application::beforeCloseDoc( s ); -} - -/*!Update actions.*/ -void LightApp_Application::updateActions() -{ - updateCommandsStatus(); -} - -/*! - Creates new study -*/ -SUIT_Study* LightApp_Application::createNewStudy() -{ - LightApp_Application::lastStudyId++; - - LightApp_Study* aStudy = new LightApp_Study( this ); - - // Set up processing of major study-related events - connect( aStudy, SIGNAL( created( SUIT_Study* ) ), this, SLOT( onStudyCreated( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( opened ( SUIT_Study* ) ), this, SLOT( onStudyOpened ( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( saved ( SUIT_Study* ) ), this, SLOT( onStudySaved ( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( closed ( SUIT_Study* ) ), this, SLOT( onStudyClosed ( SUIT_Study* ) ) ); - - return aStudy; -} - -/*! - Creates window by flag. - \param flag - identificator of window type -*/ -QWidget* LightApp_Application::createWindow( const int flag ) -{ - QWidget* wid = 0; - if ( flag == WT_ObjectBrowser ) - { - OB_Browser* ob = new OB_Browser( desktop() ); - ob->setAutoUpdate( true ); - //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107 - ob->setCaption( tr( "OBJECT_BROWSER" ) ); - - OB_ListView* ob_list = dynamic_cast( const_cast( ob->listView() ) ); - if( ob_list ) - ob_list->setColumnMaxWidth( 0, desktop()->width()/4 ); - - ob->setFilter( new LightApp_OBFilter( selectionMgr() ) ); - ob->setNameTitle( tr( "OBJ_BROWSER_NAME" ) ); - - // Create OBSelector - new LightApp_OBSelector( ob, mySelMgr ); - - wid = ob; - - ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); - } -#ifndef DISABLE_PYCONSOLE - else if ( flag == WT_PyConsole ) - { - PythonConsole* pyCons = new PythonConsole( desktop() ); - pyCons->setCaption( tr( "PYTHON_CONSOLE" ) ); - wid = pyCons; - // pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); - } -#endif - else if ( flag == WT_LogWindow ) - { - LogWindow* logWin = new LogWindow( desktop() ); - logWin->setCaption( tr( "LOG_WINDOW" ) ); - wid = logWin; - logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); - } - return wid; -} - -/*! - \return default windows( Object Browser, Python Console ) - Adds to map \a aMap. - */ -void LightApp_Application::defaultWindows( QMap& aMap ) const -{ - aMap.insert( WT_ObjectBrowser, Qt::DockLeft ); -#ifndef DISABLE_PYCONSOLE - aMap.insert( WT_PyConsole, Qt::DockBottom ); -#endif - // aMap.insert( WT_LogWindow, Qt::DockBottom ); -} - -/*!Default view managers*/ -void LightApp_Application::defaultViewManagers( QStringList& ) const -{ - /*!Do nothing.*/ -} - -/*! - \return preferences. - Create preferences, if \a crt = true. -*/ -LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const -{ - if ( myPrefs ) - return myPrefs; - - LightApp_Application* that = (LightApp_Application*)this; - - bool toCreate = !_prefs_ && crt; - if( toCreate ) - { - _prefs_ = new LightApp_Preferences( resourceMgr() ); - that->createPreferences( _prefs_ ); - } - - that->myPrefs = _prefs_; - - QPtrList appList = SUIT_Session::session()->applications(); - for ( QPtrListIterator appIt ( appList ); appIt.current(); ++appIt ) - { - if ( !appIt.current()->inherits( "LightApp_Application" ) ) - continue; - - LightApp_Application* app = (LightApp_Application*)appIt.current(); - - QStringList modNameList; - app->modules( modNameList, false ); - for ( QStringList::const_iterator it = modNameList.begin(); it != modNameList.end(); ++it ) - { - int id = _prefs_->addPreference( *it ); - _prefs_->setItemProperty( id, "info", tr( "PREFERENCES_NOT_LOADED" ).arg( *it ) ); - } - - ModuleList modList; - app->modules( modList ); - for ( ModuleListIterator itr( modList ); itr.current(); ++itr ) - { - LightApp_Module* mod = 0; - if ( itr.current()->inherits( "LightApp_Module" ) ) - mod = (LightApp_Module*)itr.current(); - - if ( mod && !_prefs_->hasModule( mod->moduleName() ) ) - { - int modCat = _prefs_->addPreference( mod->moduleName() ); - _prefs_->setItemProperty( modCat, "info", QString::null ); - if( toCreate ) - mod->createPreferences(); - } - } - } - - connect( myPrefs, SIGNAL( preferenceChanged( QString&, QString&, QString& ) ), - this, SLOT( onPreferenceChanged( QString&, QString&, QString& ) ) ); - - return myPrefs; -} - -/*! - Adds new module to application -*/ -void LightApp_Application::moduleAdded( CAM_Module* mod ) -{ - CAM_Application::moduleAdded( mod ); - - LightApp_Module* lightMod = 0; - if ( mod && mod->inherits( "LightApp_Module" ) ) - lightMod = (LightApp_Module*)mod; - - if ( myPrefs && lightMod && !myPrefs->hasModule( lightMod->moduleName() )) - { - int modCat = myPrefs->addPreference( mod->moduleName() ); - myPrefs->setItemProperty( modCat, "info", QString::null ); - lightMod->createPreferences(); - } -} - -/*! - Create preferences -*/ -void LightApp_Application::createPreferences( LightApp_Preferences* pref ) -{ - if ( !pref ) - return; - - int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) ); - - int genTab = pref->addPreference( tr( "PREF_TAB_GENERAL" ), salomeCat ); - int studyGroup = pref->addPreference( tr( "PREF_GROUP_STUDY" ), genTab ); - pref->setItemProperty( studyGroup, "columns", 1 ); - - pref->addPreference( tr( "PREF_MULTI_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "multi_file" ); - pref->addPreference( tr( "PREF_ASCII_FILE" ), studyGroup, LightApp_Preferences::Bool, "Study", "ascii_file" ); - pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" ); - - int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab ); - pref->setItemProperty( extgroup, "columns", 1 ); - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", platform ); - pref->setItemProperty( apppref, "existing", true ); - pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser ); - pref->setItemProperty( apppref, "readOnly", false ); - - pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" ); - - int pythonConsoleGroup = pref->addPreference( tr( "PREF_GROUP_PY_CONSOLE" ), genTab ); - pref->setItemProperty( pythonConsoleGroup, "columns", 1 ); - pref->addPreference( tr( "PREF_FONT" ), pythonConsoleGroup, LightApp_Preferences::Font, "PyConsole", "font" ); - - int viewTab = pref->addPreference( tr( "PREF_TAB_VIEWERS" ), salomeCat ); - - int occGroup = pref->addPreference( tr( "PREF_GROUP_OCCVIEWER" ), viewTab ); - - int vtkGroup = pref->addPreference( tr( "PREF_GROUP_VTKVIEWER" ), viewTab ); - - int plot2dGroup = pref->addPreference( tr( "PREF_GROUP_PLOT2DVIEWER" ), viewTab ); - - int supervGroup = pref->addPreference( tr( "PREF_GROUP_SUPERV" ), viewTab ); - - pref->setItemProperty( occGroup, "columns", 1 ); - pref->setItemProperty( vtkGroup, "columns", 1 ); - pref->setItemProperty( plot2dGroup, "columns", 1 ); - - int occTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), occGroup, - LightApp_Preferences::DblSpin, "OCCViewer", "trihedron_size" ); - pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup, - LightApp_Preferences::Color, "OCCViewer", "background" ); - - pref->setItemProperty( occTS, "min", 1.0E-06 ); - pref->setItemProperty( occTS, "max", 1000 ); - - int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup, - LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" ); - int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup, - LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" ); - - pref->setItemProperty( isoU, "min", 0 ); - pref->setItemProperty( isoU, "max", 100000 ); - - pref->setItemProperty( isoV, "min", 0 ); - pref->setItemProperty( isoV, "max", 100000 ); - - int vtkTS = pref->addPreference( tr( "PREF_TRIHEDRON_SIZE" ), vtkGroup, - LightApp_Preferences::DblSpin, "VTKViewer", "trihedron_size" ); - pref->addPreference( tr( "PREF_RELATIVE_SIZE" ), vtkGroup, LightApp_Preferences::Bool, "VTKViewer", "relative_size" ); - pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), vtkGroup, - LightApp_Preferences::Color, "VTKViewer", "background" ); - - pref->setItemProperty( vtkTS, "min", 1.0E-06 ); - pref->setItemProperty( vtkTS, "max", 150 ); - - pref->addPreference( tr( "PREF_SHOW_LEGEND" ), plot2dGroup, - LightApp_Preferences::Bool, "Plot2d", "ShowLegend" ); - - int legendPosition = pref->addPreference( tr( "PREF_LEGEND_POSITION" ), plot2dGroup, - LightApp_Preferences::Selector, "Plot2d", "LegendPos" ); - QStringList aLegendPosList; - aLegendPosList.append( tr("PREF_LEFT") ); - aLegendPosList.append( tr("PREF_RIGHT") ); - aLegendPosList.append( tr("PREF_TOP") ); - aLegendPosList.append( tr("PREF_BOTTOM") ); - - QValueList anIndexesList; - anIndexesList.append(0); - anIndexesList.append(1); - anIndexesList.append(2); - anIndexesList.append(3); - - pref->setItemProperty( legendPosition, "strings", aLegendPosList ); - pref->setItemProperty( legendPosition, "indexes", anIndexesList ); - - int curveType = pref->addPreference( tr( "PREF_CURVE_TYPE" ), plot2dGroup, - LightApp_Preferences::Selector, "Plot2d", "CurveType" ); - QStringList aCurveTypesList; - aCurveTypesList.append( tr("PREF_POINTS") ); - aCurveTypesList.append( tr("PREF_LINES") ); - aCurveTypesList.append( tr("PREF_SPLINE") ); - - anIndexesList.clear(); - anIndexesList.append(0); - anIndexesList.append(1); - anIndexesList.append(2); - - pref->setItemProperty( curveType, "strings", aCurveTypesList ); - pref->setItemProperty( curveType, "indexes", anIndexesList ); - - int markerSize = pref->addPreference( tr( "PREF_MARKER_SIZE" ), plot2dGroup, - LightApp_Preferences::IntSpin, "Plot2d", "MarkerSize" ); - - pref->setItemProperty( markerSize, "min", 0 ); - pref->setItemProperty( markerSize, "max", 100 ); - - QStringList aScaleModesList; - aScaleModesList.append( tr("PREF_LINEAR") ); - aScaleModesList.append( tr("PREF_LOGARITHMIC") ); - - anIndexesList.clear(); - anIndexesList.append(0); - anIndexesList.append(1); - - int horScale = pref->addPreference( tr( "PREF_HOR_AXIS_SCALE" ), plot2dGroup, - LightApp_Preferences::Selector, "Plot2d", "HorScaleMode" ); - - pref->setItemProperty( horScale, "strings", aScaleModesList ); - pref->setItemProperty( horScale, "indexes", anIndexesList ); - - int verScale = pref->addPreference( tr( "PREF_VERT_AXIS_SCALE" ), plot2dGroup, - LightApp_Preferences::Selector, "Plot2d", "VerScaleMode" ); - - pref->setItemProperty( verScale, "strings", aScaleModesList ); - pref->setItemProperty( verScale, "indexes", anIndexesList ); - - pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), plot2dGroup, - LightApp_Preferences::Color, "Plot2d", "Background" ); - - int dirTab = pref->addPreference( tr( "PREF_TAB_DIRECTORIES" ), salomeCat ); - int dirGroup = pref->addPreference( tr( "PREF_GROUP_DIRECTORIES" ), dirTab ); - pref->setItemProperty( dirGroup, "columns", 1 ); - pref->addPreference( tr( "" ), dirGroup, - LightApp_Preferences::DirList, "FileDlg", "QuickDirList" ); - - pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), supervGroup, - LightApp_Preferences::Color, "SUPERVGraph", "Background" ); - pref->addPreference( tr( "PREF_SUPERV_TITLE_COLOR" ), supervGroup, - LightApp_Preferences::Color, "SUPERVGraph", "Title" ); -// pref->addPreference( tr( "PREF_SUPERV_CTRL_COLOR" ), supervGroup, -// LightApp_Preferences::Color, "SUPERVGraph", "Ctrl" ); - - int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat ); - int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab ); - pref->addPreference( tr( "PREF_AUTO_SIZE_FIRST" ), objSetGroup, LightApp_Preferences::Bool, - "ObjectBrowser", "auto_size_first" ); - pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool, - "ObjectBrowser", "auto_size" ); -} - -/*! - Changes appearance of application according to changed preferences - \param sec - section - \param param - name of changed parameter -*/ -void LightApp_Application::preferencesChanged( const QString& sec, const QString& param ) -{ - SUIT_ResourceMgr* resMgr = resourceMgr(); - if ( !resMgr ) - return; - -#ifndef DISABLE_OCCVIEWER - if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) ) - { - double sz = resMgr->doubleValue( sec, param, -1 ); - QPtrList lst; - viewManagers( OCCViewer_Viewer::Type(), lst ); - for ( QPtrListIterator it( lst ); it.current() && sz >= 0; ++it ) - { - SUIT_ViewModel* vm = it.current()->getViewModel(); - if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) ) - continue; - - OCCViewer_Viewer* occVM = (OCCViewer_Viewer*)vm; - occVM->setTrihedronSize( sz ); - occVM->getAISContext()->UpdateCurrentViewer(); - } - } -#endif - -#ifndef DISABLE_VTKVIEWER - if ( sec == QString( "VTKViewer" ) && (param == QString( "trihedron_size" ) || param == QString( "relative_size" )) ) - { - double sz = resMgr->doubleValue( "VTKViewer", "trihedron_size", -1 ); - bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true ); - QPtrList lst; -#ifndef DISABLE_SALOMEOBJECT - viewManagers( SVTK_Viewer::Type(), lst ); - for ( QPtrListIterator it( lst ); it.current() && sz >= 0; ++it ) - { - SUIT_ViewModel* vm = it.current()->getViewModel(); - if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) - continue; - - SVTK_Viewer* vtkVM = dynamic_cast( vm ); - if( vtkVM ) - { - vtkVM->setTrihedronSize( sz, isRelative ); - vtkVM->Repaint(); - } - } -#endif - } -#endif - -#ifndef DISABLE_OCCVIEWER - if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) ) - { - QPtrList lst; - viewManagers( OCCViewer_Viewer::Type(), lst ); - int u = resMgr->integerValue( sec, "iso_number_u" ); - int v = resMgr->integerValue( sec, "iso_number_v" ); - for ( QPtrListIterator it( lst ); it.current(); ++it ) - { - OCCViewer_ViewManager* mgr = dynamic_cast( it.current() ); - if( mgr && mgr->getOCCViewer() ) - mgr->getOCCViewer()->setIsos( u, v ); - } - } -#endif - - if( sec=="ObjectBrowser" ) - { - if( param=="auto_size" || param=="auto_size_first" ) - { - OB_Browser* ob = objectBrowser(); - if( !ob ) - return; - - bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ), - autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true ); - ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual ); - ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual ); - if( autoSize ) - for( int i=1; ilistView()->columns(); i++ ) - if( ob->listView()->columnWidth( i )>0 ) - ob->listView()->adjustColumn( i ); - updateObjectBrowser( false ); - } - } - - if( sec=="Study" ) - { - if( param=="store_positions" ) - updateWindows(); - } - -#ifndef DISABLE_PYCONSOLE - if( sec=="PyConsole" ) - { - if( param=="font" ) - if( pythonConsole() ) - pythonConsole()->setFont( resMgr->fontValue( "PyConsole", "font" ) ); - } -#endif -} - -/*! - Saves preferences -*/ -void LightApp_Application::savePreferences() -{ - saveWindowsGeometry(); - - if ( resourceMgr() ) - { - if ( desktop() ) - desktop()->saveGeometry( resourceMgr(), "desktop" ); - resourceMgr()->save(); - } -} - -/*! - Updates desktop title -*/ -void LightApp_Application::updateDesktopTitle() { - QString aTitle = applicationName(); - QString aVer = applicationVersion(); - if ( !aVer.isEmpty() ) - aTitle += QString( " " ) + aVer; - - if ( activeStudy() ) { - QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false ); - aTitle += QString( " - [%1]" ).arg( sName ); - } - - desktop()->setCaption( aTitle ); -} - -/*! - Updates windows after close document -*/ -void LightApp_Application::afterCloseDoc() -{ - updateWindows(); - - CAM_Application::afterCloseDoc(); -} - -/*! - Updates actions of active module -*/ -void LightApp_Application::updateModuleActions() -{ - QString modName; - if ( activeModule() ) - modName = activeModule()->moduleName(); - - if ( myActions.contains( modName ) ) - myActions[modName]->setOn( true ); -} - -/*! - Gets current windows. - \param winMap - output current windows map. -*/ -void LightApp_Application::currentWindows( QMap& winMap ) const -{ - winMap.clear(); - if ( !activeStudy() ) - return; - - if ( activeModule() && activeModule()->inherits( "LightApp_Module" ) ) - ((LightApp_Module*)activeModule())->windows( winMap ); - else - defaultWindows( winMap ); -} - -/*! - Gets current view managers. - \param lst - output current view managers list. -*/ -void LightApp_Application::currentViewManagers( QStringList& lst ) const -{ - lst.clear(); - if ( !activeStudy() ) - return; - - if ( activeModule() && activeModule()->inherits( "LightApp_Module" ) ) - ((LightApp_Module*)activeModule())->viewManagers( lst ); - else - defaultViewManagers( lst ); -} - -/*! - Updates windows -*/ -void LightApp_Application::updateWindows() -{ - QMap winMap; - currentWindows( winMap ); - - if ( activeStudy() ) { - for ( QMap::ConstIterator it = winMap.begin(); it != winMap.end(); ++it ) - getWindow( it.key() ); - - loadWindowsGeometry(); - } - - // setWindowShown should be done even if no study is active (open). in this case all open windows - // will be hidden, which is neccessary in this case. - for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) { - - if ( myWindowsVisible.contains( itr.key() ) && - !myWindowsVisible[ itr.key() ] ) - continue; - - setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) ); - } -} - -/*! - Updates view managers -*/ -void LightApp_Application::updateViewManagers() -{ - QStringList lst; - currentViewManagers( lst ); - - for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it ) - getViewManager( *it, true ); -} - -/*! - Loads windows geometry -*/ -void LightApp_Application::loadWindowsGeometry() -{ - bool store = resourceMgr()->booleanValue( "Study", "store_positions", true ); - if( !store ) - return; - - QtxDockAction* dockMgr = 0; - - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - dockMgr = (QtxDockAction*)a; - - if ( !dockMgr ) - return; - - QString modName; - if ( activeModule() ) - modName = activeModule()->name(""); - - QString section = QString( "windows_geometry" ); - if ( !modName.isEmpty() ) - section += QString( "." ) + modName; - - dockMgr->loadGeometry( resourceMgr(), section, false ); - dockMgr->restoreGeometry(); -} - -/*! - Saves windows geometry -*/ -void LightApp_Application::saveWindowsGeometry() -{ - bool store = resourceMgr()->booleanValue( "Study", "store_positions", true ); - if( !store ) - return; - - QtxDockAction* dockMgr = 0; - - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - dockMgr = (QtxDockAction*)a; - - if ( !dockMgr ) - return; - - QString modName; - if ( activeModule() ) - modName = activeModule()->name(""); - - QString section = QString( "windows_geometry" ); - if ( !modName.isEmpty() ) - section += QString( "." ) + modName; - - dockMgr->storeGeometry(); - dockMgr->saveGeometry( resourceMgr(), section, false ); -} - -/*! - Activates windows -*/ -void LightApp_Application::activateWindows() -{ - if ( activeStudy() ) - { - for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) - itr.data()->activate( activeStudy()->id() ); - } -} - -/*! - Adds icon names for modules -*/ -void LightApp_Application::moduleIconNames( QMap& iconMap ) const -{ - iconMap.clear(); - - SUIT_ResourceMgr* resMgr = resourceMgr(); - if ( !resMgr ) - return; - - QStringList modList; - modules( modList, false ); - - for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it ) - { - QString modName = *it; - QString modIntr = moduleName( modName ); - QString modIcon = resMgr->stringValue( modIntr, "icon", QString::null ); - - if ( modIcon.isEmpty() ) - continue; - - if ( SUIT_Tools::extension( modIcon ).isEmpty() ) - modIcon += QString( ".png" ); - - iconMap.insert( modName, modIcon ); - } -} - -/*! - Inserts items in popup, which necessary for current application -*/ -void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title ) -{ - CAM_Application::contextMenuPopup( type, thePopup, title ); - - OB_Browser* ob = objectBrowser(); - if ( !ob || type != ob->popupClientType() ) - return; - - thePopup->insertSeparator(); - thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); -} - -/*! - Create empty study -*/ -void LightApp_Application::createEmptyStudy() -{ - CAM_Application::createEmptyStudy(); - if ( objectBrowser() ) - objectBrowser()->updateTree(); -} - -/*! - Activates module - \param mod - module to be activated -*/ -bool LightApp_Application::activateModule( CAM_Module* mod ) -{ - bool res = CAM_Application::activateModule( mod ); - if ( objectBrowser() ) - objectBrowser()->updateTree(); - return res; -} - -/*! - \return keyborad accelerators manager object -*/ -SUIT_Accel* LightApp_Application::accel() const -{ - return myAccel; -} - -/*! - Removes dead widget container from map -*/ -void LightApp_Application::onWCDestroyed( QObject* ob ) -{ - // remove destroyed widget container from windows map - for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) - { - if ( itr.data() != ob ) - continue; - - int key = itr.key(); - myWindows.remove( key ); - break; - } -} - -/*! - Connects just added view manager -*/ -void LightApp_Application::addViewManager( SUIT_ViewManager* vm ) -{ - connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - this, SLOT( onCloseView( SUIT_ViewManager* ) ) ); - STD_Application::addViewManager( vm ); -} - -/*! - Remove view manager from memory -*/ -void LightApp_Application::removeViewManager( SUIT_ViewManager* vm ) -{ - disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - this, SLOT( onCloseView( SUIT_ViewManager* ) ) ); - STD_Application::removeViewManager( vm ); - delete vm; -} - -/*! - Renames active window of desktop -*/ -void LightApp_Application::onRenameWindow() -{ - if( !desktop() ) - return; - - QWidget* w = desktop()->activeWindow(); - if( !w ) - return; - - bool ok; - QString name = QInputDialog::getText( tr( "TOT_RENAME" ), tr( "PRP_RENAME" ), QLineEdit::Normal, w->caption(), &ok, w ); - if( ok && !name.isEmpty() ) - w->setCaption( name ); -} - -/*! - \return if the library of module exists - \param moduleTitle - title of module -*/ -bool LightApp_Application::isLibExists( const QString& moduleTitle ) const -{ - if( moduleTitle.isEmpty() ) - return false; - - QString lib = moduleLibrary( moduleTitle ); - - //abd: changed libSalomePyQtGUI to SalomePyQtGUI for WIN32 - bool isPythonModule = lib.contains("SalomePyQtGUI"); - - QStringList paths; -#ifdef WIN32 - paths = QStringList::split( ";", ::getenv( "PATH" ) ); -#else - paths = QStringList::split( ":", ::getenv( "LD_LIBRARY_PATH" ) ); -#endif - - bool isLibFound = false; - QStringList::const_iterator anIt = paths.begin(), aLast = paths.end(); - for( ; anIt!=aLast; anIt++ ) - { - QFileInfo inf( Qtx::addSlash( *anIt ) + lib ); - - if( inf.exists() ) - { - isLibFound = true; - break; - } - } - - if ( !isLibFound ) - { - printf( "****************************************************************\n" ); - printf( "* Warning: library %s cannot be found\n", moduleTitle.latin1() ); - printf( "* Module will not be available\n" ); - printf( "****************************************************************\n" ); - } - else if ( !isPythonModule ) - return true; - - if ( isPythonModule ) - { - QString pylib = moduleName( moduleTitle ) + QString(".py"); - QString pylibgui = moduleName( moduleTitle ) + QString("GUI.py"); - - // Check the python library -#ifdef WIN32 - paths = QStringList::split( ";", ::getenv( "PATH" ) ); -#else - paths = QStringList::split( ":", ::getenv( "PYTHONPATH" ) ); -#endif - bool isPyLib = false, isPyGuiLib = false; - QStringList::const_iterator anIt = paths.begin(), aLast = paths.end(); - for( ; anIt!=aLast; anIt++ ) - { - QFileInfo inf( Qtx::addSlash( *anIt ) + pylib ); - QFileInfo infgui( Qtx::addSlash( *anIt ) + pylibgui ); - - if( !isPyLib && inf.exists() ) - isPyLib = true; - - if( !isPyGuiLib && infgui.exists() ) - isPyGuiLib = true; - - if ( isPyLib && isPyGuiLib && isLibFound) - return true; - } - - printf( "****************************************************************\n" ); - printf( "* Warning: python library for %s cannot be found:\n", moduleTitle.latin1() ); - if (!isPyLib) - printf( "* No module named %s\n", moduleName( moduleTitle ).latin1() ); - if (!isPyGuiLib) - printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).latin1() ); - printf( "****************************************************************\n" ); - return true; - } - return false; -} - -/*! - \return default name for an active study -*/ -void LightApp_Application::setDefaultStudyName( const QString& theName ) -{ - QStringList anInfoList; - modules( anInfoList, false ); - - LightApp_Study* aStudy = (LightApp_Study*)activeStudy(); - if( anInfoList.count() == 1 && // to avoid a conflict between different modules - !aStudy->isSaved() ) - { - aStudy->setStudyName( theName ); - updateDesktopTitle(); - } -} - -/*! slot, called on show/hide of a dock window */ -void LightApp_Application::onVisibilityChanged( bool visible ) -{ - const QObject* win = sender(); - - for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) - if ( itr.data() == win ) - { - myWindowsVisible[ itr.key() ] = visible; - return; - } -} - -/*! - Custom event handler -*/ -bool LightApp_Application::event( QEvent* e ) -{ - if( e && e->type()==2000 ) - { - QCustomEvent* ce = ( QCustomEvent* )e; - QString* d = ( QString* )ce->data(); - if( SUIT_MessageBox::warn2(0, tr("WRN_WARNING"), - d ? *d : "", - tr("BUT_OK"), tr("BUT_CANCEL"), 0, 1, 0 )==0 ) - onPreferences(); - if( d ) - delete d; - return true; - } - return CAM_Application::event( e ); -} diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h deleted file mode 100644 index 8f81e404f..000000000 --- a/src/LightApp/LightApp_Application.h +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Application.h -// Created: 6/20/2005 18:39:25 PM -// Author: OCC team -// Copyright (C) CEA 2005 - -#ifndef LIGHTAPP_APPLICATION_H -#define LIGHTAPP_APPLICATION_H - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "LightApp.h" -#include - -class LogWindow; -class OB_Browser; -#ifndef DISABLE_PYCONSOLE - class PythonConsole; -#endif -class STD_Application; -class LightApp_WidgetContainer; -class LightApp_Preferences; -class LightApp_SelectionMgr; -class SUIT_Study; -class SUIT_Accel; -class CAM_Module; - -class QString; -class QWidget; -class QStringList; -class QPixmap; - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*! - Description : Application containing only LightApp module -*/ - -class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application -{ - Q_OBJECT - -public: - typedef enum { WT_ObjectBrowser, -#ifndef DISABLE_PYCONSOLE - WT_PyConsole, -#endif - WT_LogWindow, - WT_User } - WindowTypes; - - enum { MenuWindowId = 6 }; - - enum { RenameId = CAM_Application::UserID, - -#ifndef DISABLE_GLVIEWER - NewGLViewId , -#endif - -#ifndef DISABLE_PLOT2DVIEWER - NewPlot2dId, -#endif - -#ifndef DISABLE_OCCVIEWER - NewOCCViewId, -#endif - -#ifndef DISABLE_VTKVIEWER - NewVTKViewId, -#endif - - PreferencesId, MRUId, UserID }; -public: - LightApp_Application(); - virtual ~LightApp_Application(); - - virtual QString applicationName() const; - virtual QString applicationVersion() const; - - virtual CAM_Module* loadModule( const QString& ); - virtual bool activateModule( const QString& ); - - virtual bool useStudy( const QString& ); - - LightApp_SelectionMgr* selectionMgr() const; - - LogWindow* logWindow(); - OB_Browser* objectBrowser(); -#ifndef DISABLE_PYCONSOLE - PythonConsole* pythonConsole(); -#endif - - virtual void updateObjectBrowser( const bool = true ); - - LightApp_Preferences* preferences() const; - - virtual QString getFileFilter() const; - - virtual QString getFileName( bool open, const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ); - virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ); - virtual QStringList getOpenFileNames( const QString& initial, const QString& filters, - const QString& caption, QWidget* parent ); - - void updateActions(); - - SUIT_ViewManager* getViewManager( const QString&, const bool ); - virtual void addViewManager( SUIT_ViewManager* ); - virtual void removeViewManager( SUIT_ViewManager* ); - virtual SUIT_ViewManager* createViewManager( const QString& vmType ); - - QWidget* getWindow( const int, const int = -1 ); - QWidget* window( const int, const int = -1 ) const; - void addWindow( QWidget*, const int, const int = -1 ); - void removeWindow( const int, const int = -1 ); - - bool isWindowVisible( const int ) const; - void setWindowShown( const int, const bool ); - - virtual void start(); - - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); - - virtual void createEmptyStudy(); - - SUIT_Accel* accel() const; - - void setDefaultStudyName( const QString& theName ); - - static int studyId(); - - virtual bool event( QEvent* ); - -signals: - void studyOpened(); - void studySaved(); - void studyClosed(); - -public slots: - virtual void onHelpContentsModule(); - virtual void onHelpContextModule( const QString&, const QString& ); - virtual void onNewDoc(); - virtual void onOpenDoc(); - virtual void onHelpAbout(); - virtual bool onOpenDoc( const QString& ); - virtual bool onLoadDoc( const QString& ); - -protected: - virtual void createActions(); - virtual void createActionForViewer( const int id, - const int parentId, - const QString& suffix, - const int accel ); - virtual SUIT_Study* createNewStudy(); - virtual QWidget* createWindow( const int ); - virtual void defaultWindows( QMap& ) const; - void defaultViewManagers( QStringList& ) const; - - virtual void setActiveStudy( SUIT_Study* ); - virtual void updateCommandsStatus(); - virtual void onSelectionChanged(); - - virtual void beforeCloseDoc( SUIT_Study* ); - virtual void afterCloseDoc(); - virtual void moduleAdded( CAM_Module* ); - virtual bool activateModule( CAM_Module* = 0 ); - - LightApp_Preferences* preferences( const bool ) const; - virtual void createPreferences( LightApp_Preferences* ); - virtual void preferencesChanged( const QString&, const QString& ); - virtual void savePreferences(); - virtual void updateDesktopTitle(); - -protected slots: - virtual void onDesktopActivated(); - - void onNewWindow(); - void onModuleActivation( QAction* ); - void onCloseView( SUIT_ViewManager* ); - - void onStudyCreated( SUIT_Study* ); - void onStudyOpened( SUIT_Study* ); - void onStudySaved( SUIT_Study* ); - void onStudyClosed( SUIT_Study* ); - - void onWCDestroyed( QObject* ); - -private slots: - void onSelection(); - void onRefresh(); - void onPreferences(); - void onMRUActivated( QString ); - void onPreferenceChanged( QString&, QString&, QString& ); - void onRenameWindow(); - void onVisibilityChanged( bool ); - -protected: - void updateWindows(); - void updateViewManagers(); - void updateModuleActions(); - - void loadWindowsGeometry(); - void saveWindowsGeometry(); - - void updatePreference( const QString&, const QString&, const QString& ); - - QString defaultModule() const; - void currentWindows( QMap& ) const; - void currentViewManagers( QStringList& ) const; - void moduleIconNames( QMap& ) const; - - void activateWindows(); - bool isLibExists( const QString& ) const; - -protected: - typedef QMap ActionMap; - typedef QMap WindowMap; - typedef QMap WindowVisibilityMap; - -protected: - LightApp_Preferences* myPrefs; - LightApp_SelectionMgr* mySelMgr; - ActionMap myActions; - WindowMap myWindows; - WindowVisibilityMap myWindowsVisible; - - SUIT_Accel* myAccel; - - static LightApp_Preferences* _prefs_; - - static int lastStudyId; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/LightApp/LightApp_DataModel.cxx b/src/LightApp/LightApp_DataModel.cxx deleted file mode 100644 index 6c113382a..000000000 --- a/src/LightApp/LightApp_DataModel.cxx +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_DataModel.cxx -// Created: 10/25/2004 10:36:06 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#include "LightApp_DataModel.h" -#include "LightApp_Study.h" -#include "LightApp_RootObject.h" -#include "LightApp_DataObject.h" -#include "LightApp_Module.h" -#include "LightApp_Application.h" - -#include - -#include -#include -#include -#include - -/*! - Constructor -*/ -LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule ) -: CAM_DataModel( theModule ) -{ -} - -/*! - Destructor -*/ -LightApp_DataModel::~LightApp_DataModel() -{ -} - -/*! - Emit opened() -*/ -bool LightApp_DataModel::open( const QString&, CAM_Study* study, QStringList ) -{ - emit opened(); //TODO: is it really needed? to be removed maybe... - return true; -} - -/*! - Emit saved() -*/ -bool LightApp_DataModel::save( QStringList& ) -{ - emit saved(); - return true; -} - -/*! - Emit saved() -*/ -bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& ) -{ - emit saved(); - return true; -} - -/*! - Emit closed() -*/ -bool LightApp_DataModel::close() -{ - emit closed(); - return true; -} - -/*! - Build whole data model tree -*/ -void LightApp_DataModel::build() -{ -} - -/*! - Updates data model presentation in some widgets (for example, in object browser -*/ -void LightApp_DataModel::updateWidgets() -{ - LightApp_Application* app = dynamic_cast( module()->application() ); - if( app ) - app->objectBrowser()->updateTree( 0, false ); -} - -/*! - Default behaviour of data model update for light modules -*/ -void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* ) -{ - LightApp_ModuleObject* modelRoot = dynamic_cast( root() ); - DataObjectList ch; - if( modelRoot ) - { - ch = modelRoot->children(); - for ( DataObjectListIterator it( ch ); it.current(); ++it ) - it.current()->setParent( 0 ); - } - build(); - updateWidgets(); - for( DataObjectListIterator it( ch ); it.current(); ++it ) - it.current()->deleteLater(); -} - -/*! - \return corresponding module -*/ -LightApp_Module* LightApp_DataModel::getModule() const -{ - return dynamic_cast( module() ); -} - -/*! - \return corresponding study -*/ -LightApp_Study* LightApp_DataModel::getStudy() const -{ - LightApp_RootObject* aRoot = dynamic_cast( root()->root() ); - if ( !aRoot ) - return 0; - return aRoot->study(); -} - -/*! - default implementation, always returns false so as not to mask study's isModified() -*/ -bool LightApp_DataModel::isModified() const -{ - return false; -} - -/*! - default implementation, always returns true so as not to mask study's isSaved() -*/ -bool LightApp_DataModel::isSaved() const -{ - return true; -} diff --git a/src/LightApp/LightApp_DataModel.h b/src/LightApp/LightApp_DataModel.h deleted file mode 100644 index c2eb2d6e7..000000000 --- a/src/LightApp/LightApp_DataModel.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_DataModel.h -// Created: 10/25/2004 10:32:33 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#ifndef LIGHTAPP_DATAMODEL_H -#define LIGHTAPP_DATAMODEL_H - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "LightApp.h" -#include "CAM_DataModel.h" - -class LightApp_Module; -class LightApp_Study; -class LightApp_DataObject; - -/*! - Description : Base class of data model -*/ -class LIGHTAPP_EXPORT LightApp_DataModel : public CAM_DataModel -{ - Q_OBJECT - -public: - LightApp_DataModel ( CAM_Module* theModule ); - virtual ~LightApp_DataModel(); - - virtual bool open( const QString&, CAM_Study*, QStringList ); - virtual bool save( QStringList& ); - virtual bool saveAs( const QString&, CAM_Study*, QStringList& ); - virtual bool close(); - - virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 ); - - virtual bool isModified() const; - virtual bool isSaved() const; - - LightApp_Module* getModule() const; - -signals: - void opened(); - void saved(); - void closed(); - -protected: - LightApp_Study* getStudy() const; - virtual void build(); - virtual void updateWidgets(); -}; - -#endif diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx deleted file mode 100644 index a4df6dfa8..000000000 --- a/src/LightApp/LightApp_DataObject.cxx +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_DataObject.h" - -#include "LightApp_Study.h" -#include "LightApp_RootObject.h" - -#include "CAM_DataModel.h" -#include "CAM_Module.h" - -#include -#include -#include - -#include - -/*! - Class: LightApp_DataObject::Key - Level: Internal -*/ -class LightApp_DataObject::Key : public SUIT_DataObjectKey -{ -public: - Key( const QString& ); - virtual ~Key(); - - virtual bool isLess( const SUIT_DataObjectKey* ) const; - virtual bool isEqual( const SUIT_DataObjectKey* ) const; - -private: - QString myEntry; -}; - -/*!Constructor. Initialize by \a entry.*/ -LightApp_DataObject::Key::Key( const QString& entry ) -: SUIT_DataObjectKey(), - myEntry( entry ) -{ -} - -/*!Destructor. Do nothing.*/ -LightApp_DataObject::Key::~Key() -{ -} - -/*!Checks: Is current key less than \a other.*/ -bool LightApp_DataObject::Key::isLess( const SUIT_DataObjectKey* other ) const -{ - Key* that = (Key*)other; - return myEntry < that->myEntry; -} - -/*!Checks: Is current key equal with \a other.*/ -bool LightApp_DataObject::Key::isEqual( const SUIT_DataObjectKey* other ) const -{ - Key* that = (Key*)other; - return myEntry == that->myEntry; -} - -/*!Constructor. Initialize by \a parent*/ -LightApp_DataObject::LightApp_DataObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ), myCompObject( 0 ), myCompDataType( "" ) -{ -} - -/*!Destructor. Do nothing.*/ -LightApp_DataObject::~LightApp_DataObject() -{ -} - -/*!Gets object ID. - *\retval QString - */ -QString LightApp_DataObject::entry() const -{ - return QString::null; -} - -/*!Create and return new key object.*/ -SUIT_DataObjectKey* LightApp_DataObject::key() const -{ - QString str = entry(); - return new Key( str ); -} - -/*!Gets component object. - *\retval SUIT_DataObject. - */ -SUIT_DataObject* LightApp_DataObject::componentObject() const -{ - if ( !myCompObject ) { - SUIT_DataObject* compObj = 0; // for root object - - if ( parent() && parent() == root() ) - compObj = (SUIT_DataObject*)this; // for component-level objects - else - { - compObj = parent(); // for lower level objects - while ( compObj && compObj->parent() != root() ) - compObj = compObj->parent(); - } - LightApp_DataObject* that = (LightApp_DataObject*)this; - that->myCompObject = compObj; - } - return myCompObject; -} - -/*!Get component type.*/ -QString LightApp_DataObject::componentDataType() const -{ - if ( myCompDataType.isEmpty() ) { - SUIT_DataObject* aCompObj = componentObject(); - LightApp_ModuleObject* anObj = dynamic_cast( aCompObj ); - if ( anObj ) { - CAM_DataModel* aModel = anObj->dataModel(); - if ( aModel ) { - LightApp_DataObject* that = (LightApp_DataObject*)this; - that->myCompDataType = aModel->module()->name(); - } - } - } - return myCompDataType; -} - - - -/*!Constructor.Initialize by \a parent.*/ -LightApp_ModuleObject::LightApp_ModuleObject( SUIT_DataObject* parent ) -: CAM_RootObject( parent ), - CAM_DataObject( parent ) -{ -} - -/*!Constructor.Initialize by \a module and parent.*/ -LightApp_ModuleObject::LightApp_ModuleObject( CAM_DataModel* dm, SUIT_DataObject* parent ) -: CAM_RootObject( dm, parent ), - CAM_DataObject( parent ) -{ -} - -/*!Destructor. Do nothing.*/ -LightApp_ModuleObject::~LightApp_ModuleObject() -{ -} - -/*!Returns module name */ -QString LightApp_ModuleObject::name() const -{ - return CAM_RootObject::name(); -} - -/*!Insert new child object to the children list at specified position - *\add component in Study for this module object if it necessary*/ -void LightApp_ModuleObject::insertChild( SUIT_DataObject* theObj, int thePosition ) -{ - CAM_RootObject::insertChild(theObj, thePosition); - - CAM_DataModel* aModel = dataModel(); - - LightApp_RootObject* aRoot = dynamic_cast(parent()); - - if (aRoot) - aRoot->study()->addComponent(aModel); - - -} diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h deleted file mode 100644 index 4d3613dad..000000000 --- a/src/LightApp/LightApp_DataObject.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_DATAOBJECT_H -#define LIGHTAPP_DATAOBJECT_H - -#include "LightApp.h" - -#include "CAM_DataObject.h" -#include "CAM_DataModel.h" -#include "CAM_RootObject.h" - -class LightApp_Study; - -/*!Description : Data Object has empty entry so it's children must redefine metod entry() and return some unique string*/ -// to do : decomment virtual inheritance -class LIGHTAPP_EXPORT LightApp_DataObject : public virtual CAM_DataObject -{ - class Key; - -public: - enum { CT_Value, CT_Entry, CT_IOR, CT_RefEntry }; - -public: - LightApp_DataObject( SUIT_DataObject* = 0 ); - virtual ~LightApp_DataObject(); - - virtual SUIT_DataObjectKey* key() const; - virtual QString entry() const; - - virtual SUIT_DataObject* componentObject() const; - virtual QString componentDataType() const; - -protected: - QString myCompDataType; - SUIT_DataObject* myCompObject; -}; - -/*! - * LightApp_ModuleObject - class for optimized access to DataModel from - * CAM_RootObject.h. - * In modules which will be redefine LightApp_DataObject, LightApp_ModuleObject must be children from rederined DataObject for having necessary properties and children from LightApp_ModuleObject. - */ - -class LIGHTAPP_EXPORT LightApp_ModuleObject : public CAM_RootObject -{ -public: - LightApp_ModuleObject( SUIT_DataObject* = 0 ); - LightApp_ModuleObject ( CAM_DataModel*, SUIT_DataObject* = 0 ); - - virtual ~LightApp_ModuleObject(); - - virtual QString name() const; - virtual void insertChild( SUIT_DataObject*, int thePosition ); -}; - -#endif diff --git a/src/LightApp/LightApp_DataOwner.cxx b/src/LightApp/LightApp_DataOwner.cxx deleted file mode 100644 index 979140ad7..000000000 --- a/src/LightApp/LightApp_DataOwner.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_DataOwner.h" - -#include "LightApp_DataObject.h" - -#ifndef WNT -#include -#define _typeinfo std::type_info -#else -#include -#define _typeinfo type_info -#endif - -#include - -/*!Constructor. Initialize by \a theEntry.*/ -LightApp_DataOwner::LightApp_DataOwner( const QString& theEntry ) -: myEntry( theEntry ) -{ -} - -LightApp_DataOwner::LightApp_DataOwner( const LightApp_DataObject* obj ) -: myEntry( obj ? obj->entry() : QString::null ) -{ -} - -#ifndef DISABLE_SALOMEOBJECT -/*!Constructor. Initialize by \a SALOME_InteractiveObject.*/ -LightApp_DataOwner::LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ) -: myEntry( !theIO.IsNull() ? theIO->getEntry() : "" ), -myIO( theIO ) -{ -} -#endif - -/*!Destructor. Do nothing.*/ -LightApp_DataOwner::~LightApp_DataOwner() -{ -} - -/*!Checks: Is current data owner equal \a obj.*/ -bool LightApp_DataOwner::isEqual( const SUIT_DataOwner& obj ) const -{ - const LightApp_DataOwner* other = dynamic_cast( &obj ); - return other && entry() == other->entry(); -} - -bool LightApp_DataOwner::isLess( const SUIT_DataOwner& obj ) const -{ - const LightApp_DataOwner* other = dynamic_cast( &obj ); - return other && entry() < other->entry(); -} - -/*!Gets entry.*/ -QString -LightApp_DataOwner -::entry() const -{ - return myEntry; -} - -#ifndef DISABLE_SALOMEOBJECT -/*!Gets SALOME_InteractiveObject.*/ -const Handle(SALOME_InteractiveObject)& -LightApp_DataOwner -::IO() const -{ - return myIO; -} -#endif diff --git a/src/LightApp/LightApp_DataOwner.h b/src/LightApp/LightApp_DataOwner.h deleted file mode 100644 index 989e30c73..000000000 --- a/src/LightApp/LightApp_DataOwner.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LIGHTAPP_DATAOWNER_H -#define LIGHTAPP_DATAOWNER_H - -#include "LightApp.h" -#include "SUIT_DataOwner.h" - -#ifndef DISABLE_SALOMEOBJECT - #include "SALOME_InteractiveObject.hxx" -#endif - -class LightApp_DataObject; - -/*! - This class provide data owner objects. -*/ -class LIGHTAPP_EXPORT LightApp_DataOwner : public SUIT_DataOwner -{ -public: -#ifndef DISABLE_SALOMEOBJECT - LightApp_DataOwner( const Handle(SALOME_InteractiveObject)& theIO ); -#endif - LightApp_DataOwner( const LightApp_DataObject* ); - LightApp_DataOwner( const QString& ); - virtual ~LightApp_DataOwner(); - - virtual bool isEqual( const SUIT_DataOwner& ) const; - virtual bool isLess( const SUIT_DataOwner& ) const; - -#ifndef DISABLE_SALOMEOBJECT - const Handle(SALOME_InteractiveObject)& IO() const; -#endif - QString entry() const; - -private: - QString myEntry; -#ifndef DISABLE_SALOMEOBJECT - Handle(SALOME_InteractiveObject) myIO; -#endif -}; - -typedef SMART(LightApp_DataOwner) LightApp_DataOwnerPtr; - -#endif diff --git a/src/LightApp/LightApp_DataSubOwner.cxx b/src/LightApp/LightApp_DataSubOwner.cxx deleted file mode 100644 index 80c7d13a3..000000000 --- a/src/LightApp/LightApp_DataSubOwner.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_DataSubOwner.h" - -#include "LightApp_DataObject.h" - -#ifdef WNT -#include -#endif - -/*!Constructor.Initialize by \a entry and \a index*/ -LightApp_DataSubOwner::LightApp_DataSubOwner( const QString& entry, const int index ) -: LightApp_DataOwner( entry ), -myIndex( index ) -{ -} - -/*!Destructor. Do nothing.*/ -LightApp_DataSubOwner::~LightApp_DataSubOwner() -{ -} - -/*!Checks: Is current data sub owner equal \a obj.*/ -bool LightApp_DataSubOwner::isEqual( const SUIT_DataOwner& obj ) const -{ - if (LightApp_DataOwner::isEqual(obj)) { - const LightApp_DataSubOwner* other = dynamic_cast( &obj ); - return other && index() == other->index(); - } - return false; -} - -/*!Checks: Is current data sub owner less \a obj.*/ -bool LightApp_DataSubOwner::isLess( const SUIT_DataOwner& obj ) const -{ - const LightApp_DataSubOwner* other = dynamic_cast( &obj ); - if(other && entry() == other->entry()){ - return index() < other->index(); - } - return other && entry() < other->entry(); -} - -/*!Gets index.*/ -int LightApp_DataSubOwner::index() const -{ - return myIndex; -} diff --git a/src/LightApp/LightApp_DataSubOwner.h b/src/LightApp/LightApp_DataSubOwner.h deleted file mode 100644 index 9b21d18a8..000000000 --- a/src/LightApp/LightApp_DataSubOwner.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LIGHTAPP_DATASUBOWNER_H -#define LIGHTAPP_DATASUBOWNER_H - -#include -#include - -/*! - Class provide sub owner. - */ -class LIGHTAPP_EXPORT LightApp_DataSubOwner : public LightApp_DataOwner -{ -public: - LightApp_DataSubOwner( const QString&, const int ); - virtual ~LightApp_DataSubOwner(); - - virtual bool isEqual( const SUIT_DataOwner& ) const; - virtual bool isLess( const SUIT_DataOwner& obj ) const; - int index() const; - -private: - int myIndex; -}; - -#endif diff --git a/src/LightApp/LightApp_Dialog.cxx b/src/LightApp/LightApp_Dialog.cxx deleted file mode 100644 index 27219f5f1..000000000 --- a/src/LightApp/LightApp_Dialog.cxx +++ /dev/null @@ -1,906 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Dialog.cxx -// Author: Alexander SOLOVYOV - -#include -#include - -#include -#include -#include - -/*! - Constructor -*/ -LightApp_Dialog::LightApp_Dialog( QWidget* parent, const char* name, bool modal, - bool allowResize, const int f, WFlags wf ) -: QtxDialog( parent, name, modal, allowResize, f, wf ), - myIsExclusive( true ), - myIsBusy( false ) -{ - setObjectPixmap( "LightApp", tr( "ICON_SELECT" ) ); -} - -/*! - Destructor -*/ -LightApp_Dialog::~LightApp_Dialog() -{ -} - -/*! - Show dialog -*/ -void LightApp_Dialog::show() -{ - QtxDialog::show(); -} - -/*! - \return isExclusive status of selection buttons -*/ -bool LightApp_Dialog::isExclusive() const -{ - return myIsExclusive; -} - -/*! - Updates "on" state of buttons according to special button - \param _id - id of special button (if it is -1, then first selected button will be treated as special) -*/ -void LightApp_Dialog::updateButtons( const int _id ) -{ - if( !myIsExclusive ) - return; - - int id = _id; - - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QToolButton* but = (QToolButton*)anIt.data().myBtn; - if( but && but->isOn() ) - { - if( id==-1 ) - id = anIt.key(); - - if( anIt.key()!=id ) - but->setOn( false ); - } - } -} - -/*! - Sets isExclusive status of selection buttons - \param ex - new value of isExclusive status -*/ -void LightApp_Dialog::setExclusive( const bool ex ) -{ - myIsExclusive = ex; - updateButtons(); -} - -/*! - Shows object selection widget - \param id - identificator of object selection widget -*/ -void LightApp_Dialog::showObject( const int id ) -{ - setObjectShown( id, true ); -} - -/*! - Hides object selection widget - \param id - identificator of object selection widget -*/ -void LightApp_Dialog::hideObject( const int id ) -{ - setObjectShown( id, false ); -} - -/*! - Shows/hides object selection widget - \param id - identificator of object selection widget - \param shown - if it is true, widget will be shown -*/ -void LightApp_Dialog::setObjectShown( const int id, const bool shown ) -{ - if( myObjects.contains( id ) && isObjectShown( id )!=shown ) - { - Object& obj = myObjects[ id ]; - obj.myEdit->setShown( shown ); - obj.myBtn->setShown( shown ); - obj.myLabel->setShown( shown ); - if( !shown ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); - } -} - -/*! - \return isShown state of object selection widget - \param id - identificator of object selection widget -*/ -bool LightApp_Dialog::isObjectShown( const int id ) const -{ - return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown(); -} - -/*! - Change enable state of object selection widget - \param id - identificator of object selection widget - \param en - new value of enable state -*/ -void LightApp_Dialog::setObjectEnabled( const int id, const bool en ) -{ - if( myObjects.contains( id ) && isObjectEnabled( id )!=en ) - { - Object& obj = myObjects[ id ]; - obj.myEdit->setEnabled( en ); - obj.myBtn->setEnabled( en ); -// obj.myLabel->setEnabled( en ); - if( !en ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); - } -} - -/*! - \return enable state of object selection widget - \param id - identificator of object selection widget -*/ -bool LightApp_Dialog::isObjectEnabled( const int id ) const -{ - return myObjects.contains( id ) && myObjects[ id ].myEdit->isEnabled(); -} - -/*! - Passes to all active widgets name, type and id of selected object - \param name - name of selected object - \param type - type of selected object - \param id - id of selected object - \param update - is need to update selection description string -*/ -void LightApp_Dialog::selectObject( const QString& name, const int type, const QString& id, const bool update ) -{ - QStringList names; names.append( name ); - TypesList types; types.append( type ); - QStringList ids; ids.append( id ); - selectObject( names, types, ids, update ); -} - -/*! - Passes to all active widgets names, types and ids of selected objects - \param _names - names of selected objects - \param _types - types of selected objects - \param _ids - ids of selected objects - \param update - is need to update selection description string -*/ -void LightApp_Dialog::selectObject( const QStringList& _names, - const TypesList& _types, - const QStringList& _ids, - const bool update ) -{ - ObjectMap::iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myBtn->isOn() ) - selectObject( anIt.key(), _names, _types, _ids, update ); -} - -/*! - \return true if widget has selection - \param id - identificator of object selection widget -*/ -bool LightApp_Dialog::hasSelection( const int id ) const -{ - return myObjects.contains( id ) && !myObjects[ id ].myIds.isEmpty(); -} - -/*! - Clears selection of widget - \param id - identificator of object selection widget -*/ -void LightApp_Dialog::clearSelection( const int id ) -{ - if( id==-1 ) - { - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - clearSelection( anIt.key() ); - } - - else if( myObjects.contains( id ) ) - { - myObjects[ id ].myIds.clear(); - myObjects[ id ].myTypes.clear(); - myObjects[ id ].myNames.clear(); - - myObjects[ id ].myEdit->setText( QString::null ); - emit selectionChanged( id ); - } -} - -/*! - \return object selection widget - \param theId - identificator of object selection widget - \param theWgId may be "Label", "Btn" or "Control" -*/ -QWidget* LightApp_Dialog::objectWg( const int theId, const int theWgId ) const -{ - QWidget* aResWg = 0; - if( myObjects.contains( theId ) ) - { - if ( theWgId == Label ) - aResWg = myObjects[ theId ].myLabel; - else if ( theWgId == Btn ) - aResWg = myObjects[ theId ].myBtn; - else if ( theWgId == Control ) - aResWg = myObjects[ theId ].myEdit; - } - return aResWg; -} - -/*! - \return object selection widget text - \param theId - identificator of object selection widget -*/ -QString LightApp_Dialog::objectText( const int theId ) const -{ - return myObjects.contains( theId ) ? myObjects[ theId ].myEdit->text() : ""; -} - -/*! - Sets object selection widget text - \param theId - identificator of object selection widget - \param theText - new text -*/ -void LightApp_Dialog::setObjectText( const int theId, const QString& theText ) -{ - if ( myObjects.contains( theId ) ) - myObjects[ theId ].myEdit->setText( theText ); -} - -/*! - \return objects selected by widget - \param id - identificator of object selection widget - \param list - list to be filled by selected objects -*/ -void LightApp_Dialog::selectedObject( const int id, QStringList& list ) const -{ - if( myObjects.contains( id ) ) - list = myObjects[ id ].myIds; -} - -/*! - \return selected object id - \param id - identificator of object selection widget -*/ -QString LightApp_Dialog::selectedObject( const int id ) const -{ - if ( myObjects.contains( id ) && myObjects[ id ].myIds.count() > 0 ) - return myObjects[ id ].myIds.first(); - else - return ""; -} - -/*! - \return all selected objects - \param objs - map: widget id -> string id to be filled with selected objects -*/ -void LightApp_Dialog::objectSelection( SelectedObjects& objs ) const -{ - //objs.clear(); - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QStringList ids; - selectedObject( anIt.key(), ids ); - if( !ids.isEmpty() ) - objs.insert( anIt.key(), ids ); - } -} - -/*! - Creates object selection widget - \return id - \label - label text - \parent - parent object - \id - proposed id for widget (if it is less than 0, the free id will be used) -*/ -int LightApp_Dialog::createObject( const QString& label, QWidget* parent, const int id ) -{ - int nid = id; - if( nid<0 ) - for( nid=0; myObjects.contains( nid ); nid++ ); - - if( !myObjects.contains( nid ) ) - { - QLabel* lab = new QLabel( label, parent ); - myObjects[ nid ].myLabel = lab; - - QToolButton* but = new QToolButton( parent ); - but->setIconSet( QIconSet( myPixmap ) ); - but->setToggleButton( true ); - but->setMaximumWidth( but->height() ); - but->setMinimumWidth( but->height() ); - connect( but, SIGNAL( toggled( bool ) ), this, SLOT( onToggled( bool ) ) ); - myObjects[ nid ].myBtn = but; - - QLineEdit* ne = new QLineEdit( parent ); - ne->setReadOnly( true ); - ne->setMinimumWidth( 150 ); - connect( ne, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); - myObjects[ nid ].myEdit = ne; - - myObjects[ nid ].myNI = OneNameOrCount; - } - return nid; -} - -/*! - Changes label of object selection widget - \param id - identificator of object selection widget - \param label - new text of label -*/ -void LightApp_Dialog::renameObject( const int id, const QString& label ) -{ - if( myObjects.contains( id ) ) - myObjects[ id ].myLabel->setText( label ); -} - -/*! - Sets possible types for widget - \param id - identificator of object selection widget - \param type1,... - type -*/ -void LightApp_Dialog::setObjectType( const int id, const int type1, ... ) -{ - TypesList types; - - const int* tt = &type1; - while( *tt>=0 ) - { - types.append( *tt ); - tt++; - } - - setObjectType( id, types ); -} - -/*! - Sets possible types for widget - \param id - identificator of object selection widget - \param list - list of possible types -*/ -void LightApp_Dialog::setObjectType( const int id, const TypesList& list ) -{ - if( !myObjects.contains( id ) ) - return; - - TypesList& internal = myObjects[ id ].myPossibleTypes; - - QMap types; - TypesList::const_iterator anIt = list.begin(), - aLast = list.end(); - for( ; anIt!=aLast; anIt++ ) - types.insert( *anIt, 0 ); - - - internal.clear(); - QMap::const_iterator aMIt = types.begin(), - aMLast = types.end(); - for( ; aMIt!=aMLast; aMIt++ ) - internal.append( aMIt.key() ); - - updateObject( id ); -} - -/*! - Adds new possible types to object selection widget - \param id - identificator of object selection widget - \param type1, ... - new types -*/ -void LightApp_Dialog::addObjectType( const int id, const int type1, const int, ... ) -{ - TypesList types; objectTypes( id, types ); - - const int* tt = &type1; - while( *tt>=0 ) - { - types.append( *tt ); - tt++; - } - - setObjectType( id, types ); -} - -/*! - Adds new possible types to object selection widget - \param id - identificator of object selection widget - \param list - new types -*/ -void LightApp_Dialog::addObjectType( const int id, const TypesList& list ) -{ - TypesList types = list; objectTypes( id, types ); - setObjectType( id, types ); -} - -/*! - Adds new possible type to object selection widget - \param id - identificator of object selection widget - \param type - new type -*/ -void LightApp_Dialog::addObjectType( const int id, const int type ) -{ - TypesList types; objectTypes( id, types ); - types.append( type ); - setObjectType( id, types ); -} - -/*! - Clears list of possibles types for object selection widget - \param id - identificator of object selection widget -*/ -void LightApp_Dialog::removeObjectType( const int id ) -{ - TypesList types; - setObjectType( id, types ); -} - -/*! - Removes types from list of possibles for object selection widget - \param id - identificator of object selection widget - \param list - list of types to be removed -*/ -void LightApp_Dialog::removeObjectType( const int id, const TypesList& list ) -{ - if( !myObjects.contains( id ) ) - return; - - TypesList& internal = myObjects[ id ].myPossibleTypes; - - QMap types; - TypesList::const_iterator anIt = internal.begin(), - aLast = internal.end(); - for( ; anIt!=aLast; anIt++ ) - types.insert( *anIt, 0 ); - anIt = list.begin(); aLast = list.end(); - for( ; anIt!=aLast; anIt++ ) - types.remove( *anIt ); - - - internal.clear(); - QMap::const_iterator aMIt = types.begin(), - aMLast = types.end(); - for( ; aMIt!=aMLast; aMIt++ ) - internal.append( aMIt.key() ); - - updateObject( id ); -} - -/*! - Removes type from list of possibles for object selection widget - \param id - identificator of object selection widget - \param type - type to be removed -*/ -void LightApp_Dialog::removeObjectType( const int id, const int type ) -{ - TypesList list; list.append( type ); - removeObjectType( id, list ); -} - -/*! - \return true if widget has such type - \param id - identificator of object selection widget - \param type - type to be checked -*/ -bool LightApp_Dialog::hasObjectType( const int id, const int type ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myPossibleTypes.contains( type ); - else - return false; -} - -/*! - Returns list of possible types for widget - \param id - identificator of object selection widget - \param list - list to be filled with possible types -*/ -void LightApp_Dialog::objectTypes( const int id, TypesList& list ) const -{ - if( myObjects.contains( id ) ) - { - TypesList::const_iterator anIt = myObjects[ id ].myPossibleTypes.begin(), - aLast = myObjects[ id ].myPossibleTypes.end(); - for( ; anIt!=aLast; anIt++ ) - list.append( *anIt ); - } -} - -/*! - SLOT: called if selection button is clicked -*/ -void LightApp_Dialog::onToggled( bool on ) -{ - QButton* but = ( QButton* )sender(); - int id = -1; - - if( !but ) - return; - - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast && id==-1; anIt++ ) - if( anIt.data().myBtn==but ) - id = anIt.key(); - - if( id!=-1 ) - if( on ) - { - updateButtons( id ); - emit objectActivated( id ); - } - else - emit objectDeactivated( id ); -} - -/*! - Updates selection description of widget - \param id - identificator of object selection widget - \param emit_signal - if it is true, the signal "selection changed" is emitted -*/ -void LightApp_Dialog::updateObject( const int id, bool emit_signal ) -{ - if( hasSelection( id ) ) - { - Object& obj = myObjects[ id ]; - filterTypes( id, obj.myNames, obj.myTypes, obj.myIds ); - obj.myEdit->setText( selectionDescription( obj.myNames, obj.myTypes, obj.myNI ) ); - if( emit_signal ) - emit selectionChanged( id ); - } -} - -/*! - Finds in list possible types - \param id - identificator of object selection widget - \param names - list of selected objects names - \param types - list of selected objects types - \param ids - list of selected objects ids -*/ -void LightApp_Dialog::filterTypes( const int id, QStringList& names, TypesList& types, QStringList& ids ) const -{ - if( !myObjects.contains( id ) ) - return; - - const Object& obj = myObjects[ id ]; - if( obj.myPossibleTypes.isEmpty() ) - return; - - QStringList new_names, new_ids; - TypesList new_types; - - TypesList::const_iterator anIt1 = types.begin(), - aLast = types.end(); - QStringList::const_iterator anIt2 = names.begin(), - anIt3 = ids.begin(); - for( ; anIt1!=aLast; anIt1++, anIt2++, anIt3++ ) - if( obj.myPossibleTypes.contains( *anIt1 ) ) - { - if( new_types.count()==1 && !multipleSelection( id ) ) - break; - - new_names.append( *anIt2 ); - new_types.append( *anIt1 ); - new_ids.append( *anIt3 ); - } - names = new_names; - types = new_types; - ids = new_ids; -} - -/*! - \return global resource manager -*/ -SUIT_ResourceMgr* LightApp_Dialog::resMgr() const -{ - return SUIT_Session::session()->resourceMgr(); -} - -/*! - Sets pixmap for all object selection button - \param p - image -*/ -void LightApp_Dialog::setObjectPixmap( const QPixmap& p ) -{ - myPixmap = p; - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - ( ( QToolButton* )anIt.data().myBtn )->setIconSet( p ); -} - -/*! - Sets pixmap all for object selection button - \param section - name of section of resource manager - \param file - name of file -*/ -void LightApp_Dialog::setObjectPixmap( const QString& section, const QString& file ) -{ - SUIT_ResourceMgr* mgr = resMgr(); - if( mgr ) - setObjectPixmap( mgr->loadPixmap( section, file ) ); -} - -/*! - \return true, if it is enable multiple selection - \param id - identificator of object selection widget -*/ -bool LightApp_Dialog::multipleSelection( const int id ) const -{ - return nameIndication( id )!=OneName; -} - -/*! - \return type of name indication - \param id - identificator of object selection widget -*/ -LightApp_Dialog::NameIndication LightApp_Dialog::nameIndication( const int id ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myNI; - else - return OneNameOrCount; -} - -/*! - Sets type of name indication - \param id - identificator of object selection widget - \param ni - new type of name indication -*/ -void LightApp_Dialog::setNameIndication( const int id, const NameIndication ni ) -{ - if( id==-1 ) - { - ObjectMap::iterator anIt = myObjects.begin(), - aNext, - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - anIt.data().myNI = ni; - setReadOnly( anIt.key(), isReadOnly( anIt.key() ) ); - aNext = anIt; aNext++; - updateObject( anIt.key(), aNext==aLast ); - } - } - else if( myObjects.contains( id ) ) - { - myObjects[ id ].myNI = ni; - setReadOnly( id, isReadOnly( id ) ); - updateObject( id, true ); - } -} - -/*! - \return string representation of selection by selection data - \param names - list of selected objects names - \param types - list of selected objects types - \param ni - type of name indication -*/ -QString LightApp_Dialog::selectionDescription( const QStringList& names, const TypesList& types, const NameIndication ni ) const -{ - if( names.count()!=types.count() ) - return "LightApp_Dialog::selectionDescription(): Error!!!"; - - if( names.isEmpty() ) - return QString::null; - - switch( ni ) - { - case OneName: - return names.first(); - break; - - case OneNameOrCount: - if( names.count()==1 ) - return names.first(); - else - return countOfTypes( types ); - break; - - case ListOfNames: - return names.join( " " ); - break; - - case Count: - return countOfTypes( types ); - break; - }; - return QString::null; -} - -/*! - \return string representation of count of types - \param types - list of types -*/ -QString LightApp_Dialog::countOfTypes( const TypesList& types ) const -{ - QMap typesCount; - QStringList typeCount; - - TypesList::const_iterator anIt = types.begin(), - aLast = types.end(); - for( ; anIt!=aLast; anIt++ ) - if( typesCount.contains( *anIt ) ) - typesCount[ *anIt ]++; - else - typesCount[ *anIt ] = 1; - - QMap::const_iterator aMIt = typesCount.begin(), - aMLast = typesCount.end(); - for( ; aMIt!=aMLast; aMIt++ ) - typeCount.append( QString( "%1 %2" ).arg( aMIt.data() ).arg( typeName( aMIt.key() ) ) ); - - return typeCount.join( ", " ); -} - -/*! - \return reference to type name - \param type - integer id of type -*/ -QString& LightApp_Dialog::typeName( const int type ) -{ - return myTypeNames[ type ]; -} - -/*! - \return const reference to type name - \param type - integer id of type -*/ -const QString& LightApp_Dialog::typeName( const int type ) const -{ - return myTypeNames[ type ]; -} - - -/*! - Activates object selection widget - \param id - identificator of object selection widget -*/ -void LightApp_Dialog::activateObject( const int theId ) -{ - if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() ) - myObjects[ theId ].myBtn->toggle(); -} - -/*! - Deactivates all object selection widgets -*/ -void LightApp_Dialog::deactivateAll() -{ - ObjectMap::iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - { - QToolButton* btn = ( QToolButton* )anIt.data().myBtn; - btn->setOn( false ); - } -} - -/*! - Passes to widget name, type and id of selected object - \param id - identificator of object selection widget - \param name - name of selected object - \param type - type of selected object - \param selid - id of selected object - \param update - is need to update selection description string -*/ -void LightApp_Dialog::selectObject( const int id, const QString& name, const int type, const QString& selid, const bool update ) -{ - QStringList names; names.append( name ); - TypesList types; types.append( type ); - QStringList ids; ids.append( selid ); - selectObject( id, names, types, ids, update ); -} - -/*! - Passes to widget names, types and ids of selected objects - \param id - identificator of object selection widget - \param _names - names of selected object - \param _types - types of selected object - \param _ids - ids of selected object - \param update - is need to update selection description string -*/ -void LightApp_Dialog::selectObject( const int id, const QStringList& _names, const TypesList& _types, - const QStringList& _ids, const bool update ) -{ - if( !myObjects.contains( id ) ) - return; - - QStringList names = _names, ids = _ids; - TypesList types = _types; - - filterTypes( id, names, types, ids ); - - Object& obj = myObjects[ id ]; - if( update ) - obj.myEdit->setText( selectionDescription( names, types, obj.myNI ) ); - obj.myTypes = types; - obj.myIds = ids; - obj.myNames = names; - - emit selectionChanged( id ); -} - -/*! - Sets read only state of object selection line edit - \param id - identificator of object selection widget - \param ro - new read only state -*/ -void LightApp_Dialog::setReadOnly( const int id, const bool ro ) -{ - if( myObjects.contains( id ) ) - myObjects[ id ].myEdit->setReadOnly( nameIndication( id )==ListOfNames || nameIndication( id )==OneName ? ro : true ); -} - -/*! - \return read only state of object selection line edit - \param id - identificator of object selection widget -*/ -bool LightApp_Dialog::isReadOnly( const int id ) const -{ - if( myObjects.contains( id ) ) - return myObjects[ id ].myEdit->isReadOnly(); - else - return true; -} - -/*! - SLOT: called if text of object selection line edit is changed -*/ -void LightApp_Dialog::onTextChanged( const QString& text ) -{ - if( myIsBusy ) - return; - - myIsBusy = true; - - if( sender() && sender()->inherits( "QLineEdit" ) ) - { - QLineEdit* edit = ( QLineEdit* )sender(); - int id = -1; - ObjectMap::const_iterator anIt = myObjects.begin(), - aLast = myObjects.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myEdit == edit ) - id = anIt.key(); - - if( id>=0 && !isReadOnly( id ) ) - { - QStringList list = QStringList::split( " ", text ); - emit objectChanged( id, list ); - } - } - - myIsBusy = false; -} diff --git a/src/LightApp/LightApp_Dialog.h b/src/LightApp/LightApp_Dialog.h deleted file mode 100644 index 6e3b3b8a0..000000000 --- a/src/LightApp/LightApp_Dialog.h +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Dialog.h -// Author: Alexander SOLOVYOV - -#ifndef LIGHTAPP_DIALOG_H -#define LIGHTAPP_DIALOG_H - -#include "LightApp.h" -#include - -#include -#include -#include - -class QLineEdit; -class QButton; -class QLabel; - -class SUIT_ResourceMgr; - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -/*! - \class LightApp_Dialog - Base class for all LightApp dialogs. - Provides standard widget for object selection: line edit, button; - it is necessary to call corresponding methods on selection change. - Standard dialog provides filtering, selection string representation, - possibility to indicate necessary selection by text with list of ids. -*/ -class LIGHTAPP_EXPORT LightApp_Dialog : public QtxDialog -{ - Q_OBJECT - -public: - typedef QValueList TypesList; - typedef QMap SelectedObjects; - - enum ObjectWg - { - Label = 0x00000001, - Btn = 0x00000002, - Control = 0x00000004 - }; - - typedef enum - { - OneName, // " is shown - ListOfNames, //! list of all names is shown - Count //! In every case " " is shown - - } NameIndication; - //! The enumeration describing how names of selected objects will be shown in line edit - //! For more details see above - -public: - LightApp_Dialog( QWidget* = 0, const char* = 0, bool = false, - bool = false, const int = Standard, WFlags = 0 ); - virtual ~LightApp_Dialog(); - - virtual void show(); - - //! Check if buttons is exclusive (as radiobuttons) - bool isExclusive() const; - - //! Set exclusive state - void setExclusive( const bool ); - - //! Check if operation according to dialog will be resumed automatically when mouse enter the dialog - bool isAutoResumed() const; - - //! Set auto resumed state - void setAutoResumed( const bool ); - - //! Show widgets corresponding to id - void showObject( const int ); - - //! Hide widgets corresponding to id - void hideObject( const int ); - - //! Change the shown state of widgets corresponding to id - void setObjectShown( const int, const bool ); - - //! Check the shown state - bool isObjectShown( const int ) const; - - //! Change the enabled state of widgets corresponding to id - void setObjectEnabled( const int, const bool ); - - //! Check the enabled state - bool isObjectEnabled( const int ) const; - - //! Get widget of object (see ObjectWg enumeration) - QWidget* objectWg( const int theId, const int theWgId ) const; - - //! Pass to all active widgets name, type and id of selected object - void selectObject( const QString&, const int, const QString&, const bool = true ); - - /*! - Pass to all active widgets list of names, types and ids of selected objects - Every active widget filters list and accept only objects with possible types - */ - void selectObject( const QStringList&, const TypesList&, const QStringList&, const bool = true ); - - //! Get text of object's control - QString objectText( const int ) const; - - //! Set text of object's control - void setObjectText( const int, const QString& ); - - //! Select in certain widget avoiding check if there is active widget - void selectObject( const int, const QString&, const int, const QString&, const bool = true ); - void selectObject( const int, const QStringList&, const TypesList&, const QStringList&, const bool = true ); - - //! Check if certain widget has selection - bool hasSelection( const int ) const; - - //! Clear selection in widgets. If parameter is -1, then selection in all widgets will be cleared - void clearSelection( const int = -1 ); - - //! Get ids list of object selected in certain widget - void selectedObject( const int, QStringList& ) const; - - //! Get ids list of object selected in certain widget - QString selectedObject( const int ) const; - - //! Get map "widget id -> ids list" - void objectSelection( SelectedObjects& ) const; - - //! Activate object selection button - void activateObject( const int ); - - //! Set all object selection buttons to inactive state - void deactivateAll(); - -signals: - //! selection in certain widget is changed - void selectionChanged ( int ); - - //! selection in certain widget is on - void objectActivated ( int ); - - //! selection in certain widget is off - void objectDeactivated( int ); - - /* - text representation of selection is changed - it is emitted only if "read only" state of line edit is false - */ - void objectChanged( int, const QStringList& ); - -protected: - //! Finds and returns resource manager - SUIT_ResourceMgr* resMgr() const; - - /*! Create label, button and line edit for object selection - * If passed id is negative, then id will be calculated automatically (first free id) - * Returns the same id (if id>=0) or calculated - */ - int createObject ( const QString&, QWidget*, const int = -1 ); - - //! Set pixmap as icon for all selection buttons - void setObjectPixmap ( const QPixmap& ); - - //! Load pixmap with section, name using resource manager and set as icon for all selection buttons - void setObjectPixmap ( const QString&, const QString& ); - - //! Change label - void renameObject ( const int, const QString& ); - - //! Set possible types for certain id. The list of arguments must be finished by negative integer - void setObjectType ( const int, const int, ... ); - - //! Set list as possible types for object selection - void setObjectType ( const int, const TypesList& ); - - /*! - Add types to list of possible types - The list of arguments must be finished by negative integer - */ - void addObjectType ( const int, const int, const int, ... ); - - //! Add types to list of possible types - void addObjectType ( const int, const TypesList& ); - - //! Add type to list of possible types - void addObjectType ( const int, const int ); - - //! Clear list of possible types (it means, that all types are welcome) - void removeObjectType( const int ); - - //! Remove types in list from list of possible types - void removeObjectType( const int, const TypesList& ); - - //! Remove a type from list of possible types - void removeObjectType( const int, const int ); - - //! Check if list of possible types contains this one - bool hasObjectType ( const int, const int ) const; - - //! Return list of possible types - void objectTypes ( const int, TypesList& ) const; - - //!Change and get type name for indicating in selection widget - QString& typeName( const int ); - const QString& typeName( const int ) const; - - //! Create string contains selection list by list of names, list of types and current name indication state - virtual QString selectionDescription( const QStringList&, const TypesList&, const NameIndication ) const; - - //! Create string by pattern " " for current list of types - virtual QString countOfTypes( const TypesList& ) const; - - //! Get and set name indication for certain widget - NameIndication nameIndication( const int ) const; - void setNameIndication( const int, const NameIndication ); - - //! Check using name indication if multiple selection in possible - bool multipleSelection( const int ) const; - - //! Set the "read only" state of object selection line edit - //! The "read only" will be false only if name indication is ListOfNames - void setReadOnly( const int, const bool ); - - //! Check the "read only" state of object selection line edit - bool isReadOnly( const int ) const; - -private slots: - //! emits if the object selection button changes state - void onToggled( bool ); - - //! text in some line edit is changed - void onTextChanged( const QString& ); - -private: - /*! - If buttons are exclusive, set to "off" all buttons except one with id - If id=-1, then all buttons, except first with "on" state, will be set to "off" - */ - void updateButtons( const int = -1 ); - - /*! - Filter types and update selection string in line edit - If bool is true, then signal is emitted - */ - void updateObject( const int, bool = true ); - - //! Remove from list not possible types and remove from names and ids lists the corresponding items - void filterTypes( const int, QStringList&, TypesList&, QStringList& ) const; - -private: - typedef struct - { - QLineEdit* myEdit; - QButton* myBtn; - QLabel* myLabel; - QStringList myNames, myIds; - TypesList myTypes, myPossibleTypes; - NameIndication myNI; - - } Object; - - typedef QMap ObjectMap; - -private: - ObjectMap myObjects; - - QMap myTypeNames; - bool myIsExclusive, myIsBusy; - QPixmap myPixmap; -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/LightApp/LightApp_Displayer.cxx b/src/LightApp/LightApp_Displayer.cxx deleted file mode 100644 index 0845d5cc9..000000000 --- a/src/LightApp/LightApp_Displayer.cxx +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_Displayer.h" -#include "LightApp_Application.h" -#include "LightApp_Module.h" - -#include - -#include -#include -#include -#include -#include - -#include -#ifndef DISABLE_SALOMEOBJECT - #include "SALOME_InteractiveObject.hxx" -#endif - -/*! - Default constructor -*/ -LightApp_Displayer::LightApp_Displayer() -{ -} - -/*! - Destructor -*/ -LightApp_Displayer::~LightApp_Displayer() -{ -} - -/*! - Displays object in view - \param entry - object entry - \param updateViewer - is it necessary to update viewer - \param theViewFrame - view -*/ -void LightApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame ) -{ - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - if ( vf ) - { - SALOME_Prs* prs = buildPresentation( entry, vf ); - - if ( prs ) - { - vf->BeforeDisplay( this ); - vf->Display( prs ); - vf->AfterDisplay( this ); - - if ( updateViewer ) - vf->Repaint(); - - delete prs; // delete presentation because displayer is its owner - } - } -} - -/*! - Redisplays object in view - \param entry - object entry - \param updateViewer - is it necessary to update viewer -*/ -void LightApp_Displayer::Redisplay( const QString& entry, const bool updateViewer ) -{ - // Remove the object permanently ( == true) - SUIT_Session* ses = SUIT_Session::session(); - SUIT_Application* app = ses->activeApplication(); - if ( app ) - { - SUIT_Desktop* desk = app->desktop(); - QPtrList wnds = desk->windows(); - SUIT_ViewWindow* wnd; - for ( wnd = wnds.first(); wnd; wnd = wnds.next() ) - { - SUIT_ViewManager* vman = wnd->getViewManager(); - if( !vman ) - continue; - - SUIT_ViewModel* vmodel = vman->getViewModel(); - if( !vmodel ) - continue; - - SALOME_View* view = dynamic_cast(vmodel); - if( view && ( IsDisplayed( entry, view ) || view == GetActiveView() ) ) - { - Erase( entry, true, false, view ); - Display( entry, updateViewer, view ); - } - } - } -} - -/*! - Erases object in view - \param entry - object entry - \param forced - deletes object from viewer (otherwise it will be erased, but cached) - \param updateViewer - is it necessary to update viewer - \param theViewFrame - view -*/ -void LightApp_Displayer::Erase( const QString& entry, const bool forced, - const bool updateViewer, SALOME_View* theViewFrame ) -{ - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - - if ( vf ) { - SALOME_Prs* prs = vf->CreatePrs( entry.latin1() ); - if ( prs ) { - vf->Erase( prs, forced ); - if ( updateViewer ) - vf->Repaint(); - delete prs; // delete presentation because displayer is its owner - } - } -} - -/*! - Erases all objects in view - \param forced - deletes objects from viewer - \param updateViewer - is it necessary to update viewer - \param theViewFrame - view -*/ -void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const -{ - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - - if ( vf ) { - vf->EraseAll( forced ); - if ( updateViewer ) - vf->Repaint(); - } -} - -/*! - \return true if object is displayed in viewer - \param entry - object entry - \param theViewFrame - view -*/ -bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const -{ - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - bool res = false; - if( vf ) - { -#ifndef DISABLE_SALOMEOBJECT - Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject(); - temp->setEntry( entry.latin1() ); - res = vf->isVisible( temp ); -#endif - } - return res; -} - -/*! - Updates active view -*/ -void LightApp_Displayer::UpdateViewer() const -{ - SALOME_View* vf = GetActiveView(); - if ( vf ) - vf->Repaint(); -} - -/*! - \return presentation of object, built with help of CreatePrs method - \param entry - object entry - \param theViewFrame - view - \sa CreatePrs() -*/ -SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame ) -{ - SALOME_Prs* prs = 0; - - SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); - - if ( vf ) - prs = vf->CreatePrs( entry.latin1() ); - - return prs; -} - -/*! - \return active view -*/ -SALOME_View* LightApp_Displayer::GetActiveView() -{ - SUIT_Session* session = SUIT_Session::session(); - if ( SUIT_Application* app = session->activeApplication() ) { - if ( LightApp_Application* sApp = dynamic_cast( app ) ) { - if( SUIT_ViewManager* vman = sApp->activeViewManager() ) { - if ( SUIT_ViewModel* vmod = vman->getViewModel() ) - return dynamic_cast( vmod ); - } - } - } - return 0; -} - -/*! - \return true, if object can be displayed in this type of viewer - \param entry - object entry - \param viewer_type - type of viewer -*/ -bool LightApp_Displayer::canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const -{ - return true; -} - -/*! - \return true, if object can be displayed in any type of viewer - \param entry - object entry -*/ -bool LightApp_Displayer::canBeDisplayed( const QString& entry ) const -{ - QString viewerType; - SUIT_Session* session = SUIT_Session::session(); - if( SUIT_Application* app = session->activeApplication() ) - if( LightApp_Application* sApp = dynamic_cast( app ) ) - if( SUIT_ViewManager* vman = sApp->activeViewManager() ) - if( SUIT_ViewModel* vmod = vman->getViewModel() ) - viewerType = vmod->getType(); - return !viewerType.isNull() && canBeDisplayed( entry, viewerType ); -} - -/*! - \return displayer, corresponding to module - \param mod_name - name of module - \param load - is module has to be forced loaded -*/ -LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load ) -{ - SUIT_Session* session = SUIT_Session::session(); - SUIT_Application* sapp = session ? session->activeApplication() : 0; - LightApp_Application* app = dynamic_cast( sapp ); - if( !app ) - return 0; - - LightApp_Module* m = dynamic_cast( app ? app->module( mod_name ) : 0 ); - if( !m && load ) - { - m = dynamic_cast( app->loadModule( mod_name ) ); - if( m ) - app->addModule( m ); - } - - if( m ) - { - m->connectToStudy( dynamic_cast( app->activeStudy() ) ); - if( m!=app->activeModule() && load ) - { - m->setMenuShown( false ); - m->setToolShown( false ); - } - } - return m ? m->displayer() : 0; -} diff --git a/src/LightApp/LightApp_Displayer.h b/src/LightApp/LightApp_Displayer.h deleted file mode 100644 index 5b4318965..000000000 --- a/src/LightApp/LightApp_Displayer.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LIGHTAPP_DISPLAYER_HEADER -#define LIGHTAPP_DISPLAYER_HEADER - -#include "LightApp.h" - -#include - -class QString; - -/*! - \class LightApp_Displayer - Uniform mechanism of display/erase of objects in different views. - Objects are specified by string entry -*/ -class LIGHTAPP_EXPORT LightApp_Displayer : public SALOME_Displayer -{ -public: - LightApp_Displayer(); - virtual ~LightApp_Displayer(); - - void Display( const QString&, const bool = true, SALOME_View* = 0 ); - void Redisplay( const QString&, const bool = true ); - void Erase( const QString&, const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 ); - void EraseAll( const bool forced = false, const bool updateViewer = true, SALOME_View* = 0 ) const; - bool IsDisplayed( const QString&, SALOME_View* = 0 ) const; - void UpdateViewer() const; - - static SALOME_View* GetActiveView(); - static LightApp_Displayer* FindDisplayer( const QString&, const bool ); - - virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const; - bool canBeDisplayed( const QString& /*entry*/ ) const; - -protected: - virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); -}; - -#endif diff --git a/src/LightApp/LightApp_Driver.cxx b/src/LightApp/LightApp_Driver.cxx deleted file mode 100644 index e8e161dc5..000000000 --- a/src/LightApp/LightApp_Driver.cxx +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_Driver.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifdef WIN32 -#include -#endif - -/*! Constructor.*/ -LightApp_Driver::LightApp_Driver() -: myIsTemp( false ) -{ -} - -/*! Destructor.*/ -LightApp_Driver::~LightApp_Driver() -{ -} - -using namespace std; - -/*! - Save in file 'theFileName' datas from this driver -*/ -bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile ) -{ - int aNbModules = 0; - std::map::const_iterator it; - for (it = myMap.begin(); it != myMap.end(); ++it) - aNbModules++; - - unsigned char** aBuffer = new unsigned char*[aNbModules]; - long* aBufferSize = new long[aNbModules]; - char** aModuleName = new char*[aNbModules]; - - if(aBuffer == NULL || aBufferSize == NULL || aModuleName == NULL) - return false; - - int aFileBufferSize = 4; //4 bytes for a number of the modules that will be written to the stream; - int i = 0; - for (it = myMap.begin(); it != myMap.end(); ++it) { - aModuleName[i] = const_cast(it->first.c_str());//(it->first); - aFileBufferSize += 4; //Add 4 bytes: a length of the module name - aFileBufferSize += strlen(aModuleName[i])+1; - std::string aName(aModuleName[i]); - PutFilesToStream(aName, aBuffer[i], aBufferSize[i], isMultiFile); - aFileBufferSize += 8; //Add 8 bytes: a length of the buffer - aFileBufferSize += aBufferSize[i]; - i++; - } - int n = i; - - unsigned char* aFileBuffer = new unsigned char[aFileBufferSize]; - if(aFileBuffer == NULL) - return false; - - myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).dirPath( true ) + "/" ).latin1() ; - - int aCurrentPos = 0; - - //Initialize 4 bytes of the buffer by 0 - memset(aFileBuffer, 0, 4); - //Copy the number of modules that will be written to the stream - memcpy(aFileBuffer, &aNbModules, ((sizeof(int) > 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - int aBufferNameSize = 0; - for (i = 0; i < n; i++) { - aBufferNameSize = strlen(aModuleName[i])+1; - //Initialize 4 bytes of the buffer by 0 - memset((aFileBuffer + aCurrentPos), 0, 4); - //Copy the length of the module name to the buffer - memcpy((aFileBuffer + aCurrentPos), &aBufferNameSize, ((sizeof(int) > 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - //Copy the module name to the buffer - memcpy((aFileBuffer + aCurrentPos), aModuleName[i], aBufferNameSize); - aCurrentPos += aBufferNameSize; - - //Initialize 8 bytes of the buffer by 0 - memset((aFileBuffer + aCurrentPos), 0, 8); - //Copy the length of the module buffer to the buffer - memcpy((aFileBuffer + aCurrentPos), (aBufferSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - //Copy the module buffer to the buffer - memcpy((aFileBuffer + aCurrentPos), aBuffer[i], aBufferSize[i]); - aCurrentPos += aBufferSize[i]; - } - -#ifdef WNT - ofstream aFile(theFileName, ios::out | ios::binary); -#else - ofstream aFile(theFileName); -#endif - aFile.write((char*)aFileBuffer, aFileBufferSize); - aFile.close(); - - delete[] aBuffer; - delete[] aBufferSize; - delete[] aModuleName; - delete[] aFileBuffer; - - return true; -} - -/*! - Filling current driver from file 'theFileName' -*/ -bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFile ) -{ -#ifdef WNT - ifstream aFile(theFileName, ios::binary); -#else - ifstream aFile(theFileName); -#endif - - myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).dirPath( true ) + "/" ).latin1() ; - - aFile.seekg(0, ios::end); - int aFileBufferSize = aFile.tellg(); - unsigned char* aFileBuffer = new unsigned char[aFileBufferSize]; - aFile.seekg(0, ios::beg); - aFile.read((char*)aFileBuffer, aFileBufferSize); - aFile.close(); - - int aNbModules = 0; - //Copy the number of files in the stream - memcpy(&aNbModules, aFileBuffer, sizeof(int)); - long aCurrentPos = 4; - int aModuleNameSize; - - for (int i = 0; i < aNbModules; i++) { - //Put a length of the module name to aModuleNameSize - memcpy(&aModuleNameSize, (aFileBuffer + aCurrentPos), ((sizeof(int) > 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - char *aModuleName = new char[aModuleNameSize]; - //Put a module name to aModuleName - memcpy(aModuleName, (aFileBuffer + aCurrentPos), aModuleNameSize); - aCurrentPos += aModuleNameSize; - - //Put a length of the file buffer to aBufferSize - long aBufferSize; - memcpy(&aBufferSize, (aFileBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - unsigned char *aBuffer = new unsigned char[aBufferSize]; - - //Put a buffer for current module to aBuffer - memcpy(aBuffer, (aFileBuffer + aCurrentPos), aBufferSize); - aCurrentPos += aBufferSize; - - // Put buffer to aListOfFiles and set to myMap - ListOfFiles aListOfFiles = PutStreamToFiles(aBuffer, aBufferSize, isMultiFile); - SetListOfFiles(aModuleName, aListOfFiles); - - delete[] aModuleName; - delete[] aBuffer; - } - - delete[] aFileBuffer; - - return true; -} - -/*! - \return temp directory for path 'theURL' -*/ -std::string LightApp_Driver::GetTmpDir (const char* theURL, const bool isMultiFile) -{ - std::string anURLDir = GetDirFromPath(theURL); - std::string aTmpDir = isMultiFile ? anURLDir : GetTmpDir(); - - return aTmpDir; -} - -/*! - \return list of files for module with name 'theModuleName' -*/ -LightApp_Driver::ListOfFiles LightApp_Driver::GetListOfFiles( const char* theModuleName ) -{ - ListOfFiles aListOfFiles; - - std::string aName(theModuleName); - if (myMap.count(aName)) - aListOfFiles = myMap[aName]; - - return aListOfFiles; -} - -/*! - Sets list of files for module with name 'theModuleName' -*/ -void LightApp_Driver::SetListOfFiles( const char* theModuleName, const ListOfFiles theListOfFiles ) -{ - std::string aName (theModuleName); - myMap[aName] = theListOfFiles; -} - -/*! - Converts files which was created from module into a byte sequence unsigned char -*/ -void LightApp_Driver::PutFilesToStream( const std::string& theModuleName, unsigned char*& theBuffer, - long& theBufferSize, bool theNamesOnly ) -{ - ListOfFiles aFiles = myMap[theModuleName]; - // aFiles must contain temporary directory name in its first item - // and names of files (relatively the temporary directory) in the others - - int i, aLength = aFiles.size() - 1; - if(aLength <= 0) { - theBufferSize = 0; - theBuffer = new unsigned char[theBufferSize]; - return; - } - //Get a temporary directory for saved a file - TCollection_AsciiString aTmpDir(const_cast(aFiles[0].c_str())); - - long aBufferSize = 0; - long aCurrentPos; - int aNbFiles = 0; - int* aFileNameSize= new int[aLength]; - long* aFileSize= new long[aLength]; - - //Determine the required size of the buffer - TCollection_AsciiString aFileName; - for (i = 0; i < aLength; i++) { - char* aFName = const_cast(aFiles[i+1].c_str()); - aFileName = aFName; - //Check if the file exists - if (!theNamesOnly) { // mpv 15.01.2003: if only file names must be stroed, then size of files is zero - TCollection_AsciiString aFullPath = aTmpDir + aFileName; - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; -#ifdef WNT - ifstream aFile(aFullPath.ToCString(), ios::binary); -#else - ifstream aFile(aFullPath.ToCString()); -#endif - aFile.seekg(0, ios::end); - aFileSize[i] = aFile.tellg(); - aBufferSize += aFileSize[i]; //Add a space to store the file - } - aFileNameSize[i] = strlen(aFName) + 1; - aBufferSize += aFileNameSize[i]; //Add a space to store the file name - aBufferSize += (theNamesOnly)?4:12; //Add 4 bytes: a length of the file name, - // 8 bytes: length of the file itself - aNbFiles++; - } - - aBufferSize += 4; //4 bytes for a number of the files that will be written to the stream; - theBuffer = new unsigned char[aBufferSize]; - if(theBuffer == NULL) { - theBufferSize = 0; - theBuffer = 0; - return; - } - //Initialize 4 bytes of the buffer by 0 - memset(theBuffer, 0, 4); - //Copy the number of files that will be written to the stream - memcpy(theBuffer, &aNbFiles, ((sizeof(int) > 4) ? 4 : sizeof(int))); - - aCurrentPos = 4; - - for(i = 0; i < aLength; i++) { - ifstream *aFile; - if (!theNamesOnly) { // mpv 15.01.2003: we don't open any file if theNamesOnly = true - TCollection_AsciiString aName(const_cast(aFiles[i+1].c_str())); - TCollection_AsciiString aFullPath = aTmpDir + aName; - OSD_Path anOSDPath(aFullPath); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; -#ifdef WNT - aFile = new ifstream(aFullPath.ToCString(), ios::binary); -#else - aFile = new ifstream(aFullPath.ToCString()); -#endif - } - //Initialize 4 bytes of the buffer by 0 - memset((theBuffer + aCurrentPos), 0, 4); - //Copy the length of the file name to the buffer - memcpy((theBuffer + aCurrentPos), (aFileNameSize + i), ((sizeof(int) > 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - //Copy the file name to the buffer - char* aFName = const_cast(aFiles[i+1].c_str()); - memcpy((theBuffer + aCurrentPos), aFName, aFileNameSize[i]); - aCurrentPos += aFileNameSize[i]; - - if (!theNamesOnly) { // mpv 15.01.2003: we don't copy file content to the buffer if !theNamesOnly - //Initialize 8 bytes of the buffer by 0 - memset((theBuffer + aCurrentPos), 0, 8); - //Copy the length of the file to the buffer - memcpy((theBuffer + aCurrentPos), (aFileSize + i), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - - aFile->seekg(0, ios::beg); - aFile->read((char *)(theBuffer + aCurrentPos), aFileSize[i]); - aFile->close(); - delete(aFile); - aCurrentPos += aFileSize[i]; - } - } - delete[] aFileNameSize; - delete[] aFileSize; - - theBufferSize = aBufferSize; -} - -/*! - Converts a byte sequence to files and return list of them -*/ -LightApp_Driver::ListOfFiles LightApp_Driver::PutStreamToFiles( const unsigned char* theBuffer, - const long theBufferSize, bool theNamesOnly ) -{ - if(theBufferSize == 0 || theBuffer == 0) - return ListOfFiles(); - - // Create a temporary directory for the component's data files - std::string aDir = GetTmpDir(); - - // Remember that the files are in a temporary location that should be deleted - // when a study is closed - SetIsTemporary( true ); - - //Get a temporary directory for saving a file - TCollection_AsciiString aTmpDir(const_cast(aDir.c_str())); - - long aFileSize, aCurrentPos = 4; - int i, aFileNameSize, aNbFiles = 0; - - //Copy the number of files in the stream - memcpy(&aNbFiles, theBuffer, sizeof(int)); - - const int n = aNbFiles + 1; - ListOfFiles aFiles(n); - aFiles[0] = aDir; - - for(i = 0; i < aNbFiles; i++) { - //Put a length of the file name to aFileNameSize - memcpy(&aFileNameSize, (theBuffer + aCurrentPos), ((sizeof(int) > 4) ? 4 : sizeof(int))); - aCurrentPos += 4; - - char *aFileName = new char[aFileNameSize]; - //Put a file name to aFileName - memcpy(aFileName, (theBuffer + aCurrentPos), aFileNameSize); - aCurrentPos += aFileNameSize; - - //Put a length of the file to aFileSize - if (!theNamesOnly) { - memcpy(&aFileSize, (theBuffer + aCurrentPos), ((sizeof(long) > 8) ? 8 : sizeof(long))); - aCurrentPos += 8; - - TCollection_AsciiString aFullPath = aTmpDir + aFileName; - -#ifdef WNT - ofstream aFile(aFullPath.ToCString(), ios::out | ios::binary); -#else - ofstream aFile(aFullPath.ToCString()); -#endif - - aFile.write((char *)(theBuffer+aCurrentPos), aFileSize); - aFile.close(); - aCurrentPos += aFileSize; - } - std::string aStrFileName(aFileName); - aFiles[i+1] = aStrFileName; - delete[] aFileName; - } - return aFiles; -} - -/*! - Remove files. First item in is a directory with slash at the end. - Other items are names of files. If is true, - then the directory is also deleted. -*/ -void LightApp_Driver::RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted) -{ - int i, aLength = theFiles.size() - 1; - if(aLength <= 0) { - return; - } - //Get a temporary directory for saved a file - TCollection_AsciiString aDirName(const_cast(theFiles[0].c_str())); - - for(i = 0; i < aLength; i++) { - TCollection_AsciiString aFile(aDirName); - aFile += const_cast(theFiles[i+1].c_str()); - OSD_Path anOSDPath(aFile); - OSD_File anOSDFile(anOSDPath); - if(!anOSDFile.Exists()) continue; - - anOSDFile.Remove(); - } - - if(IsDirDeleted) { - OSD_Path aPath(aDirName); - OSD_Directory aDir(aPath); - // san -- Using a special code block below is essential - it ensures that - // OSD_FileIterator instance is destroyed by the moment when - // OSD_Directory::Remove() is called. - // Otherwise, the directory remains locked (at least on Windows) - // by the iterator and cannot be removed. - { - OSD_FileIterator anIterator(aPath, '*'); - if(!aDir.Exists() || anIterator.More()) - return; - } - aDir.Remove(); - } -} - -/*! - Removes files which was created from module theModuleName if - is true tmp directory is also deleted if it is empty -*/ -void LightApp_Driver::RemoveTemporaryFiles( const char* theModuleName, const bool IsDirDeleted ) -{ - std::string aModuleName(theModuleName); - ListOfFiles aFiles = myMap[aModuleName]; - // aFiles must contain temporary directory name in its first item - // and names of files (relatively the temporary directory) in the others - RemoveFiles( aFiles, IsDirDeleted ); - -} - -/*! - Clears map of list files -*/ -void LightApp_Driver::ClearDriverContents() -{ - std::map::iterator it; - for ( it = myMap.begin(); it != myMap.end(); ++it ) - { - const char* aModuleName = const_cast(it->first.c_str()); - // If the driver contains temporary files - - // remove them along with the temporary directory - RemoveTemporaryFiles( aModuleName, IsTemporary() ); - } - myMap.clear(); - // Reset the "temporary" flag - SetIsTemporary( false ); -} - -/*! - \return a temp directory to store created files like "/tmp/sub_dir/" -*/ -std::string LightApp_Driver::GetTmpDir() -{ - if ( myTmpDir.length() != 0 ) - return myTmpDir; - - //Find a temporary directory to store a file - TCollection_AsciiString aTmpDir; - - char *Tmp_dir = getenv("SALOME_TMP_DIR"); - if ( !Tmp_dir ) - Tmp_dir = getenv ( "TEMP" ); - if ( !Tmp_dir ) - Tmp_dir = getenv ( "TMP" ); - if ( Tmp_dir ) - { - aTmpDir = TCollection_AsciiString(Tmp_dir); -#ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; -#else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; -#endif - } - else - { -#ifdef WIN32 - aTmpDir = TCollection_AsciiString("C:\\"); -#else - aTmpDir = TCollection_AsciiString("/tmp/"); -#endif - } - - srand((unsigned int)time(NULL)); - int aRND = 999 + (int)(100000.0*rand()/(RAND_MAX+1.0)); //Get a random number to present a name of a sub directory - TCollection_AsciiString aSubDir(aRND); - if(aSubDir.Length() <= 1) aSubDir = TCollection_AsciiString("123409876"); - - aTmpDir += aSubDir; //Get RND sub directory - -#ifdef WIN32 - if(aTmpDir.Value(aTmpDir.Length()) != '\\') aTmpDir+='\\'; -#else - if(aTmpDir.Value(aTmpDir.Length()) != '/') aTmpDir+='/'; -#endif - - OSD_Path aPath(aTmpDir); - OSD_Directory aDir(aPath); - - for(aRND = 0; aDir.Exists(); aRND++) { - aTmpDir.Insert((aTmpDir.Length() - 1), TCollection_AsciiString(aRND)); //Build a unique directory name - aPath = OSD_Path(aTmpDir); - aDir = OSD_Directory(aPath); - } - -#ifdef WIN32 - // Workaround for OSD_Protection bug on Windows - OSD_Protection aProtection(OSD_RWXD, OSD_RWXD, OSD_RWXD, OSD_RWXD); -#else - OSD_Protection aProtection(OSD_RX, OSD_RWXD, OSD_RX, OSD_RX); -#endif - aDir.Build(aProtection); - - myTmpDir = aTmpDir.ToCString(); - - return aTmpDir.ToCString(); -} - -/*! - \return the dir by the path -*/ -std::string LightApp_Driver::GetDirFromPath( const std::string& thePath ) { - if(thePath == "") - return ""; - OSD_Path aPath = OSD_Path(TCollection_AsciiString(const_cast(thePath.c_str()))); - TCollection_AsciiString aDirString(aPath.Trek()); - aDirString.ChangeAll('|','/'); - return aDirString.ToCString(); -} - diff --git a/src/LightApp/LightApp_Driver.h b/src/LightApp/LightApp_Driver.h deleted file mode 100644 index e130b86da..000000000 --- a/src/LightApp/LightApp_Driver.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_DRIVER_H -#define LIGHTAPP_DRIVER_H - -#include - -#include "string" -#include "vector" -#include "map" - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*!Description : Driver can save to file and read from file list of files for light modules*/ - -class LIGHTAPP_EXPORT LightApp_Driver -{ -public: - LightApp_Driver(); - virtual ~LightApp_Driver(); - - - typedef std::vector ListOfFiles; - - virtual bool SaveDatasInFile (const char* theFileName, bool isMultiFile); - virtual bool ReadDatasFromFile (const char* theFileName, bool isMultiFile); - virtual std::string GetTmpDir (const char* theURL, const bool isMultiFile); - - ListOfFiles GetListOfFiles (const char* theModuleName); - virtual void SetListOfFiles (const char* theModuleName, const ListOfFiles theListOfFiles); - virtual void RemoveTemporaryFiles(const char* theModuleName, const bool IsDirDeleted); - void RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted); - - virtual void ClearDriverContents(); - -protected: - void PutFilesToStream(const std::string& theModuleName, unsigned char*& theBuffer, - long& theBufferSize, bool theNamesOnly = false); - ListOfFiles PutStreamToFiles(const unsigned char* theBuffer, - const long theBufferSize, bool theNamesOnly = false); - - std::string GetTmpDir(); - std::string GetDirFromPath(const std::string& thePath); - - void SetIsTemporary( bool theFlag ) { myIsTemp = theFlag; } - bool IsTemporary() const { return myIsTemp; } - -protected: - typedef std::map MapOfListOfFiles; - MapOfListOfFiles myMap; - std::string myTmpDir; - -private: - bool myIsTemp; -}; - -#endif diff --git a/src/LightApp/LightApp_EventFilter.cxx b/src/LightApp/LightApp_EventFilter.cxx deleted file mode 100644 index 77ab42c9f..000000000 --- a/src/LightApp/LightApp_EventFilter.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_EventFilter.h" - -#include - -#include - -LightApp_EventFilter* LightApp_EventFilter::myFilter = NULL; - -/*!Constructor.*/ -LightApp_EventFilter::LightApp_EventFilter() -: QObject() -{ - qApp->installEventFilter( this ); -} - -/*!Destructor.*/ -LightApp_EventFilter::~LightApp_EventFilter() -{ - qApp->removeEventFilter( this ); -} - -/*! - Custom event filter -*/ -bool LightApp_EventFilter::eventFilter( QObject* o, QEvent* e ) -{ - if ( e->type() == QEvent::WindowActivate && o->inherits("QDialog") ) - { - QWidget* parent = ((QWidget*)o)->parentWidget(); - - SUIT_Desktop* aDesktop = 0; - - while( parent ) - { - if ( aDesktop = dynamic_cast(parent) ) - break; - parent = parent->parentWidget(); - } - - if ( aDesktop ) - aDesktop->emitActivated(); - } - - return QObject::eventFilter( o, e ); -} - -/*!Create new instance of LightApp_EventFilter*/ -void LightApp_EventFilter::Init() -{ - if( myFilter==NULL ) - myFilter = new LightApp_EventFilter(); -} - -/*!Destroy filter.*/ -void LightApp_EventFilter::Destroy() -{ - if( myFilter ) - { - delete myFilter; - myFilter = NULL; - } -} diff --git a/src/LightApp/LightApp_EventFilter.h b/src/LightApp/LightApp_EventFilter.h deleted file mode 100644 index 836db4476..000000000 --- a/src/LightApp/LightApp_EventFilter.h +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LIGHTAPP_EVENTFILTER_H -#define LIGHTAPP_EVENTFILTER_H - -#include "LightApp.h" - -#include - -#if defined WNT -#pragma warning( disable: 4251 ) -#endif - -/*! - Class provide event filter. -*/ -class LIGHTAPP_EXPORT LightApp_EventFilter: public QObject -{ -public: - static void Init(); - static void Destroy(); - -protected: - LightApp_EventFilter(); - virtual ~LightApp_EventFilter(); - -private: - /*! global event filter for qapplication */ - virtual bool eventFilter( QObject* o, QEvent* e ); - -private: - static LightApp_EventFilter* myFilter; -}; - -#if defined WNT -#pragma warning( default: 4251 ) -#endif - -#endif diff --git a/src/LightApp/LightApp_GLSelector.cxx b/src/LightApp/LightApp_GLSelector.cxx deleted file mode 100644 index d7c14c59b..000000000 --- a/src/LightApp/LightApp_GLSelector.cxx +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_GLSelector.h" - -#include "LightApp_DataOwner.h" -#include "LightApp_DataObject.h" - -#include - -/*!Constructor. Initialize by GLViewer_Viewer2d and SUIT_SelectionMgr.*/ -LightApp_GLSelector::LightApp_GLSelector( GLViewer_Viewer2d* viewer, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged( SelectionChangeStatus ) ), - this, SLOT( onSelectionChanged() ) ); -} - -/*!Destructor. Do nothing.*/ -LightApp_GLSelector::~LightApp_GLSelector() -{ -} - -/*!Gets viewer*/ -GLViewer_Viewer2d* LightApp_GLSelector::viewer() const -{ - return myViewer; -} - -/*!On selection changed event.*/ -void LightApp_GLSelector::onSelectionChanged() -{ - selectionChanged(); -} - -/*!Gets list of selected Data Owner objects.*/ -void LightApp_GLSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if ( !myViewer ) - return; - - GLViewer_Context* cont = myViewer->getGLContext(); - if ( !cont ) - return; - - for ( cont->InitSelected(); cont->MoreSelected(); cont->NextSelected() ) - { - GLViewer_Object* obj = cont->SelectedObject(); - if ( obj ) - { - LightApp_DataOwner* owner = dynamic_cast( obj->owner() ); - if ( owner ) - aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( owner->entry() ) ) ); - } - } -} - -/*!Sets to selected list of Data Owner objects.*/ -void LightApp_GLSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) -{ - if ( !myViewer ) - return; - - GLViewer_Context* cont = myViewer->getGLContext(); - if ( !cont ) - return; - - QMap aSelected; - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - - if ( owner ) - aSelected.insert( owner->entry(), 0 ); - } - - bool changed = false; - const ObjList& displayed = cont->getObjects(); - for ( ObjList::const_iterator it = displayed.begin(); it != displayed.end(); ++it ) - { - GLViewer_Object* obj = *it; - if ( obj && obj->getVisible() ) - { - LightApp_DataOwner* owner = dynamic_cast( obj->owner() ); - bool sel = owner && aSelected.contains( owner->entry() ); - changed = changed || sel != (bool)obj->isSelected(); - if ( sel && !obj->isSelected() ) - cont->setSelected( obj, false ); - else if ( !sel && obj->isSelected() ) - cont->remSelected( obj, false ); - } - } - - if ( changed ) - myViewer->updateAll(); -} diff --git a/src/LightApp/LightApp_GLSelector.h b/src/LightApp/LightApp_GLSelector.h deleted file mode 100644 index 2923c25ab..000000000 --- a/src/LightApp/LightApp_GLSelector.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_GLSELECTOR_H -#define LIGHTAPP_GLSELECTOR_H - -#include "LightApp.h" - -#include - -#include - -#include -#include - -class LightApp_DataObject; - -/*! - \class LightApp_GLSelector - Custom selector to get/set selection from GL viewer -*/ -class LIGHTAPP_EXPORT LightApp_GLSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - LightApp_GLSelector( GLViewer_Viewer2d*, SUIT_SelectionMgr* ); - virtual ~LightApp_GLSelector(); - - GLViewer_Viewer2d* viewer() const; - - virtual QString type() const { return GLViewer_Viewer2d::Type(); } - -private slots: - void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - GLViewer_Viewer2d* myViewer; -}; - -#endif diff --git a/src/LightApp/LightApp_HDFDriver.cxx b/src/LightApp/LightApp_HDFDriver.cxx deleted file mode 100644 index 292cdd88b..000000000 --- a/src/LightApp/LightApp_HDFDriver.cxx +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_HDFDriver.h" - -#include "HDFexplorer.hxx" -#include "HDFOI.hxx" - -// OCCT Includes -#include - -/*! Constructor.*/ -LightApp_HDFDriver::LightApp_HDFDriver() -{ -} - -/*! Destructor.*/ -LightApp_HDFDriver::~LightApp_HDFDriver() -{ -} - -using namespace std; - -/*! - Saves in file 'theFileName' datas from this driver -*/ -bool LightApp_HDFDriver::SaveDatasInFile( const char* theFileName, bool isMultiFile ) -{ - bool isASCII = false; - bool isError = false; - - HDFfile *hdf_file = 0; - HDFgroup *hdf_group_datacomponent = 0; - HDFgroup *hdf_group_study_structure = 0; - HDFgroup *hdf_sco_group = 0; - HDFgroup *hdf_sco_group2 = 0; - HDFdataset *hdf_dataset = 0; - hdf_size aHDFSize[1]; - - try { - hdf_file = new HDFfile ((char*)theFileName); - hdf_file->CreateOnDisk(); - - //----------------------------------------------------------------------- - // 1 - Create a groupe for each SComponent and Update the PersistanceRef - //----------------------------------------------------------------------- - hdf_group_datacomponent = new HDFgroup ("DATACOMPONENT", hdf_file); - hdf_group_datacomponent->CreateOnDisk(); - - std::map mapNameEntry; - - int tag = 1; - std::map::const_iterator it; - for (it = myMap.begin(); it != myMap.end(); ++it, ++tag) { - std::string aName (it->first); - char* aModuleName = const_cast(aName.c_str()); - unsigned char* aBuffer; - long aBufferSize; - PutFilesToStream(aName, aBuffer, aBufferSize, isMultiFile); - - //Handle(SALOMEDSImpl_SComponent) sco = itcomponent.Value(); - //TCollection_AsciiString scoid = sco->GetID(); - //hdf_sco_group = new HDFgroup(scoid.ToCString(), hdf_group_datacomponent); - - TCollection_AsciiString entry ("0:1:"); - entry += TCollection_AsciiString(tag); - mapNameEntry[aModuleName] = entry.ToCString(); - - //hdf_sco_group = new HDFgroup (aModuleName, hdf_group_datacomponent); - hdf_sco_group = new HDFgroup (entry.ToCString(), hdf_group_datacomponent); - hdf_sco_group->CreateOnDisk(); - - aHDFSize[0] = aBufferSize; - - hdf_dataset = new HDFdataset ("FILE_STREAM", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk(aBuffer); //Save the stream in the HDF file - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; //will be deleted by hdf_sco_group destructor - - // store multifile state - aHDFSize[0] = 2; - hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((void*)(isMultiFile ? "M" : "S")); // save: multi or single - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; //will be deleted by hdf_sco_group destructor - - // store ASCII state - aHDFSize[0] = 2; - hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk((void*)(isASCII ? "A" : "B")); // save: ASCII or BINARY - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; //will be deleted by hdf_sco_group destructor - - hdf_sco_group->CloseOnDisk(); - hdf_sco_group = 0; // will be deleted by hdf_group_datacomponent destructor - - delete [] aBuffer; - } - - hdf_group_datacomponent->CloseOnDisk(); - hdf_group_datacomponent = 0; // will be deleted by hdf_file destructor - - //----------------------------------------------------------------------- - // 3 - Write the Study Structure - //----------------------------------------------------------------------- - hdf_group_study_structure = new HDFgroup ("STUDY_STRUCTURE", hdf_file); - hdf_group_study_structure->CreateOnDisk(); - - for (it = myMap.begin(); it != myMap.end(); ++it) { - std::string aName (it->first); - char* aModuleName = const_cast(aName.c_str()); - - //hdf_sco_group2 = new HDFgroup(scid.ToCString(), hdf_group_study_structure); - char* entry = (char*)(mapNameEntry[aModuleName].c_str()); - hdf_sco_group2 = new HDFgroup (entry, hdf_group_study_structure); - hdf_sco_group2->CreateOnDisk(); - - // ComponentDataType treatment - hdf_int32 name_len = (hdf_int32)strlen(aModuleName); - aHDFSize[0] = name_len + 1; - hdf_dataset = new HDFdataset ("COMPONENTDATATYPE", hdf_sco_group2, HDF_STRING, aHDFSize, 1); - hdf_dataset->CreateOnDisk(); - hdf_dataset->WriteOnDisk(aModuleName); - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; //will be deleted by hdf_sco_group2 destructor - - hdf_sco_group2->CloseOnDisk(); - hdf_sco_group2 = 0; // will be deleted by hdf_group_study_structure destructor - } - - hdf_group_study_structure->CloseOnDisk(); - hdf_group_study_structure = 0; // will be deleted by hdf_file destructor - - hdf_file->CloseOnDisk(); - delete hdf_file; // recursively deletes all hdf objects... - - } catch (HDFexception) { - isError = true; - } - if (isASCII && !isError) { // save file in ASCII format - HDFascii::ConvertFromHDFToASCII(theFileName, true); - } - - return !isError; -} - -/*! - Filling current driver from file 'theFileName' -*/ -bool LightApp_HDFDriver::ReadDatasFromFile( const char* theFileName, bool isMultiFile ) -{ - bool isASCII = false; - bool isError = false; - TCollection_AsciiString aHDFUrl; - - HDFfile *hdf_file = 0; - HDFgroup *hdf_group_datacomponent = 0; - HDFgroup *hdf_group_study_structure = 0; - HDFgroup *hdf_sco_group = 0; - HDFgroup *hdf_sco_group2 = 0; - - std::map mapEntryName; - - if (HDFascii::isASCII(theFileName)) { - isASCII = true; - char* aResultPath = HDFascii::ConvertFromASCIIToHDF(theFileName); - aHDFUrl = aResultPath; - aHDFUrl += "hdf_from_ascii.hdf"; - delete(aResultPath); - } else { - aHDFUrl = (char*)theFileName; - } - - hdf_file = new HDFfile((char*)aHDFUrl.ToCString()); - - char aMultifileState[2]; - char ASCIIfileState[2]; - - try { - hdf_file->OpenOnDisk(HDF_RDONLY); - - } catch (HDFexception) { - //char *eStr = new char[strlen(aUrl.ToCString()) + 17]; - //sprintf(eStr,"Can't open file %s", aUrl.ToCString()); - //_errorCode = TCollection_AsciiString(eStr); - //delete [] eStr; - return false; - } - - try { - if (!hdf_file->ExistInternalObject("STUDY_STRUCTURE")) { - //_errorCode = "Study is empty"; - isError = true; - } else { - hdf_group_study_structure = new HDFgroup ("STUDY_STRUCTURE", hdf_file); - hdf_group_study_structure->OpenOnDisk(); - - char name[HDF_NAME_MAX_LEN + 1]; - Standard_Integer nbsons = hdf_group_study_structure->nInternalObjects(); - for (Standard_Integer i = 0; i < nbsons; i++) { - hdf_group_study_structure->InternalObjectIndentify(i, name); - if (strncmp(name, "INTERNAL_COMPLEX", 16) == 0) continue; - hdf_object_type type = hdf_group_study_structure->InternalObjectType(name); - if (type == HDF_GROUP) { - hdf_sco_group2 = new HDFgroup (name, hdf_group_study_structure); - hdf_sco_group2->OpenOnDisk(); - - // Read component data - char* aCompDataType = NULL; - int aDataSize = 0; - - if (hdf_sco_group2->ExistInternalObject("COMPONENTDATATYPE")) { - HDFdataset *hdf_dataset = new HDFdataset("COMPONENTDATATYPE", hdf_sco_group2); - hdf_dataset->OpenOnDisk(); - aDataSize = hdf_dataset->GetSize(); - aCompDataType = new char[aDataSize]; - if (aCompDataType == NULL) { - isError = true; - } else { - hdf_dataset->ReadFromDisk(aCompDataType); - - mapEntryName[name] = aCompDataType; - - delete [] aCompDataType; - } - - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; - } - - hdf_sco_group2->CloseOnDisk(); - } - } - - hdf_group_study_structure->CloseOnDisk(); - } - - if (!hdf_file->ExistInternalObject("DATACOMPONENT")) { - //_errorCode = "No components stored"; - isError = true; - } else { - hdf_group_datacomponent = new HDFgroup ("DATACOMPONENT", hdf_file); - hdf_group_datacomponent->OpenOnDisk(); - - char name[HDF_NAME_MAX_LEN + 1]; - Standard_Integer nbsons = hdf_group_datacomponent->nInternalObjects(); - for (Standard_Integer i = 0; i < nbsons; i++) { - hdf_group_datacomponent->InternalObjectIndentify(i, name); - if (strncmp(name, "INTERNAL_COMPLEX", 16) == 0) continue; - hdf_object_type type = hdf_group_datacomponent->InternalObjectType(name); - if (type == HDF_GROUP) { - hdf_sco_group = new HDFgroup (name, hdf_group_datacomponent); - hdf_sco_group->OpenOnDisk(); - - // Read component data - unsigned char* aStreamFile = NULL; - int aStreamSize = 0; - - if (hdf_sco_group->ExistInternalObject("FILE_STREAM")) { - HDFdataset *hdf_dataset = new HDFdataset("FILE_STREAM", hdf_sco_group); - hdf_dataset->OpenOnDisk(); - aStreamSize = hdf_dataset->GetSize(); - aStreamFile = new unsigned char[aStreamSize]; - if (aStreamFile == NULL) { - isError = true; - } else { - hdf_dataset->ReadFromDisk(aStreamFile); - } - - hdf_dataset->CloseOnDisk(); - hdf_dataset = 0; - } - - HDFdataset *multifile_hdf_dataset = new HDFdataset("MULTIFILE_STATE", hdf_sco_group); - multifile_hdf_dataset->OpenOnDisk(); - multifile_hdf_dataset->ReadFromDisk(aMultifileState); - multifile_hdf_dataset->CloseOnDisk(); - multifile_hdf_dataset = 0; - - HDFdataset *ascii_hdf_dataset = new HDFdataset("ASCII_STATE", hdf_sco_group); - ascii_hdf_dataset->OpenOnDisk(); - ascii_hdf_dataset->ReadFromDisk(ASCIIfileState); - ascii_hdf_dataset->CloseOnDisk(); - ascii_hdf_dataset = 0; - - isASCII = (ASCIIfileState[0] == 'A') ? true : false; - - if (aStreamFile != NULL) { - // Put buffer to aListOfFiles and set to myMap - ListOfFiles aListOfFiles = PutStreamToFiles(aStreamFile, aStreamSize, isMultiFile); - char* aCompDataType = (char*)(mapEntryName[name].c_str()); - SetListOfFiles(aCompDataType, aListOfFiles); - - delete [] aStreamFile; - } - - hdf_sco_group->CloseOnDisk(); - } - } - - hdf_group_datacomponent->CloseOnDisk(); - } - } catch (HDFexception) { - isError = true; - - //Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - //aFilesToRemove->Append(aHDFUrl); - //RemoveFiles(aFilesToRemove, true); - } - - hdf_file->CloseOnDisk(); - delete hdf_file; // all related hdf objects will be deleted - - if (isASCII && !isError) { - //Handle(TColStd_HSequenceOfAsciiString) aFilesToRemove = new TColStd_HSequenceOfAsciiString; - //aFilesToRemove->Append(aHDFUrl); - //RemoveFiles(aFilesToRemove, true); - } - - //std::map::const_iterator it; - //for (it = mapEntryName.begin(); it != mapEntryName.end(); ++it) { - // cout << "Read Component: entry = " << it->first - // << ", Component data type = " << it->second << endl; - //} - - return !isError; -} diff --git a/src/LightApp/LightApp_HDFDriver.h b/src/LightApp/LightApp_HDFDriver.h deleted file mode 100644 index 6f3b2c339..000000000 --- a/src/LightApp/LightApp_HDFDriver.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_HDFDRIVER_H -#define LIGHTAPP_HDFDRIVER_H - -#include -#include - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*!Description : Driver can save to file and read from file list of files for light modules*/ - -class LIGHTAPP_EXPORT LightApp_HDFDriver : public LightApp_Driver -{ -public: - LightApp_HDFDriver(); - virtual ~LightApp_HDFDriver(); - - virtual bool SaveDatasInFile (const char* theFileName, bool isMultiFile); - virtual bool ReadDatasFromFile (const char* theFileName, bool isMultiFile); -}; - -#endif diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx deleted file mode 100644 index 2a753d8b8..000000000 --- a/src/LightApp/LightApp_Module.cxx +++ /dev/null @@ -1,565 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Module.cxx -// Created: 6/20/2005 16:30:56 AM -// Author: OCC team -// Copyright (C) CEA 2005 - -#include "LightApp_Module.h" - -#include "CAM_Application.h" - -#include "LightApp_Application.h" -#include "LightApp_DataModel.h" -#include "LightApp_DataObject.h" -#include "LightApp_Study.h" -#include "LightApp_Preferences.h" -#include "LightApp_Selection.h" -#include "LightApp_Operation.h" -#include "LightApp_SwitchOp.h" -#include "LightApp_UpdateFlags.h" -#include "LightApp_ShowHideOp.h" - -#include "SUIT_Operation.h" -#include -#include -#include - -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT - #include - #include -#else - #include -#endif - #include -#endif -#ifndef DISABLE_OCCVIEWER - #include - #include -#ifndef DISABLE_SALOMEOBJECT - #include -#else - #include -#endif -#endif -#ifndef DISABLE_GLVIEWER - #include - #include -#endif -#ifndef DISABLE_PLOT2DVIEWER - #include - #include -#ifndef DISABLE_SALOMEOBJECT - #include -#else - #include -#endif -#endif - -#include - -#include - -#include -#include -#include - -/*!Constructor.*/ -LightApp_Module::LightApp_Module( const QString& name ) -: CAM_Module( name ), - myPopupMgr( 0 ), - mySwitchOp( 0 ), - myDisplay( -1 ), - myErase( -1 ), - myDisplayOnly( -1 ), - myEraseAll( -1 ) -{ -} - -/*!Destructor.*/ -LightApp_Module::~LightApp_Module() -{ - if ( mySwitchOp ) - delete mySwitchOp; -} - -/*!Initialize module.*/ -void LightApp_Module::initialize( CAM_Application* app ) -{ - CAM_Module::initialize( app ); - - SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0; - if ( resMgr ) - resMgr->raiseTranslators( name() ); -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::windows( QMap& ) const -{ -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::viewManagers( QStringList& ) const -{ -} - -/*!Context menu popup.*/ -void LightApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) -{ - LightApp_Selection* sel = createSelection(); - sel->init( client, getApp()->selectionMgr() ); - popupMgr()->updatePopup( menu, sel ); - delete sel; -} - -/*!Update object browser. - * For updating model or whole object browser use update() method can be used. -*/ -void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel, - SUIT_DataObject* theDataObject ) -{ - bool upd = getApp()->objectBrowser()->isAutoUpdate(); - getApp()->objectBrowser()->setAutoUpdate( false ); - - if( theIsUpdateDataModel ){ - if( CAM_DataModel* aDataModel = dataModel() ){ - if ( LightApp_DataModel* aModel = dynamic_cast( aDataModel ) ) { - SUIT_DataObject* aParent = NULL; - if(theDataObject && theDataObject != aDataModel->root()) - aParent = theDataObject->parent(); - - LightApp_DataObject* anObject = dynamic_cast(theDataObject); - LightApp_Study* aStudy = dynamic_cast(getApp()->activeStudy()); - aModel->update( anObject, aStudy ); - } - } - } - getApp()->objectBrowser()->setAutoUpdate( upd ); - getApp()->objectBrowser()->updateTree( 0, false ); -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::selectionChanged() -{ -} - -/*!Activate module.*/ -bool LightApp_Module::activateModule( SUIT_Study* study ) -{ - bool res = CAM_Module::activateModule( study ); - - if ( res && application() && application()->resourceMgr() ) - application()->resourceMgr()->raiseTranslators( name() ); - - connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), - this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); - connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ), - this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) ); - - if ( mySwitchOp == 0 ) - mySwitchOp = new LightApp_SwitchOp( this ); - - return res; -} - -/*!Deactivate module.*/ -bool LightApp_Module::deactivateModule( SUIT_Study* study ) -{ - delete mySwitchOp; - mySwitchOp = 0; - - disconnect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), - this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) ); - disconnect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ), - this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) ); - - // abort all operations - MapOfOperation::const_iterator anIt; - for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) { - anIt.data()->abort(); - } - - return CAM_Module::activateModule( study ); -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::MenuItem() -{ -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::createPreferences() -{ -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::preferencesChanged( const QString&, const QString& ) -{ -} - -/*!Gets application.*/ -LightApp_Application* LightApp_Module::getApp() const -{ - return (LightApp_Application*)application(); -} - -/*! - * \brief Update something in accordance with update flags - * \param theFlags - update flags -* -* Update viewer or/and object browser etc. in accordance with update flags ( see -* LightApp_UpdateFlags enumeration ). Derived modules can redefine this method for their -* own purposes -*/ -void LightApp_Module::update( const int theFlags ) -{ - if ( theFlags & UF_Model ) - { - if( CAM_DataModel* aDataModel = dataModel() ) - if( LightApp_DataModel* aModel = dynamic_cast( aDataModel ) ) - aModel->update( 0, dynamic_cast( getApp()->activeStudy() ) ); - } - if ( theFlags & UF_ObjBrowser ) - getApp()->objectBrowser()->updateTree( 0 ); - if ( theFlags & UF_Controls ) - updateControls(); - if ( theFlags & UF_Viewer ) - { - if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() ) - if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() ) - { -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT - if ( viewWnd->inherits( "SVTK_ViewWindow" ) ) - ( (SVTK_ViewWindow*)viewWnd )->Repaint(); -#else - if ( viewWnd->inherits( "VTKViewer_ViewWindow" ) ) - ( (VTKViewer_ViewWindow*)viewWnd )->Repaint(); -#endif -#endif -#ifndef DISABLE_OCCVIEWER - if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) ) - ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate(); -#endif -#ifndef DISABLE_PLOT2DVIEWER - if ( viewWnd->inherits( "Plot2d_ViewWindow" ) ) - ( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint(); -#endif -#ifndef DISABLE_GLVIEWER - if ( viewWnd->inherits( "GLViewer_ViewFrame" ) ) - ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate(); -#endif - } - } -} -/*! - * \brief Updates controls -* -* Updates (i.e. disable/enable) controls states (menus, tool bars etc.). This method is -* called from update( UF_Controls ). You may redefine it in concrete module. -*/ -void LightApp_Module::updateControls() -{ -} - -/*!Create new instance of data model and return it.*/ -CAM_DataModel* LightApp_Module::createDataModel() -{ - return new LightApp_DataModel(this); -} - -/*!Create and return instance of LightApp_Selection.*/ -LightApp_Selection* LightApp_Module::createSelection() const -{ - return new LightApp_Selection(); -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::onModelOpened() -{ -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::onModelSaved() -{ -} - -/*!NOT IMPLEMENTED*/ -void LightApp_Module::onModelClosed() -{ -} - -/*!Gets popup manager.(create if not exist)*/ -QtxPopupMgr* LightApp_Module::popupMgr() -{ - if ( !myPopupMgr ) - { - myPopupMgr = new QtxPopupMgr( 0, this ); - - QPixmap p; - SUIT_Desktop* d = application()->desktop(); - - QAction - *disp = createAction( -1, tr( "TOP_DISPLAY" ), p, tr( "MEN_DISPLAY" ), tr( "STB_DISPLAY" ), - 0, d, false, this, SLOT( onShowHide() ) ), - *erase = createAction( -1, tr( "TOP_ERASE" ), p, tr( "MEN_ERASE" ), tr( "STB_ERASE" ), - 0, d, false, this, SLOT( onShowHide() ) ), - *dispOnly = createAction( -1, tr( "TOP_DISPLAY_ONLY" ), p, tr( "MEN_DISPLAY_ONLY" ), tr( "STB_DISPLAY_ONLY" ), - 0, d, false, this, SLOT( onShowHide() ) ), - *eraseAll = createAction( -1, tr( "TOP_ERASE_ALL" ), p, tr( "MEN_ERASE_ALL" ), tr( "STB_ERASE_ALL" ), - 0, d, false, this, SLOT( onShowHide() ) ); - myDisplay = actionId( disp ); - myErase = actionId( erase ); - myDisplayOnly = actionId( dispOnly ); - myEraseAll = actionId( eraseAll ); - - myPopupMgr->insert( disp, -1, 0 ); - myPopupMgr->insert( erase, -1, 0 ); - myPopupMgr->insert( dispOnly, -1, 0 ); - myPopupMgr->insert( eraseAll, -1, 0 ); - myPopupMgr->insert( separator(), -1, 0 ); - - QString oneAndNotActive = "( count( $component ) = 1 ) and ( component != activeModule )"; - QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )"; - uniform = uniform.arg( oneAndNotActive ).arg( name() ); - myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, true ); - myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, true ); - myPopupMgr->setRule( dispOnly, uniform, true ); - - QStringList viewers; - -#ifndef DISABLE_OCCVIEWER -#ifndef DISABLE_SALOMEOBJECT - viewers.append( SOCC_Viewer::Type() ); -#else - viewers.append( OCCViewer_Viewer::Type() ); -#endif -#endif -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT - viewers.append( SVTK_Viewer::Type() ); -#else - viewers.append( VTKViewer_Viewer::Type() ); -#endif -#endif -#ifndef DISABLE_PLOT2DVIEWER -#ifndef DISABLE_SALOMEOBJECT - viewers.append( SPlot2d_Viewer::Type() ); -#else - viewers.append( Plot2d_Viewer::Type() ); -#endif -#endif - - if( !viewers.isEmpty() ) - { - QString strViewers = "{ ", temp = "'%1' "; - QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end(); - for( ; anIt!=aLast; anIt++ ) - strViewers+=temp.arg( *anIt ); - strViewers+="}"; - myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), true ); - } - } - return myPopupMgr; -} - -/*!Gets preferences.*/ -LightApp_Preferences* LightApp_Module::preferences() const -{ - LightApp_Preferences* pref = 0; - if ( getApp() ) - pref = getApp()->preferences(); - return pref; -} - -/*!Add preference to preferences.*/ -int LightApp_Module::addPreference( const QString& label ) -{ - LightApp_Preferences* pref = preferences(); - if ( !pref ) - return -1; - - int catId = pref->addPreference( moduleName(), -1 ); - if ( catId == -1 ) - return -1; - - return pref->addPreference( label, catId ); -} - -/*!Add preference to preferences.*/ -int LightApp_Module::addPreference( const QString& label, const int pId, const int type, - const QString& section, const QString& param ) -{ - LightApp_Preferences* pref = preferences(); - if ( !pref ) - return -1; - - return pref->addPreference( moduleName(), label, pId, type, section, param ); -} - -/*!Gets property of preferences.*/ -QVariant LightApp_Module::preferenceProperty( const int id, const QString& prop ) const -{ - QVariant var; - LightApp_Preferences* pref = preferences(); - if ( pref ) - var = pref->itemProperty( id, prop ); - return var; -} - -/*!Set property of preferences.*/ -void LightApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var ) -{ - LightApp_Preferences* pref = preferences(); - if ( pref ) - pref->setItemProperty( id, prop, var ); -} - -/*! - * \brief Starts operation with given identifier - * \param id - identifier of operation to be started -* -* Module stores operations in map. This method starts operation by id. -* If operation isn't in map, then it will be created by createOperation method -* and will be inserted to map -*/ -void LightApp_Module::startOperation( const int id ) -{ - LightApp_Operation* op = 0; - if( myOperations.contains( id ) ) - op = myOperations[ id ]; - else - { - op = createOperation( id ); - if( op ) - { - myOperations.insert( id, op ); - op->setModule( this ); - connect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onOperationStopped( SUIT_Operation* ) ) ); - connect( op, SIGNAL( destroyed() ), this, SLOT( onOperationDestroyed() ) ); - } - } - - if( op ) - { - // be sure that operation has correct study pointer - op->setStudy( application() ? application()->activeStudy() : 0 ); - op->start(); - } -} - -/*! - * \brief Creates operation with given identifier - * \param id - identifier of operation to be started - * \return Pointer on created operation or NULL if operation is not created -* -* Creates operation with given id. You should not call this method, it will be called -* automatically from startOperation. You may redefine this method in concrete module to -* create operations. -*/ -LightApp_Operation* LightApp_Module::createOperation( const int id ) const -{ - if( id==-1 ) - return 0; - - if( id==myDisplay ) - return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY ); - else if( id==myErase ) - return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE ); - else if( id==myDisplayOnly ) - return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY_ONLY ); - else if( id==myEraseAll ) - return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE_ALL ); - else - return 0; -} - -/*! - * \brief Virtual protected slot called when operation stopped - * \param theOp - stopped operation -* -* Virtual protected slot called when operation stopped. Redefine this slot if you want to -* perform actions after stopping operation -*/ -void LightApp_Module::onOperationStopped( SUIT_Operation* /*theOp*/ ) -{ -} - -/*! - * \brief Virtual protected slot called when operation destroyed - * \param theOp - destroyed operation -* -* Virtual protected slot called when operation destroyed. Redefine this slot if you want to -* perform actions after destroying operation. Base implementation removes pointer on -* destroyed operation from the map of operations -*/ -void LightApp_Module::onOperationDestroyed() -{ - const QObject* s = sender(); - if( s && s->inherits( "LightApp_Operation" ) ) - { - const LightApp_Operation* op = ( LightApp_Operation* )s; - MapOfOperation::const_iterator anIt = myOperations.begin(), - aLast = myOperations.end(); - for( ; anIt!=aLast; anIt++ ) - if( anIt.data()==op ) - { - myOperations.remove( anIt.key() ); - break; - } - } -} - -/*! - Must be redefined in order to use standard displayer mechanism - \return displayer of module -*/ -LightApp_Displayer* LightApp_Module::displayer() -{ - return 0; -} - -/*! - SLOT: called on activating of standard operations show/hide -*/ -void LightApp_Module::onShowHide() -{ - if( !sender()->inherits( "QAction" ) || !popupMgr() ) - return; - - QAction* act = ( QAction* )sender(); - int id = actionId( act ); - if( id!=-1 ) - startOperation( id ); -} - -/*! - virtual SLOT: called on view manager adding -*/ -void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* ) -{ -} - -/*! - virtual SLOT: called on view manager removing -*/ -void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* ) -{ -} diff --git a/src/LightApp/LightApp_Module.h b/src/LightApp/LightApp_Module.h deleted file mode 100644 index 01035d773..000000000 --- a/src/LightApp/LightApp_Module.h +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Module.h -// Created: 6/20/2005 16:25:06 AM -// Author: OCC team -// Copyright (C) CEA 2005 - -#ifndef LIGHTAPP_MODULE_H -#define LIGHTAPP_MODULE_H - -#include "LightApp.h" -#include - -class LightApp_Application; -class LightApp_Preferences; -class LightApp_Selection; -class LightApp_Operation; -class LightApp_SwitchOp; -class LightApp_ShowHideOp; -class LightApp_Displayer; - -class SUIT_Study; -class SUIT_DataObject; -class SUIT_Operation; -class SUIT_ViewManager; -class CAM_Application; - -class QtxPopupMgr; - -class QString; -class QVariant; - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -/*! - \class LightApp_Module - Base class for all light modules -*/ - -class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module -{ - Q_OBJECT - -public: - LightApp_Module( const QString& ); - virtual ~LightApp_Module(); - - virtual void initialize( CAM_Application* ); - virtual void windows( QMap& ) const; - virtual void viewManagers( QStringList& ) const; - - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); - - virtual void createPreferences(); - - LightApp_Application* getApp() const; - - virtual void update( const int ); - // Update viewer or/and object browser etc. in accordance with update flags - // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method - // for their own purposes - - virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 ); - // Update object bropwser ( for updating model or whole object browser use update() method - // can be used ) - - virtual void selectionChanged(); - virtual void preferencesChanged( const QString&, const QString& ); - - virtual void studyActivated() {}; - - virtual LightApp_Displayer* displayer(); - -public slots: - virtual bool activateModule( SUIT_Study* ); - virtual bool deactivateModule( SUIT_Study* ); - - void MenuItem(); - -protected slots: - virtual void onModelSaved(); - virtual void onModelOpened(); - virtual void onModelClosed(); - - virtual void onOperationStopped( SUIT_Operation* ); - virtual void onOperationDestroyed(); - virtual void onShowHide(); - virtual void onViewManagerAdded( SUIT_ViewManager* ); - virtual void onViewManagerRemoved( SUIT_ViewManager* ); - -protected: - virtual QtxPopupMgr* popupMgr(); - LightApp_Preferences* preferences() const; - - virtual CAM_DataModel* createDataModel(); - virtual LightApp_Selection* createSelection() const; - - int addPreference( const QString& label ); - int addPreference( const QString& label, const int pId, const int = -1, - const QString& section = QString::null, - const QString& param = QString::null ); - QVariant preferenceProperty( const int, const QString& ) const; - void setPreferenceProperty( const int, const QString&, const QVariant& ); - - /*! Module stores operations in map. This method starts operation by id. - * If operation isn't in map, then it will be created by createOperation method - * and will be inserted to map - */ - void startOperation( const int ); - /*! Create operation by its id. You must not call this method, it will be called automatically - * by startOperation. Please redefine this method in current module - */ - virtual LightApp_Operation* createOperation( const int ) const; - - virtual void updateControls(); - -private: - typedef QMap MapOfOperation; - -private: - QtxPopupMgr* myPopupMgr; - MapOfOperation myOperations; - LightApp_SwitchOp* mySwitchOp; - -protected: - int myDisplay, myErase, myDisplayOnly, myEraseAll; -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/LightApp/LightApp_ModuleDlg.cxx b/src/LightApp/LightApp_ModuleDlg.cxx deleted file mode 100644 index d7777bdaa..000000000 --- a/src/LightApp/LightApp_ModuleDlg.cxx +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : LightApp_ModuleDlg.cxx -// Author : Michael Zorin (mzn) -// Module : LightApp - -#include - -#include -#include -#include -#include -#include - -#ifndef WIN32 -using namespace std; -#endif - -/*!Default icon*/ -static const char* const default_icon[] = { -"48 48 17 1", -". c None", -"# c #161e4c", -"b c #1d3638", -"e c #2f585b", -"i c #345b5e", -"c c #386266", -"g c #3f7477", -"d c #4d8589", -"m c #519099", -"o c #6abbc1", -"a c #70c9d3", -"f c #79ddea", -"n c #7adff2", -"k c #7ce2f4", -"j c #993550", -"h c #d84b71", -"l c #ef537d", -"................................................", -"................................................", -"................................................", -"................................................", -"................................................", -"................########.########.########......", -"...............#aaaaaa###aaaaaa###aaaaaa##......", -"..............#aaaaaa#b#aaaaaa#b#aaaaaa#c#......", -".............########b########b########cc#......", -".............#dddddd#b#dddddd#b#dddddd#cc#......", -"...........########d########d########d#cc#......", -"..........#aaaaaa###aaaaaa###aaaaaa##d#cc#......", -".........#aaaaaa#b#aaaaaa#b#aaaaaa#c#d#cc#......", -"........########b########e########cc#d#c#.......", -"........#dddddd#b#dddddd#e#ffffff#cc#d####......", -"......########d########d########f#cc###g##......", -".....#aaaaaa###aaaaaa###hhhhhh##f#cc#gg#c#......", -"....#aaaaaa#b#aaaaaa#i#hhhhhh#j#f#cc###cc#......", -"...########b########i########jj#f#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj#f####g#cc#......", -"...#kkkkkk#b#kkkkkk#i#llllll#jj###m##g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj#mm#c#g#cc#......", -"...#knnkkk#b#kkkkkk#i#llllll#jj###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#i#llllll#j#dd#cc#g####......", -"...#kkkkkk###kkkkkk###llllll####d#cc###g##......", -"...########g########g########o##d#cc#gg#c#......", -"....#gggggg#b#gggggg#b#oooooo#c#d#cc###cc#......", -"...########b########b########cc#d#c#gg#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#d####g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###g##g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#gg#c#g#cc#......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###cc#g#c#.......", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#gg#cc#g##........", -"...#kkkkkk###kkkkkk###kkkkkk####g#cc###.........", -"...########g########g########g##g#cc#...........", -"....#gggggg#b#gggggg#b#gggggg#c#g#cc#...........", -"...########b########b########cc#g#c#............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#g##.............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc###..............", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#cc#................", -"...#kkkkkk#b#kkkkkk#b#kkkkkk#c#.................", -"...#kkkkkk###kkkkkk###kkkkkk##..................", -"...########.########.########...................", -"................................................", -"................................................", -"................................................", -"................................................"}; - -//============================================================================================================================== -/*! - * LightApp_ModuleDlg::LightApp_ModuleDlg \n - * - * Constructor. - */ -//============================================================================================================================== -LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon ) - : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - QPixmap defaultIcon( ( const char** ) default_icon ); - setCaption( tr( "CAPTION" ) ); - setSizeGripEnabled( TRUE ); - - QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); - ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 ); - - // Module's name and icon - myComponentFrame = new QFrame( this, "myComponentFrame" ); - myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - myComponentFrame->setMinimumHeight( 100 ); - myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - - QGridLayout* myComponentFrameLayout = new QGridLayout( myComponentFrame ); - myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 ); - - // --> icon - myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" ); - myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon ); - myComponentIcon->setScaledContents( false ); - myComponentIcon->setAlignment( AlignCenter ); - // --> name - myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" ); - QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); - myComponentLab->setAlignment( AlignCenter ); - - myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 ); - myComponentFrameLayout->addWidget( myComponentLab, 0, 1 ); - - // Info - QVBoxLayout* infoLayout = new QVBoxLayout(); - infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 ); - - // --> top line - QFrame* myLine1 = new QFrame( this, "myLine1" ); - myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain ); - // --> info label - myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" ); - myInfoLabel->setAlignment( AlignCenter ); - // --> bottom line - QFrame* myLine2 = new QFrame( this, "myLine2" ); - myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain ); - - infoLayout->addStretch(); - infoLayout->addWidget( myLine1 ); - infoLayout->addWidget( myInfoLabel ); - infoLayout->addWidget( myLine2 ); - infoLayout->addStretch(); - - // Buttons - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); - - // --> New - myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" ); - myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true ); - // --> Open - myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" ); - myOpenBtn->setAutoDefault( true ); - // --> Load - myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" ); - myLoadBtn->setAutoDefault( true ); - // --> Cancel - myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" ); - myCancelBtn->setAutoDefault( true ); - - btnLayout->addWidget( myNewBtn ); - btnLayout->addWidget( myOpenBtn ); - btnLayout->addWidget( myLoadBtn ); - btnLayout->addStretch(); - btnLayout->addSpacing( 70 ); - btnLayout->addStretch(); - btnLayout->addWidget( myCancelBtn ); - - ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); - ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); - ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 ); - - // signals and slots connections - connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myOpenBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myLoadBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); -} - -//============================================================================================================================== -/*! - * LightApp_ModuleDlg::onButtonClicked - * - * Buttons slot - */ -//============================================================================================================================== -void LightApp_ModuleDlg::onButtonClicked() -{ - QPushButton* btn = ( QPushButton* )sender(); - if ( btn == myNewBtn ) - done( 1 ); - if ( btn == myOpenBtn ) - done( 2 ); - if ( btn == myLoadBtn ) - done( 3 ); -} diff --git a/src/LightApp/LightApp_ModuleDlg.h b/src/LightApp/LightApp_ModuleDlg.h deleted file mode 100644 index 9b818344c..000000000 --- a/src/LightApp/LightApp_ModuleDlg.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// File : LightApp_ModuleDlg.h -// Author : Michael ZORIN (mzn) -// Module : SALOME - -#ifndef LIGHTAPP_MODULEDLG_H -#define LIGHTAPP_MODULEDLG_H - -#include "LightApp.h" -#include -#include - -class QFrame; -class QLabel; -class QPushButton; - -/*! - \class LightApp_ModuleDlg - Dialog allows to choose action on module activation when there is no document. - It is possible to create new document, to open existing or to cancel module activation -*/ -class LIGHTAPP_EXPORT LightApp_ModuleDlg : public QDialog -{ - Q_OBJECT - -public: - LightApp_ModuleDlg ( QWidget* parent, const QString& component, const QPixmap icon = QPixmap() ) ; - ~LightApp_ModuleDlg ( ) { }; - -private slots: - void onButtonClicked(); - -private: - QFrame* myComponentFrame; - QLabel* myComponentLab; - QLabel* myComponentIcon; - QLabel* myInfoLabel; - QPushButton* myNewBtn; - QPushButton* myOpenBtn; - QPushButton* myLoadBtn; - QPushButton* myCancelBtn; -}; - -#endif - diff --git a/src/LightApp/LightApp_NameDlg.cxx b/src/LightApp/LightApp_NameDlg.cxx deleted file mode 100644 index e1bca58ce..000000000 --- a/src/LightApp/LightApp_NameDlg.cxx +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : LightApp_NameDlg.cxx -// Author : Vadim SANDLER -// $Header$ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#ifndef WIN32 -using namespace std; -#endif - -/*! - Constructor -*/ -LightApp_NameDlg::LightApp_NameDlg( QWidget* parent ) -: QDialog( parent ? parent : NULL,//application()->desktop(), -"LightApp_NameDlg", -true, -WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) -{ - setCaption( tr("TLT_RENAME") ); - setSizeGripEnabled( TRUE ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); - - /***************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 ); - QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 ); - - QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" ); - TextLabel->setText( tr( "NAME_LBL" ) ); - GroupC1Layout->addWidget( TextLabel ); - - myLineEdit = new QLineEdit( GroupC1, "LineEdit1" ); - myLineEdit->setMinimumSize( 250, 0 ); - GroupC1Layout->addWidget( myLineEdit ); - - /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 ); - - myButtonOk = new QPushButton( GroupButtons, "buttonOk" ); - myButtonOk->setText( tr( "BUT_OK" ) ); - myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( myButtonOk ); - - GroupButtonsLayout->addStretch(); - - myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - myButtonCancel->setText( tr( "BUT_CANCEL" ) ); - myButtonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( myButtonCancel ); - /***************************************************************/ - - topLayout->addWidget( GroupC1 ); - topLayout->addWidget( GroupButtons ); - - // signals and slots connections - connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - - /* Move widget on the botton right corner of main widget */ - SUIT_Tools::centerWidget( this, parent ); -} - -/*! - Destructor -*/ -LightApp_NameDlg::~LightApp_NameDlg() -{ -} - -/*! - Sets name -*/ -void LightApp_NameDlg::setName( const QString& name ) -{ - myLineEdit->setText( name ); - myLineEdit->end(false); - myLineEdit->home(true); -} - -/*! - Returns name entered by user -*/ -QString LightApp_NameDlg::name() -{ - return myLineEdit->text(); -} - -/*! - Accepts if name isn't empty -*/ -void LightApp_NameDlg::accept() -{ - if ( name().stripWhiteSpace().isEmpty() ) - return; - QDialog::accept(); -} - -/*! - Creates modal dialog and returns name entered [ static ] -*/ -QString LightApp_NameDlg::getName( QWidget* parent, const QString& oldName ) -{ - QString n; - LightApp_NameDlg* dlg = new LightApp_NameDlg( parent ); - if ( !oldName.isNull() ) - dlg->setName( oldName ); - if ( dlg->exec() == QDialog::Accepted ) - n = dlg->name(); - delete dlg; - return n; -} diff --git a/src/LightApp/LightApp_NameDlg.h b/src/LightApp/LightApp_NameDlg.h deleted file mode 100644 index 45f64c15b..000000000 --- a/src/LightApp/LightApp_NameDlg.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// SALOME SalomeApp : implementation of desktop and GUI kernel -// -// File : LightApp_NameDlg.h -// Author : Vadim SANDLER -// Module : SALOME -// $Header$ - -#ifndef LIGHTAPP_NAMEDLG_H -#define LIGHTAPP_NAMEDLG_H - -#include "LightApp.h" -#include - -class QLineEdit; -class QPushButton; - -/*! - \class LightApp_NameDlg - Common dialog box class -*/ -class LIGHTAPP_EXPORT LightApp_NameDlg : public QDialog -{ - Q_OBJECT - -public: - LightApp_NameDlg( QWidget* parent = 0 ); - ~LightApp_NameDlg(); - - void setName( const QString& name ); - QString name(); - - static QString getName( QWidget* parent = 0, const QString& oldName = QString::null ); - -protected slots: - void accept(); - -private: - QPushButton* myButtonOk; - QPushButton* myButtonCancel; - QLineEdit* myLineEdit; -}; - -#endif // LightApp_NAMEDLG_H diff --git a/src/LightApp/LightApp_OBFilter.cxx b/src/LightApp/LightApp_OBFilter.cxx deleted file mode 100644 index b15720271..000000000 --- a/src/LightApp/LightApp_OBFilter.cxx +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_OBFilter.h" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_DataObject.h" -#include "LightApp_DataOwner.h" - -/*! - Constructor. -*/ -LightApp_OBFilter::LightApp_OBFilter( LightApp_SelectionMgr* theSelMgr ) -{ - mySelMgr = theSelMgr; -} - -/*!Destructor.*/ -LightApp_OBFilter::~LightApp_OBFilter() -{ -} - -/*!Checks: data object is ok?*/ -bool LightApp_OBFilter::isOk( const SUIT_DataObject* theDataObj ) const -{ - const LightApp_DataObject* obj = dynamic_cast( theDataObj ); - if ( obj ) - return mySelMgr->isOk( new LightApp_DataOwner( obj->entry() ) ); - - return true; -} - diff --git a/src/LightApp/LightApp_OBFilter.h b/src/LightApp/LightApp_OBFilter.h deleted file mode 100644 index 79e010c14..000000000 --- a/src/LightApp/LightApp_OBFilter.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_OBFILTER_H -#define LIGHTAPP_OBFILTER_H - -#include "LightApp.h" -#include "OB_Filter.h" - -class LightApp_SelectionMgr; - -/*! - \class LightApp_OBFilter - Custom Object Browser filter, that checks correctness of object by all filters set in selection manager -*/ -class LIGHTAPP_EXPORT LightApp_OBFilter: public OB_Filter -{ -public: - LightApp_OBFilter( LightApp_SelectionMgr* theSelMgr ); - ~LightApp_OBFilter(); - - virtual bool isOk( const SUIT_DataObject* ) const; - -private: - LightApp_SelectionMgr* mySelMgr; - -}; - -#endif diff --git a/src/LightApp/LightApp_OBSelector.cxx b/src/LightApp/LightApp_OBSelector.cxx deleted file mode 100644 index 0b762d420..000000000 --- a/src/LightApp/LightApp_OBSelector.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_OBSelector.h" - -#include "LightApp_DataOwner.h" -#include "LightApp_DataObject.h" - -#include - -#include - -#include - -#include - -/*! - Constructor -*/ -LightApp_OBSelector::LightApp_OBSelector( OB_Browser* ob, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, ob ), - myBrowser( ob ) -{ - if ( myBrowser ) { - connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); - } - - setModified(); -} - -/*! - Destructor -*/ -LightApp_OBSelector::~LightApp_OBSelector() -{ -} - -/*! - Gets browser. -*/ -OB_Browser* LightApp_OBSelector::browser() const -{ - return myBrowser; -} - -/*! - Gets selection. -*/ -void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const -{ - if (mySelectedList.count() == 0 ) { - if ( !myBrowser ) - return; - DataObjectList objlist; - myBrowser->getSelected( objlist ); - LightApp_OBSelector* that = (LightApp_OBSelector*)this; - for ( DataObjectListIterator it( objlist ); it.current(); ++it ) - { - LightApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) - { -#ifndef DISABLE_SALOMEOBJECT - Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject - ( obj->entry(), obj->componentDataType(), obj->name() ); - LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj ); -#else - LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() ); -#endif - that->mySelectedList.append( SUIT_DataOwnerPtr( owner ) ); - } - } - } - theList = mySelectedList; -} - -/*!Sets selection.*/ -void LightApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) -{ - if ( !myBrowser ) - return; - - if( myEntries.count() == 0 || - myModifiedTime < myBrowser->getModifiedTime() ) - fillEntries( myEntries ); - - DataObjectList objList; - for ( SUIT_DataOwnerPtrList::const_iterator it = theList.begin(); it != theList.end(); ++it ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*it).operator->() ); - if ( owner && myEntries.contains( owner->entry() ) ) - objList.append( myEntries[owner->entry()] ); - } - - myBrowser->setSelected( objList ); - mySelectedList.clear(); -} - -/*!On selection changed.*/ -void LightApp_OBSelector::onSelectionChanged() -{ - QTime t1 = QTime::currentTime(); - mySelectedList.clear(); - selectionChanged(); - QTime t2 = QTime::currentTime(); - qDebug( QString( "selection time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) ); -} - -/*!Fill entries.*/ -void LightApp_OBSelector::fillEntries( QMap& entires ) -{ - entires.clear(); - - if ( !myBrowser ) - return; - - for ( SUIT_DataObjectIterator it( myBrowser->getRootObject(), - SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) - { - LightApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj ) - entires.insert( obj->entry(), obj ); - } - - setModified(); -} - -/*!Update modified time.*/ -void LightApp_OBSelector::setModified() -{ - myModifiedTime = clock(); -} diff --git a/src/LightApp/LightApp_OBSelector.h b/src/LightApp/LightApp_OBSelector.h deleted file mode 100644 index f6811946c..000000000 --- a/src/LightApp/LightApp_OBSelector.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_OBSELECTOR_H -#define LIGHTAPP_OBSELECTOR_H - -#include "LightApp.h" - -#include -#include - -class OB_Browser; -class LightApp_DataObject; - -/*! - \class LightApp_OBSelector - Custom selector to get/set selection from object browser -*/ -class LIGHTAPP_EXPORT LightApp_OBSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - LightApp_OBSelector( OB_Browser*, SUIT_SelectionMgr* ); - virtual ~LightApp_OBSelector(); - - OB_Browser* browser() const; - - /*!Return "ObjectBrowser"*/ - virtual QString type() const { return "ObjectBrowser"; } - - void setModified(); - unsigned long getModifiedTime() { return myModifiedTime; } - -private slots: - void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - void fillEntries( QMap& ); - -private: - OB_Browser* myBrowser; - SUIT_DataOwnerPtrList mySelectedList; - - QMap myEntries; - - unsigned long myModifiedTime; -}; - -#endif diff --git a/src/LightApp/LightApp_OCCSelector.cxx b/src/LightApp/LightApp_OCCSelector.cxx deleted file mode 100644 index 446ae593b..000000000 --- a/src/LightApp/LightApp_OCCSelector.cxx +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_DataOwner.h" -#include "LightApp_OCCSelector.h" - -#ifndef DISABLE_SALOMEOBJECT - #include -#endif -#include -#include - -/*! - Constructor -*/ -LightApp_OCCSelector::LightApp_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); -} - -/*! - Destructor. -*/ -LightApp_OCCSelector::~LightApp_OCCSelector() -{ -} - -/*! - Gets viewer. -*/ -OCCViewer_Viewer* LightApp_OCCSelector::viewer() const -{ - return myViewer; -} - -/*!On selection changed.*/ -void LightApp_OCCSelector::onSelectionChanged() -{ - selectionChanged(); -} - -/*!Gets selection list.*/ -void LightApp_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if ( !myViewer ) - return; - - AIS_ListOfInteractive aSelList; - myViewer->getSelectedObjects( aSelList ); - for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() ) - if ( !anIt.Value().IsNull() ) - { -#ifndef DISABLE_SALOMEOBJECT - Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anIt.Value()->GetOwner()); - if( !anObj.IsNull() ) - aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anObj ) ) ); -#else - aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) ); -#endif - } -} - -/*!Sets selection list.*/ -void LightApp_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) -{ - if ( !myViewer ) - return; - - QMap aDisplayed; - Handle(AIS_InteractiveContext) aContext = myViewer->getAISContext(); - if ( aContext.IsNull() ) - return; - - AIS_ListOfInteractive aDispList, aSelList; - aContext->DisplayedObjects( aDispList ); - - for ( AIS_ListIteratorOfListOfInteractive it( aDispList ); it.More(); it.Next() ) - { - QString entryStr = entry( it.Value() ); - if ( !entryStr.isEmpty() ) - aDisplayed.insert( entryStr, it.Value() ); - } - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if ( owner && aDisplayed.contains( owner->entry() ) ) - aSelList.Append( aDisplayed[owner->entry()] ); - } - - myViewer->unHighlightAll( false ); - myViewer->setObjectsSelected( aSelList ); -} - -/*!Gets entry ob object.*/ -QString LightApp_OCCSelector::entry( const Handle(AIS_InteractiveObject)& anAIS ) const -{ - if ( anAIS.IsNull() || !anAIS->HasOwner() ) - return QString::null; - - QString res; - -#ifndef DISABLE_SALOMEOBJECT - Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast(anAIS->GetOwner()); - if ( !anObj.IsNull() ) - res = QString( anObj->getEntry() ); -#endif - - return res; -} diff --git a/src/LightApp/LightApp_OCCSelector.h b/src/LightApp/LightApp_OCCSelector.h deleted file mode 100644 index c358efe8a..000000000 --- a/src/LightApp/LightApp_OCCSelector.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_OCCSELECTOR_H -#define LIGHTAPP_OCCSELECTOR_H - -#include "LightApp.h" - -#include - -#include - -class Handle_AIS_InteractiveObject; - -/*! - \class LightApp_OCCSelector - Custom selector to get/set selection from OCC viewer -*/ -class LIGHTAPP_EXPORT LightApp_OCCSelector : public SUIT_Selector -{ - Q_OBJECT - -public: - LightApp_OCCSelector( OCCViewer_Viewer*, SUIT_SelectionMgr* ); - virtual ~LightApp_OCCSelector(); - - OCCViewer_Viewer* viewer() const; - - virtual QString type() const { return OCCViewer_Viewer::Type(); } - -private slots: - virtual void onSelectionChanged(); - -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - - QString entry( const Handle_AIS_InteractiveObject& ) const; - -private: - OCCViewer_Viewer* myViewer; -}; - -#endif diff --git a/src/LightApp/LightApp_Operation.cxx b/src/LightApp/LightApp_Operation.cxx deleted file mode 100755 index 86450eb81..000000000 --- a/src/LightApp/LightApp_Operation.cxx +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : LightApp_Operation.h -// Author : Sergey LITONIN -// Module : LightApp - -#include -#include -#include -#include -#include -#include - -#include - -#include - - -/*! - * \brief Constructor -* -* Constructor sets myModule in NULL and myIsAutoResumed in TRUE -*/ -LightApp_Operation::LightApp_Operation() -: SUIT_Operation( 0 ), - myModule( 0 ), - myIsAutoResumed( true ) -{ -} - -/*! - * \brief Destructor -* -* Destructor does nothing -*/ -LightApp_Operation::~LightApp_Operation() -{ - -} - -/*! - * \brief Gets module of operation - * \return Pointer to the module -* -* Gets pointer to the module or NULL if module was not set. It is strongly recomended to -* set valid pointer on the module before start of operation -*/ -LightApp_Module* LightApp_Operation::module() const -{ - return myModule; -} - - -/*! - * \brief Sets module of operation - * \param theModule - module to be set -* -* Sets pointer to the module. It is strongly recomended to set valid pointer on the -* module before start of operation -*/ -void LightApp_Operation::setModule( LightApp_Module* theModule ) -{ - myModule = theModule; - setApplication( myModule ? myModule->application() : 0 ); - setStudy( application() ? application()->activeStudy() : 0 ); -} - -/*! - * \brief Gets desktop of operation - * \return Pointer to the desktop -* -* Gets pointer to the desktop or NULL if application was not set. It is strongly recomended -* to set valid pointer on the application before start of operation -*/ -SUIT_Desktop* LightApp_Operation::desktop() const -{ - return application() != 0 ? application()->desktop() : 0; -} - -/*! - * \brief Enable dialog of operation -* -* Virtual method redefined from the base class. Enable dialog if it was desabled (in -* suspend method) and activate selection -*/ -void LightApp_Operation::resumeOperation() -{ - SUIT_Operation::resumeOperation(); - setDialogActive( true ); -} - -/*! - * \brief Performs actions needed for starting operation -* -* Virtual method redefined from the base class. Connect signal of selection manager to -* onSelectionDone() slot -*/ -void LightApp_Operation::startOperation() -{ - if( selectionMgr() ) - connect( selectionMgr(), SIGNAL( selectionChanged() ), SLOT( onSelectionDone() ) ); - - //If suspended operation was stopped during starting other operation, - //the dialog is inactive now, We must activate it - setDialogActive( true ); -} - -/*! - * \brief Performs actions needed for suspending operation -* -* Virtual method redefined from the base class. This implementation calls corresponding -* method of base class and cals setDialogActive( false ) -*/ -void LightApp_Operation::suspendOperation() -{ - SUIT_Operation::suspendOperation(); - setDialogActive( false ); -} - -/*! - * \brief Performs actions needed for aborting operation -* -* Virtual method redefined from the base class calls corresponding method of base class -* and hides dialog box (if it is exists), disconnect slots from selection manager -*/ -void LightApp_Operation::abortOperation() -{ - SUIT_Operation::abortOperation(); - setDialogActive( true ); - if ( dlg() ) - dlg()->hide(); - - if( selectionMgr() ) - disconnect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionDone() ) ); -} - -/*! - * \brief Performs actions needed for committing operation -* -* Virtual method redefined from the base class calls corresponding method of base class -* and hides dialog box (if it is exists), disconnect slots from selection manager -*/ -void LightApp_Operation::commitOperation() -{ - SUIT_Operation::commitOperation(); - setDialogActive( true ); - if ( dlg() ) - dlg()->hide(); - - if( selectionMgr() ) - disconnect( selectionMgr(), SIGNAL( selectionChanged() ), this, SLOT( onSelectionDone() ) ); -} - -/*! - * \brief Gets dialog - * \return Pointer to the dialog of this operation or NULL if it does not exist -* -* This method should be redefined in derived classes if they use dialogs. If this -* function returns pointer to dialog then dialog will be correctly -* -# deactivated in suspendOperation method -* -# activated in resumeOperation method -* -# hidden in abortOperation and commitOperation methods -*/ -LightApp_Dialog* LightApp_Operation::dlg() const -{ - return 0; -} - -/*! - * \brief Activates selection -* -* Virtual method should be redefined in derived classes if they use own selection modes -* (different from default) -*/ -void LightApp_Operation::activateSelection() -{ -} - -/*! - * \brief Virtual method called when selection is changed -* -* Virtual method should be redefined in derived classes if they works with selection -* to provide reaction on the change of selection -*/ -void LightApp_Operation::selectionDone() -{ -} - -/*! - * \brief Gets active operation -* -* This method provided for convinience calls SUIT_Study::activeOperation() one -*/ -SUIT_Operation* LightApp_Operation::activeOperation() const -{ - return study() != 0 ? study()->activeOperation() : 0; -} - -/*! - * \brief Gets selection manager -* -* This method provided for convinience calls LightApp_Application::selectionMgr() one -*/ -LightApp_SelectionMgr* LightApp_Operation::selectionMgr() const -{ - SUIT_Application* app = application(); - if ( app != 0 && app->inherits( "LightApp_Application" ) ) - return ( (LightApp_Application*)app )->selectionMgr(); - else - return 0; -} - -/*! - * \brief Call selectionDone() method -* -* Call selectionDone() method if operator is an active one (see selectionDone() for more -* description ) -*/ -void LightApp_Operation::onSelectionDone() -{ - if ( isActive() ) - selectionDone(); -} - -/*! - * \brief Update object browser or/and viewer etc. - * \param flags - update flags -* -* This method provided for convinience calls LightApp_Module::update() one (see -* LightApp_Module::update() for more description) -*/ -void LightApp_Operation::update( const int flags ) -{ - if ( myModule != 0 ) - myModule->update( flags ); -} - -/*! - * \brief Activate/Deactivate dialog of operation - * \param active - State of the dialog to be set -* -* Activate/Deactivate dialog of operation. This method called from startOperation(), -* suspendOperation() ones and so on -*/ -void LightApp_Operation::setDialogActive( const bool active ) -{ - if( dlg() ) - { - if( active ) - { - activateSelection(); - dlg()->setActiveWindow(); - } - } -} - -/*! - * \brief Gets autoresume property - * \return Autoresume property. -* -* Autoresume property is used during automatic resuming operation. If operation is -* suspended and cursor is moved above dialog of the operation then operation is resumed -* automatically (if possible). It can be resumed only program call otherwise (see -* LightApp_SwitchOp for more description). This property is TRUE by default and may be -* changed with setAutoResumed() method call. -*/ -bool LightApp_Operation::isAutoResumed() const -{ - return myIsAutoResumed; -} - -/*! - * \brief Sets autoresume property - * \param on - Value to be set - * \return Autoresume property. -* -* Sets autoresume property (see isAutoResumed() for more description) -*/ -void LightApp_Operation::setAutoResumed( const bool on ) -{ - myIsAutoResumed = on; -} diff --git a/src/LightApp/LightApp_Operation.h b/src/LightApp/LightApp_Operation.h deleted file mode 100755 index 8afcda91a..000000000 --- a/src/LightApp/LightApp_Operation.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : LightApp_Operation.h -// Author : Sergey LITONIN -// Module : LIGHT - - -#ifndef LightApp_Operation_H -#define LightApp_Operation_H - -#include "LightApp.h" -#include - -class LightApp_Module; -class LightApp_Application; -class LightApp_Operation; -class LightApp_SelectionMgr; -class LightApp_Dialog; -class SUIT_Desktop; - -/*! - \class LightApp_Operation - \brief Base class for all operations - Base class for all operations (see SUIT_Operation for more description) -*/ -class LIGHTAPP_EXPORT LightApp_Operation : public SUIT_Operation -{ - Q_OBJECT - -public: - LightApp_Operation(); - virtual ~LightApp_Operation(); - - virtual void setModule( LightApp_Module* ); - LightApp_Module* module() const; - - bool isAutoResumed() const; - - virtual LightApp_Dialog* dlg() const; - -protected: - - // Methods redefined from base class - - virtual void startOperation(); - virtual void suspendOperation(); - virtual void resumeOperation(); - virtual void abortOperation(); - virtual void commitOperation(); - - // Additional virtual methods may be redefined by derived classes - - virtual void setDialogActive( const bool ); - virtual void activateSelection(); - virtual void selectionDone(); - - - // Axiluary methods - - SUIT_Desktop* desktop() const; - SUIT_Operation* activeOperation() const; - LightApp_SelectionMgr* selectionMgr() const; - void update( const int ); - void setAutoResumed( const bool ); - -private slots: - - virtual void onSelectionDone(); - -private: - - LightApp_Module* myModule; - bool myIsAutoResumed; -}; - -#endif - - - - - - diff --git a/src/LightApp/LightApp_Preferences.cxx b/src/LightApp/LightApp_Preferences.cxx deleted file mode 100644 index 65a7ef490..000000000 --- a/src/LightApp/LightApp_Preferences.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Preferences.cxx -// Author: Sergey TELKOV - -#include "LightApp_Preferences.h" - -#include - -#include - -/*! - Constructor.Initialize by resource manager and parent QWidget. -*/ -LightApp_Preferences::LightApp_Preferences( QtxResourceMgr* resMgr, QWidget* parent ) -: QtxListResourceEdit( resMgr, parent ) -{ -} - -/*! - Destructor. -*/ -LightApp_Preferences::~LightApp_Preferences() -{ -} - -/*! - Adds preference. -*/ -int LightApp_Preferences::addPreference( const QString& label, const int pId, const int type, - const QString& section, const QString& param ) -{ - return addItem( label, pId, type, section, param ); -} - -/*! - Adds preference. -*/ -int LightApp_Preferences::addPreference( const QString& mod, const QString& label, const int pId, - const int type, const QString& section, const QString& param ) -{ - int id = addItem( label, pId, type, section, param ); - if ( id != -1 && !mod.isEmpty() ) - myPrefMod.insert( id, mod ); - return id; -} - -/*! - Checks: is preferences has module with name \a mod. -*/ -bool LightApp_Preferences::hasModule( const QString& mod ) const -{ - bool res = false; - for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it ) - res = it.data() == mod; - return res; -} - -/*!Do nothing.*/ -void LightApp_Preferences::onHelp() -{ -} - -/*!Store preferences on apply.*/ -void LightApp_Preferences::onApply() -{ - store(); -} - -/*!Emit preference changed.*/ -void LightApp_Preferences::changedResources( const QMap& map ) -{ - for ( QMap::ConstIterator it = map.begin(); it != map.end(); ++it ) - { - QString sec, param; - it.key()->resource( sec, param ); - QString mod = module( it.key()->id() ); - emit preferenceChanged( mod, sec, param ); - } -} - -/*!Gets module name by \a id, if exist.*/ -QString LightApp_Preferences::module( const int id ) const -{ - QString mod; - if ( myPrefMod.contains( id ) ) - mod = myPrefMod[id]; - return mod; -} diff --git a/src/LightApp/LightApp_Preferences.h b/src/LightApp/LightApp_Preferences.h deleted file mode 100644 index f3d791986..000000000 --- a/src/LightApp/LightApp_Preferences.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_Preferences.h -// Author: Sergey TELKOV - -#ifndef LIGHTAPP_PREFERENCES_H -#define LIGHTAPP_PREFERENCES_H - -#include - -#include -#include - -#include - -class QtxResourceMgr; - -/*! - \class LightApp_Preferences - Custom preference container. Assign each preference category with module. - Emits signal on preference changing -*/ -class LIGHTAPP_EXPORT LightApp_Preferences : public QtxListResourceEdit -{ - Q_OBJECT - -public: - LightApp_Preferences( QtxResourceMgr*, QWidget* = 0 ); - virtual ~LightApp_Preferences(); - - int addPreference( const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); - int addPreference( const QString& modName, const QString& label, const int pId = -1, const int = -1, - const QString& section = QString::null, const QString& param = QString::null ); - - bool hasModule( const QString& ) const; - -signals: - void preferenceChanged( QString&, QString&, QString& ); - -private slots: - void onHelp(); - void onApply(); - virtual void changedResources( const QMap& ); - -private: - QString module( const int ) const; - -private: - typedef QMap PrefModuleMap; - -private: - PrefModuleMap myPrefMod; -}; - -#endif diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx deleted file mode 100644 index e15c16832..000000000 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_PreferencesDlg.cxx -// Author: Sergey TELKOV - -#include "LightApp_PreferencesDlg.h" -#include "LightApp_Preferences.h" - -#include "QtxResourceMgr.h" - -#include -#include -#include -#include -#include - -/*! - Constructor. -*/ -LightApp_PreferencesDlg::LightApp_PreferencesDlg( LightApp_Preferences* prefs, QWidget* parent ) -: QtxDialog( parent, 0, true, true, OK | Close | Apply ), -myPrefs( prefs ), mySaved ( false ) -{ - setCaption( tr( "CAPTION" ) ); - - QVBoxLayout* main = new QVBoxLayout( mainFrame(), 5 ); - - QVBox* base = new QVBox( mainFrame() ); - main->addWidget( base ); - - myPrefs->reparent( base, QPoint( 0, 0 ), true ); - - setFocusProxy( myPrefs ); - - setButtonPosition( Right, Close ); - - setDialogFlags( AlignOnce ); - - connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); - connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); - - QButton* defBtn = userButton( insertButton( tr( "DEFAULT_BTN_TEXT" ) ) ); - if ( defBtn ) - connect( defBtn, SIGNAL( clicked() ), this, SLOT( onDefault() ) ); - QButton* impBtn = userButton( insertButton( tr( "IMPORT_BTN_TEXT" ) ) ); - if( impBtn ) - connect( impBtn, SIGNAL( clicked() ), this, SLOT( onImportPref() ) ); -} - -/*! - Destructor. -*/ -LightApp_PreferencesDlg::~LightApp_PreferencesDlg() -{ - if ( !myPrefs ) - return; - - myPrefs->reparent( 0, QPoint( 0, 0 ), false ); - myPrefs = 0; -} - -/*!Show dialog.*/ -void LightApp_PreferencesDlg::show() -{ - myPrefs->retrieve(); - myPrefs->toBackup(); - - QtxDialog::show(); -} - -/*!Store preferences on accept.*/ -void LightApp_PreferencesDlg::accept() -{ - QtxDialog::accept(); - - myPrefs->store(); - mySaved = true; -} - -/*!Reject. Restore preferences from backup.*/ -void LightApp_PreferencesDlg::reject() -{ - QtxDialog::reject(); - - myPrefs->fromBackup(); -} - -/*!Do nothing.*/ -void LightApp_PreferencesDlg::onHelp() -{ -} - -/*!Store preferences on apply.*/ -void LightApp_PreferencesDlg::onApply() -{ - myPrefs->store(); - - // Fix for Bug PAL11197: Restoring the corrected values from resource manager. - // (Correcting in VisuGUI.cxx and SMESHGUI.cxx in methods - // ::preferencesChanged( const QString& sect, const QString& name )) - myPrefs->retrieve(); - // - - myPrefs->toBackup(); - mySaved = true; -} - -/*! Restore default preferences*/ -void LightApp_PreferencesDlg::onDefault() -{ - if( QMessageBox::Ok == QMessageBox::information( this, tr( "WARNING" ), tr( "DEFAULT_QUESTION" ), QMessageBox::Ok, QMessageBox::Cancel ) ) - { - if ( myPrefs && myPrefs->resourceMgr() ) - { - bool prev = myPrefs->resourceMgr()->ignoreUserValues(); - myPrefs->resourceMgr()->setIgnoreUserValues( true ); - myPrefs->retrieve(); - myPrefs->resourceMgr()->setIgnoreUserValues( prev ); - } - } -} - -/*! Import preferences from some file */ -void LightApp_PreferencesDlg::onImportPref() -{ - QtxResourceMgr* mgr = myPrefs->resourceMgr(); - if( !mgr ) - return; - - QFileDialog dlg( ".", "*", this, "", tr( "IMPORT_PREFERENCES" ) ); - dlg.setShowHiddenFiles( true ); - dlg.exec(); - QString fname = dlg.selectedFile(); - if( fname.isEmpty() ) - return; - - if( mgr->import( fname ) ) - { - myPrefs->retrieve(); - myPrefs->toBackup(); - } -} diff --git a/src/LightApp/LightApp_PreferencesDlg.h b/src/LightApp/LightApp_PreferencesDlg.h deleted file mode 100644 index 4c7f20f30..000000000 --- a/src/LightApp/LightApp_PreferencesDlg.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_PreferencesDlg.h -// Author: Sergey TELKOV - -#ifndef LIGHTAPP_PREFERENCESDLG_H -#define LIGHTAPP_PREFERENCESDLG_H - -#include - -#include - -class LightApp_Preferences; - -/*! - \class LightApp_PreferencesDlg - Dialog for preferences edition -*/ -class LIGHTAPP_EXPORT LightApp_PreferencesDlg : public QtxDialog -{ - Q_OBJECT - -public: - LightApp_PreferencesDlg( LightApp_Preferences*, QWidget* = 0 ); - virtual ~LightApp_PreferencesDlg(); - - virtual void show(); - virtual void accept(); - virtual void reject(); - - bool isSaved() { return mySaved; } - void setSaved( bool saved ) { mySaved = saved; } - -private slots: - void onHelp(); - void onApply(); - void onDefault(); - void onImportPref(); - -private: - LightApp_Preferences* myPrefs; - bool mySaved; -}; - -#endif diff --git a/src/LightApp/LightApp_RootObject.h b/src/LightApp/LightApp_RootObject.h deleted file mode 100644 index 1c1543a46..000000000 --- a/src/LightApp/LightApp_RootObject.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_ROOTOBJECT_H -#define LIGHTAPP_ROOTOBJECT_H - -#include "LightApp.h" -#include "SUIT_DataObject.h" - -class LightApp_Study; - -/*! - LightApp_RootObject - class to be instanciated by only one object - - root object of LightApp data object tree. This object is not shown - in object browser (invisible), so it has no re-definition of name(), icon(), - etc. methods. The goal of this class is to provide a unified access - to LightApp_Study object from LightApp_DataObject instances. -*/ -class LIGHTAPP_EXPORT LightApp_RootObject : public SUIT_DataObject -{ -public: - LightApp_RootObject( LightApp_Study* study ) - : myStudy( study ) - {} - - virtual ~LightApp_RootObject() {} - - void setStudy( LightApp_Study* study ) { myStudy = study; } - LightApp_Study* study() const { return myStudy; } - -private: - LightApp_Study* myStudy; - -}; - -#endif diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx deleted file mode 100644 index 5620c41d3..000000000 --- a/src/LightApp/LightApp_Selection.cxx +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_Selection.h" -#include "LightApp_SelectionMgr.h" -#include "LightApp_DataOwner.h" -#include "LightApp_Study.h" -#include "LightApp_Application.h" -#include "LightApp_Displayer.h" - -#include "SUIT_Session.h" -#include "SUIT_ViewWindow.h" - -/*! - Constructor -*/ -LightApp_Selection::LightApp_Selection() -: myStudy( 0 ) -{ -} - -/*! - Destructor. -*/ -LightApp_Selection::~LightApp_Selection() -{ -} - -/*! - Initialization. -*/ -void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr) -{ - myPopupClient = client; - myStudy = 0; - - if( mgr ) - { - if( mgr->application() ) - myStudy = dynamic_cast( mgr->application()->activeStudy() ); - if( !myStudy ) - return; - - //1) to take owners from current popup client - SUIT_DataOwnerPtrList sel( true ), cur_sel( true ); - mgr->selected( sel, client ); - - //2) to take such owners from other popup clients that it's entry is different with every entry from current list - QPtrList aSelectors; - mgr->selectors( aSelectors ); - for( SUIT_Selector* selector = aSelectors.first(); selector; selector = aSelectors.next() ) - { - qDebug( selector->type() ); - if( selector->type()!=client ) - { - mgr->selected( cur_sel, selector->type() ); - SUIT_DataOwnerPtrList::const_iterator aLIt = cur_sel.begin(), aLLast = cur_sel.end(); - for( ; aLIt!=aLLast; aLIt++ ) - sel.append( *aLIt ); //check entry and don't append if such entry is in list already - } - } - - //3) to analyse owner and fill internal data structures - SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), aLast = sel.end(); - QMap entries; - QString entry; - int num=0; - for( ; anIt!=aLast; anIt++ ) - { - LightApp_DataOwner* sowner = dynamic_cast( (*anIt ).get() ); - if( sowner ) - { - entry = myStudy->referencedToEntry( sowner->entry() ); - if( entries.contains( entry ) ) - continue; - - entries.insert( entry, 0 ); - myEntries.insert( num, entry ); - myIsReferences.insert( num, sowner->entry() != entry ); - processOwner( sowner ); - num++; - } - } - } -} - -/*! - Gets count of entries. -*/ -int LightApp_Selection::count() const -{ - return myEntries.count(); -} - -/*! - Gets QtxValue(); -*/ -QtxValue LightApp_Selection::param( const int ind, const QString& p ) const -{ - LightApp_Application* app = dynamic_cast( myStudy ? myStudy->application() : 0 ); - if( !( ind>=0 && indmoduleTitle( param( ind, "component" ).toString() ); - LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false ); - // false in last parameter means that now we doesn't load module, if it isn't loaded - - bool vis = false; - if( d ) - vis = d->IsDisplayed( myEntries[ ind ] ); - else - { - LightApp_Displayer local_d; - vis = local_d.IsDisplayed( myEntries[ ind ] ); - } - return QtxValue( vis, 0 ); - } - - else if( p=="component" ) - { - return myStudy->componentDataType( myEntries[ ind ] ); - } - - else if( p=="isComponent" ) - { - return QtxValue( myStudy->isComponent( myEntries[ ind ] ), 0 ); - } - - else if( p=="isReference" ) - return QtxValue( isReference( ind ), false ); - - else if( p=="canBeDisplayed" ) - { - QString mod_name = app->moduleTitle( param( ind, "component" ).toString() ); - LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false ); - // false in last parameter means that now we doesn't load module, if it isn't loaded - - if ( d ) - return d->canBeDisplayed( myEntries[ ind ] ); - else if ( myEntries[ ind ].startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) ) // object is a Save Point object - return false; - - return true; - //now if displayer is null, it means, that according module isn't loaded, so that we allow to all display/erase - //operations under object - } - - return QtxValue(); -} - -/*! - Gets global parameters. client, isActiveView, activeView etc. -*/ -QtxValue LightApp_Selection::globalParam( const QString& p ) const -{ - if ( p == "client" ) return QtxValue( myPopupClient ); - else if ( p == "activeModule" ) - { - LightApp_Application* app = dynamic_cast( myStudy->application() ); - QString mod_name = app ? QString( app->activeModule()->name() ) : QString::null; - //cout << "activeModule : " << mod_name.latin1() << endl; - if( !mod_name.isEmpty() ) - return mod_name; - else - return QtxValue(); - } - else if ( p == "isActiveView" ) return QtxValue( (bool)activeVW() ); - else if ( p == "activeView" ) return QtxValue( activeViewType() ); -#ifndef WNT - else return QtxPopupMgr::Selection::globalParam( p ); -#else - else return Selection::globalParam( p ); -#endif -} - -/*! - Do nothing. To be redefined by successors -*/ -void LightApp_Selection::processOwner( const LightApp_DataOwner* ) -{ -} - -/*! - Gets entry with index \a index. -*/ -QString LightApp_Selection::entry( const int index ) const -{ - if ( index >= 0 && index < count() ) - return myEntries[ index ]; - return QString(); -} - -/*! - Returns true if i-th selected object was reference to object with entry( i ) -*/ -bool LightApp_Selection::isReference( const int index ) const -{ - if( index >= 0 && index < count() ) - return myIsReferences[ index ]; - else - return false; -} - -/*! - Gets type of active view manager. -*/ -QString LightApp_Selection::activeViewType() const -{ - SUIT_ViewWindow* win = activeVW(); - if ( win ) { - SUIT_ViewManager* vm = win->getViewManager(); - if ( vm ) - return vm->getType(); - } - return QString::null; -} - -/*! - Gets active view window. -*/ -SUIT_ViewWindow* LightApp_Selection::activeVW() const -{ - SUIT_Session* session = SUIT_Session::session(); - if ( session ) { - SUIT_Application* app = session->activeApplication(); - if ( app ) { - SUIT_Desktop* desk = app->desktop(); - if ( desk ) - return desk->activeWindow(); - } - } - return 0; -} diff --git a/src/LightApp/LightApp_Selection.h b/src/LightApp/LightApp_Selection.h deleted file mode 100644 index 846699f3b..000000000 --- a/src/LightApp/LightApp_Selection.h +++ /dev/null @@ -1,76 +0,0 @@ -// LightApp_Selection -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : LightApp_Selection.h -// Author : Alexander SOLOVYOV -// Module : GUI -// $Header$ - -#ifndef LIGHTAPP_SELECTION_HeaderFile -#define LIGHTAPP_SELECTION_HeaderFile - -#include "LightApp.h" -#include - -class LightApp_SelectionMgr; -class LightApp_DataOwner; -class LightApp_Study; -class SUIT_ViewWindow; - -/*! - \class LightApp_Selection - Custom selection class, allowing to build popup with rules on the base - of owners selected in all selectors (popup client has more priority). - It is able to return values of standard object properties - (isVisible,isComponent,canBeDisplayed,isReference, etc) -*/ -class LIGHTAPP_EXPORT LightApp_Selection : public QtxPopupMgr::Selection -{ -public: - LightApp_Selection(); - virtual ~LightApp_Selection(); - - virtual void init( const QString&, LightApp_SelectionMgr* ); - virtual void processOwner( const LightApp_DataOwner* ); - - virtual int count() const; - virtual QtxValue param( const int, const QString& ) const; - virtual QtxValue globalParam( const QString& ) const; - void setModuleName( const QString ); - -protected: - QString entry( const int ) const; - bool isReference( const int ) const; - /*!Gets study.*/ - LightApp_Study* study() const { return myStudy; } - QString activeViewType() const; - SUIT_ViewWindow* activeVW() const; - -private: - QString myPopupClient; - QMap myEntries; // entries of selected objects - QMap myIsReferences; // whether i-th selected object was a reference - LightApp_Study* myStudy; -}; - -#endif diff --git a/src/LightApp/LightApp_SelectionMgr.cxx b/src/LightApp/LightApp_SelectionMgr.cxx deleted file mode 100644 index ca18b5759..000000000 --- a/src/LightApp/LightApp_SelectionMgr.cxx +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_SelectionMgr.h" - -#include "LightApp_Study.h" -#include "LightApp_DataOwner.h" -#include "LightApp_DataSubOwner.h" -#include "LightApp_Application.h" - -#include - -#ifndef DISABLE_SALOMEOBJECT - #include - #include - - // Open CASCADE Include - #include - #include - #include -#endif - -/*! - Constructor. -*/ -LightApp_SelectionMgr::LightApp_SelectionMgr( LightApp_Application* app, const bool fb ) -: SUIT_SelectionMgr( fb ), -myApp( app ) -{ -} - -/*! - Destructor. -*/ -LightApp_SelectionMgr::~LightApp_SelectionMgr() -{ -} - -/*! - Gets application. -*/ -LightApp_Application* LightApp_SelectionMgr::application() const -{ - return myApp; -} - -#ifndef DISABLE_SALOMEOBJECT -/*! - Get all selected objects from selection manager -*/ -void LightApp_SelectionMgr::selectedObjects( SALOME_ListIO& theList, const QString& theType, - const bool convertReferences ) const -{ - theList.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList, theType ); - - QMap entryMap; - - QString entry, checkEntry; - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if( !owner ) - continue; - - LightApp_Study* study = dynamic_cast( application()->activeStudy() ); - if ( !study ) - return; - - entry = owner->entry(); - // Entry to check object uniqueness. - // It is selected owner entry in the case, when we do not convert references, - // and entry of a real object, when we convert references. - checkEntry = entry; - if ( convertReferences ) { - QString refEntry = study->referencedToEntry( entry ); - checkEntry = refEntry; - if ( !entryMap.contains( checkEntry ) ) { - if ( refEntry != entry ) { - QString component = study->componentDataType( refEntry ); - theList.Append( new SALOME_InteractiveObject( refEntry, component, ""/*refobj->Name().c_str()*/ ) ); - } - else if( !owner->IO().IsNull() ) - theList.Append( owner->IO() ); - } - } - else { - if( !entryMap.contains( entry ) && !owner->IO().IsNull() ) - theList.Append( owner->IO() ); - } - - entryMap.insert(checkEntry, 1); - } -} - -/*! - Append selected objects. -*/ -void LightApp_SelectionMgr::setSelectedObjects( const SALOME_ListIO& lst, const bool append ) -{ - SUIT_DataOwnerPtrList owners; - for ( SALOME_ListIteratorOfListIO it( lst ); it.More(); it.Next() ) - { - if ( it.Value()->hasEntry() ) - owners.append( new LightApp_DataOwner( it.Value() ) ); - } - - setSelected( owners, append ); -} - -#else -/*! - Get all selected objects from selection manager -*/ -void LightApp_SelectionMgr::selectedObjects( QStringList& theList, const QString& theType, - const bool convertReferences ) const -{ - theList.clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList, theType ); - - QString entry; - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if( !owner ) - continue; - - LightApp_Study* study = dynamic_cast( application()->activeStudy() ); - if ( !study ) - return; - - entry = owner->entry(); - if( !theList.contains( entry ) ) - theList.append( entry ); - } -} - -#endif - -/*! - Emit current selection changed. -*/ -void LightApp_SelectionMgr::selectionChanged( SUIT_Selector* theSel ) -{ - SUIT_SelectionMgr::selectionChanged( theSel ); - - emit currentSelectionChanged(); -} - -#ifndef DISABLE_SALOMEOBJECT - -/*! - get map of indexes for the given SALOME_InteractiveObject -*/ -void LightApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger& theIndex) -{ - theIndex.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - if ( subOwner->entry() == QString(IObject->getEntry()) ) - theIndex.Add( subOwner->index() ); - } - -} - -/*! - get map of indexes for the given entry of SALOME_InteractiveObject -*/ -void LightApp_SelectionMgr::GetIndexes( const QString& theEntry, TColStd_IndexedMapOfInteger& theIndex ) -{ - theIndex.Clear(); - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - if ( subOwner->entry() == theEntry ) - theIndex.Add( subOwner->index() ); - } - -} - -/*! - Add or remove interactive objects from selection manager. -*/ -bool LightApp_SelectionMgr::AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, - const TColStd_MapOfInteger& theIndexes, - bool modeShift) -{ - SUIT_DataOwnerPtrList remainsOwners; - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - if ( !modeShift ) { - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataOwner* owner = dynamic_cast( (*itr).operator->() ); - if ( owner ) - { - if ( owner->entry() != QString(IObject->getEntry()) ) - { - const LightApp_DataSubOwner* subOwner = dynamic_cast( owner ); - if ( subOwner ) - remainsOwners.append( new LightApp_DataSubOwner( subOwner->entry(), subOwner->index() ) ); - else - remainsOwners.append( new LightApp_DataOwner( owner->entry() ) ); - } - } - } - } - else - remainsOwners = aList; - - TColStd_MapIteratorOfMapOfInteger It; - It.Initialize(theIndexes); - for(;It.More();It.Next()) - remainsOwners.append( new LightApp_DataSubOwner( QString(IObject->getEntry()), It.Key() ) ); - - bool append = false; - setSelected( remainsOwners, append ); - - emit currentSelectionChanged(); - - TColStd_IndexedMapOfInteger anIndexes; - GetIndexes( IObject, anIndexes ); - return !anIndexes.IsEmpty(); - -} - -/*! - select 'subobjects' with given indexes -*/ -void LightApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger theIndex, bool append ) -{ - SUIT_DataOwnerPtrList aList; - - if ( theIndex.IsEmpty() ) - aList.append( new LightApp_DataOwner( QString(IObject->getEntry()) ) ); - else - { - int i; - for ( i = 1; i <= theIndex.Extent(); i++ ) - aList.append( new LightApp_DataSubOwner( QString(IObject->getEntry()), theIndex( i ) ) ); - } - - setSelected( aList, append ); - -} - -/*! - select 'subobjects' with given indexes -*/ -void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool append ) -{ - SUIT_DataOwnerPtrList aList; - - MapIOOfMapOfInteger::Iterator it; - for ( it = theMapIO.begin(); it != theMapIO.end(); ++it ) - { - if ( it.data().IsEmpty() ) - aList.append( new LightApp_DataOwner( QString(it.key()->getEntry()) ) ); - else - { - int i; - for ( i = 1; i <= it.data().Extent(); i++ ) - aList.append( new LightApp_DataSubOwner( QString(it.key()->getEntry()), it.data()( i ) ) ); - } - } - - setSelected( aList, append ); - -} - -/*! - get map of selected subowners : object's entry <-> map of indexes -*/ -void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) -{ - theMap.clear(); - - TColStd_IndexedMapOfInteger anIndexes; - - SUIT_DataOwnerPtrList aList; - selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr ) - { - const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); - if ( subOwner ) - { - if ( !theMap.contains( subOwner->entry() ) ) - { - anIndexes.Clear(); - GetIndexes( subOwner->entry(), anIndexes ); - theMap.insert( subOwner->entry(), anIndexes ); - } - } - } -} - -#endif diff --git a/src/LightApp/LightApp_SelectionMgr.h b/src/LightApp/LightApp_SelectionMgr.h deleted file mode 100644 index be758e079..000000000 --- a/src/LightApp/LightApp_SelectionMgr.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_SELECTIONMGR_H -#define LIGHTAPP_SELECTIONMGR_H - -#include "LightApp.h" - -#include - -#ifndef DISABLE_SALOMEOBJECT - #include - #include - - class SALOME_ListIO; - class TColStd_IndexedMapOfInteger; - class TColStd_MapOfInteger; -#else -#include -#endif - -class LightApp_Application; - -/*! - Custom selection manager, allowing to work with object selection - (additionally to data owners) and to access to sub-selection of objects -*/ -class LIGHTAPP_EXPORT LightApp_SelectionMgr : public SUIT_SelectionMgr -{ - Q_OBJECT - -public: - LightApp_SelectionMgr( LightApp_Application*, const bool = true ); - virtual ~LightApp_SelectionMgr(); - - LightApp_Application* application() const; - -#ifndef DISABLE_SALOMEOBJECT - typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger; - typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger; - - void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const; - void setSelectedObjects( const SALOME_ListIO&, const bool = false ); - - void GetIndexes( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger& theIndex ); - void GetIndexes( const QString& theEntry, - TColStd_IndexedMapOfInteger& theIndex ); - - bool AddOrRemoveIndex( const Handle(SALOME_InteractiveObject)& IObject, - const TColStd_MapOfInteger& theIndices, - bool modeShift ); - - void selectObjects( const Handle(SALOME_InteractiveObject)& IObject, - TColStd_IndexedMapOfInteger theIndex, bool append ); - void selectObjects( MapIOOfMapOfInteger theMapIO, bool append ); - - void selectedSubOwners( MapEntryOfMapOfInteger& theMap ); -#else - void selectedObjects( QStringList&, const QString& = QString::null, const bool = true ) const; -#endif - -signals: - void currentSelectionChanged(); - -private: - virtual void selectionChanged( SUIT_Selector* ); - -private: - LightApp_Application* myApp; -}; - -#endif diff --git a/src/LightApp/LightApp_ShowHideOp.cxx b/src/LightApp/LightApp_ShowHideOp.cxx deleted file mode 100644 index a329cf889..000000000 --- a/src/LightApp/LightApp_ShowHideOp.cxx +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_ShowHideOp.h" -#include "LightApp_Application.h" -#include "LightApp_DataOwner.h" -#include "LightApp_Module.h" -#include "LightApp_Study.h" -#include "LightApp_Displayer.h" -#include "CAM_Study.h" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_Selection.h" - -#ifndef DISABLE_SALOMEOBJECT - #include - #include -#endif - -/*! - Constructor -*/ -LightApp_ShowHideOp::LightApp_ShowHideOp( ActionType type ) -: LightApp_Operation(), - myActionType( type ) -{ -} - -/*! - Destructor -*/ -LightApp_ShowHideOp::~LightApp_ShowHideOp() -{ -} - -/*! - Makes show/hide operation -*/ -void LightApp_ShowHideOp::startOperation() -{ - LightApp_Application* app = dynamic_cast( application() ); - LightApp_Study* study = app ? dynamic_cast( app->activeStudy() ) : 0; - if( !app || !study ) - { - abort(); - return; - } - - LightApp_SelectionMgr* mgr = app->selectionMgr(); - LightApp_Selection sel; sel.init( "", mgr ); - if( sel.count()==0 && myActionType!=ERASE_ALL ) - { - abort(); - return; - } - - QString mod_name; - if( sel.count()>0 ) - { - QString aStr = sel.param( 0, "component" ).toString(); - mod_name = app->moduleTitle( aStr ); - } - else if( app->activeModule() ) - mod_name = app->moduleTitle( app->activeModule()->name() ); - - LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, true ); - if( !d ) - { - abort(); - return; - } - - if( myActionType==DISPLAY_ONLY || myActionType==ERASE_ALL ) - { - //ERASE ALL - QStringList comps; - study->components( comps ); - QStringList::const_iterator anIt = comps.begin(), aLast = comps.end(); - for( ; anIt!=aLast; anIt++ ) - { - LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), true ); - if( disp ) - disp->EraseAll( false, false, 0 ); - } - if( myActionType==ERASE_ALL ) - { - d->UpdateViewer(); - commit(); - return; - } - } - - QStringList entries; - -#ifndef DISABLE_SALOMEOBJECT - SALOME_ListIO selObjs; - mgr->selectedObjects( selObjs ); - SALOME_ListIteratorOfListIO anIt( selObjs ); - for( ; anIt.More(); anIt.Next() ) - if( !anIt.Value().IsNull() ) -#else - QStringList selObjs; - mgr->selectedObjects( selObjs ); - QStringList::const_iterator anIt = selObjs.begin(), aLast = selObjs.end(); - for( ; ; anIt!=aLast ) -#endif - { - QString entry = -#ifndef DISABLE_SALOMEOBJECT - anIt.Value()->getEntry(); -#else - *anIt; -#endif - - if( study->isComponent( entry ) ) - study->children( entry, entries ); - else - entries.append( entry ); - } - - for( QStringList::const_iterator it = entries.begin(), last = entries.end(); it!=last; it++ ) - { - QString e = study->referencedToEntry( *it ); - if( myActionType==DISPLAY || myActionType==DISPLAY_ONLY ) - d->Display( e, false, 0 ); - else if( myActionType==ERASE ) - d->Erase( e, false, false, 0 ); - } - d->UpdateViewer(); - commit(); -} diff --git a/src/LightApp/LightApp_ShowHideOp.h b/src/LightApp/LightApp_ShowHideOp.h deleted file mode 100644 index 687c16dd2..000000000 --- a/src/LightApp/LightApp_ShowHideOp.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LIGHTAPP_SHOW_HIDE_OPERATION_HEADER -#define LIGHTAPP_SHOW_HIDE_OPERATION_HEADER - -#include "LightApp_Operation.h" - -class LightApp_Displayer; - -/*! - \class LightApp_ShowHideOp - Standard operation allowing to show/hide selected objects - corresponding to any module with help of module displayer -*/ -class LIGHTAPP_EXPORT LightApp_ShowHideOp : public LightApp_Operation -{ - Q_OBJECT - -public: - typedef enum { DISPLAY, ERASE, DISPLAY_ONLY, ERASE_ALL } ActionType; - -public: - LightApp_ShowHideOp( ActionType ); - ~LightApp_ShowHideOp(); - -protected: - virtual void startOperation(); - -private: - ActionType myActionType; -}; - -#endif - diff --git a/src/LightApp/LightApp_Study.cxx b/src/LightApp/LightApp_Study.cxx deleted file mode 100644 index a37df3ba7..000000000 --- a/src/LightApp/LightApp_Study.cxx +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_Study.h" - -#include "CAM_DataModel.h" -#include "LightApp_Application.h" -#include "LightApp_DataModel.h" -#include "LightApp_DataObject.h" -#include "LightApp_RootObject.h" -#include "LightApp_HDFDriver.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_DataObjectIterator.h" - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/*! - Constructor. -*/ -LightApp_Study::LightApp_Study( SUIT_Application* app ) -: CAM_Study( app ) -{ - // HDF persistence - myDriver = new LightApp_HDFDriver(); - //myDriver = new LightApp_Driver(); -} - -/*! - Destructor. -*/ -LightApp_Study::~LightApp_Study() -{ -} - -/*! - Create document. -*/ -void LightApp_Study::createDocument() -{ - setStudyName( QString( "Study%1" ).arg( LightApp_Application::studyId() ) ); - - // create myRoot - setRoot( new LightApp_RootObject( this ) ); - - CAM_Study::createDocument(); - - emit created( this ); -} - -/*! - Opens document -*/ -bool LightApp_Study::openDocument( const QString& theFileName ) -{ - myDriver->ClearDriverContents(); - // create files for models from theFileName - if( !openStudyData(theFileName)) - return false; - - setRoot( new LightApp_RootObject( this ) ); // create myRoot - - // update loaded data models: call open() and update() on them. - ModelList dm_s; - dataModels( dm_s ); - for ( ModelListIterator it( dm_s ); it.current(); ++it ) - openDataModel( studyName(), it.current() ); - // this will build a SUIT_DataObject-s tree under myRoot member field - // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step - // but tree that corresponds to not-loaded data models will be updated any way. - ((LightApp_Application*)application())->updateObjectBrowser( false ); - - bool res = CAM_Study::openDocument( theFileName ); - - emit opened( this ); - return res; -} - -/*! - Loads document -*/ -bool LightApp_Study::loadDocument( const QString& theStudyName ) -{ - myDriver->ClearDriverContents(); - if( !openStudyData(theStudyName)) - return false; - - setRoot( new LightApp_RootObject( this ) ); // create myRoot - - //SRN: BugID IPAL9021, put there the same code as in a method openDocument - - // update loaded data models: call open() and update() on them. - ModelList dm_s; - dataModels( dm_s ); - - for ( ModelListIterator it( dm_s ); it.current(); ++it ) - openDataModel( studyName(), it.current() ); - - // this will build a SUIT_DataObject-s tree under myRoot member field - // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step - // but tree that corresponds to not-loaded data models will be updated any way. - ((LightApp_Application*)application())->updateObjectBrowser( false ); - - bool res = CAM_Study::openDocument( theStudyName ); - emit opened( this ); - //SRN: BugID IPAL9021: End - return res; -} - -/*! - Saves document -*/ -bool LightApp_Study::saveDocumentAs( const QString& theFileName ) -{ - SUIT_ResourceMgr* resMgr = application()->resourceMgr(); - if( !resMgr ) - return false; - - ModelList list; - dataModels( list ); - - LightApp_DataModel* aModel = (LightApp_DataModel*)list.first(); - - QStringList listOfFiles; - bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - for ( ; aModel; aModel = (LightApp_DataModel*)list.next() ) - { - std::vector anOldList = myDriver->GetListOfFiles( aModel->module()->name() ); - listOfFiles.clear(); - aModel->saveAs( theFileName, this, listOfFiles ); - if ( !listOfFiles.isEmpty() ) - saveModuleData(aModel->module()->name(), listOfFiles); - - // Remove files if necessary. File is removed if it was in the list of files before - // saving and it is not contained in the list after saving. This provides correct - // removing previous temporary files. These files are not removed before saving - // because they may be required for it. - - std::vector aNewList = myDriver->GetListOfFiles( aModel->module()->name() ); - - std::set aNewNames; - std::set toRemove; - int i, n; - for( i = 0, n = aNewList.size(); i < n; i++ ) - aNewNames.insert( aNewList[ i ] ); - for( i = 0, n = anOldList.size(); i < n; i++ ) - { - if ( i == 0 ) // directory is always inserted in list - toRemove.insert( anOldList[ i ] ); - else if ( aNewNames.find( anOldList[ i ] ) == aNewNames.end() ) - toRemove.insert( anOldList[ i ] ); - } - - std::vector toRemoveList( toRemove.size() ); - std::set::iterator anIter; - for( anIter = toRemove.begin(), i = 0; anIter != toRemove.end(); ++anIter, ++i ) - toRemoveList[ i ] = *anIter; - - - myDriver->RemoveFiles( toRemoveList, isMultiFile ); - } - - bool res = saveStudyData(theFileName); - res = res && CAM_Study::saveDocumentAs( theFileName ); - //SRN: BugID IPAL9377, removed usage of uninitialized variable - if ( res ) - emit saved( this ); - - return res; -} - -/*! - Saves document -*/ -bool LightApp_Study::saveDocument() -{ - ModelList list; dataModels( list ); - - LightApp_DataModel* aModel = (LightApp_DataModel*)list.first(); - - myDriver->ClearDriverContents(); - QStringList listOfFiles; - for ( ; aModel; aModel = (LightApp_DataModel*)list.next() ) { - listOfFiles.clear(); - aModel->save( listOfFiles ); - saveModuleData(aModel->module()->name(), listOfFiles); - } - - bool res = saveStudyData(studyName()); - res = res && CAM_Study::saveDocument(); - if (res) - emit saved( this ); - - return res; -} - -/*! - Closes document -*/ -void LightApp_Study::closeDocument(bool permanently) -{ - // Inform everybody that this study is going to close when it's most safe to, - // i.e. in the very beginning - emit closed( this ); - - CAM_Study::closeDocument(permanently); - - // Remove temporary files - myDriver->ClearDriverContents(); -} - -/*! - \return real entry by entry of reference - \param entry - entry of reference object -*/ -QString LightApp_Study::referencedToEntry( const QString& entry ) const -{ - return entry; -} - -/*! - \return entries of object children -*/ -void LightApp_Study::children( const QString&, QStringList& ) const -{ -} - -/*! - \return true if entry corresponds to component -*/ -bool LightApp_Study::isComponent( const QString& entry ) const -{ - if( !root() ) - return false; - - DataObjectList ch; - root()->children( ch ); - DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end(); - for( ; anIt!=aLast; anIt++ ) - { - LightApp_DataObject* obj = dynamic_cast( *anIt ); - if( obj && obj->entry()==entry ) - return true; - } - return false; -} - -/*! - \return component data type for entry -*/ -QString LightApp_Study::componentDataType( const QString& entry ) const -{ - LightApp_DataObject* aCurObj; - for ( SUIT_DataObjectIterator it( root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { - aCurObj = dynamic_cast( it.current() ); - if ( aCurObj && aCurObj->entry() == entry ) { - return aCurObj->componentDataType(); - } - } - return ""; -} - -/*! - \return true if study is modified -*/ -bool LightApp_Study::isModified() const -{ - bool isAnyChanged = CAM_Study::isModified(); - ModelList list; dataModels( list ); - - LightApp_DataModel* aModel = 0; - for ( QPtrListIterator it( list ); it.current() && !isAnyChanged; ++it ){ - aModel = dynamic_cast( it.current() ); - if ( aModel ) - isAnyChanged = aModel->isModified(); - } - return isAnyChanged; -} - -/*! - \return true if data model is saved -*/ -bool LightApp_Study::isSaved() const -{ - return CAM_Study::isSaved(); -} - -/*! - Creates SComponent for module, necessary for SalomeApp study -*/ -void LightApp_Study::addComponent(const CAM_DataModel* dm) -{ -} - -/*! - Saves list file for module 'theModuleName' -*/ -void LightApp_Study::saveModuleData(QString theModuleName, QStringList theListOfFiles) -{ - int aNb = theListOfFiles.count(); - if ( aNb == 0 ) - return; - - std::vector aListOfFiles ( aNb ); - int anIndex = 0; - for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) { - if ( (*it).isEmpty() ) - continue; - aListOfFiles[anIndex] = (*it).latin1(); - anIndex++; - } - myDriver->SetListOfFiles(theModuleName, aListOfFiles); -} - -/*! - Gets list of file for module 'theModuleNam' -*/ -void LightApp_Study::openModuleData(QString theModuleName, QStringList& theListOfFiles) -{ - std::vector aListOfFiles = myDriver->GetListOfFiles(theModuleName); - int i, aLength = aListOfFiles.size() - 1; - if (aLength < 0) - return; - - //Get a temporary directory for saved a file - theListOfFiles.append(aListOfFiles[0].c_str()); - for(i = 0; i < aLength; i++) - theListOfFiles.append(aListOfFiles[i+1].c_str()); -} - -/*! - Saves data from study -*/ -bool LightApp_Study::saveStudyData( const QString& theFileName ) -{ - ModelList list; dataModels( list ); - SUIT_ResourceMgr* resMgr = application()->resourceMgr(); - if( !resMgr ) - return false; - bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - - bool aRes = myDriver->SaveDatasInFile(theFileName.latin1(), isMultiFile); - return aRes; -} - -/*! - Opens data for study -*/ -bool LightApp_Study::openStudyData( const QString& theFileName ) -{ - SUIT_ResourceMgr* resMgr = application()->resourceMgr(); - if( !resMgr ) - return false; - bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - - bool aRes = myDriver->ReadDatasFromFile(theFileName.latin1(), isMultiFile); - return aRes; -} - -/*! - Opens data model -*/ -bool LightApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm ) -{ - if (!dm) - return false; - - QStringList listOfFiles; - openModuleData(dm->module()->name(), listOfFiles); - if (dm && dm->open(studyName, this, listOfFiles)) { - // Something has been read -> create data model tree - LightApp_DataModel* aDM = dynamic_cast( dm ); - if ( aDM ) - aDM->update(NULL, this); - return true; - } - return false; -} - -/*! - \return temporary directory for saving files of modules -*/ -std::string LightApp_Study::GetTmpDir (const char* theURL, - const bool isMultiFile) -{ - return myDriver->GetTmpDir(theURL, isMultiFile); -} - -/*! - \return list of files necessary for module - \param theModuleName - name of module -*/ -std::vector LightApp_Study::GetListOfFiles(const char* theModuleName) const -{ - std::vector aListOfFiles; - aListOfFiles = myDriver->GetListOfFiles(theModuleName); - return aListOfFiles; -} - -/*! - Sets list of files necessary for module - \param theModuleName - name of module - \param theListOfFiles - list of files -*/ -void LightApp_Study::SetListOfFiles (const char* theModuleName, const std::vector theListOfFiles) -{ - myDriver->SetListOfFiles(theModuleName, theListOfFiles); -} - -/*! - Removes temporary files -*/ -void LightApp_Study::RemoveTemporaryFiles (const char* theModuleName, const bool isMultiFile) const -{ - if (isMultiFile) - return; - bool isDirDeleted = true; - myDriver->RemoveTemporaryFiles(theModuleName, isDirDeleted); -} - -/*! - Fills list with components names - \param comp - list to be filled -*/ -void LightApp_Study::components( QStringList& comp ) const -{ - DataObjectList children = root()->children(); - DataObjectList::const_iterator anIt = children.begin(), aLast = children.end(); - for( ; anIt!=aLast; anIt++ ) - { - LightApp_DataObject* obj = dynamic_cast( *anIt ); - if( obj && obj->entry()!="Interface Applicative" ) - comp.append( obj->entry() ); - } -} diff --git a/src/LightApp/LightApp_Study.h b/src/LightApp/LightApp_Study.h deleted file mode 100644 index b9de680b8..000000000 --- a/src/LightApp/LightApp_Study.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_STUDY_H -#define LIGHTAPP_STUDY_H - -#include -#include - -#include -#include -#include - -#include "string" -#include "vector" - -class SUIT_Application; -class CAM_DataModel; - -/*! - Custom study, using for open/close of documents HDF format. - Data of each module can be saved to different files, those - after that are combined into one HDF file -*/ -class LIGHTAPP_EXPORT LightApp_Study : public CAM_Study -{ - Q_OBJECT - -public: - LightApp_Study( SUIT_Application* ); - virtual ~LightApp_Study(); - - virtual void createDocument(); - virtual bool openDocument( const QString& ); - virtual bool loadDocument( const QString& ); - - virtual bool saveDocument(); - virtual bool saveDocumentAs( const QString& ); - - virtual void closeDocument(bool permanently = true); - - virtual bool isSaved() const; - virtual bool isModified() const; - - virtual void addComponent ( const CAM_DataModel* dm); - - virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile ); - - virtual QString componentDataType( const QString& ) const; - virtual QString referencedToEntry( const QString& ) const; - virtual bool isComponent( const QString& ) const; - virtual void children( const QString&, QStringList& ) const; - virtual void components( QStringList& ) const; - -protected: - virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); - virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles ); - virtual bool saveStudyData ( const QString& theFileName ); - virtual bool openStudyData ( const QString& theFileName ); - - virtual std::vector GetListOfFiles ( const char* theModuleName ) const; - virtual void SetListOfFiles ( const char* theModuleName, - const std::vector theListOfFiles ); - - virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const; - -protected: - virtual bool openDataModel ( const QString&, CAM_DataModel* ); - -signals: - void saved ( SUIT_Study* ); - void opened ( SUIT_Study* ); - void closed ( SUIT_Study* ); - void created( SUIT_Study* ); - - -private: - LightApp_Driver* myDriver; - - friend class LightApp_Application; -}; - -#endif diff --git a/src/LightApp/LightApp_SwitchOp.cxx b/src/LightApp/LightApp_SwitchOp.cxx deleted file mode 100755 index 67283f365..000000000 --- a/src/LightApp/LightApp_SwitchOp.cxx +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "LightApp_SwitchOp.h" -#include "LightApp_Module.h" -#include "LightApp_Operation.h" -#include "LightApp_Dialog.h" -#include -#include -#include -#include -#include -#include -#include - -/*! - * \brief Constructor - * \param theParent - parent of object -* -* Creates instance of the object. Connects signals and slots. Install eveny filter -* on application -*/ -LightApp_SwitchOp::LightApp_SwitchOp( LightApp_Module* theModule ) -: QObject( 0 ), - myModule( theModule ) -{ - qApp->installEventFilter( this ); -} - -/*! - * \brief Destructor -*/ -LightApp_SwitchOp::~LightApp_SwitchOp() -{ - -} - -/*! - * \brief Get module -* -* Get module. Module is a parent of this class -*/ -LightApp_Module* LightApp_SwitchOp::module() const -{ - return myModule; -} - -/*! - * \brief Get study - * \return Active study of application (in current realisation) -* -* Get study -*/ -SUIT_Study* LightApp_SwitchOp::study() const -{ - return module()->application()->activeStudy(); -} - -/*! - * \brief Get operation by widget - * \param theWg - key widget to find operation - * \return Pointer to the operations if it is found or zero -* -* Find operation containing dialog with given widget -*/ -LightApp_Operation* LightApp_SwitchOp::operation( QWidget* theWg ) const -{ - // get dialog from widget - LightApp_Dialog* aDlg = 0; - QWidget* aParent = theWg; - while( aParent && !aParent->inherits( "LightApp_Dialog" ) ) - aParent = aParent->parentWidget(); - - if ( aParent && aParent->inherits( "LightApp_Dialog" ) ) - aDlg = (LightApp_Dialog*)aParent; - - // try to find operation corresponding to the dialog - if ( aDlg != 0 && study() != 0 ) - { - QPtrListIterator anIter( study()->operations() ); - while( SUIT_Operation* anOp = anIter.current() ) - { - if ( anOp->inherits( "LightApp_Operation" ) && - ((LightApp_Operation*)anOp)->dlg() == aDlg ) - return ((LightApp_Operation*)anOp); - ++anIter; - } - } - - return 0; -} - -/*! - * \brief Event filter - * \param theObj - object - * \param theEv - event -* -* Event filter. Catched signals off application. If event concerns to dialog then -* corresponding operation is found and activated. -*/ -bool LightApp_SwitchOp::eventFilter( QObject* theObj, QEvent* theEv ) -{ - if ( theObj->inherits( "QWidget" ) && ( theEv->type() == QEvent::Enter ) ) - { - QEvent::Type aType = theEv->type(); - LightApp_Operation* anOp = operation( (QWidget*)theObj ); - if ( anOp ) - { - switch ( aType ) - { - case QEvent::Enter: - { - if ( !anOp->isActive() && anOp->isAutoResumed() && - study() && !study()->blockingOperation( anOp ) ) - study()->resume( anOp ); - } - break; - - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonPress: - case QEvent::MouseButtonDblClick: - case QEvent::MouseMove: - case QEvent::KeyPress: - case QEvent::KeyRelease: - { - if ( !anOp->isActive() ) - return true; - } - break; - - } - } - } - - return QObject::eventFilter( theObj, theEv ); -} - - - - - - - - - - - - - - - - - - - diff --git a/src/LightApp/LightApp_SwitchOp.h b/src/LightApp/LightApp_SwitchOp.h deleted file mode 100755 index a85d2e3da..000000000 --- a/src/LightApp/LightApp_SwitchOp.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef LightApp_SwitchOp_H -#define LightApp_SwitchOp_H - -#include "LightApp.h" -#include - -class LightApp_Module; -class LightApp_Operation; -class QEvent; -class SUIT_Study; - -/*! - * \brief This class is intended for controling switching between operation - * - * Several operation may be launched simultaneously. This class is intended for - * controlling switching between such operations. This class works with operations having - * dialogs (activation of other operations is performed by SUIT_Study). When several - * operations is launched simultaneously corresponding dialogs are shown on the screen. - * Only one operation from the launched ones can be active (active operation). Other - * operations are suspended. As result only one dialog from shown ones can be active too. - * Other dialogs are disabled. This class installs event filter on application. When mouse - * cursor is moved above disabled dialog corresponding event is catched by this class. - * It finds corresponding operation and verify whether operation can be resumed (see - * SUIT_Study::isDenied( SUIT_Operation* ) method). If yes then current active - * operation is suspended and new operation activated. Module contains this class as a - * field. Then module is created instance of this class created too. - */ -class LIGHTAPP_EXPORT LightApp_SwitchOp : public QObject -{ - Q_OBJECT - -public: - - LightApp_SwitchOp( LightApp_Module* ); - virtual ~LightApp_SwitchOp(); - - // Redefined from base class - bool eventFilter( QObject*, QEvent* ); - -private: - - LightApp_Module* module() const; - LightApp_Operation* operation( QWidget* ) const; - SUIT_Study* study() const; - -private: - - LightApp_Module* myModule; - -}; - -#endif - - - - - - diff --git a/src/LightApp/LightApp_UpdateFlags.h b/src/LightApp/LightApp_UpdateFlags.h deleted file mode 100755 index b11103f76..000000000 --- a/src/LightApp/LightApp_UpdateFlags.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : LightApp_UpdateFlags.h -// Author : Sergey LITONIN -// Module : LIGHT - - -#ifndef LightApp_UpdateFlags_H -#define LightApp_UpdateFlags_H - -/*! - \enum UpdateFlags - Enumeration for update flags. First byte is reserved for LightApp_Module. - Modules derived from this model must use other 3 bytes to define their - own update flags -*/ - -typedef enum -{ - UF_Forced = 0x00000001, - UF_Model = 0x00000002, - UF_Viewer = 0x00000004, - UF_ObjBrowser = 0x00000008, - UF_Controls = 0x00000010, -} UpdateFlags; - -#endif - - - - - - diff --git a/src/LightApp/LightApp_VTKSelector.cxx b/src/LightApp/LightApp_VTKSelector.cxx deleted file mode 100644 index 5cc226cbb..000000000 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_VTKSelector.h" -#include "LightApp_DataOwner.h" - -#ifndef DISABLE_VTKVIEWER - #include "SVTK_ViewModelBase.h" - #include "SVTK_ViewManager.h" - #include "SVTK_Selector.h" - #include "SVTK_ViewWindow.h" - #include "SVTK_Functor.h" - #include "VTKViewer_Algorithm.h" - #include -#endif - -#ifndef DISABLE_SALOMEOBJECT - #include "SALOME_Actor.h" - #include "SALOME_ListIteratorOfListIO.hxx" -#endif - - - -#ifndef DISABLE_VTKVIEWER -#ifndef DISABLE_SALOMEOBJECT -/*! - Constructor. -*/ -LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)& theIO, - SUIT_Desktop* theDesktop ) -: LightApp_DataOwner( theIO ), -myDesktop( theDesktop ) -{ -} -#else -LightApp_SVTKDataOwner::LightApp_SVTKDataOwner( const QString& theEntry ) -: LightApp_DataOwner( theEntry ) -{ -} -#endif - -/*! - \return active SVTK view window -*/ -SVTK_ViewWindow* -LightApp_SVTKDataOwner -::GetActiveViewWindow() const -{ - if(SUIT_ViewWindow* aViewWindow = myDesktop->activeWindow()) - return dynamic_cast(aViewWindow); - - return NULL; -} - -/*! - Gets dataowners ids list. -*/ -const TColStd_IndexedMapOfInteger& -LightApp_SVTKDataOwner -::GetIds() const -{ - if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){ - if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){ - aSelector->GetIndex(IO(),myIds); - } - } - - return myIds; -} - -/*! - Gets selection mode. -*/ -Selection_Mode -LightApp_SVTKDataOwner -::GetMode() const -{ - if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){ - if(SVTK_Selector* aSelector = aViewWindow->GetSelector()){ - return aSelector->SelectionMode(); - } - } - - return -1; -} - -/*! - Gets actor pointer. -*/ -SALOME_Actor* -LightApp_SVTKDataOwner -::GetActor() const -{ - if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow()){ - using namespace SVTK; - return Find(aViewWindow->getRenderer()->GetActors(),TIsSameIObject(IO())); - } - - return NULL; -} - -#endif - -/*! - Destuctor. -*/ -/* -LightApp_SVTKDataOwner::~LightApp_SVTKDataOwner() -{ -} -*/ - -#ifndef DISABLE_VTKVIEWER -/*! - Constructor. -*/ -LightApp_VTKSelector -::LightApp_VTKSelector( SVTK_ViewModelBase* viewer, - SUIT_SelectionMgr* mgr ): - SUIT_Selector( mgr, viewer ), - myViewer( viewer ) -{ - if ( myViewer ) - connect( myViewer, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); -} - -/*! - Gets viewer. -*/ -SVTK_ViewModelBase* -LightApp_VTKSelector -::viewer() const -{ - return myViewer; -} - -/*! - Gets type of salome vtk viewer. -*/ -QString -LightApp_VTKSelector -::type() const -{ - return myViewer->getType(); -} - -#endif -/*! - On selection changed. -*/ -void -LightApp_VTKSelector -::onSelectionChanged() -{ - selectionChanged(); -} - -#ifndef DISABLE_VTKVIEWER - -/*! - Gets list of selected data owners.(output \a aList). -*/ -void -LightApp_VTKSelector -::getSelection( SUIT_DataOwnerPtrList& aList ) const -{ - if(myViewer){ - if(SUIT_ViewManager* aViewManager = myViewer->getViewManager()){ - if(SVTK_ViewManager* aViewMgr = dynamic_cast(aViewManager)){ - if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ - if(SVTK_Selector* aSelector = aView->GetSelector()){ - const SALOME_ListIO& aListIO = aSelector->StoredIObjects(); - SALOME_ListIteratorOfListIO anIter(aListIO); - for(; anIter.More(); anIter.Next()){ - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if(anIO->hasEntry()) - aList.append(new LightApp_SVTKDataOwner(anIO,aViewMgr->getDesktop())); - } - } - } - } - } - } -} - -/*! - Sets selection to selector from data owner list \a theList. -*/ -void -LightApp_VTKSelector -::setSelection( const SUIT_DataOwnerPtrList& theList ) -{ - if(myViewer){ - if(SUIT_ViewManager* aViewMgr = myViewer->getViewManager()){ - if(SVTK_ViewWindow* aView = dynamic_cast(aViewMgr->getActiveView())){ - if(SVTK_Selector* aSelector = aView->GetSelector()){ - SALOME_ListIO anAppendList; - const SALOME_ListIO& aStoredList = aSelector->StoredIObjects(); - SUIT_DataOwnerPtrList::const_iterator anIter = theList.begin(); - for(; anIter != theList.end(); ++anIter){ - const SUIT_DataOwner* aDataOwner = (*anIter).get(); - if(const LightApp_SVTKDataOwner* anOwner = dynamic_cast(aDataOwner)){ - aSelector->SetSelectionMode(anOwner->GetMode()); - Handle(SALOME_InteractiveObject) anIO = anOwner->IO(); - - aSelector->AddIObject(anIO); - - anAppendList.Append(anIO); - aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false); - }else if(const LightApp_DataOwner* anOwner = dynamic_cast(aDataOwner)){ - Handle(SALOME_InteractiveObject) anIO = - new SALOME_InteractiveObject(anOwner->entry().latin1(),""); - aSelector->AddIObject(anIO); - anAppendList.Append(anIO); - } - } - // To remove IOs, which is not selected. - QMap< QString, Handle( SALOME_InteractiveObject )> toRemove; - SALOME_ListIteratorOfListIO anIt( aStoredList ); - for( ; anIt.More(); anIt.Next() ) - if( !anIt.Value().IsNull() ) - toRemove[ anIt.Value()->getEntry() ] = anIt.Value(); - - anIt = SALOME_ListIteratorOfListIO(anAppendList); - for( ; anIt.More(); anIt.Next() ) - toRemove.remove( anIt.Value()->getEntry() ); - - QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(), - REnd = toRemove.end(); - for( ; RIt!=REnd; RIt++ ) - aSelector->RemoveIObject( RIt.data() ); - - aView->onSelectionChanged(); - } - } - } - } -} - -#endif diff --git a/src/LightApp/LightApp_VTKSelector.h b/src/LightApp/LightApp_VTKSelector.h deleted file mode 100644 index 3c17f04e2..000000000 --- a/src/LightApp/LightApp_VTKSelector.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_VTKSELECTOR_H -#define LIGHTAPP_VTKSELECTOR_H - -#include "SUIT_Selector.h" -#include "LightApp.h" -#include "LightApp_DataOwner.h" - -class SUIT_Desktop; - -#ifndef DISABLE_VTKVIEWER - #include - #include - #include "SVTK_Selection.h" -#ifndef DISABLE_SALOMEOBJECT - #include "SALOME_InteractiveObject.hxx" -#endif - class SALOME_Actor; - class SVTK_ViewWindow; - class SVTK_ViewModelBase; -#endif - -/*! - Provide salome vtk data owner list. -*/ -class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner -{ - public: - virtual ~LightApp_SVTKDataOwner() {}; -#ifndef DISABLE_VTKVIEWER - #ifndef DISABLE_SALOMEOBJECT - LightApp_SVTKDataOwner( const Handle(SALOME_InteractiveObject)&, SUIT_Desktop* ); - #else - LightApp_SVTKDataOwner( const QString& ); - #endif - - /*!Gets dataowners ids list.*/ - const TColStd_IndexedMapOfInteger& GetIds() const; - - /*!Gets selection mode.*/ - Selection_Mode GetMode() const; - - /*!Finds corresponding actor in the active viewer.*/ - SALOME_Actor* GetActor() const; - - protected: - mutable TColStd_IndexedMapOfInteger myIds; - - SVTK_ViewWindow* GetActiveViewWindow() const; - SUIT_Desktop* myDesktop; -#endif -}; - - -/*! - \class LightApp_VTKSelector - Custom selector to get/set selection from object browser -*/ -class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector -{ - Q_OBJECT; - -public: - virtual ~LightApp_VTKSelector() {}; -#ifndef DISABLE_VTKVIEWER - LightApp_VTKSelector( SVTK_ViewModelBase*, SUIT_SelectionMgr* ); - - SVTK_ViewModelBase* viewer() const; - - virtual QString type() const; -#else - LightApp_VTKSelector( SUIT_SelectionMgr* ); -#endif - -private slots: - void onSelectionChanged(); - -#ifndef DISABLE_VTKVIEWER -protected: - virtual void getSelection( SUIT_DataOwnerPtrList& ) const; - virtual void setSelection( const SUIT_DataOwnerPtrList& ); - -private: - SVTK_ViewModelBase* myViewer; - -#endif -}; - -#endif diff --git a/src/LightApp/LightApp_WidgetContainer.cxx b/src/LightApp/LightApp_WidgetContainer.cxx deleted file mode 100644 index aa6f831d2..000000000 --- a/src/LightApp/LightApp_WidgetContainer.cxx +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#include "LightApp_WidgetContainer.h" - -#include -#include - -/*! - Constructor. -*/ -LightApp_WidgetContainer::LightApp_WidgetContainer( const int type, QWidget* parent ) -: QDockWindow( QDockWindow::InDock, parent ), -myType( type ) -{ - setWidget( myStack = new QWidgetStack( this ) ); - myStack->show(); -} - -/*! - Destructor. -*/ -LightApp_WidgetContainer::~LightApp_WidgetContainer() -{ -} - -/*! - Checks: is widget container is empty? -*/ -bool LightApp_WidgetContainer::isEmpty() const -{ - const QObjectList* lst = myStack->children(); - if ( !lst ) - return true; - - bool res = true; - for ( QObjectListIt it( *lst ); it.current() && res; ++it ) - { - if ( it.current()->isWidgetType() && myStack->id( (QWidget*)it.current() ) != -1 ) - res = false; - } - return res; -} - -/*! - Gets type of widget container. -*/ -int LightApp_WidgetContainer::type() const -{ - return myType; -} - -/*! - Checks: is container contains widget with id \a id. -*/ -bool LightApp_WidgetContainer::contains( const int id ) const -{ - return myStack->widget( id ) != 0; -} - -/*! - * Insert widget(\a wid with id \a id) to container.And return id of widget in stack. - *\warning remove widget with id = \a id , if it was in container. - */ -int LightApp_WidgetContainer::insert( const int id, QWidget* wid ) -{ - if ( id == -1 || !wid ) - return -1; - - if ( contains( id ) ) - remove( id ); - - int stackId = myStack->addWidget( wid, id ); - if ( !myStack->visibleWidget() ) - myStack->raiseWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); - - return stackId; -} - -/*! - Remove widget(\a wid) from stack. -*/ -void LightApp_WidgetContainer::remove( const int id ) -{ - remove( myStack->widget( id ) ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Remove widget(\a wid) from stack. -*/ -void LightApp_WidgetContainer::remove( QWidget* wid ) -{ - myStack->removeWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Raise widget with id = \a id. -*/ -void LightApp_WidgetContainer::activate( const int id ) -{ - myStack->raiseWidget( id ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Raise widget (\a wid). -*/ -void LightApp_WidgetContainer::activate( QWidget* wid ) -{ - myStack->raiseWidget( wid ); - - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); -} - -/*! - Gets widget from container list(stack) by id = \a id. -*/ -QWidget* LightApp_WidgetContainer::widget( const int id ) const -{ - return myStack->widget( id ); -} - -/*! - Gets visible widget. -*/ -QWidget* LightApp_WidgetContainer::active() const -{ - return myStack->visibleWidget(); -} diff --git a/src/LightApp/LightApp_WidgetContainer.h b/src/LightApp/LightApp_WidgetContainer.h deleted file mode 100644 index 1679ec0c7..000000000 --- a/src/LightApp/LightApp_WidgetContainer.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -#ifndef LIGHTAPP_WIDGETCONTAINER_H -#define LIGHTAPP_WIDGETCONTAINER_H - -#include "LightApp.h" - -#include - -class QWidget; -class QWidgetStack; - -/*! - Class which privade widget container. -*/ -class LIGHTAPP_EXPORT LightApp_WidgetContainer : public QDockWindow -{ - Q_OBJECT - -public: - LightApp_WidgetContainer( const int, QWidget* = 0 ); - virtual ~LightApp_WidgetContainer(); - - bool isEmpty() const; - - int type() const; - - int insert( const int, QWidget* ); - void remove( QWidget* ); - void remove( const int ); - bool contains( const int ) const; - - void activate( QWidget* ); - void activate( const int ); - - QWidget* active() const; - QWidget* widget( const int ) const; - -private: - int myType; - QWidgetStack* myStack; -}; - -#endif diff --git a/src/LightApp/Makefile.in b/src/LightApp/Makefile.in deleted file mode 100755 index eb1cef66f..000000000 --- a/src/LightApp/Makefile.in +++ /dev/null @@ -1,227 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : OCC team (OCN) -# Module : LightApp -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@srcdir@/resources - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= LightApp.h \ - LightApp_AboutDlg.h \ - LightApp_Application.h \ - LightApp_DataModel.h \ - LightApp_DataObject.h \ - LightApp_DataOwner.h \ - LightApp_DataSubOwner.h \ - LightApp_Dialog.h \ - LightApp_Displayer.h \ - LightApp_Driver.h \ - LightApp_EventFilter.h \ - LightApp_HDFDriver.h \ - LightApp_Module.h \ - LightApp_ModuleDlg.h \ - LightApp_NameDlg.h \ - LightApp_OBFilter.h \ - LightApp_OBSelector.h \ - LightApp_Operation.h \ - LightApp_Selection.h \ - LightApp_SelectionMgr.h \ - LightApp_ShowHideOp.h \ - LightApp_Study.h \ - LightApp_SwitchOp.h \ - LightApp_Preferences.h \ - LightApp_PreferencesDlg.h \ - LightApp_RootObject.h \ - LightApp_UpdateFlags.h \ - LightApp_WidgetContainer.h - -ifneq ($(DISABLE_VTKVIEWER),yes) -ifneq ($(DISABLE_SALOMEOBJECT),yes) - EXPORT_HEADERS+= LightApp_VTKSelector.h -endif -endif -ifneq ($(DISABLE_OCCVIEWER),yes) - EXPORT_HEADERS+= LightApp_OCCSelector.h -endif -ifneq ($(DISABLE_GLVIEWER),yes) - EXPORT_HEADERS+= LightApp_GLSelector.h -endif - -# .po files to transform in .qm -PO_FILES = LightApp_images.po \ - LightApp_msg_en.po - -# Libraries targets -LIB = libLightApp.la - -LIB_SRC= LightApp_AboutDlg.cxx \ - LightApp_Application.cxx \ - LightApp_DataModel.cxx \ - LightApp_DataObject.cxx \ - LightApp_DataOwner.cxx \ - LightApp_DataSubOwner.cxx \ - LightApp_Dialog.cxx \ - LightApp_Displayer.cxx \ - LightApp_Driver.cxx \ - LightApp_EventFilter.cxx \ - LightApp_HDFDriver.cxx \ - LightApp_Module.cxx \ - LightApp_ModuleDlg.cxx \ - LightApp_NameDlg.cxx \ - LightApp_OBFilter.cxx \ - LightApp_OBSelector.cxx \ - LightApp_Operation.cxx \ - LightApp_Selection.cxx \ - LightApp_SelectionMgr.cxx \ - LightApp_ShowHideOp.cxx \ - LightApp_Study.cxx \ - LightApp_SwitchOp.cxx \ - LightApp_Preferences.cxx \ - LightApp_PreferencesDlg.cxx \ - LightApp_WidgetContainer.cxx - -ifneq ($(DISABLE_VTKVIEWER),yes) -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIB_SRC+= LightApp_VTKSelector.cxx -endif -endif -ifneq ($(DISABLE_OCCVIEWER),yes) - LIB_SRC+= LightApp_OCCSelector.cxx -endif -ifneq ($(DISABLE_GLVIEWER),yes) - LIB_SRC+= LightApp_GLSelector.cxx -endif - -LIB_MOC = LightApp_AboutDlg.h \ - LightApp_Application.h \ - LightApp_DataModel.h \ - LightApp_Dialog.h \ - LightApp_OBSelector.h \ - LightApp_Operation.h \ - LightApp_Module.h \ - LightApp_ModuleDlg.h \ - LightApp_NameDlg.h \ - LightApp_SelectionMgr.h \ - LightApp_ShowHideOp.h \ - LightApp_Study.h \ - LightApp_SwitchOp.h \ - LightApp_Preferences.h \ - LightApp_PreferencesDlg.h \ - LightApp_WidgetContainer.h - -ifneq ($(DISABLE_VTKVIEWER),yes) -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIB_MOC+= LightApp_VTKSelector.h -endif -endif -ifneq ($(DISABLE_OCCVIEWER),yes) - LIB_MOC+= LightApp_OCCSelector.h -endif -ifneq ($(DISABLE_GLVIEWER),yes) - LIB_MOC+= LightApp_GLSelector.h -endif - -RESOURCES_FILES = icon_about.png \ - icon_applogo.png \ - icon_default.png \ - icon_module.png \ - icon_module_big.png \ - icon_select.png \ - LightApp.ini \ - LightApp.xml - -CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(OCC_INCLUDES) \ - $(HDF5_INCLUDES) $(KERNEL_CXXFLAGS) - -ifneq ($(DISABLE_VTKVIEWER),yes) - CPPFLAGS+= $(VTK_INCLUDES) -else - CPPFLAGS+= -DDISABLE_VTKVIEWER -endif -ifneq ($(DISABLE_PLOT2DVIEWER),yes) - CPPFLAGS+= $(QWT_INCLUDES) -else - CPPFLAGS+= -DDISABLE_PLOT2DVIEWER -endif -ifeq ($(DISABLE_OCCVIEWER),yes) - CPPFLAGS+= -DDISABLE_OCCVIEWER -endif -ifneq ($(DISABLE_PYCONSOLE),yes) - CPPFLAGS+= $(PYTHON_INCLUDES) -else - CPPFLAGS+= -DDISABLE_PYCONSOLE -endif -ifeq ($(DISABLE_GLVIEWER),yes) - CPPFLAGS+= -DDISABLE_GLVIEWER -endif -ifeq ($(DISABLE_SUPERVGRAPHVIEWER),yes) - CPPFLAGS+= -DDISABLE_SUPERVGRAPHVIEWER -endif -ifeq ($(DISABLE_SALOMEOBJECT),yes) - CPPFLAGS+= -DDISABLE_SALOMEOBJECT -endif - -LDFLAGS+=$(QT_MT_LIBS) -ifneq ($(DISABLE_PYCONSOLE),yes) - LDFLAGS+= $(PYTHON_LIBS) -endif - -LIBS+= -lsuit -lstd -lCAM -lObjBrowser -lLogWindow $(CAS_KERNEL) -lSalomePrs \ - $(HDF5_LIBS) $(KERNEL_LDFLAGS) -lSalomeHDFPersist - -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIBS+= -lSalomeObject -endif -ifneq ($(DISABLE_VTKVIEWER),yes) - LIBS+= -lVTKViewer -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIBS+= -lSVTK -endif -endif -ifneq ($(DISABLE_OCCVIEWER),yes) - LIBS+= -lOCCViewer -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIBS+= -lSOCC -endif -endif -ifneq ($(DISABLE_GLVIEWER),yes) - LIBS+= -lGLViewer -endif -ifneq ($(DISABLE_PLOT2DVIEWER),yes) - LIBS+= -lPlot2d -ifneq ($(DISABLE_SALOMEOBJECT),yes) - LIBS+= -lSPlot2d -endif -endif -ifneq ($(DISABLE_PYCONSOLE),yes) - LIBS+= -lPyInterp -lPythonConsole -endif -ifneq ($(DISABLE_SUPERVGRAPHVIEWER),yes) - LIBS+= -lSUPERVGraph -endif - -@CONCLUDE@ diff --git a/src/LightApp/resources/LightApp.ini b/src/LightApp/resources/LightApp.ini deleted file mode 100755 index fb5a7018a..000000000 --- a/src/LightApp/resources/LightApp.ini +++ /dev/null @@ -1,21 +0,0 @@ -# The resources mapping file for LightApp application - -[language] -language = en - -[launch] -modules = LIGHT - -[resources] -SUIT = $(GUI_ROOT_DIR)/share/salome/resources/gui -STD = $(GUI_ROOT_DIR)/share/salome/resources/gui -LightApp = $(GUI_ROOT_DIR)/share/salome/resources/gui -Plot2d = $(GUI_ROOT_DIR)/share/salome/resources/gui -GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -LIGHT = $(LIGHT_ROOT_DIR)/share/salome/resources/light - -[LIGHT] -name = Light -icon = LIGHT diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml deleted file mode 100644 index fa3b06bd7..000000000 --- a/src/LightApp/resources/LightApp.xml +++ /dev/null @@ -1,92 +0,0 @@ - -
- - - - - - - -
-
- - - -
-
- - - - -
-
- - - - - - - - - - - - - - - -
-
- - - - - - -
-
- - - -
-
- - - -
-
- - -
-
- - -
-
- - - - - -
-
- - - -
-
- - - - - - - - -
-
- - - -
-
diff --git a/src/LightApp/resources/LightApp_images.po b/src/LightApp/resources/LightApp_images.po deleted file mode 100644 index 9149d196d..000000000 --- a/src/LightApp/resources/LightApp_images.po +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File: LightApp_images.po -// Created: May, 2005 -// Author: OCC team -// Copyright (C) CEA 2005 - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ABOUT" -msgstr "icon_about.png" - -msgid "ABOUT_SPLASH" -msgstr "icon_about.png" - -msgid "APP_DEFAULT_ICO" -msgstr "icon_default.png" - -msgid "APP_MODULE_ICO" -msgstr "icon_module.png" - -msgid "APP_MODULE_BIG_ICO" -msgstr "icon_module_big.png" - -msgid "ICON_SELECT" -msgstr "icon_select.png" - -msgid "APP_BASE_LOGO" -msgstr "icon_applogo.png" diff --git a/src/LightApp/resources/LightApp_msg_en.po b/src/LightApp/resources/LightApp_msg_en.po deleted file mode 100644 index f06c47efc..000000000 --- a/src/LightApp/resources/LightApp_msg_en.po +++ /dev/null @@ -1,352 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - - -//======================================================================================= - -msgid "APP_NAME" -msgstr "SALOME" - -msgid "ABOUT_CAPTION" -msgstr "About %1" - -msgid "ABOUT_VERSION" -msgstr "Version %1" - -msgid "ABOUT_COPYRIGHT" -msgstr "Copyright (C) 2003-2006 OPEN CASCADE, EADS/CCR, LIP6,\nCEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS" - -msgid "ABOUT_LICENSE" -msgstr "GNU LGPL" - -//======================================================================================= - -msgid "LightApp_Application::ACTIVATING_MODULE" -msgstr "Trying to activate module \"%1\"" - -msgid "LightApp_Application::TOT_RENAME" -msgstr "Rename" - -msgid "LightApp_Application::MEN_DESK_RENAME" -msgstr "&Rename" - -msgid "LightApp_Application::PRP_RENAME" -msgstr "Rename active window" - -msgid "LightApp_Application::TOT_DESK_PREFERENCES" -msgstr "Preferences" - -msgid "LightApp_Application::MEN_DESK_PREFERENCES" -msgstr "Pre&ferences..." - -msgid "LightApp_Application::TOT_DESK_MRU" -msgstr "Most recently used" - -msgid "LightApp_Application::MEN_DESK_MRU" -msgstr "Most recently used" - -msgid "LightApp_Application::PRP_DESK_PREFERENCES" -msgstr "Allow to change the preferences" - -msgid "LightApp_Application::INF_TOOLBAR_MODULES" -msgstr "Modules" - -msgid "LightApp_Application::PRP_APP_MODULE" -msgstr "Switch to SALOME platform neutral point" - -msgid "LightApp_Application::PRP_MODULE" -msgstr "Switch to the module \"%1\"" - -msgid "LightApp_Application::NEW_WINDOW_0" -msgstr "&GL view" - -msgid "LightApp_Application::NEW_WINDOW_1" -msgstr "&Plot2d view" - -msgid "LightApp_Application::NEW_WINDOW_2" -msgstr "&OCC view" - -msgid "LightApp_Application::NEW_WINDOW_3" -msgstr "VT&K view" - -msgid "LightApp_Application::INF_CANCELLED" -msgstr "Module activation cancelled" - -msgid "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" -msgstr "External browser \"%1\" can not show help page \"%2\". Do you want to change it in preferences?" - -msgid "LightApp_Application::DEFINE_EXTERNAL_BROWSER" -msgstr "External browser is not found. Do you want to define it in preferences?" - -msgid "LightApp_Application::DATA_MODELS" -msgstr "Data models" - -msgid "LightApp_Application::OBJECT_BROWSER" -msgstr "Object Browser" - -msgid "LightApp_Application::OBJ_BROWSER_NAME" -msgstr "Object" - -msgid "LightApp_Application::LOG_WINDOW" -msgstr "Message Window" - -//======================================================================================= - -msgid "LightApp_Application::MEN_DESK_MODULE_HELP" -msgstr "Module help" - -//======================================================================================= - -msgid "LightApp_Application::PREFERENCES_NOT_LOADED" -msgstr "Preferences for module \"%1\" will be available when the module will be loaded" - -msgid "LightApp_Application::PREF_CATEGORY_SALOME" -msgstr "SALOME" - -msgid "LightApp_Application::PREF_TAB_GENERAL" -msgstr "General" - -msgid "LightApp_Application::PREF_GROUP_STUDY" -msgstr "Study properties" - -msgid "LightApp_Application::PREF_MULTI_FILE" -msgstr "Multi file save" - -msgid "LightApp_Application::PREF_ASCII_FILE" -msgstr "ASCII save" - -msgid "LightApp_Application::PREF_STORE_POS" -msgstr "Store positions of windows" - -msgid "LightApp_Application::PREF_GROUP_EXT_BROWSER" -msgstr "External browser" - -msgid "LightApp_Application::PREF_APP" -msgstr "Application" - -msgid "LightApp_Application::PREF_PARAM" -msgstr "Parameters" - -msgid "LightApp_Application::PREF_GROUP_PY_CONSOLE" -msgstr "Python console properties" - -msgid "LightApp_Application::PREF_FONT" -msgstr "Font" - -msgid "LightApp_Application::PREF_TAB_OBJBROWSER" -msgstr "Object browser" - -msgid "LightApp_Application::PREF_OBJ_BROWSER_SETTINGS" -msgstr "Object browser settings" - -msgid "LightApp_Application::PREF_GROUP_DEF_COLUMNS" -msgstr "Default columns" - -msgid "LightApp_Application::PREF_TAB_VIEWERS" -msgstr "Viewers" - -msgid "LightApp_Application::PREF_GROUP_OCCVIEWER" -msgstr "OCC Viewer 3d" - -msgid "LightApp_Application::PREF_GROUP_VTKVIEWER" -msgstr "VTK Viewer 3d" - -msgid "LightApp_Application::PREF_VIEWER_BACKGROUND" -msgstr "Background color" - -msgid "LightApp_Application::PREF_TRIHEDRON_SIZE" -msgstr "Trihedron size" - -msgid "LightApp_Application::PREF_RELATIVE_SIZE" -msgstr "Relative size" - -msgid "LightApp_Application::PREF_ISOS_U" -msgstr "Number of isolines along U" -msgid "LightApp_Application::PREF_ISOS_V" -msgstr "Number of isolines along V" - -msgid "LightApp_Application::PREF_TRIHEDRON_SHOW" -msgstr "Show trihedron" - -msgid "LightApp_Application::PREF_GROUP_PLOT2DVIEWER" -msgstr "Plot2d Viewer" - -msgid "LightApp_Application::PREF_SHOW_LEGEND" -msgstr "Show legend" - -msgid "LightApp_Application::PREF_LEGEND_POSITION" -msgstr "Legend position:" - -msgid "LightApp_Application::PREF_LEFT" -msgstr "Left" - -msgid "LightApp_Application::PREF_RIGHT" -msgstr "Right" - -msgid "LightApp_Application::PREF_TOP" -msgstr "Top" - -msgid "LightApp_Application::PREF_BOTTOM" -msgstr "Bottom" - -msgid "LightApp_Application::PREF_CURVE_TYPE" -msgstr "Curve type:" - -msgid "LightApp_Application::PREF_POINTS" -msgstr "Points" - -msgid "LightApp_Application::PREF_LINES" -msgstr "Lines" - -msgid "LightApp_Application::PREF_SPLINE" -msgstr "Spline" - -msgid "LightApp_Application::PREF_MARKER_SIZE" -msgstr "Marker size:" - -msgid "LightApp_Application::PREF_LINEAR" -msgstr "Linear" - -msgid "LightApp_Application::PREF_LOGARITHMIC" -msgstr "Logarithmic" - -msgid "LightApp_Application::PREF_HOR_AXIS_SCALE" -msgstr "Horizontal axis scale:" - -msgid "LightApp_Application::PREF_VERT_AXIS_SCALE" -msgstr "Vertical axis scale:" - -msgid "LightApp_Application::PREF_TAB_DIRECTORIES" -msgstr "Directories" - -msgid "LightApp_Application::PREF_GROUP_DIRECTORIES" -msgstr "Quick directory list" - -msgid "LightApp_Application::MEN_REFRESH" -msgstr "Refresh" - -msgid "LightApp_Application::PREF_GROUP_SUPERV" -msgstr "Graph Supervisor" - -msgid "LightApp_Application::PREF_SUPERV_TITLE_COLOR" -msgstr "Title color" - -msgid "LightApp_Application::PREF_SUPERV_CTRL_COLOR" -msgstr "Ctrl color" - -msgid "LightApp_Application::PREF_AUTO_SIZE" -msgstr "Auto size for other columns" - -msgid "LightApp_Application::PREF_AUTO_SIZE_FIRST" -msgstr "Auto size for first column" - -//======================================================================================= - -msgid "LightApp_PreferencesDlg::CAPTION" -msgstr "Preferences" - -msgid "LightApp_PreferencesDlg::DEFAULT_BTN_TEXT" -msgstr "Defaults" - -msgid "LightApp_PreferencesDlg::WARNING" -msgstr "Warning" - -msgid "LightApp_PreferencesDlg::DEFAULT_QUESTION" -msgstr "Do you want to retrieve default preferences?" - -msgid "LightApp_PreferencesDlg::IMPORT_PREFERENCES" -msgstr "Import preferences" - -msgid "LightApp_PreferencesDlg::IMPORT_BTN_TEXT" -msgstr "Import" - -//======================================================================================= - -msgid "LightApp_Module::TOP_DISPLAY" -msgstr "Display" - -msgid "LightApp_Module::MEN_DISPLAY" -msgstr "Display" - -msgid "LightApp_Module::STB_DISPLAY" -msgstr "Display" - -msgid "LightApp_Module::TOP_ERASE" -msgstr "Erase" - -msgid "LightApp_Module::MEN_ERASE" -msgstr "Erase" - -msgid "LightApp_Module::STB_ERASE" -msgstr "Erase" - -msgid "LightApp_Module::TOP_DISPLAY_ONLY" -msgstr "Display only" - -msgid "LightApp_Module::MEN_DISPLAY_ONLY" -msgstr "Display only" - -msgid "LightApp_Module::STB_DISPLAY_ONLY" -msgstr "Display only" - -msgid "LightApp_Module::TOP_ERASE_ALL" -msgstr "Erase all" - -msgid "LightApp_Module::MEN_ERASE_ALL" -msgstr "Erase all" - -msgid "LightApp_Module::STB_ERASE_ALL" -msgstr "Erase all" -//======================================================================================= - - -msgid "LightApp_ModuleDlg::CAPTION" -msgstr "Activate module" - -msgid "LightApp_ModuleDlg::NEW" -msgstr "&New" - -msgid "LightApp_ModuleDlg::OPEN" -msgstr "&Open" - -msgid "LightApp_ModuleDlg::LOAD" -msgstr "&Load" - -msgid "LightApp_ModuleDlg::CANCEL" -msgstr "&Cancel" - -msgid "LightApp_ModuleDlg::ActivateComponent_DESCRIPTION" -msgstr "Create, open or load study." - -msgid "LightApp_NameDlg::TLT_RENAME" -msgstr "Rename" - -msgid "LightApp_NameDlg::NAME_LBL" -msgstr "Name: " - diff --git a/src/LightApp/resources/icon_about.png b/src/LightApp/resources/icon_about.png deleted file mode 100755 index 6817eb4073d11a0fe69b69d01bc06f5a8895f208..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 79549 zcmXte$i(88pcXue70tJd&Deex%H{b5rA2a79 znT#cK<$a$Uqpm84fl7=D004%9ytF0&z|sK#3@$P(bp3eq2_E_ZjJu|sBv3m=atM8a z;v%o_4ghF4|1B`H>p{=ZH@Q7z^gOhjtv$TW-N1m1kBb}F-QCXFi9*iJ+{M<;l0q8n zZfD~JcB4=+ceAvm;NsxmrI6BA&*YVa?u!CYke1N)$vX-3%`=i|d8_E!JX`g@cgR+z z`+P!aE;mTU5FLs(MorZnB20xUiKp?Ko=Nom#&uMvgt~=#E1(|@kNjC2IT@o-?auKo zyCAz@BeQF>a+BP9_VDm9`)4>!IREB!z@C=zz4m&gpr`7*h>j;Jw&Wi?*jt77fAlPr zeh8NyT_=e=R%jLaZ)9$1t!z?xddhHazKOTO9n6)!!_(nbk#ZBnmV6i^ugzeE%>o`g zE^Us_63^r_^B^s4ZH5_OIl2~;=YuxUChMOSt84uBBYC|^ug|}#94BXt5#Ds+46$*iV}<@vj5Uo;zTbdd|gYuXK+#o7BqaN> zb=*&+&V4VuwDa(=^IG)$dq1qk{z7yMccfh+WJ&2F&e}EQ zP0a66BNk{#(1)6XE+nvDux|#mg7sklzUTenZTgQ%g+}>`6TsK8oR=GwEOvE1x5JeUmG{s&tjTi69m&6Wp>_;?b z25IQ)de07QH``sW_vsJ0wu8+NF*WdZW2osFJ#y`ZhZ;YdF{CR}=d9%6u}EGh)Yg3< zZe`c2|NiZpL>tyZ&ABmODtK8#gXg0=j3ly#Hi)=|#a>B~LD2_vn=R1e<3oo2Vj8@D z_2`}=L5C6{3kS$(@bibd4rxJF@MJV(jlbIwPhXdr^X`8)u0#Wn(Vd=&fa#iCUA=|D zBk-KH1`iNY1OR8xI+K6la|u|+HpF7)C8c7da??Br(;IbCWbo#f)?es0aSn32J19gu(oJ)I)w%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gAs`@1@Z((Ry5e>65+(ev1)Op_KkrF$8|BI zkaKPkupW}U#)*ECJ0?jfAi5u1l)@@Iz_WD-)(2w@PZCB^Jy5<4g#HMD&#{pWT3SL& z6YQqz4Q(u^M5H#y0f)05S6mi!#_K4Ax~1dCRP~&YDR2zWI;BZUGo8V-)~l7>HJs3K`t$|No&NjU7bdySgeE z$kepWmFC{`zQm#Y=R(S%BqTG)-5>}vqruuiob%Wn?xZmR_Sh?syaY-B-O`2#?UR|f zdzzU&<$#!lnzBC4OPq`+g1dQ`h;Io0iCX~S@EDQ;poP4=s3j377D0}Kg*1o{3ILD? zz;y^P_I?0k9K;93ASjuEGQEh12!p7oC|EBz_@DuW4d9a_1^@&QL62brppbmZN7 zFbse^0*W0_O!M>eGe}EIgJY1`5)B{t^7$h$wR~cbkd(!c`vq*Ov9U6N-2xCmWO)o3 zfI=2MbU{fK6q~S^1jQaG>4E?&D=R$N!D1McOhKMz1&VB_*$ z1x$h*DhzDQj~VXWdCai?#C--HVNnJid2@yBUh7Idu(&zg&V053b!{c>CrrgH>P(gSS^WgQ&P9I7P4n>!vH0uY3duAO?`f z{tp2FY?uCj{`A%V1=FhjCq^3lKYjA#|F2)ZVpV(b;>8aD0ffK(KZpPeu#F`lCCXr> z%g4aY^pZhBMxKF-n+vCUfB+gY9s_~DA5SwV^K4@fW_!&rYgRL`K>CeSEkFRV+`D)0 zBe0%f`S}xA2_OOFBK$wJjzTZiLE?ne;nPbD09E!MK73}le0CcH^XE+rJS;yLp1c=l zICyv=!}V(q8RFwI7!(xb;pPFW6P8=IZhZs@FaVd9R$sX}XLkSq002ovPDHLkV1fe3 BH~atq diff --git a/src/LightApp/resources/icon_default.png b/src/LightApp/resources/icon_default.png deleted file mode 100644 index 0140a6667b1232eee2ee1680bf0ef475025b0ca4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 684 zcmV;d0#p5oP)1u zMC(dLP(cK%ATBKUKq&Q9S}iTc8XFU%ZPKJkCYf|5lg#|?Tu5xQaN(lg_MH3Ro(r(R ze+SWw>Hc~D&Dl!j_Mr>O{y()#r;j+Sx4I|P->QO#imNetMY|hNgk)4>()U#cX9!DlJ%p zROV-_M^O|rMUgruLogjdif-X(KokR@VL&zdKx5wsfR%P>>UDc`Gy$>b=bgzyiI}Zo zMG#nJFlV@?b?=s)=HUnh0ILB2o_^aw#K-#D3^aen*GlZ^4pXFW1q~Wf2cQDTvINnu zlkn)}4;UWjL9Aj02$UQc6$>t#riaT7iV1{o{J!C_qlY0r)&~Z<4AVut&0<6+ysf6r zz$zcI*xDdp6kzDXi25a-lnR3KLPdtlc8B{Fi=)_OV}Y{=03qBslt{<~+~Spptf#w7 zM*TrEOYWb{R#T!VT;(guzv@0_n8`8Q#r z*Y93tshniAs!zpg>U~to6!~(;@})+`>sc}~k<6=&>Zmz}eFuQ!^KG=izvmY*NB diff --git a/src/LightApp/resources/icon_module.png b/src/LightApp/resources/icon_module.png deleted file mode 100644 index 9fdd5fb01222465f14b6dd39a8607b0486bda000..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1385 zcmV-v1(y1WP)E*${}5JJ`f000McNliru)dUm_9wbGCV_pCN1olZp zK~#90ZIr=J+g2RMf3{y78z**L0)>Pu34^k3L!+vus+zQ3rfS-%N$bv)cG$6({U1B^ zuIF56@UJu>AeVdib-D;LaBxs@9Ov5W*RS_aPfvfNl&+LY zrL#__LlFQ#9LGYMraB>H7Gpfl7`vn>%8aV2k}S&z07Q(jbar+&Pbsavc<}%j z@B8S@n>TECcQ+=4v^nQi9LJ+D3`GDC5CFjH>MFl_^(p`Wmt~pc^LZhPBGm161>3ga z|rquU+J4up#jIo`jDFpzI(ljknO26`bziwI9Eyh^h^E|oP zYznUH0%HuKD1tOi!S{XW^?INvifEdqGCe(Ay>sWzt!lL@t*x#7`S9UGf`T9@A08h5 z{OZ-K4}IU~2qDRJUGebn5XQ&Hp;RhCtyY74J`a>qa2y9lqY=omELoOSUtV6WNRqTj zDOIxB>@teu7`0lh;`8UvFIkoqiK3W_q9_ao0}w?K=H}*LVPWC?oh-|crYVe#je(|V znOrV6rfJ#~La2Inc4nYftK~j^{P^kS=4Rx&?nJRz)TXAUSQv()AP6u%J`ROK0Vt*5 zx-KM10=ljP=bRgc;T4O;fvT!qP17(!2uXyH!PeH+)@U?(={SxG02R|TGm4_1FbtvJ z@5Ax&G3@T{LaWsRMNz;sO_s@I!hAm8uq^A3ot>SPIFA3eEUPOu8V&Aw-jEP7P*rtC zlB6X~)8tB}BAKQsV2lOZwgF=dg+c*pwHjxPrJ^V%6B82_V{FZ`tj%V#X%RvO5&*!1 z2M@UK`;!Qv?{c}^=b21K(sg|_GcyCFQVA|!zRXS2l` zqG{T0uh%>EeIFwLfMT%-v$L}!P18KaSe(gZ5T(?294CViG5|p0oO4xG{jssJezjWF zDwRqxm&+l?ai(=$FB*n%bS{TSj~?-bg@vIk%b{TyvZ|_%BuSgKTFu$t-~V7R7^u3g z#{kgCX0xlgTyDoS&HivWJlx;k-`L#T+}+#T^DxELX~`gjWE+h}cWZ0w#P|IK0QmXf!NCEy zZ9ANtoP3$4>0z(e69hpB%H{I!*=+V&p-@OBCMH^zWgTyCZ+CZgc2ZfECD(P+AP6u3 zjL!A-jvxql5CjAO5&#gMJ$u%4UH8{849ko$<@EH_cU{*dghZWAhhCKZ+ko&NhyM#j rQIH@AGGi>mIcG_dByZoa|Lgw)N}}v>NL48|00000NkvXXu0mjfY-5lX diff --git a/src/LightApp/resources/icon_module_big.png b/src/LightApp/resources/icon_module_big.png deleted file mode 100755 index 99e10b1ff7802e5652aea93f3d535506b198ed92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3630 zcmV+}4$<+6P)AICXyd`awvWRegrApycPz)a9E&?(|pap{zKVT?Ld zDlhZUX@x4Gst?h09!5kWfTmM20aX;*fTxLRK0+j@8fwMBO@bRzx_(OmN(J4+%d#A zq;tU~q_qaX5`u(lkxC_S6E>!4VhIbaHOGg>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Fin$$lOWlYB$I9;-ISmy}{HJd}O~?8_TM*}>Wps2>K6Y%V*!S{_|3RU16K>MQwQSs^%aONU!fEa$oyjsj zZ~%?wp8FmI;=UjZHKCNV&jWlJ69^WF*RsbYmA`=3Q?&7c3pU&jwLrU^t^#lV#$ zjN%zM`1>c(TGP7vy1GTkWt#waVb4Fa@tVI{68Lixm`mcN=l7tsp0`&CFi{Hn`UfYN zDpq*!&1bm&ru&IhG%XiJ6h(FEy!ZOQ)s5K<@ZPR`z0MySD)#+)*WaVHJ|}os!a_D< z@@~HEhkeI~#sFB=+17BwLQC?2d}hUC6Q!W<@avLV&9BQuhB7826;Tj17_-Yab}jG_ zFUya9@=uG7b>0N#lE~*0eZYcG4ht>j1BI640~)QXUVxHO1MnzPNImUs(y(ZBjoa^c8=d#Wzp$P!dS9t;e diff --git a/src/ObjBrowser/Makefile.in b/src/ObjBrowser/Makefile.in deleted file mode 100755 index 71ff8fefd..000000000 --- a/src/ObjBrowser/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# File : Makefile.in -# Author : Vladimir Klyachin (OCN) -# Module : ObjectBrowser -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@srcdir@/resources - - -@COMMENCE@ - -# header files -EXPORT_HEADERS= OB.h \ - OB_Browser.h \ - OB_ListItem.h \ - OB_ListView.h \ - OB_Filter.h - -# Libraries targets -LIB = libObjBrowser.la - -LIB_SRC= OB_Browser.cxx \ - OB_ListItem.cxx \ - OB_ListView.cxx \ - OB_Filter.cxx - -LIB_MOC = OB_Browser.h \ - OB_ListView.h - -# .po files to transform in .qm -PO_FILES = OB_msg_en.po - -CPPFLAGS+=$(QT_INCLUDES) - -LDFLAGS+=$(QT_MT_LIBS) -LIBS+= -lsuit - -@CONCLUDE@ - - diff --git a/src/VTKViewer/resources/view_update_rate.png b/src/VTKViewer/resources/view_update_rate.png index 9065e6b4545832f1d932e15b4bfd4af4cceffc96..3db37ac12b507939b2f26a7fbfaed78a36a29f8d 100755 GIT binary patch delta 23 ecmX@jevX}^Gr-TCmrIIwBinRlM&8MDne_lreFhu= delta 19 acmX@dewv-FGr-TCOKKy>bmqwmnDqcZY6bTI -- 2.39.2