From 752259d8395c81a8167c6ece232952b98c50bfd1 Mon Sep 17 00:00:00 2001 From: san Date: Fri, 15 Mar 2013 12:07:39 +0400 Subject: [PATCH] 0023829: Remove Graphic3dDemo sample app as obsolete --- samples/qt/Graphic3dDemo/Graph.dsp | 111 - samples/qt/Graphic3dDemo/Graph.dsw | 29 - samples/qt/Graphic3dDemo/Graph.sln | 21 - samples/qt/Graphic3dDemo/Graph.vcproj | 187 - samples/qt/Graphic3dDemo/Graphic3dDemo.dsp | 605 ---- samples/qt/Graphic3dDemo/Graphic3dDemo.dsw | 29 - samples/qt/Graphic3dDemo/Graphic3dDemo.sln | 21 - samples/qt/Graphic3dDemo/Graphic3dDemo.vcproj | 893 ----- samples/qt/Graphic3dDemo/Run.bat | 30 - samples/qt/Graphic3dDemo/Run_MSVC.bat | 19 - samples/qt/Graphic3dDemo/env.bat | 29 - samples/qt/Graphic3dDemo/inc/Application.h | 110 - samples/qt/Graphic3dDemo/inc/AutoTestDlg.h | 34 - samples/qt/Graphic3dDemo/inc/Document.h | 52 - samples/qt/Graphic3dDemo/inc/Graph.h | 634 ---- .../inc/Handle_Sphere_BasicShape.hxx | 85 - .../inc/Handle_Sphere_Sphere.hxx | 85 - samples/qt/Graphic3dDemo/inc/MDIWindow.h | 63 - samples/qt/Graphic3dDemo/inc/ObjectDlg.h | 68 - samples/qt/Graphic3dDemo/inc/ShapeDlg.h | 67 - .../Graphic3dDemo/inc/Sphere_BasicShape.hxx | 107 - .../Graphic3dDemo/inc/Sphere_BasicShape.ixx | 77 - .../Graphic3dDemo/inc/Sphere_BasicShape.jxx | 3 - .../qt/Graphic3dDemo/inc/Sphere_Sphere.hxx | 107 - .../qt/Graphic3dDemo/inc/Sphere_Sphere.ixx | 79 - .../qt/Graphic3dDemo/inc/Sphere_Sphere.jxx | 4 - samples/qt/Graphic3dDemo/inc/Translate.h | 33 - samples/qt/Graphic3dDemo/inc/View.h | 105 - samples/qt/Graphic3dDemo/inc/ViewDlg.h | 50 - samples/qt/Graphic3dDemo/inc/ViewOperations.h | 55 - samples/qt/Graphic3dDemo/inc/global.h | 23 - samples/qt/Graphic3dDemo/res/Sample_icons.ts | 127 - samples/qt/Graphic3dDemo/res/Sample_msg.ts | 589 ---- samples/qt/Graphic3dDemo/res/auto.png | Bin 1151 -> 0 bytes samples/qt/Graphic3dDemo/res/cascade.png | Bin 225 -> 0 bytes samples/qt/Graphic3dDemo/res/close.png | Bin 212 -> 0 bytes .../qt/Graphic3dDemo/res/cursor_rotate.png | Bin 291 -> 0 bytes samples/qt/Graphic3dDemo/res/cursor_zoom.png | Bin 245 -> 0 bytes samples/qt/Graphic3dDemo/res/document.png | Bin 241 -> 0 bytes samples/qt/Graphic3dDemo/res/help.png | Bin 214 -> 0 bytes samples/qt/Graphic3dDemo/res/lamp.png | Bin 1355 -> 0 bytes samples/qt/Graphic3dDemo/res/new.png | Bin 177 -> 0 bytes samples/qt/Graphic3dDemo/res/optim.png | Bin 1216 -> 0 bytes samples/qt/Graphic3dDemo/res/stop.png | Bin 202 -> 0 bytes samples/qt/Graphic3dDemo/res/tile.png | Bin 199 -> 0 bytes samples/qt/Graphic3dDemo/res/tool_shading.png | Bin 209 -> 0 bytes .../qt/Graphic3dDemo/res/tool_wireframe.png | Bin 208 -> 0 bytes samples/qt/Graphic3dDemo/res/view_axo.png | Bin 286 -> 0 bytes samples/qt/Graphic3dDemo/res/view_back.png | Bin 233 -> 0 bytes samples/qt/Graphic3dDemo/res/view_bottom.png | Bin 233 -> 0 bytes samples/qt/Graphic3dDemo/res/view_fitall.png | Bin 231 -> 0 bytes samples/qt/Graphic3dDemo/res/view_fitarea.png | Bin 224 -> 0 bytes samples/qt/Graphic3dDemo/res/view_front.png | Bin 238 -> 0 bytes samples/qt/Graphic3dDemo/res/view_glpan.png | Bin 205 -> 0 bytes samples/qt/Graphic3dDemo/res/view_left.png | Bin 231 -> 0 bytes samples/qt/Graphic3dDemo/res/view_pan.png | Bin 178 -> 0 bytes samples/qt/Graphic3dDemo/res/view_reset.png | Bin 204 -> 0 bytes samples/qt/Graphic3dDemo/res/view_right.png | Bin 230 -> 0 bytes samples/qt/Graphic3dDemo/res/view_rotate.png | Bin 224 -> 0 bytes samples/qt/Graphic3dDemo/res/view_top.png | Bin 235 -> 0 bytes samples/qt/Graphic3dDemo/res/view_zoom.png | Bin 222 -> 0 bytes samples/qt/Graphic3dDemo/src/Application.cxx | 695 ---- samples/qt/Graphic3dDemo/src/AutoTestDlg.cxx | 169 - samples/qt/Graphic3dDemo/src/Document.cxx | 147 - samples/qt/Graphic3dDemo/src/Graph.cpp | 3017 ----------------- .../qt/Graphic3dDemo/src/Graphic3dDemo.cxx | 54 - samples/qt/Graphic3dDemo/src/MDIWindow.cxx | 206 -- samples/qt/Graphic3dDemo/src/ObjectDlg.cxx | 291 -- samples/qt/Graphic3dDemo/src/ShapeDlg.cxx | 357 -- .../Graphic3dDemo/src/Sphere_BasicShape.cxx | 71 - .../qt/Graphic3dDemo/src/Sphere_Sphere.cxx | 1137 ------- samples/qt/Graphic3dDemo/src/Translate.cxx | 172 - samples/qt/Graphic3dDemo/src/View.cxx | 883 ----- samples/qt/Graphic3dDemo/src/ViewDlg.cxx | 248 -- .../qt/Graphic3dDemo/src/ViewOperations.cxx | 328 -- 75 files changed, 12306 deletions(-) delete mode 100755 samples/qt/Graphic3dDemo/Graph.dsp delete mode 100755 samples/qt/Graphic3dDemo/Graph.dsw delete mode 100755 samples/qt/Graphic3dDemo/Graph.sln delete mode 100755 samples/qt/Graphic3dDemo/Graph.vcproj delete mode 100755 samples/qt/Graphic3dDemo/Graphic3dDemo.dsp delete mode 100755 samples/qt/Graphic3dDemo/Graphic3dDemo.dsw delete mode 100755 samples/qt/Graphic3dDemo/Graphic3dDemo.sln delete mode 100755 samples/qt/Graphic3dDemo/Graphic3dDemo.vcproj delete mode 100755 samples/qt/Graphic3dDemo/Run.bat delete mode 100755 samples/qt/Graphic3dDemo/Run_MSVC.bat delete mode 100755 samples/qt/Graphic3dDemo/env.bat delete mode 100755 samples/qt/Graphic3dDemo/inc/Application.h delete mode 100755 samples/qt/Graphic3dDemo/inc/AutoTestDlg.h delete mode 100755 samples/qt/Graphic3dDemo/inc/Document.h delete mode 100755 samples/qt/Graphic3dDemo/inc/Graph.h delete mode 100755 samples/qt/Graphic3dDemo/inc/Handle_Sphere_BasicShape.hxx delete mode 100755 samples/qt/Graphic3dDemo/inc/Handle_Sphere_Sphere.hxx delete mode 100755 samples/qt/Graphic3dDemo/inc/MDIWindow.h delete mode 100755 samples/qt/Graphic3dDemo/inc/ObjectDlg.h delete mode 100755 samples/qt/Graphic3dDemo/inc/ShapeDlg.h delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.hxx delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.ixx delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.jxx delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_Sphere.hxx delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_Sphere.ixx delete mode 100755 samples/qt/Graphic3dDemo/inc/Sphere_Sphere.jxx delete mode 100755 samples/qt/Graphic3dDemo/inc/Translate.h delete mode 100755 samples/qt/Graphic3dDemo/inc/View.h delete mode 100755 samples/qt/Graphic3dDemo/inc/ViewDlg.h delete mode 100755 samples/qt/Graphic3dDemo/inc/ViewOperations.h delete mode 100755 samples/qt/Graphic3dDemo/inc/global.h delete mode 100755 samples/qt/Graphic3dDemo/res/Sample_icons.ts delete mode 100755 samples/qt/Graphic3dDemo/res/Sample_msg.ts delete mode 100755 samples/qt/Graphic3dDemo/res/auto.png delete mode 100755 samples/qt/Graphic3dDemo/res/cascade.png delete mode 100755 samples/qt/Graphic3dDemo/res/close.png delete mode 100755 samples/qt/Graphic3dDemo/res/cursor_rotate.png delete mode 100755 samples/qt/Graphic3dDemo/res/cursor_zoom.png delete mode 100755 samples/qt/Graphic3dDemo/res/document.png delete mode 100755 samples/qt/Graphic3dDemo/res/help.png delete mode 100755 samples/qt/Graphic3dDemo/res/lamp.png delete mode 100755 samples/qt/Graphic3dDemo/res/new.png delete mode 100755 samples/qt/Graphic3dDemo/res/optim.png delete mode 100755 samples/qt/Graphic3dDemo/res/stop.png delete mode 100755 samples/qt/Graphic3dDemo/res/tile.png delete mode 100755 samples/qt/Graphic3dDemo/res/tool_shading.png delete mode 100755 samples/qt/Graphic3dDemo/res/tool_wireframe.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_axo.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_back.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_bottom.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_fitall.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_fitarea.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_front.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_glpan.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_left.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_pan.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_reset.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_right.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_rotate.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_top.png delete mode 100755 samples/qt/Graphic3dDemo/res/view_zoom.png delete mode 100755 samples/qt/Graphic3dDemo/src/Application.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/AutoTestDlg.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/Document.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/Graph.cpp delete mode 100755 samples/qt/Graphic3dDemo/src/Graphic3dDemo.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/MDIWindow.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/ObjectDlg.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/ShapeDlg.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/Sphere_BasicShape.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/Sphere_Sphere.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/Translate.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/View.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/ViewDlg.cxx delete mode 100755 samples/qt/Graphic3dDemo/src/ViewOperations.cxx diff --git a/samples/qt/Graphic3dDemo/Graph.dsp b/samples/qt/Graphic3dDemo/Graph.dsp deleted file mode 100755 index 0ccc51c528..0000000000 --- a/samples/qt/Graphic3dDemo/Graph.dsp +++ /dev/null @@ -1,111 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Graph" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Graph - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Graph.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Graph.mak" CFG="Graph - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Graph - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Graph - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Graph - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "win32/bin" -# PROP Intermediate_Dir "win32/obj" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GRAPH_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "inc" /I "$(QTDIR)\include" /I "$(QTDIR)\include\Qt" /D "NDEBUG" /D "QT_DLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GRAPH_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib QtCore4.lib QtGui4.lib /nologo /dll /machine:I386 /libpath:"$(QTDIR)\lib" - -!ELSEIF "$(CFG)" == "Graph - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Graph___Win32_Debug" -# PROP BASE Intermediate_Dir "Graph___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "win32/bind" -# PROP Intermediate_Dir "win32/objd" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GRAPH_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "inc" /I "$(QTDIR)\include" /I "$(QTDIR)\include\Qt" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GRAPH_EXPORTS" /D "QT_DLL" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib QtCore4.lib QtGui4.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"$(QTDIR)\lib" - -!ENDIF - -# Begin Target - -# Name "Graph - Win32 Release" -# Name "Graph - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\Graph.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\inc\Graph.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/samples/qt/Graphic3dDemo/Graph.dsw b/samples/qt/Graphic3dDemo/Graph.dsw deleted file mode 100755 index c880a4be55..0000000000 --- a/samples/qt/Graphic3dDemo/Graph.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Graph"=.\Graph.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/samples/qt/Graphic3dDemo/Graph.sln b/samples/qt/Graphic3dDemo/Graph.sln deleted file mode 100755 index 1be8fc250e..0000000000 --- a/samples/qt/Graphic3dDemo/Graph.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Graph", "Graph.vcproj", "{BA569B32-6C9B-4402-AF34-ACBD29A9DEBD}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BA569B32-6C9B-4402-AF34-ACBD29A9DEBD}.Debug.ActiveCfg = Debug|Win32 - {BA569B32-6C9B-4402-AF34-ACBD29A9DEBD}.Debug.Build.0 = Debug|Win32 - {BA569B32-6C9B-4402-AF34-ACBD29A9DEBD}.Release.ActiveCfg = Release|Win32 - {BA569B32-6C9B-4402-AF34-ACBD29A9DEBD}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/samples/qt/Graphic3dDemo/Graph.vcproj b/samples/qt/Graphic3dDemo/Graph.vcproj deleted file mode 100755 index 07b6649bcd..0000000000 --- a/samples/qt/Graphic3dDemo/Graph.vcproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/qt/Graphic3dDemo/Graphic3dDemo.dsp b/samples/qt/Graphic3dDemo/Graphic3dDemo.dsp deleted file mode 100755 index 7dd43bf49c..0000000000 --- a/samples/qt/Graphic3dDemo/Graphic3dDemo.dsp +++ /dev/null @@ -1,605 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Graphic3dDemo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=Graphic3dDemo - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "Graphic3dDemo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "Graphic3dDemo.mak" CFG="Graphic3dDemo - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Graphic3dDemo - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "Graphic3dDemo - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "win32/bin" -# PROP Intermediate_Dir "win32/obj" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "inc" /I "$(CASROOT)\inc" /I "$(QTDIR)\include" /I "$(QTDIR)\include\Qt" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "WNT" /D "QT_DLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 TKernel.lib TKV3d.lib TKService.lib PTKernel.lib TKG3d.lib TKSTL.lib TKBrep.lib TKPrim.lib TKTopAlgo.lib TKG2d.lib TKMath.lib QtCore4.lib QtGui4.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Graph.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /machine:I386 /libpath:"$(CASROOT)\win32\lib" /libpath:"$(QTDIR)\lib" /libpath:"win32\bin" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Graphic3dDemo___Win32_Debug" -# PROP BASE Intermediate_Dir "Graphic3dDemo___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "win32/bind" -# PROP Intermediate_Dir "win32/objd" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "inc" /I "$(CASROOT)\inc" /I "$(QTDIR)\include" /I "$(QTDIR)\include\Qt" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "WNT" /D "QT_DLL" /D "GRAPH_EXPORTS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 TKernel.lib TKV3d.lib TKService.lib PTKernel.lib TKG3d.lib TKSTL.lib TKBrep.lib TKPrim.lib TKTopAlgo.lib TKG2d.lib TKMath.lib QtCore4.lib QtGui4.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Graph.lib /nologo /entry:"mainCRTStartup" /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"$(CASROOT)\win32\libd" /libpath:"$(QTDIR)\lib" /libpath:"win32\bind" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "Graphic3dDemo - Win32 Release" -# Name "Graphic3dDemo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\Application.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\AutoTestDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\Document.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\Graphic3dDemo.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\MDIWindow.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\ObjectDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\ShapeDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\Sphere_BasicShape.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\Sphere_Sphere.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\Translate.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\View.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\ViewDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\src\ViewOperations.cxx -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\inc\Application.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Application.h -InputName=Application - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Application.h -InputName=Application - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\AutoTestDlg.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\AutoTestDlg.h -InputName=AutoTestDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\AutoTestDlg.h -InputName=AutoTestDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\Document.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Document.h -InputName=Document - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Document.h -InputName=Document - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\global.h -# End Source File -# Begin Source File - -SOURCE=.\inc\Handle_Sphere_BasicShape.hxx -# End Source File -# Begin Source File - -SOURCE=.\inc\Handle_Sphere_Sphere.hxx -# End Source File -# Begin Source File - -SOURCE=.\inc\MDIWindow.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\MDIWindow.h -InputName=MDIWindow - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\MDIWindow.h -InputName=MDIWindow - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\ObjectDlg.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ObjectDlg.h -InputName=ObjectDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ObjectDlg.h -InputName=ObjectDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\ShapeDlg.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ShapeDlg.h -InputName=ShapeDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ShapeDlg.h -InputName=ShapeDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_BasicShape.hxx -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_BasicShape.ixx -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_BasicShape.jxx -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_Sphere.hxx -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_Sphere.ixx -# End Source File -# Begin Source File - -SOURCE=.\inc\Sphere_Sphere.jxx -# End Source File -# Begin Source File - -SOURCE=.\inc\Translate.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Translate.h -InputName=Translate - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\Translate.h -InputName=Translate - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\View.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\View.h -InputName=View - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\View.h -InputName=View - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\ViewDlg.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ViewDlg.h -InputName=ViewDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ViewDlg.h -InputName=ViewDlg - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\inc\ViewOperations.h - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ViewOperations.h -InputName=ViewOperations - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build - Moc'ing $(InputName).h ... -InputDir=.\inc -InputPath=.\inc\ViewOperations.h -InputName=ViewOperations - -".\win32\inc\moc_$(InputName).cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\Sample_icons.ts - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build -InputPath=.\res\Sample_icons.ts -InputName=Sample_icons - -".\win32\res\$(InputName).qm" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)/bin/lrelease $(InputPath) -qm .\win32\res\$(InputName).qm - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build -InputPath=.\res\Sample_icons.ts -InputName=Sample_icons - -".\win32\res\$(InputName).qm" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)/bin/lrelease $(InputPath) -qm .\win32\res\$(InputName).qm - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\res\Sample_msg.ts - -!IF "$(CFG)" == "Graphic3dDemo - Win32 Release" - -# Begin Custom Build -InputPath=.\res\Sample_msg.ts -InputName=Sample_msg - -".\win32\res\$(InputName).qm" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)/bin/lrelease $(InputPath) -qm .\win32\res\$(InputName).qm - -# End Custom Build - -!ELSEIF "$(CFG)" == "Graphic3dDemo - Win32 Debug" - -# Begin Custom Build -InputPath=.\res\Sample_msg.ts -InputName=Sample_msg - -".\win32\res\$(InputName).qm" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(QTDIR)/bin/lrelease $(InputPath) -qm .\win32\res\$(InputName).qm - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "moc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\win32\inc\moc_Application.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_AutoTestDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_Document.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_MDIWindow.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_ObjectDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_ShapeDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_Translate.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_View.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_ViewDlg.cxx -# End Source File -# Begin Source File - -SOURCE=.\win32\inc\moc_ViewOperations.cxx -# End Source File -# End Group -# End Target -# End Project diff --git a/samples/qt/Graphic3dDemo/Graphic3dDemo.dsw b/samples/qt/Graphic3dDemo/Graphic3dDemo.dsw deleted file mode 100755 index 75bb4b39ea..0000000000 --- a/samples/qt/Graphic3dDemo/Graphic3dDemo.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Graphic3dDemo"=.\Graphic3dDemo.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/samples/qt/Graphic3dDemo/Graphic3dDemo.sln b/samples/qt/Graphic3dDemo/Graphic3dDemo.sln deleted file mode 100755 index 7cfb8b9100..0000000000 --- a/samples/qt/Graphic3dDemo/Graphic3dDemo.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Graphic3dDemo", "Graphic3dDemo.vcproj", "{9E15431A-031C-42CA-875B-284448550F66}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {9E15431A-031C-42CA-875B-284448550F66}.Debug.ActiveCfg = Debug|Win32 - {9E15431A-031C-42CA-875B-284448550F66}.Debug.Build.0 = Debug|Win32 - {9E15431A-031C-42CA-875B-284448550F66}.Release.ActiveCfg = Release|Win32 - {9E15431A-031C-42CA-875B-284448550F66}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/samples/qt/Graphic3dDemo/Graphic3dDemo.vcproj b/samples/qt/Graphic3dDemo/Graphic3dDemo.vcproj deleted file mode 100755 index 20cbe18c5e..0000000000 --- a/samples/qt/Graphic3dDemo/Graphic3dDemo.vcproj +++ /dev/null @@ -1,893 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/qt/Graphic3dDemo/Run.bat b/samples/qt/Graphic3dDemo/Run.bat deleted file mode 100755 index e27f328f79..0000000000 --- a/samples/qt/Graphic3dDemo/Run.bat +++ /dev/null @@ -1,30 +0,0 @@ -@ECHO OFF - -call env.bat - -IF NOT EXIST win32\obj goto QTSET - -IF NOT EXIST "%QTDIR%" goto QTSET - -goto QT - -:QTSET - -SET QTDIR=%ROOT%\3rdparty\win32\qt -SET PATH=%QTDIR%;%PATH% - -:QT - -if not exist %BIN_DIR%\Graphic3dDemo.exe goto ERR_EXE - -@echo Starting Graphic3dDemo ..... -start .\%BIN_DIR%\Graphic3dDemo.exe - -GOTO END - -:ERR_EXE -ECHO Executable %BIN_DIR%\Graphic3dDemo.exe not found." -ECHO Probably you didn't compile the application. -GOTO END - -:END diff --git a/samples/qt/Graphic3dDemo/Run_MSVC.bat b/samples/qt/Graphic3dDemo/Run_MSVC.bat deleted file mode 100755 index 4e20089e96..0000000000 --- a/samples/qt/Graphic3dDemo/Run_MSVC.bat +++ /dev/null @@ -1,19 +0,0 @@ -@ECHO OFF - -call env.bat - -IF NOT DEFINED QTDIR GOTO ERR_QTDIR - -REM *** To start build on MSVC6 *** -rem msdev.exe Graphic3dDemo.dsw - -REM *** To start build on MSVC7 *** -start "%VS71COMNTOOLS%\..\IDE\devenv.exe" Graphic3dDemo.sln - -GOTO END - -:ERR_QTDIR -ECHO Environment variable "QTDIR" has not been defined. Abort. -GOTO END - -:END diff --git a/samples/qt/Graphic3dDemo/env.bat b/samples/qt/Graphic3dDemo/env.bat deleted file mode 100755 index e7414c57d5..0000000000 --- a/samples/qt/Graphic3dDemo/env.bat +++ /dev/null @@ -1,29 +0,0 @@ -@ECHO OFF - -call ../../../env.bat %1 %2 %3 - -IF NOT DEFINED CASROOT GOTO ERR_CASROOT - -IF NOT EXIST "%CASROOT%\win32\bin\TKernel.dll" GOTO ERR_CASCADE - -SET CASLIBS=%CASROOT%\win32\bin - -SET ROOT=%CASROOT%\.. - -SET RES_DIR=win32\res -SET BIN_DIR=win32\bin - -SET CSF_ResourcesDefaults=%RES_DIR% -SET PATH=%CASLIBS%;%QTDIR%\bin;%PATH% - -GOTO END - -:ERR_CASROOT -ECHO Environment variable "CASROOT" has not been defined. Abort. -EXIT - -:ERR_CASCADE -ECHO Environment variable "CASROOT" defined incorrectly. Abort. -EXIT - -:END diff --git a/samples/qt/Graphic3dDemo/inc/Application.h b/samples/qt/Graphic3dDemo/inc/Application.h deleted file mode 100755 index c5eed6b0ca..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Application.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef APPLICATION_H -#define APPLICATION_H - -#include -#include -#include -#include -#include -#include - -#include "MDIWindow.h" -#include "ViewDlg.h" - -class Document; -class OutputWindow; -class QTextEdit; - -class Application: public QMainWindow -{ - Q_OBJECT - - enum { FileNewId, FileQuitId, ViewToolId, ViewStatusId, HelpAboutId, OptimId, - AutoTestId, StopId, TileId, CascadeId }; - - enum { FileImportBREPId}; - -public: - Application(); - ~Application(); - - static QWorkspace* getWorkspace(); - static Application* getApplication(); - static QString getResourceDir(); - static void startTimer(); - static void stopTimer( int, const char*, bool addToGraph = true, int aOpt = -1 ); - static void showTimer( const char* ); - static void addResult(MDIWindow::ResultType, double); - void showMessage( QString& ); - - MDIWindow* getActiveMDI(); - - void updateActions(); - void importBREP(); -signals: - void sendQuit(); - -public slots: - void InitApp(); - Document* onNewDocument(); - void onCloseDocument( Document* theDoc ); - void onViewToolBar(); - void onViewStatusBar(); - void onAbout(); - void onQuit(); - void onTranslate(); - void onToggleOptim(bool); - void onAutoTest(); - void onStop(); - void updateWindowList(); - void activateWindow(); - void onEditViewProperties(); - void updateViewDlg(); - -protected: - QWorkspace* workspace() const; - void keyPressEvent( QKeyEvent* e ); - -private slots: - void onWindowActivated( QWidget* ); - -private: - void createActions(); - void createCCActions(); - void createIEPopups(); - -private: - QWorkspace* myWorkSpace; - MDIWindow* myActiveMDI; - int myNbDocuments; - bool myIsDocuments; - QList myStdActions; - QList myCCActions; - QToolBar* myStdToolBar; - QMenu* myFilePopup; - QMenu* myImportPopup; - QMenu* myToolsMenu; - QMenu* myWinMenu; - OutputWindow* myOutput; - - bool myEscPressed; - bool myStopPressed; - - ViewDlg* myViewDlg; - -}; - -class OutputWindow : public QWidget -{ -public: - OutputWindow( QWidget* parent = 0 ); - ~OutputWindow(); - - void print( QString& ); - -private: - QTextEdit* myLineEdit; - int myLineCounter; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/AutoTestDlg.h b/samples/qt/Graphic3dDemo/inc/AutoTestDlg.h deleted file mode 100755 index 6a066becd4..0000000000 --- a/samples/qt/Graphic3dDemo/inc/AutoTestDlg.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef AUTOTESTDLG_H -#define AUTOTESTDLG_H - -#include -#include -#include -#include - -class AutoTestDlg : public QDialog -{ - Q_OBJECT - -public: - AutoTestDlg(QWidget * parent=0); - int getStartNbItems() { return myStartSpin->value(); } - int getStopNbItems() { return myStopSpin->value(); } - int getStep() { return myStepSpin->value(); } - int isText() { return myTeCheck->isChecked(); } - -public slots: - void onStart(); - void onCancel(); - void setStartMaxValue(int i); - void checkStepSpinState(); - void onText(); - -private: - QSpinBox* myStartSpin; - QSpinBox* myStopSpin; - QSpinBox* myStepSpin; - QCheckBox* myTeCheck; -}; - -#endif //#ifndef AUTOTESTDLG_H \ No newline at end of file diff --git a/samples/qt/Graphic3dDemo/inc/Document.h b/samples/qt/Graphic3dDemo/inc/Document.h deleted file mode 100755 index 009f045cd1..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Document.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef DOCUMENT_H -#define DOCUMENT_H - -#include -#include - -#include "MDIWindow.h" -#include "ViewOperations.h" - -#include -#include -#include - -class Application; -class Document : public QObject -{ - Q_OBJECT -public: - Document( int theIndex, Application* app ); - ~Document(); - - Application* getApplication(); - Handle_AIS_InteractiveContext& getContext(); - - void removeView( MDIWindow* theView ); - int countOfWindow(); - void createMagView( int, int, int, int ); - void createNewView( V3d_TypeOfView type = V3d_ORTHOGRAPHIC ); - -signals: - void sendCloseDocument( Document* ); -public slots: - void onCloseView( MDIWindow* theView ); - void onWireframe(); - void onShading(); - -private: - Handle_V3d_Viewer Viewer( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain, - const Standard_Real ViewSize ); -private: - Application* myApp; - QList myViews; - Handle_V3d_Viewer myViewer; - Handle_AIS_InteractiveContext myContext; - ViewOperations* myOperations; - int myIndex; - int myNbViews; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/Graph.h b/samples/qt/Graphic3dDemo/inc/Graph.h deleted file mode 100755 index 3d1e80366f..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Graph.h +++ /dev/null @@ -1,634 +0,0 @@ -// 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 TEST_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 -// TEST_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. - -#ifdef GRAPH_EXPORTS -#define GRAPH_API __declspec(dllexport) -#else -#define GRAPH_API __declspec(dllimport) -#endif - -////////////////////////////////////////////////////////////////////// -// File : Graph.h -// Created : 26.03.02 -// Author : Vadim SANDLER -////////////////////////////////////////////////////////////////////// - -#if !defined(_Graph_h) -#define _Graph_h - -#include -#include -#include -#include -#include -#include -#include -#include - -//================================================================ -// Class : GraphNode -// Description : graph node -//================================================================ -class GRAPH_API GraphNode { -public: -// default constructor - GraphNode(); -// constructor - GraphNode(const double x, const double y); -// copy constructor - GraphNode(const GraphNode& node); - -// x coordinate - inline double x() const { return myX; } -// y coordinate - inline double y() const { return myY; } -// operator == - bool operator== (const GraphNode& node); -// operator < - bool operator< (const GraphNode& node); -// operator > - bool operator> (const GraphNode& node); -// operator = - GraphNode& operator= (const GraphNode& node); - -private: -// node coordinates - double myX; - double myY; -}; - -typedef QList NodeList; -class GraphView; - -//================================================================ -// Class : GraphItem -// Description : graph data set -//================================================================ -class GRAPH_API GraphItem { -public: -// constructor - GraphItem(GraphView* parent, QString name = QString::null); -// destructor - virtual ~GraphItem(); - -// adds node - void addNode (GraphNode* node); -// adds node - void addNode (const double x, const double y); -// adds nodes - void addNodes(NodeList& nodes); -// removes node (and deletes it) - void removeNode(GraphNode* node); -// removes node by index (and deletes it) - void removeNode(int index); -// clears nodes - void clear (); -// gets number of nodes - int count () { return myNodes.count(); } -// returns true if list of nodes is empty - bool isEmpty () { return myNodes.isEmpty(); } -// returns true if item is valid, i.e. has valid attributes and not empty - bool isValid (); -// returns flag, true by default - bool isSorted() { return mySorted; } -// sets/clears flag (and reorders nodes) - void setSorted (bool sorted); -// gets node by index or NULL if index is out of range - GraphNode* getNode (const int index); -// gets node by index or NULL if index is out of range - GraphNode* operator[] (const int index); -// sets dynamic marker for item - void setMarker (const int marker, - const int color, - const int line); -// sets static marker for item -// (with own (NOT CHANGEABLE) marker, color and type line) - void setMarker (const int marker, - const QColor& color, - const Qt::PenStyle line); -// gets item name - QString getName() const { return myName; } -// sets item name - void setName(const QString& name) { myName = name; } -// returns true if item has own color - bool hasOwnColor() const { return myHasOwnColor; } -// returns true if item has own line type - bool hasOwnLine() const { return myHasOwnLine; } -// returns true if item has own marker - bool hasOwnMarker() const { return myHasOwnMarker; } -// sets own color - void setColor(const QColor& color); -// returns item's color - QColor getColor(); -// sets own line - void setLine(const Qt::PenStyle line); -// returns item's line type - Qt::PenStyle getLine(); -// sets own marker - void setMarker(const int marker); -// return item's marker type - int getMarker(); -// gets marker attributes - void getMarker (int& marker, int& color, int& line); - -protected: -// performs initialization - void init(); - -private: -// parent graph viewer - GraphView* myParent; -// node list - NodeList myNodes; -// name of item - QString myName; -// attributes type of line, color and marker - int myMarker; - int myColor; - int myLine; -// own marker - bool myHasOwnMarker; -// own color - bool myHasOwnColor; - QColor myOwnColor; -// own line type - bool myHasOwnLine; - Qt::PenStyle myOwnLine; -// flag - bool mySorted; -}; - -typedef QList ItemList; -typedef QList ColorList; -typedef QList LineList; -typedef QList IntList; - -class GraphLegend; - -//================================================================ -// Class : GraphView -// Description : simple graph displayer -//================================================================ -class GRAPH_API GraphView : public QWidget { - struct OperationButton { - Qt::MouseButtons button; - Qt::KeyboardModifiers modifier; - OperationButton(const Qt::MouseButtons btn = Qt::NoButton, - const Qt::KeyboardModifiers m = Qt::NoModifier) - : button(btn), modifier(m) {} - }; - -public: - enum ViewOperation { voNone, voZoom, voZoomX, voZoomY, - voPan, voPanX, voPanY, voRect }; - enum GridMode { gmFixed, gmIntervals, gmFloating }; - -#ifdef DEB - void drawItem(QPainter* painter, - int pxMin, - int pxMax, - int pyMin, - int pyMax, - double xMin, - double xMax, - double yMin, - double yMax, - GraphItem* item); -#endif - -/* ================== CONSTRUCTION/DESTRUCTION ================ */ -// Constructor - GraphView(QWidget* parent = 0); -// Destructor - ~GraphView(); - -/* ======================= OVERRIDED ========================== */ -// event filter - bool eventFilter(QObject* object, QEvent* event); - -/* ================== CURSORS HANDLING ======================== */ -// sets cursor for certain view operation - void setOperationCursor (const ViewOperation operation, - const QCursor& newCursor); -// gets cursor for certain view operation - QCursor getOperationCursor (const ViewOperation operation) const; - -/* =================== VIEW OPERATIONS ======================== */ -// returns global flag state - bool isOperationsEnabled() const { return myEnableGlobal; } -// globally enables/disables operations - void setOperationsEnabled(bool on); -// returns 'true' if view operation is enabled - bool isOperationEnabled (const ViewOperation operation) const; -// enables/disables view operation - void setOperationEnabled(const ViewOperation operation, - bool enable); -// sets operation key-mousebutton combination - void setOperationButton (const ViewOperation operation, - const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier); -// gets operation key-mousebutton combination - void getOperationButton (const ViewOperation operation, - Qt::MouseButtons& button, - Qt::KeyboardModifiers& modifier) const; -// tests for operation key-mousebutton combination - bool testOperation (const ViewOperation theOp, - const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier) const; -// tests key-mousebutton combination and returns view operation if any matches - ViewOperation testOperation (const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier) const; - - // resets view : sets origin to 0.0 and scales to 1.0 - void reset(); -// fits viewer so display all data - void fitAll(); -// fits viewer to display certain data - void fitData(const double xMin, const double xMax, - const double yMin, const double yMax); -// fits viewer to display certain data along horizontal axis - void fitDataX(const double xMin, const double xMax); -// fits viewer to display certain data along vertical axis - void fitDataY(const double yMin, const double yMax); -// performs pan operation by dx, dy pixels - void pan(const int dx, const int dy); -// performs zoom operation by dx, dy pixels - void zoom(const int dx, const int dy); -// starts view operation if it is enabled - void startViewOperation(const ViewOperation operation); - -/* ================== ATRIBUTES HANDLING ====================== */ -// enables/disables internal markers drawing - void showMarkers (bool show); -// enables/disables tooltips - void showTooltips (bool show); -// returns true is axes are shown - bool isAxesShown () const { return myShowAxes; } -// shows/hides axes - void showAxes (bool show); -// returns true is tick-marks are shown - bool isTickMarkShown () const { return myShowTickMarks; } -// shows/hides tick-marks - void showTickMark (bool show); -// returns true is title is shown - bool isTitleShown () const { return myShowTitle; } -// shows/hides title - void showTitle (bool show); -// gets graph title - const QString& getTitle () const { return myTitle; } -// sets graph title - void setTitle (const QString& title); -// returns true is axes titles are shown - bool isAxesTitleShown() const { return myShowAxesTitle; } -// shows/hides axis titles - void showAxesTitle (bool show); -// gets graph X axis title - const QString& getXTitle () const { return myXTitle; } -// sets graph X axis title - void setXTitle (const QString& title); -// gets graph Y axis title - const QString& getYTitle () const { return myYTitle; } -// sets graph Y axis title - void setYTitle (const QString& title); -// returns true is grid is shown - bool isGridShown () const { return myShowGrid; } -// shows/hides grid - void showGrid (bool show); -// sets grid step (FLOATING mode) for x, y axes, -// doesn't change step if it is <= 0 - void setGridStep (const double x, const double y, bool turn = true); -// gets grid step (FLOATING mode) for x, y axes -// and returns true if grid mode is FLOATING - bool getGridStep (double& x, double& y) const; -// sets grid step (FIXED mode) for x, y axes in pixels, -// doesn't change step if it is less <= 0 - void setFixedGridStep (const int x, const int y, bool turn = true); -// gets grid step (FIXED mode) for x, y axes in pixels -// and returns true if grid mode is FIXED - bool getFixedGridStep (int& x, int& y) const; -// sets number of grid intervals (INTERVALS mode) for x, y axes, -// doesn't change if <= 0 - void setGridIntervals (const int xInt, - const int yInt, - bool turn = true); -// gets number of grid intervals (INTERVALS mode) for x, y axes, -// and returns true if grid mode is INTERVALS - bool getGridIntervals (int &xInt, int &yInt) const; -// returns grid mode [FIXED, INTERVALS, FLOATING] - GridMode getGridMode() const { return myGridMode; } -// switches grid mode [FIXED, INTERVALS, FLOATING] - void setGridMode(const GridMode mode); -// sets X axis scale - void setXScale(const double scale); -// gets X axis scale (data per pixel along X axis) - double getXScale() const { return myXScale; } -// sets Y axis scale - void setYScale(const double scale); -// gets Y axis scale (data per pixel along Y axis) - double getYScale() const { return myYScale; } -// sets X,Y axis scale - void setScale(const double scale); -// moves axes origin to point [x, y] - void setOrigin(const double x, const double y); -// gets axes origin - void getOrigin(double& x, double& y) const; -// changes backgroundColor, use it instead setBackgroundColor - void changeBackgroundColor(const int index = -1); -// gets main title font - QFont getTitleFont() { return myTitleFont; } -// sets main title font - void setTitleFont(QFont& font); -// gets axes title font - QFont getAxesTitleFont() { return myAxesTitleFont; } -// sets axes title font - void setAxesTitleFont(QFont& font); -// gets tick marks font - QFont getTickMarksFont() { return myTickMarksFont; } -// sets tick marks font - void setTickMarksFont(QFont& font); -// sets legend widget - void setLegend(GraphLegend* legend); -// gets legend widget - GraphLegend* getLegend() { return myLegend; } -// gets margins size - void getMargins(int& leftMargin, - int& rightMargin, - int& topMargin, - int& bottomMargin); - -/* ================== DATA HANDLING =========================== */ -// inserts item into list - void insertItem(GraphItem* item); -// removes item from list - void removeItem(const int index); -// clears data list - void clear(); -// gets number of items - int getNbItems() { return myItems.count(); } -// gets item by index, returns NULL if index is out of range - GraphItem* getItem(const int index); -// returns index of item in data list - int findItem(GraphItem* item); -// sets/unsets items to be sorted by horizontal coordinate - void setSorted(bool sorted); -// gets full data range - void getRange(double& minX, double& minY, - double& maxX, double& maxY); -// gets current data range - void getCurrentRange(double& minX, double& minY, - double& maxX, double& maxY); -// returns number of colors provided - virtual int getNbColors(); -// returns number of markers provided - virtual int getNbMarkers(); -// returns number of type lines provided - virtual int getNbTypeLines(); -// gets marker size (default is 9 pixels) - int getMarkerSize() { return myMarkerSize; } -// sets marker size (for good look it should be odd) - void setMarkerSize(const int size); -// gets color by index - virtual QColor getColor(const int color); -// gets line - virtual Qt::PenStyle getLine(const int line); -// returns true if colors seem to be the same (difference is less than gap) - static bool isSameColors(const QColor color1, - const QColor color2, - const int gap = 10); - -protected: -/* ================== VIEW OPERATIONS HANDLING ================ */ -// starts/finishes view operation - void startOperation (ViewOperation theOp); -// called on view operation starting - virtual void onStartOperation (); -// called on view operation finishing - virtual void onFinishOperation (); -// called on view operation running - virtual void onOperation (QPoint mousePos); -// called on mouse moving action (e.g. for highlighting item) - virtual void onMouseMove (QPoint mousePos); -// gets sensibility area size - int getSensibilitySize() const { return mySensibilitySize; } -// sets sensibility area size - void setSensibilitySize(const int size); -// handles tooltips for the view - QRect tip(const QPoint& point, QString& tipText); - -/* ================== EVENTS HANDLING ========================= */ -// MousePress event handler - void mousePressEvent (QMouseEvent* e); -// MouseMove event handler - void mouseMoveEvent (QMouseEvent* e); -// MouseRelease event handler - void mouseReleaseEvent (QMouseEvent* e); -// MouseDoubleClick event handler - void mouseDoubleClickEvent (QMouseEvent *e); -// KeyPress event handler - void keyPressEvent (QKeyEvent *e); -// KeyRelease event handler - void keyReleaseEvent (QKeyEvent *e); -// Resize event handler - void resizeEvent (QResizeEvent* e); -// Paint event handler - void paintEvent (QPaintEvent* e); -// global event handler - bool event (QEvent* e); - -/* ================== DRAWING FUNCTIONS ======================= */ -// gets graph painting area - virtual QRect getGraphRect (); -// draws grid - virtual void drawGrid (QPainter* painter); -// draws border (it is drawn when grid is not) - virtual void drawBorder (QPainter* painter); -// draws axes - virtual void drawAxes (QPainter* painter); -// draws tick marks - virtual void drawTickMarks(QPainter* painter); -// draws axes titles - virtual void drawAxesTitle(QPainter* painter); -// draws graph title - virtual void drawTitle(QPainter* painter); -// draws item - virtual void drawItem (QPainter* painter, GraphItem* item); -// draws marker at position - virtual void drawMarker(QPainter* painter, - const QPoint point, - const int marker, - const QColor& color); -// gets new unique marker for item if possible - virtual void getNextMarker(int& typeMarker, int& color, int& typeLine); -// checks if marker belongs to some entity - bool existMarker(const int typeMarker, - const int color, - const int typeLine); - -private: -// returns true if line [x1,y1] - [x2,y2] intersect rectangle - static bool intersects(QRect rect, long x1, long y1, long x2, long y2); -// calculates points for grid and/or tick marks - void getTickPoints(IntList& xList, IntList& yList); - -private: -// enable view operations flags - bool myEnableGlobal; - bool myEnableRect; - bool myEnablePan; - bool myEnablePanX; - bool myEnablePanY; - bool myEnableZoom; - bool myEnableZoomX; - bool myEnableZoomY; -// current view operation - ViewOperation myOperation; -// current view operation - ViewOperation myForcedOp; -// sensibility size for rect selection operation - int mySensibilitySize; -// view operation points (second is used for rubber rectangle) - QPoint myPoint; - QPoint myOtherPoint; -// view operations key-mouse combinations - OperationButton myRectKey; - OperationButton myPanKey; - OperationButton myPanXKey; - OperationButton myPanYKey; - OperationButton myZoomKey; - OperationButton myZoomXKey; - OperationButton myZoomYKey; -// state cursors - QCursor myDefCursor; - QCursor myRectCursor; - QCursor myPanCursor; - QCursor myPanXCursor; - QCursor myPanYCursor; - QCursor myZoomCursor; - QCursor myZoomXCursor; - QCursor myZoomYCursor; -// axes origin (left-bottom point) - GraphNode myOrigin; -// X axis scale - double myXScale; - double myYScale; -// draw flags - bool myShowAxes; - bool myShowTitle; - bool myShowAxesTitle; - bool myShowTickMarks; - bool myShowGrid; - bool myShowTooltips; - bool myShowMarkers; -// grid mode - GridMode myGridMode; -// fixed grid size - int myGridPStepX; - int myGridPStepY; -// floating grid size - double myGridStepX; - double myGridStepY; -// number of grid intervals - int myGridIntX; - int myGridIntY; -// marker size - int myMarkerSize; -// titles - QString myTitle; - QString myXTitle; - QString myYTitle; -// colors - ColorList myColors; -// line types - LineList myLines; -// data - ItemList myItems; - GraphLegend* myLegend; -// fonts - QFont myTitleFont; - QFont myAxesTitleFont; - QFont myTickMarksFont; -// rubber band - QRubberBand* myRubberBand; - - friend class GraphLegend; -}; - -//================================================================ -// Class : GraphLegend -// Description : Legend widget -//================================================================ -class GRAPH_API GraphLegend : public QWidget { -public: -// constructor - GraphLegend(QWidget* parent, GraphView* graph); - -// updates legend contents - void updateMe(); -// shows/hides legend title - void showTitle(bool show); -// sets legend title - void setTitle(const QString& title); -// gets legend title - QString getTitle() const { return myTitle; } -// returns graph item which is below the point or NULL - GraphItem* itemAt(const QPoint& point); -// gets legend title font - QFont getTitleFont() { return myTitleFont; } -// sets legend title font - void setTitleFont(QFont& font); -// gets item font - QFont getItemFont() { return font(); } -// sets item font - void setItemFont(QFont& font); -// get minimum size - QSize minimumSizeHint() const; - QSize sizeHint() const; - -protected: -// handles tooltips for the view - QRect tip(const QPoint& point, QString& tipText); -// returns rect which contains item's name - QRect textRect(GraphItem* item, QString& tipText); -// draws contents - void paintEvent(QPaintEvent* e); -// global event handler - bool event(QEvent* e); - -private: -// parent graph - GraphView* myGraph; - bool myShowTitle; - QString myTitle; - QFont myTitleFont; -}; - -//================================================================ -// Class : GraphSplitView -// Description : Graph view with a legend in splitted window -//================================================================ -class GRAPH_API GraphSplitView : public QWidget { -public: -// constructor - GraphSplitView(QWidget* parent); - -// returns graph view - GraphView* getGraph() { return myGraph; } -// returns legend view - GraphLegend* getLegend(); -// shows/hides legend view - void showLegend(bool show); -// returns true if legend is being shown - bool isLegendShown(); - -private: -// graph view - GraphView* myGraph; -// splitter window - QSplitter* mySplitter; -}; - -#endif // !defined(_Graph_h) \ No newline at end of file diff --git a/samples/qt/Graphic3dDemo/inc/Handle_Sphere_BasicShape.hxx b/samples/qt/Graphic3dDemo/inc/Handle_Sphere_BasicShape.hxx deleted file mode 100755 index 54ab820336..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Handle_Sphere_BasicShape.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. - -#ifndef _Handle_Sphere_BasicShape_HeaderFile -#define _Handle_Sphere_BasicShape_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_AIS_Shape_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(AIS_Shape); -class Sphere_BasicShape; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(Sphere_BasicShape); - -class Handle(Sphere_BasicShape) : public Handle(AIS_Shape) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(Sphere_BasicShape)():Handle(AIS_Shape)() {} - Handle(Sphere_BasicShape)(const Handle(Sphere_BasicShape)& aHandle) : Handle(AIS_Shape)(aHandle) - { - } - - Handle(Sphere_BasicShape)(const Sphere_BasicShape* anItem) : Handle(AIS_Shape)((AIS_Shape *)anItem) - { - } - - Handle(Sphere_BasicShape)& operator=(const Handle(Sphere_BasicShape)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(Sphere_BasicShape)& operator=(const Sphere_BasicShape* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - Sphere_BasicShape* operator->() - { - return (Sphere_BasicShape *)ControlAccess(); - } - - Sphere_BasicShape* operator->() const - { - return (Sphere_BasicShape *)ControlAccess(); - } - - Standard_EXPORT ~Handle(Sphere_BasicShape)(); - - Standard_EXPORT static const Handle(Sphere_BasicShape) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/samples/qt/Graphic3dDemo/inc/Handle_Sphere_Sphere.hxx b/samples/qt/Graphic3dDemo/inc/Handle_Sphere_Sphere.hxx deleted file mode 100755 index 5d8a8aa2b3..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Handle_Sphere_Sphere.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. - -#ifndef _Handle_Sphere_Sphere_HeaderFile -#define _Handle_Sphere_Sphere_HeaderFile - -#ifndef _Standard_Macro_HeaderFile -#include -#endif -#ifndef _Standard_HeaderFile -#include -#endif - -#ifndef _Handle_Sphere_BasicShape_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(Sphere_BasicShape); -class Sphere_Sphere; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(Sphere_Sphere); - -class Handle(Sphere_Sphere) : public Handle(Sphere_BasicShape) { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - Handle(Sphere_Sphere)():Handle(Sphere_BasicShape)() {} - Handle(Sphere_Sphere)(const Handle(Sphere_Sphere)& aHandle) : Handle(Sphere_BasicShape)(aHandle) - { - } - - Handle(Sphere_Sphere)(const Sphere_Sphere* anItem) : Handle(Sphere_BasicShape)((Sphere_BasicShape *)anItem) - { - } - - Handle(Sphere_Sphere)& operator=(const Handle(Sphere_Sphere)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(Sphere_Sphere)& operator=(const Sphere_Sphere* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - Sphere_Sphere* operator->() - { - return (Sphere_Sphere *)ControlAccess(); - } - - Sphere_Sphere* operator->() const - { - return (Sphere_Sphere *)ControlAccess(); - } - - Standard_EXPORT ~Handle(Sphere_Sphere)(); - - Standard_EXPORT static const Handle(Sphere_Sphere) DownCast(const Handle(Standard_Transient)& AnObject); -}; -#endif diff --git a/samples/qt/Graphic3dDemo/inc/MDIWindow.h b/samples/qt/Graphic3dDemo/inc/MDIWindow.h deleted file mode 100755 index 3b72778739..0000000000 --- a/samples/qt/Graphic3dDemo/inc/MDIWindow.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef MDIWINDOW_H -#define MDIWINDOW_H - -#include -#include -#include - -#include "ViewOperations.h" - -class Document; -class View; -class GraphSplitView; - -class MDIWindow : public QMainWindow -{ - Q_OBJECT - -friend class Document; - -public: - - enum ResultType - { - DisplayNonOpt, DisplayOpt, UpdateNonOpt, UpdateOpt, Undefined - }; - -public: - MDIWindow( Document* aDocument, QWidget* parent, V3d_TypeOfView ); - ~MDIWindow(); - - Document* getDocument(); - int getDisplayMode(); - void defineMagView(); - Handle_V3d_View& getView(); - void activateAction( ViewOperations::Action action ); - void addResult(ResultType, int, double); - - bool eventFilter(QObject*, QEvent*); - void graphPopup(const QPoint&); - -signals: - void message( const QString&, int ); - void sendCloseView( MDIWindow* theView ); - -public slots: - void closeEvent( QCloseEvent* e ); - void setCursor( const QCursor& ); - void onGraphClear(); - void onGraphFitAll(); - -protected: - void createViewActions(); - void createGraphActions(); - -private: - Document* myDocument; - View* myView; - GraphSplitView* myGraphView; - QMenu* myGraphPopup; - ViewOperations* myOperations; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/ObjectDlg.h b/samples/qt/Graphic3dDemo/inc/ObjectDlg.h deleted file mode 100755 index ce3399300a..0000000000 --- a/samples/qt/Graphic3dDemo/inc/ObjectDlg.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef OBJECTDLG_H -#define OBJECTDLG_H - -#include - -#include -#include -#include - -class QLabel; -class QComboBox; -class QSpinBox; -class ObjectDlg : public QDialog -{ - Q_OBJECT - - enum { SolidEdgeId, DashEdgeId, DotEdgeId, DotDashEdgeId }; - - enum { NoDegId, TinyDegId, WireDegId, MarkerDegId, BBoxDegId }; - -public: - ObjectDlg( QWidget* parent, Handle(V3d_View)&, Handle(AIS_InteractiveContext)& ); - virtual ~ObjectDlg(); - -private slots: - void onOk(); - void onCancel(); - void onHelp(); - void onShowEdges( bool ); - void onDegenerateModel( int ); - void onDegRatio( int ); - void onEdgeStyle( int ); - void onEdgeWidth( int ); - void onAutoApply( bool ); - -protected: - void showEvent ( QShowEvent* ); - -private: - void updateEdgeAspect( bool edgeStyle ); - /* if edgeStyle - true then type of line will be changed; - width of line will be changed otherwise - */ - void updateDegenerationModel(); - -private: - /* ----- common section ----- */ - bool myAutoApply; - Handle_V3d_View myView; - Handle_AIS_InteractiveContext myContext; - /* ----- edge section ----- */ - QLabel* myEdgeStyle; - QLabel* myEdgeWidth; - QComboBox* myEdgeBox; - QSpinBox* myEdgeSpin; - int myCurrentEdgeStyle; - float myCurrentEdgeWidth; - /* ----- degeneration section ----- */ - Aspect_TypeOfDegenerateModel myDegModel; - int myCurrentDegModel; - float myCurrentDegRatio; - QLabel* myDegModelLabel; - QLabel* myDegRatioLabel; - QComboBox* myDegModelBox; - QSpinBox* myDegRatioSpin; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/ShapeDlg.h b/samples/qt/Graphic3dDemo/inc/ShapeDlg.h deleted file mode 100755 index 7417de4482..0000000000 --- a/samples/qt/Graphic3dDemo/inc/ShapeDlg.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef SHAPEDLG_H -#define SHAPEDLG_H - -#include - -#include -#include -#include -//#include -#include - -class QLabel; -class QComboBox; -class QSpinBox; -class QDoubleSpinBox; -class QCheckBox; -class ShapeDlg : public QDialog -{ - Q_OBJECT - - enum { SolidEdgeId, DashEdgeId, DotEdgeId, DotDashEdgeId }; - - enum { NoDegId, TinyDegId, WireDegId, MarkerDegId, BBoxDegId }; - -public: - ShapeDlg( QWidget* parent, Handle(V3d_View)&, Handle(AIS_InteractiveContext)& ); - virtual ~ShapeDlg(); - -private slots: - void onOk(); - void onCancel(); - void onHelp(); - void onRadiusChanged( double ); - void onItemsChanged( int ); - void onPanesChanged( int ); - void onDeflectionChanged( double ); - void onText(); - void onPositionChanged(); -protected: - void closeEvent ( QCloseEvent* ); - void showEvent ( QShowEvent* ); - -private: - void updateSphere(); - -private: - /* ----- common section ----- */ - Handle_V3d_View myView; - Handle_AIS_InteractiveContext myContext; - Handle_Sphere_Sphere myShape; - double myRadius; - double myDeflection; - int myNbPanes; - int myNbItems; - QDoubleSpinBox* myDefSpin; - QSpinBox* myPanesSpin; - QSpinBox* myItemsSpin; - QDoubleSpinBox* myXSpin; - QDoubleSpinBox* myYSpin; - QDoubleSpinBox* myZSpin; - QCheckBox* myVNormal; - QCheckBox* myVColor; - QCheckBox* myVTexel; - QCheckBox* myText; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.hxx b/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.hxx deleted file mode 100755 index c961cb982b..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.hxx +++ /dev/null @@ -1,107 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#ifndef _Sphere_BasicShape_HeaderFile -#define _Sphere_BasicShape_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_Sphere_BasicShape_HeaderFile -#include -#endif - -#include -#include -#include -class TopoDS_Shape; -class gp_Pnt; - - -class Sphere_BasicShape : public AIS_Shape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Sphere_BasicShape(const TopoDS_Shape& aShape,const Standard_Real aDeflection,const Standard_Boolean hasVNormals,const Standard_Boolean hasVColors,const Standard_Boolean hasVTexels); -Standard_EXPORT void SetPosition(const gp_Pnt& aPosition) ; -Standard_EXPORT void SetVNormals(const Standard_Boolean aFlag) ; -Standard_EXPORT void SetVColors(const Standard_Boolean aFlag) ; -Standard_EXPORT void SetVTexels(const Standard_Boolean aFlag) ; -Standard_EXPORT void SetDeflection(const Standard_Real aValue) ; -Standard_EXPORT gp_Pnt Position() const; -Standard_EXPORT Standard_Boolean VNormalsFlag() const; -Standard_EXPORT Standard_Boolean VColorsFlag() const; -Standard_EXPORT Standard_Boolean VTexelsFlag() const; -Standard_EXPORT Standard_Real Deflection() const; -Standard_EXPORT ~Sphere_BasicShape(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& Sphere_BasicShape_Type_(); - Standard_EXPORT const Handle_Standard_Type& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // -Standard_Real myDeflection; -Standard_Boolean myVNormalsFlag; -Standard_Boolean myVColorsFlag; -Standard_Boolean myVTexelsFlag; - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.ixx b/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.ixx deleted file mode 100755 index 0158de1f9a..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.ixx +++ /dev/null @@ -1,77 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -Sphere_BasicShape::~Sphere_BasicShape() {} - - - -Standard_EXPORT Handle_Standard_Type& Sphere_BasicShape_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(AIS_Shape); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(AIS_Shape); - static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_InteractiveObject); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_InteractiveObject); - static Handle_Standard_Type aType3 = STANDARD_TYPE(SelectMgr_SelectableObject); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(SelectMgr_SelectableObject); - static Handle_Standard_Type aType4 = STANDARD_TYPE(PrsMgr_PresentableObject); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(PrsMgr_PresentableObject); - static Handle_Standard_Type aType5 = STANDARD_TYPE(MMgt_TShared); - if ( aType5.IsNull()) aType5 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType6 = STANDARD_TYPE(Standard_Transient); - if ( aType6.IsNull()) aType6 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("Sphere_BasicShape", - sizeof(Sphere_BasicShape), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(Sphere_BasicShape) Handle(Sphere_BasicShape)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(Sphere_BasicShape) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(Sphere_BasicShape))) { - _anOtherObject = Handle(Sphere_BasicShape)((Handle(Sphere_BasicShape)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& Sphere_BasicShape::DynamicType() const -{ - return STANDARD_TYPE(Sphere_BasicShape) ; -} -Standard_Boolean Sphere_BasicShape::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(Sphere_BasicShape) == AType || AIS_Shape::IsKind(AType)); -} -Handle_Sphere_BasicShape::~Handle_Sphere_BasicShape() {} - diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.jxx b/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.jxx deleted file mode 100755 index 3fcb6ec56e..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_BasicShape.jxx +++ /dev/null @@ -1,3 +0,0 @@ -#include -#include -#include diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.hxx b/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.hxx deleted file mode 100755 index 6cdf6bd92a..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.hxx +++ /dev/null @@ -1,107 +0,0 @@ -// File generated by CPPExt (Transient) -// -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#ifndef _Sphere_Sphere_HeaderFile -#define _Sphere_Sphere_HeaderFile - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Handle_Sphere_Sphere_HeaderFile -#include -#endif - -#include -#include -#include -#include -#include -#include -class gp_Pnt; -class PrsMgr_PresentationManager3d; -class Prs3d_Presentation; - - -class Sphere_Sphere : public Sphere_BasicShape { - -public: - - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // -Standard_EXPORT Sphere_Sphere(const gp_Pnt& aPosition,const Standard_Real aRadius,const Standard_Real aDeflection = 1.0,const Standard_Boolean hasVNormals = Standard_True,const Standard_Boolean hasVColors = Standard_False,const Standard_Boolean hasVTexels = Standard_False, const Standard_Boolean hasText = Standard_False, const Standard_Boolean isOptText = Standard_False); -Standard_EXPORT void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ; -Standard_EXPORT void SetRadius(const Standard_Real aValue) ; -Standard_EXPORT Standard_Real Radius() const; -Standard_EXPORT static Standard_Integer NbPanes(const Standard_Real aRadius,const Standard_Real aDeflection) ; -Standard_EXPORT static Standard_Integer NbPanes(const Standard_Integer nbItems) ; -Standard_EXPORT static Standard_Integer NbItems(const Standard_Integer nbPanes) ; -Standard_EXPORT static Standard_Real Deflection(const Standard_Real aRadius,const Standard_Integer nbPanes) ; -Standard_EXPORT ~Sphere_Sphere(); - - - - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& Sphere_Sphere_Type_(); - Standard_EXPORT const Handle_Standard_Type& DynamicType() const; - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; - -protected: - - // Methods PROTECTED - // - - - // Fields PROTECTED - // - - -private: - - // Methods PRIVATE - // - - - // Fields PRIVATE - // -Standard_Real myRadius; -Standard_Boolean myText; -Standard_Boolean myOptText; - - -}; - - - - - -// other Inline functions and methods (like "C++: function call" methods) -// - - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.ixx b/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.ixx deleted file mode 100755 index 6de3be25c0..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.ixx +++ /dev/null @@ -1,79 +0,0 @@ -// File generated by CPPExt (Transient) -// Copyright (C) 1991,1995 by -// -// MATRA DATAVISION, FRANCE -// -// This software is furnished in accordance with the terms and conditions -// of the contract and with the inclusion of the above copyright notice. -// This software or any other copy thereof may not be provided or otherwise -// be made available to any other person. No title to an ownership of the -// software is hereby transferred. -// -// At the termination of the contract, the software and all copies of this -// software must be deleted. -// -#include - -#ifndef _Standard_TypeMismatch_HeaderFile -#include -#endif - -Sphere_Sphere::~Sphere_Sphere() {} - - - -Standard_EXPORT Handle_Standard_Type& Sphere_Sphere_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(Sphere_BasicShape); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(Sphere_BasicShape); - static Handle_Standard_Type aType2 = STANDARD_TYPE(AIS_Shape); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(AIS_Shape); - static Handle_Standard_Type aType3 = STANDARD_TYPE(AIS_InteractiveObject); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(AIS_InteractiveObject); - static Handle_Standard_Type aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); - if ( aType4.IsNull()) aType4 = STANDARD_TYPE(SelectMgr_SelectableObject); - static Handle_Standard_Type aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); - if ( aType5.IsNull()) aType5 = STANDARD_TYPE(PrsMgr_PresentableObject); - static Handle_Standard_Type aType6 = STANDARD_TYPE(MMgt_TShared); - if ( aType6.IsNull()) aType6 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType7 = STANDARD_TYPE(Standard_Transient); - if ( aType7.IsNull()) aType7 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,aType5,aType6,aType7,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("Sphere_Sphere", - sizeof(Sphere_Sphere), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - - -// DownCast method -// allow safe downcasting -// -const Handle(Sphere_Sphere) Handle(Sphere_Sphere)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(Sphere_Sphere) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(Sphere_Sphere))) { - _anOtherObject = Handle(Sphere_Sphere)((Handle(Sphere_Sphere)&)AnObject); - } - } - - return _anOtherObject ; -} -const Handle(Standard_Type)& Sphere_Sphere::DynamicType() const -{ - return STANDARD_TYPE(Sphere_Sphere) ; -} -Standard_Boolean Sphere_Sphere::IsKind(const Handle(Standard_Type)& AType) const -{ - return (STANDARD_TYPE(Sphere_Sphere) == AType || Sphere_BasicShape::IsKind(AType)); -} -Handle_Sphere_Sphere::~Handle_Sphere_Sphere() {} - diff --git a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.jxx b/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.jxx deleted file mode 100755 index 3be04d8dc7..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Sphere_Sphere.jxx +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include -#include -#include diff --git a/samples/qt/Graphic3dDemo/inc/Translate.h b/samples/qt/Graphic3dDemo/inc/Translate.h deleted file mode 100755 index be2b539550..0000000000 --- a/samples/qt/Graphic3dDemo/inc/Translate.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef TRANSLATE_H -#define TRANSLATE_H - -#include -#include -#include -#include -#include -#include "MgtBRep_TriangleMode.hxx" -#include - -class Translate: public QObject -{ - Q_OBJECT -public: - Translate(QObject* parent); - ~Translate(); - - void importBREP( const Handle(AIS_InteractiveContext) ); - - - void importBREP( const Handle(AIS_InteractiveContext), const QString& ); - - bool importBREP( const Handle(AIS_InteractiveContext), const Standard_CString ); - -private : - QString selectFileName( const QString& , bool isImport ) const; - - static Handle(TopTools_HSequenceOfShape) - BuildSequenceFromContext( const Handle(AIS_InteractiveContext)& ); -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/View.h b/samples/qt/Graphic3dDemo/inc/View.h deleted file mode 100755 index c7e2011dbb..0000000000 --- a/samples/qt/Graphic3dDemo/inc/View.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef VIEW_H -#define VIEW_H - -#include - -#include -#include -#include - -#include "MDIWindow.h" -#include "Document.h" -#include "ViewOperations.h" -#include "ViewDlg.h" -#include "ObjectDlg.h" -#include "ShapeDlg.h" - -class QRubberBand; - -class View: public QWidget -{ - Q_OBJECT - enum CurrentAction3d { CurAction3d_Nothing, - CurAction3d_DynamicZooming, - CurAction3d_WindowZooming, - CurAction3d_DynamicPanning, - CurAction3d_GlobalPanning, - CurAction3d_DynamicRotation, - CurAction3d_MagnifyView - }; - -public: - View( Handle(AIS_InteractiveContext), QWidget* parent, MDIWindow* ); - ~View(); - - void setCurrentAction(); - Handle_V3d_View& getView(); - void startAction( ViewOperations::Action ); - -signals: - void selectionChanged(); - void noActiveActions(); - void ViewInitialized(); - -public slots: - void onBackground(); - void paintEvent( QPaintEvent * e); - void resizeEvent( QResizeEvent* e); - -private slots: - void onImportObject(); - void onEditObjectProperties(); - void onCreateShape(); - void onLoadBox(); - void onLoadSphere(); - void onLoadTorus(); - void onLoadLine(); - void onRemoveObject(); - void onWireframeMode(); - void onShadingMode(); - void onDisplayTrihedron(); - void onEraseTrihedron(); - - -protected: - void mousePressEvent ( QMouseEvent* e); - void mouseReleaseEvent ( QMouseEvent* e); - void mouseMoveEvent ( QMouseEvent* e); - void init(); - - -private: - void onLButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point ); - void onRButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point ); - void onLButtonUp( Qt::KeyboardModifiers nFlags, const QPoint point ); - void onRButtonUp( Qt::KeyboardModifiers nFlags, const QPoint point ); - void onMouseMove( Qt::MouseButtons btns, Qt::KeyboardModifiers nFlags, const QPoint point ); - void DragEvent( int x, int y, int TheState ); - void InputEvent( int x, int y ); - void MoveEvent( int x, int y ); - void MultiMoveEvent( int x, int y ); - void MultiDragEvent( int x, int y, int TheState ); - void MultiInputEvent( int x, int y ); - void Popup(); - void DrawRectangle ( int MinX, int MinY, int MaxX, int MaxY, bool Draw ); - -private: - MDIWindow* myMDI; - QRubberBand* myRubberBand; - ObjectDlg* myObjDlg; - ShapeDlg* myShapeDlg; - Standard_Integer myFirst; - Handle_V3d_View myView; - Handle_AIS_InteractiveContext myContext; - Handle_AIS_Trihedron myTrihedron; - CurrentAction3d myCurrentMode; - Standard_Integer myXmin; - Standard_Integer myYmin; - Standard_Integer myXmax; - Standard_Integer myYmax; - Quantity_Factor myCurZoom; - Standard_Boolean myComputedModeIsOn; - Standard_Integer myCycleCounter; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/ViewDlg.h b/samples/qt/Graphic3dDemo/inc/ViewDlg.h deleted file mode 100755 index d9f5d8e418..0000000000 --- a/samples/qt/Graphic3dDemo/inc/ViewDlg.h +++ /dev/null @@ -1,50 +0,0 @@ -// ViewDlg.h: interface for the ViewDlg class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_VIEWDLG_H__624EA574_FAC0_11D5_A986_0001021E946C__INCLUDED_) -#define AFX_VIEWDLG_H__624EA574_FAC0_11D5_A986_0001021E946C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include - -#include - -class QCheckBox; -class ViewDlg : public QDialog -{ - Q_OBJECT - -public: - ViewDlg(QWidget* parent/*, Handle(V3d_View)& view*/); - virtual ~ViewDlg(); -public slots: - void Update(); -protected: - void showEvent ( QShowEvent* ); - -private slots: - void onOk(); - void onCancel(); - void onHelp(); - void onZBuffer( bool ); - void onAnimation( bool ); - void onDegeneration( bool ); - void onAutoApply( bool ); - void onApplyAllViews( bool ); - -private: - Standard_Boolean myAutoApply; - Standard_Boolean myApplyAllViews; -// Handle_V3d_View myView; - QCheckBox* myAnimBox; - QCheckBox* myDegBox; - QCheckBox* myZBufferBox; - Standard_Boolean myIsAnim; - Standard_Boolean myIsDeg; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/ViewOperations.h b/samples/qt/Graphic3dDemo/inc/ViewOperations.h deleted file mode 100755 index 3adbbbd353..0000000000 --- a/samples/qt/Graphic3dDemo/inc/ViewOperations.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef VIEWOPERATIONS_H -#define VIEWOPERATIONS_H - -#include -#include -#include - -#include - -class ViewOperations : public QObject -{ - Q_OBJECT - -public: - enum ViewActions { /*MagViewId, AxoViewId, PerViewId,*/ ToolWireframeId, ToolShadingId }; - - enum Action { ViewFitAllId, ViewFitAreaId, ViewZoomId, ViewPanId, - ViewGlobalPanId, ViewFrontId, ViewBackId, - ViewTopId, ViewBottomId, ViewLeftId, ViewRightId,ViewAxoId, - ViewRotationId, ViewResetId }; - - ViewOperations( QObject * parent=0 ) ; - ViewOperations( Handle(AIS_InteractiveContext) theContext, QObject * parent=0 ) ; - ~ViewOperations(); - - QList getViewActions(); - QList getToolActions(); - void initActions(); - int getDisplayMode(); - -signals: - void setCursor( const QCursor& ); - -private slots: - void onActionActivated(); - -public slots: - void onWireframe(); - void onShading(); - void onToolAction(); - void updateToggled( bool ); - void onNoActiveActions(); - -private: - void initCursors(); - void initViewActions(); - void initToolActions(); - -private: - Handle_AIS_InteractiveContext myContext; - QList myViewActions; - QList myToolActions; -}; - -#endif diff --git a/samples/qt/Graphic3dDemo/inc/global.h b/samples/qt/Graphic3dDemo/inc/global.h deleted file mode 100755 index 40261bac16..0000000000 --- a/samples/qt/Graphic3dDemo/inc/global.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef GLOBAL_H -#define GLOBAL_H - -#include -#include - -#if defined WNT -#ifdef _DEBUG -#include -#define verify(a) assert(a) -#else -#define verify(a) a -#endif -#else -#define verify(a) a; -#endif - -#ifndef WNT -#define true TRUE -#define false FALSE -#endif - -#endif diff --git a/samples/qt/Graphic3dDemo/res/Sample_icons.ts b/samples/qt/Graphic3dDemo/res/Sample_icons.ts deleted file mode 100755 index 22b7091b4f..0000000000 --- a/samples/qt/Graphic3dDemo/res/Sample_icons.ts +++ /dev/null @@ -1,127 +0,0 @@ - - - - Application - - ICON_AUTO_TEST - ../../res/auto.png - - - ICON_CASCADE - ../../res/cascade.png - - - ICON_CLOSE - ../../res/close.png - - - ICON_HELP - ../../res/help.png - - - ICON_NEW - ../../res/new.png - - - ICON_OPTIM - ../../res/optim.png - - - ICON_STOP - ../../res/stop.png - - - ICON_TILE - ../../res/tile.png - - - - Document - - ICON_DOC - ../../res/document.png - - - - QObject - - ICON_SAMPLE - ../../res/lamp.png - - - - ViewOperations - - ICON_CURSOR_ROTATE - ../../res/cursor_rotate.png - - - ICON_CURSOR_ZOOM - ../../res/cursor_zoom.png - - - ICON_TOOL_SHAD - ../../res/tool_shading.png - - - ICON_TOOL_WIRE - ../../res/tool_wireframe.png - - - ICON_VIEW_AXO - ../../res/view_axo.png - - - ICON_VIEW_BACK - ../../res/view_back.png - - - ICON_VIEW_BOTTOM - ../../res/view_bottom.png - - - ICON_VIEW_FITALL - ../../res/view_fitall.png - - - ICON_VIEW_FITAREA - ../../res/view_fitarea.png - - - ICON_VIEW_FRONT - ../../res/view_front.png - - - ICON_VIEW_GLOBALPAN - ../../res/view_glpan.png - - - ICON_VIEW_LEFT - ../../res/view_left.png - - - ICON_VIEW_PAN - ../../res/view_pan.png - - - ICON_VIEW_RESET - ../../res/view_reset.png - - - ICON_VIEW_RIGHT - ../../res/view_right.png - - - ICON_VIEW_ROTATION - ../../res/view_rotate.png - - - ICON_VIEW_TOP - ../../res/view_top.png - - - ICON_VIEW_ZOOM - ../../res/view_zoom.png - - - diff --git a/samples/qt/Graphic3dDemo/res/Sample_msg.ts b/samples/qt/Graphic3dDemo/res/Sample_msg.ts deleted file mode 100755 index 66f509a5e2..0000000000 --- a/samples/qt/Graphic3dDemo/res/Sample_msg.ts +++ /dev/null @@ -1,589 +0,0 @@ - - - - @default - - BTN_APPLYALLVIEWS - Apply on all views - - - BTN_AUTOAPPLY - Apply immediately - - - BTN_CANCEL - Cancel - - - BTN_DEGENERATION - Enable degeneration - - - BTN_HELP - Help - - - BTN_OK - Ok - - - BTN_ZBUFFER - Enable ZBuffer - - - INF_APP_EXPORT - Export file - - - INF_APP_IMPORT - Import file - - - INF_DATA_ERROR - Incorrect Data. - - - INF_FACET_ERROR - At least one shape doesn't contain facetes. - - - INF_NOTHING_ERROR - Nothing to transfer. - - - INF_NULL_SHAPE - No objects found to be saved. - - - INF_TRANSLATE_ERROR - The translation is not done. - - - INF_WRITING_ERROR - Writing has failed. - - - MEN_DLG_DEFERRED - deferred - - - MEN_DLG_DMODE - Activate display mode - - - MEN_DLG_IMMEDIATE - immediate - - - TIT_ERROR - Error - - - - Application - - INF_ABOUT - New OpenGL functionality testings. - - - INF_READY - Ready - - - MEN_ABOUT - &About - - - MEN_CASCADE - &Cascade - - - MEN_CLOSE - &Close - - - MEN_EXPORT_BREP - &Brep ... - - - MEN_EXPORT_STL - &Stl ... - - - MEN_FILE - &File - - - MEN_FILE_EXPORT - &Export - - - MEN_FILE_IMPORT - &Import - - - MEN_HELP - &Help - - - MEN_IMPORT_BREP - &Brep ... - - - MEN_IMPORT_STL - Stl ... - - - MEN_NEW - &New 3D Viewer - - - MEN_OPTIM - Turn on/off graphic optimization - - - MEN_QUIT - &Quit - - - MEN_STATUS_BAR - &Statusbar - - - MEN_TILE - &Tile - - - MEN_TOOLS - &Tools - - - MEN_TOOL_BAR - &Toolbar - - - MEN_VIEW - &View - - - MEN_WINDOWS - &Window - - - MES_DISPLAY - Display - - - MES_UPDATE - Update - - - TBR_ABOUT - About - - - TBR_AUTO_TEST - Start automatic testing ... - - - TBR_CLOSE - Close - - - TBR_EXPORT_BREP - Brep ... - - - TBR_EXPORT_STL - Stl ... - - - TBR_FILE_EXPORT - Export - - - TBR_FILE_IMPORT - Import - - - TBR_IMPORT_BREP - Brep ... - - - TBR_NEW - New 3D Viewer - - - TBR_OPTIM - Turn on/off graphic optimization - - - TBR_QUIT - Quit - - - TBR_STATUS_BAR - Statusbar - - - TBR_STOP - Stop automatic testing - - - TBR_TOOL_BAR - Toolbar - - - TIT_ABOUT - About... - - - - AutoTestDlg - - BTN_START - Start - - - DLG_AUTO_TEST - Automatic performance testing - - - LAB_ITEMS - elements - - - LAB_START - Start with sphere containing - - - LAB_STEP - Step - - - LAB_STOP - Stop at - - - MEN_BTN_TEXT - Test Text Performance - - - - MDIWindow - - LAB_SECONDS - Time, sec. - - - LAB_TRIANGLES - Number of Triangles - - - LEG_NONOPT_DISPLAY - Non-optimized Display - - - LEG_NONOPT_UPDATE - Non-optimized Update - - - LEG_OPT_DISPLAY - Optimized Display - - - LEG_OPT_UPDATE - Optimized Update - - - MEN_GRAPH_CLEAR - Clear - - - MEN_GRAPH_FIT_ALL - Fit All - - - TBR_GRAPH_CLEAR - Clear - - - TBR_GRAPH_FIT_ALL - Fit All - - - - ObjectDlg - - BTN_SHOWEDGES - Show edges - - - MEN_DLG_BBOXDEGENERATION - Degenerate to bounding box - - - MEN_DLG_DEGMODEL - Degenerate model - - - MEN_DLG_DEGRATIO - Degenerate ratio - - - MEN_DLG_EDGEDASH - Dash style - - - MEN_DLG_EDGEDOT - Dot style - - - MEN_DLG_EDGEDOTDASH - DotDash style - - - MEN_DLG_EDGESOLID - Solid - - - MEN_DLG_EDGESTYLE - Edge style - - - MEN_DLG_EDGEWIDTH - Edge width - - - MEN_DLG_MARKERDEGENERATION - Degenerate to markers - - - MEN_DLG_NODEGENERATION - No degeneration - - - MEN_DLG_TINYDEGENERATION - Degenerate tiny - - - MEN_DLG_WIREDEGENERATION - Degenerate to wireframe - - - TITLE_OBJECT_DLG - Edit object properties - - - - QObject - - TIT_SAMPLE - Visualization Performance Meter - - - - ShapeDlg - - MEN_BTN_TEXT - Display Text - - - MEN_BTN_VCOLOR - Vertex colors - - - MEN_BTN_VNORMAL - Vertex normals - - - MEN_BTN_VTEXEL - Vertex texels - - - MEN_DLG_DEFLECTION - Chordial deflection - - - MEN_DLG_ITEMS - Nb items - - - MEN_DLG_PANES - Nb panes - - - MEN_DLG_RADIUS - radius - - - MEN_DLG_X - X - - - MEN_DLG_Y - Y - - - MEN_DLG_Z - Z - - - TITLE_SHAPE_DLG - Create sphere - - - - View - - MEN_POP_BOX - Box - - - MEN_POP_CREATESHAPE - Create shape ... - - - MEN_POP_DISPLAYMODE - Display mode - - - MEN_POP_DISPLAYTRIHEDRON - Display trihedron - - - MEN_POP_ERASETRIHEDRON - Erase trihedron - - - MEN_POP_IMPORT - Import object ... - - - MEN_POP_LINE - Line - - - MEN_POP_LOADOBJECT - Load object - - - MEN_POP_OBJPROP - Edit object properties ... - - - MEN_POP_REMOVEOBJECT - Remove object - - - MEN_POP_SHADING - Shading - - - MEN_POP_SPHERE - Sphere - - - MEN_POP_TORUS - Torus - - - MEN_POP_VIEWPROP - Edit view properties ... - - - MEN_POP_WIREFRAME - Wireframe - - - - ViewDlg - - BTN_ANIMATION - Enable view animation - - - TITLE_VIEW_DLG - Edit view properties - - - - ViewOperations - - TBR_AXO - Axo - - - TBR_BACK - Back - - - TBR_BOTTOM - Bottom - - - TBR_FITALL - FitAll - - - TBR_FITAREA - Zoom Window - - - TBR_FRONT - Front - - - TBR_GLOBALPAN - Global Panning - - - TBR_LEFT - Left - - - TBR_PAN - Dynamic Panning - - - TBR_RESET - Reset - - - TBR_RIGHT - Right - - - TBR_ROTATION - Dynamic Rotation - - - TBR_TOOL_AXOVIEW - Axonometric view - - - TBR_TOOL_MAGVIEW - Magnify view - - - TBR_TOOL_PERVIEW - Perspective view - - - TBR_TOOL_SHAD - Shading - - - TBR_TOOL_WIRE - Wireframe - - - TBR_TOP - Top - - - TBR_ZOOM - Dynamic Zooming - - - diff --git a/samples/qt/Graphic3dDemo/res/auto.png b/samples/qt/Graphic3dDemo/res/auto.png deleted file mode 100755 index a401e7a62f6ded19cfb2f32b227c355f2ef14bd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1151 zcmd^7F^iUG5S-(h^T?4)ksxVYFhvj)NgF~&y+aSfA)Y^A!M_kf%86Y9=~716LM$w_ zv|Uq)m91d0y+y7ML$e*3-q?(Xc&Jip#My?wC%ylan;b&?-$)Vu>w|Xy#F?KZ`0> zv5Ql*9MNlNHr1?VH>YWhVrZlsYFNV_&Jasok5evrREx9*vT6|vJ3|Ups6!LNVzU;? zwT_Vu;(4;Zk!#CLDOIUXO?sreUFh68CABn?orse8q*J9Tb!kerCt4<%u4`4RThp>< zF*5UX^QcBWni1B$Fg?5NB711N?96g8Vrh}FCRTJuPuLv$umnmjm|F5!iRE|XQY~{~ zS9WJlS`70xMYCB8mAYl*bu*%tzFBL_s_yD3gB!;q-R(l>dh^eD)f4$v`?74X*#<}d z^SN;6(JNpFKi)q*+a~<||M<~`-(UXy)*4+qIlA%S=RY6j?cGlffBS6j-^&-SfAiPz x>o5BHAA37LUA%PdeDnRYyT4pH|Mu}$w|1@^e*WEucP~!eiId~gqvtpC(SK36WY+)y diff --git a/samples/qt/Graphic3dDemo/res/cascade.png b/samples/qt/Graphic3dDemo/res/cascade.png deleted file mode 100755 index 9cd171538d3bf91cd2f2d4a9c9bff8806cf0da07..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(d_32{Ae-~arKTriH9nmt<-R&!UUhjd$-o|AfbHSH@gbvuNE7UK3u)$`nbw{wZ9^U{E4d?lo_c QCD42ZPgg&ebxsLQ05eNRGXMYp diff --git a/samples/qt/Graphic3dDemo/res/close.png b/samples/qt/Graphic3dDemo/res/close.png deleted file mode 100755 index b7126e002d7aa7ab3a7c9a9265a9f283f1ecfa20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(m|32{Ae-~f>MpMk-+o$V%& z#aI&L7tG-B>_!@hljQC0!qCAg>jC75mAFQf1m~xflqVLYGNfmw85QKED;Vh+=o#9^ z?aKhF@bYwV45^rtoRAQZz`&@=rl@d};fZB~%MKBV8!Qqm2Z9)7c$k=Yboh9Bcz9&^ zc(@NN(ot|a%eZ2eW+U$rp9Y~h!WNPeDv}GT7{z>>C BH68!} diff --git a/samples/qt/Graphic3dDemo/res/cursor_rotate.png b/samples/qt/Graphic3dDemo/res/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 e)|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/samples/qt/Graphic3dDemo/res/document.png b/samples/qt/Graphic3dDemo/res/document.png deleted file mode 100755 index 1ba28fff33f14e913f8c3fd3f8b84c81b2ac73ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ipS0LR0#tmSq0my4;IB?)V zLqo%Vp!k1=|6mG816e@eFRbPX6tD4gaSW-Lvvr~^-vI@V)|)bWv&`MjUp%S3Npg93 zj`F`NX0cvPE&g))fr|`nDtR7GQ+R(Ou>USY(wUuC-YFVdQ&MBb@03{S$Q~&?~ diff --git a/samples/qt/Graphic3dDemo/res/help.png b/samples/qt/Graphic3dDemo/res/help.png deleted file mode 100755 index e57336285ea67f393322fd6f19a64d9d1de42e53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(m|32{Ae;K2X?Kn}y={c$Bg zim@cfFPOpM*^M+1C&}C0g(;1@2Bci9#5JNMI6tkVJh3R1Aw4tAs30$0!AQ?Q&(Jn* zUj|TxkEe@cNX4AwgoJ(PcjV()C>w#3=B*S3``o9LZ`&mG989ZJ6T-G@yGywpz CnKtYI diff --git a/samples/qt/Graphic3dDemo/res/lamp.png b/samples/qt/Graphic3dDemo/res/lamp.png deleted file mode 100755 index a5a6775c33f5655a31ef8152b0fa94fcaa73abf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1355 zcmd^7i%XMH6hGglY)YE@mdni4rBLY*sVE7}O{Z?9Q&P-u!OCnICac6xjOt62ED8#G zTV`Zg2|ehcV$dp*UZzAy#gd9_84Ol4A0@4Gt{Oq~7j)pL)q+D}fNWcF8TBSX#DVWbcMABR%wvq6 zOe?HhV$RPqnX_{B%gwoKHrYyx&0C7MLMe)I8OC&Yiaz8gt9A+#DIszqR^lKJXN!gf zdPCEk%tJX`YNz1#Qvgeh$Seqj{!0-t;V7pgQ$0lrr$BvDEr;CzDwvB_oFRhL;;~vQ zt8s%S7-X=Q178M%`5VuK#w;tlE3po7iW0tj7{MBq5RF#SiErxA;I9Q{KpK;zi04j$tPAP#rd;Vs?mU!8tK9N|$Dx_y|RY@hW(Jp^Ii z6AG6Q8^jqTsEgQBIj02eoM4Q`!Ar!~Eo%{MXrn#@3!TC^Ha@dRj6a>d1gJy&`dl~b zS&qLNf*9=-G0l~7pa^mrHc|!NIp{+)xtkBW#&@&7E|vM{H*U949px)bxwNyi_5Uk* zYOD`&RNswyU0&r$*P*-oy?D9)Xj$!`cV|IlR`YAU>+XzG1L0Nii3M_n$M{YX_x6dn z);3?F4bQbNmF=sw=%BYr?Y+5Y8dtt3p~3IQG3mMHn%K1A*+2KE?CWj&tlqJ?WdCr? zeAliAZyNLakKB>uuh#Ww1}>L8c^vGoRk|%xyOoAbRmtrax_VPpZcWPZ1JCalT&r4M z-EtwdpbW2l$bb}#O0PmqO1O?{N1)#yf4VfS~p9CTG=r+0j)KWl~4LFX61<28v_ zxCS4M(6Oyowk1n_>S6`g(mm(apj6wQ)aq#MpLI2<;A`iqkJiGSgWUp`9O&TGNzus~ RS6?!1j4{omzno&J{srsJK~Vqz diff --git a/samples/qt/Graphic3dDemo/res/new.png b/samples/qt/Graphic3dDemo/res/new.png deleted file mode 100755 index 953757a62f594c7591c7cdcfe8e51cdde41bfa45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!93?!50ihlx9oB=)|t_Kbr05bpo|KGb%L=DJd zED7=pW^j0RBMrzAD{+k|3C>R|DNig)Wk}CVGb+eSS1{5u&@;4++m``U!IJLjmJXyP ze>`8)3#3&%T^vIy<|HRDFdn-gps+DZvm@deLlP@PXQ*(8l9MyD!~+I~_)t;*^HWte Q0M#>iy85}Sb4q9e0N}kbVE_OC diff --git a/samples/qt/Graphic3dDemo/res/optim.png b/samples/qt/Graphic3dDemo/res/optim.png deleted file mode 100755 index c469b931823262b4db779a7a9f301c87d49e73ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1216 zcmd^7-%Ha`6hG6=4NJ@K*G&_&Js8fgq4>~9k*{tthq{IngqktaMPjx!tt%M#Eh)@` zGO~IQAFPLv5QPfOkl{lJl@Fn?2crzaLD;62x)SW1JH@B|f)1Q}ethmZ_x!lG9Cm9` zVn!kWB-tt~H7E}fYvS=V96R6yhzCbiZ8@4UXPFBbEtzN=3H{p;6DUzbTFs3x1p;%c z0*rsx!PK`>c!T=WH33Gq1+Yx4G1KfCqq~Gpu9zY8MF;6y0-VD*@@X`eG@Dr>P#(gn zP?8To;x?L`2;Vv^f|8USqBu9cbpbSx0ebGGobEOW=He>gq|bAadW%D30q;pa%0P*_ zfH~4vPD9-Z7xVgCTvmUB?|gG(VUxwv>UH@&ZQ%8_H@6zkw)%KnZ|4%@$??!5Q?BBl z0)!hk*n8CTIT(9~-ngt^Vp)k(ar|M#j95e7#3`*2bqg}pGo8A`s86b;KLU^fI`jez zB8V<9bvE)EgSlFGl%z0G4B)-|BU%V#YRQ7&NIi659RMO6THR#XsLA_9ZsP$C!m#0v zUjoeKMVUJo<+~_Gd#q}mRj9;&&%m`egV;VO<6f;)W4ATLiqgvYzNla7#k^w&HiX^w zc^@hs4N$T!KqOm>6H%BXPeaplg$O>Z$AowR@+QVnZX(0+S}p_2I!HxLk3bg6Gbnp7 zX4nwHy@)fUQkL27-<CY0yetJy*pUxZI!PhuSugy|g+c8jow=y{(Y07La_w@9i&#&BF&GmPFOF2Vb*9!Z# zV0PiYv)?1+8K3o;s>dby_F}MLSRVGLspm&auJ|*J#V?X`tnaF&hciQUO6dK#IQgWq rC?WdE8*dM*zP5yp4(^k~FT+vw_}he@s}CNV@oBJ?+btty?(2U6a@7kN diff --git a/samples/qt/Graphic3dDemo/res/stop.png b/samples/qt/Graphic3dDemo/res/stop.png deleted file mode 100755 index 778955b77a027242683dfc0d581affb885a74db0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 202 zcmV;*05$)KP)W#`+tUG0qT34{@cJF-B6}E9O4!fK7DEmDgI?3y^=0-XH>)!~g&Q07*qoM6N<$ Ef+^}yBme*a diff --git a/samples/qt/Graphic3dDemo/res/tile.png b/samples/qt/Graphic3dDemo/res/tile.png deleted file mode 100755 index b3e6d7b5a35ed83898f33331dca80c2a0adb308b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(d_32{Ae-~akWODu7srr_ zTgeFv1Pqdd|NNi-&_3*F&yB0XOJ`1yDdgI)B2nos>xxS{H~w_$^IUiuae_}LCQd<= vXAh&!6g3sGoLPmeO1?ruM?GggI>W+{_ssZDSy1dPpur5Du6{1-oD!M5E{-7; zx9(0p$k$@P!CIO2|Nr#k&R4xeSIpkKM#VR4gL3eNH@XM6)v*~fryZEjIm7RKk^IM< zLMQGva_w0%EB?r&Cn0wt(*nXQnikit7ZCEzSlv7|({jd@ki>dMW6$F+wygE~y3pys ziyMye=PZ@9_1ahcetTH1{3k>9qQ>xA{#}_oj>nxtRd22HJe+fDvSdwE;a`1qW6j^c aBNz+&k}n1OJ0t*|$>8bg=d#Wzp$Pz3tZIb- diff --git a/samples/qt/Graphic3dDemo/res/view_back.png b/samples/qt/Graphic3dDemo/res/view_back.png deleted file mode 100755 index 0798f529387b5f54b8399c6cbd644b77125687a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK7gn7C+hE&W6?YYR?;K1RmeVws@Ic1XZ&cErC7-<7ih3=n&$O8-AbydZPvd1h4VK1=GLcmtkzf;be3Jl Wo1>Y@*B}>Y1B0ilpUXO@geCy{=uV9Q diff --git a/samples/qt/Graphic3dDemo/res/view_bottom.png b/samples/qt/Graphic3dDemo/res/view_bottom.png deleted file mode 100755 index c7cfdc208aa04cd5f0109df2d262083e1b71de62..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK7gn7C+hE&Xn?QP_22;gv;|CC|t!Q-4Vj)(rHd+Bmmx%k`qi+IeD z-PX$H6H&Nc^d3{mM+M_uz3yL^dS~TaGn&aPA8*1PC>Le_LomDNXXT9>-6wu$yyBJO W(-?sKn{O^Pl)S*0|y!!82HV0oYtJyeg`d=T#E!A>Kj7jX5<^IG- zWuF9VJ&8BQ4WU+a-=k0smdMUac*xWgB?+c&Q#}%=uzu8aq Wv#}d9=CuH=VDNPHb6Mw<&;$Ud^G!kk diff --git a/samples/qt/Graphic3dDemo/res/view_fitarea.png b/samples/qt/Graphic3dDemo/res/view_fitarea.png deleted file mode 100755 index f20f5c0554ffdad417e9c95fccd492044ace89bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(d_32{Ae;K2X?3=ItpK!J$? zSG$1}V@Z%-FoVOh8)+a;lDE4HvmlSpCm=_x#5JNMI6tkVJh3R1Aw4tAs30$0!AQ?Q z&(Jn*Uj|S`u&0Y-NX4Awga&42g)k;3H8wUqHieUWIvg`qo0*xLg_)h%*`3*$otfF4 z&ofQ1TDFuYQ9EpHV!(rh3kd-M2@etiE--A|;ke3(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK7M0>h8hE&Y)?Y+p`V8G#W{uX0^xI;;UT4_UF$^V%)8`Sn5cq+Jq zp@l1~sw^j`_to4Oq35mB&KQVrKY8Z9pY!dPr+HnTJ1Z0(rJdsMJpbXK8uODC*PR9K c-3$J~n&8hKB9R!|3bcm7)78&qol`;+0Em)S00000 diff --git a/samples/qt/Graphic3dDemo/res/view_glpan.png b/samples/qt/Graphic3dDemo/res/view_glpan.png deleted file mode 100755 index 02a9c1cb8de8322db45bfbef3204c0ae32a84d92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(d_32{Ae;K2X?3=ItpK!J$? zSG$1}V@Z%-FoVOh8)+a;lDE4HvmlSpCm=_x#5JNMI6tkVJh3R1Aw4tAs30$0!AQ?Q z&(Jn*Uj|TxgQtsQNX4AwgoJ{GganR+2F7rOw337g35<$v6J(f`Su_n=IvPAU#Cs%J tSR0Ob>9VmkvZ*n09Q+W(t;QI_#PDz?>zd8|Iv~d~c)I$ztaD0e0syz^Hqrn9 diff --git a/samples/qt/Graphic3dDemo/res/view_left.png b/samples/qt/Graphic3dDemo/res/view_left.png deleted file mode 100755 index 7d25b6ab2f8b8f778ac779da4db96d5a8d9f5756..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK7gm}6*hE&W6?P=s}FyLW1e}U1fkipS>1+&PRf5tyE1->er|LiHZ z;y{;Yx0;W4{yUvx9tUeDi0HN)&s`XLvSi!D`1rIJ6XmlyZmoKff1`T;x$oZ|vZ?K7 V-?`&Y+ialu44$rjF6*2UngIO(RGR|DNig)Wk}CVGb+eSS1{5u&@;4+ z+m``Uq2cM`7*a7OIpF{^i-bd~Nb&JX|sgW&tgYj0}<9EH3;v S_cH`Pkan1T+sEd~k@tDPaMF snn^>8P{+}&O^zxI9?hI#>?@QQ)XuT#9Aufl8)zDXr>mdKI;Vst02TW;XaE2J diff --git a/samples/qt/Graphic3dDemo/res/view_right.png b/samples/qt/Graphic3dDemo/res/view_right.png deleted file mode 100755 index 5540220cfa7e1f7a8b5258efe3bef0d1a70b2263..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK71bezThE&Y)^>yTGFyP^y&A-8Z#Xbj#d#<1Vo3GuNEOkrZQVY`# z29aKu1Fr5mFF&zOeB9T{BDbmdKI;Vst0DV4DIRF3v diff --git a/samples/qt/Graphic3dDemo/res/view_rotate.png b/samples/qt/Graphic3dDemo/res/view_rotate.png deleted file mode 100755 index 7e5d013b9f5a84d5ac7d0379496e2588f6a5f059..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!9%)r1XI!iqT$l(d_32{Ae;K2X?3=ItpK!J$? zSG$1}V@Z%-FoVOh8)+a;lDE4HvmlSpCm=_x#5JNMI6tkVJh3R1Aw4tAs30$0!AQ?Q z&(Jn*Uj|S`u&0Y-NX4Aw1coNIHdY=v1vY24W)^1lW-(@FcJ}7UjLgZ*9v7M#4>}7j z>2hs6n9SI5@YI0=ER!BZ^E@%q(CB7jwQV@W8RMXLnM;8&giA$2g5k?Mu9nFjw?Iy2 N@O1TaS?83{1OP9;KPmtK diff --git a/samples/qt/Graphic3dDemo/res/view_top.png b/samples/qt/Graphic3dDemo/res/view_top.png deleted file mode 100755 index b788de36fb11bef11761670ac5ceda6892d5e7d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!7%)r1n>(-?sK#ov=Pl)S*0|);9XJ`O&|Nn1j z0MS=oah(NHj3q&S!3+-1Zlr-YN#5=*tUvN!9tU#7N?apKg7ec#$`gxH8PYS;j0*D7 z6^!%@^bBp|_GJK7M0mP5hE&YS^*tzfz<}e>3kF}c6PAweHZ}CWvk$(wZ2u<#Kaqw* zO=d5SIXXNJJ!_lGEFv=@=395$hf}p|ocC{7PrbT)j?VkVM$aAz>n2M+iq9xBK9$$> ahr!_{$FWT{v)h1nFnGH9xvX(-?sKn{O^Pl)S*0|y!!82>SW;nlh^!(-7IGw3; zCi9EJX`97f+%|n0_TaH`^vZV^{HGoZ?fUmb;cjl+TRD>lr*1D4HlM$R)k68Gp)$~9 N22WQ%mvv4FO#sFsO!@!- diff --git a/samples/qt/Graphic3dDemo/src/Application.cxx b/samples/qt/Graphic3dDemo/src/Application.cxx deleted file mode 100755 index 0f5d737430..0000000000 --- a/samples/qt/Graphic3dDemo/src/Application.cxx +++ /dev/null @@ -1,695 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "global.h" -#include "Application.h" -#include "Document.h" -#include "MDIWindow.h" -#include "Translate.h" -#include "ViewOperations.h" // to have access to its enumeration -#include "AutoTestDlg.h" - -//#define OUTPUT_WINDOW - -static Application* stApp; -static OSD_Timer timer; - -Application::Application() : QMainWindow( 0 ) -{ - myNbDocuments = 0; - stApp = this; - myIsDocuments = false; - - // create and define the central widget - QFrame* vBox = new QFrame( this ); - vBox->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken ); - QVBoxLayout* main = new QVBoxLayout( vBox ); - main->setMargin( 0 ); - - myWorkSpace = new QWorkspace( vBox ); - main->addWidget( myWorkSpace ); - setCentralWidget( vBox ); - - createActions(); - createCCActions(); - - statusBar()->showMessage( tr("INF_READY"), 2001 ); - resize( 800, 650 ); - verify( connect( myWorkSpace, SIGNAL( windowActivated( QWidget* ) ), - this, SLOT( onWindowActivated( QWidget* ) ) ) ); -#ifdef OUTPUT_WINDOW - myOutput = new OutputWindow( 0 ); - myOutput->show(); -#else - myOutput = 0; -#endif - myViewDlg = NULL; -} - -Application::~Application() -{ - if (myViewDlg) delete myViewDlg; - if (myOutput) delete myOutput; -} - -void Application::createActions() -{ - QString dir = getResourceDir(); - QPixmap newIcon( dir + tr( "ICON_NEW" ) ), - helpIcon( dir + tr( "ICON_HELP" ) ), - closeIcon( dir + tr( "ICON_CLOSE" ) ), - autoIcon( dir + tr( "ICON_AUTO_TEST" ) ), - optimIcon( dir + tr( "ICON_OPTIM" ) ), - stopIcon( dir + tr( "ICON_STOP" ) ), - tileIcon( dir + tr( "ICON_TILE" ) ), - cascadeIcon( dir + tr( "ICON_CASCADE" ) ); - - // toolbar with standard actions: new, save... - myStdToolBar = new QToolBar( this ); - addToolBar( Qt::TopToolBarArea, myStdToolBar ); - - // menu with all actions - myFilePopup = menuBar()->addMenu( tr( "MEN_FILE" ) ); - - // view menu - QMenu* view = menuBar()->addMenu( tr( "MEN_VIEW" ) ); - - // Tools menu (it is shown or hidden dynamically) - myToolsMenu = new QMenu( tr( "MEN_TOOLS" ), this ); - - // Window menu - myWinMenu = menuBar()->addMenu( tr( "MEN_WINDOWS" ) ); - verify(connect( myWinMenu, SIGNAL( aboutToShow() ), - this, SLOT( updateWindowList() ) )); - - // add a help menu - QMenu* help = menuBar()->addMenu( tr( "MEN_HELP" ) ); - menuBar()->addSeparator(); - - QAction* a = new QAction( newIcon, tr( "MEN_NEW" ), this ); - a->setToolTip( tr( "TBR_NEW" ) ); - a->setShortcut( Qt::CTRL+Qt::Key_N ); - verify( connect( a, SIGNAL( activated() ), this, SLOT( onNewDocument() ) ) ); - myStdActions.insert( FileNewId, a ); - myStdToolBar->addAction( a ); - myFilePopup ->addAction( a ); - - a = new QAction( tr( "MEN_QUIT" ), this ); - a->setShortcut( Qt::CTRL+Qt::Key_Q ); - a->setToolTip( tr( "TBR_QUIT" ) ); - verify( connect( a, SIGNAL( activated() ), qApp, SLOT( closeAllWindows() ) ) ); - myStdActions.insert( FileQuitId, a ); - myFilePopup ->addAction( a ); - - a = new QAction( tr( "MEN_TOOL_BAR" ), this ); - a->setToolTip( tr( "TBR_TOOL_BAR" ) ); - verify( connect( a, SIGNAL( activated() ), this, SLOT( onViewToolBar() ) ) ); - a->setCheckable(true); - a->setChecked( true ); - myStdActions.insert( ViewToolId, a ); - view->addAction( a ); - - a = new QAction( tr("MEN_STATUS_BAR"), this ); - a->setToolTip( tr( "TBR_STATUS_BAR" ) ); - verify( connect( a, SIGNAL( activated() ), this, SLOT( onViewStatusBar() ) ) ); - a->setCheckable(true); - a->setChecked( true ); - myStdActions.insert( ViewStatusId, a ); - view->addAction( a ); - - a = new QAction( helpIcon, tr( "MEN_ABOUT" ), this ); - a->setShortcut( Qt::Key_F1 ); - a->setToolTip( tr( "TBR_ABOUT" ) ); - verify( connect( a, SIGNAL( activated() ) , this, SLOT( onAbout() ) ) ); - myStdActions.insert( HelpAboutId, a ); - myStdToolBar->addAction( a ); - help->addAction( a ); - - myStdToolBar->addSeparator(); - - // Tools menu actions - a = new QAction( optimIcon, tr( "MEN_OPTIM" ), this ); - a->setToolTip( tr( "TBR_OPTIM" ) ); - verify( connect( a, SIGNAL( toggled(bool) ) , this, SLOT( onToggleOptim(bool) ) ) ); - a->setCheckable(true); - a->setChecked(Graphic3d_ArrayOfPrimitives::IsEnable()); - myStdActions.insert( OptimId, a ); - myToolsMenu->addAction( a ); - - a = new QAction( autoIcon, tr( "TBR_AUTO_TEST" ), this ); - a->setToolTip( tr( "TBR_AUTO_TEST" ) ); - verify( connect( a, SIGNAL( activated() ) , this, SLOT( onAutoTest() ) ) ); - myStdActions.insert( AutoTestId, a ); - myToolsMenu->addAction( a ); - - a = new QAction( stopIcon, tr( "TBR_STOP" ), this ); - a->setToolTip( tr( "TBR_STOP" ) ); - verify( connect( a, SIGNAL( activated() ) , this, SLOT( onStop() ) ) ); - myStdActions.insert( StopId, a ); - myToolsMenu->addAction( a ); - - // Window menu action - a = new QAction( cascadeIcon, tr( "MEN_CASCADE" ), this ); - verify( connect( a, SIGNAL( activated() ) , myWorkSpace, SLOT( cascade() ) ) ); - myStdActions.insert( CascadeId, a ); - myWinMenu->addAction( a ); - - a = new QAction( tileIcon, tr( "MEN_TILE" ), this ); - verify( connect( a, SIGNAL( activated() ), myWorkSpace, SLOT( tile() ) ) ); - myStdActions.insert( TileId, a ); - myWinMenu->addAction( a ); - -} - -void Application::createCCActions() -{ - createIEPopups(); -} - -void Application::createIEPopups() -{ - myImportPopup = new QMenu( tr( "MEN_FILE_IMPORT" ), this ); - - QAction* a = new QAction( tr( "MEN_IMPORT_BREP" ), this ); - a->setToolTip( tr( "TBR_IMPORT_BREP" ) ); - verify( connect( a, SIGNAL( activated() ) , SLOT( onTranslate() ) ) ); - myCCActions.insert( FileImportBREPId, a ); - myImportPopup->addAction( a ); -} - -QWorkspace* Application::getWorkspace() -{ - return getApplication()->workspace(); -} - -Application* Application::getApplication() -{ - return stApp; -} - -void Application::updateWindowList() -{ - while ( myWinMenu->actions().count() > 2) - myWinMenu->removeAction(myWinMenu->actions().last()); - - QWidgetList lst = myWorkSpace->windowList(); - if (!lst.isEmpty()) - { - myWinMenu->addSeparator(); - for ( int i = 0; i < int(lst.count()); ++i ) - { - QAction* a = myWinMenu->addAction( lst.at(i)->windowTitle(), - this, SLOT( activateWindow() ) ); - a->setCheckable( true ); - a->setChecked( myWorkSpace->activeWindow() == lst.at(i) ); - } - } - -} - -void Application::activateWindow() -{ - QAction* a = qobject_cast( sender() ); - if ( !a ) return; - int idx = myWinMenu->actions().indexOf( a ) - 3; // tile, cascade and separator - QWidget* w = myWorkSpace->windowList().at( idx ); - if ( w ) { - w->showNormal(); - w->setFocus(); -// w->setActiveWindow(); - } -} - -void Application::updateActions() -{ - int count = myFilePopup->actions().count() - 1; - - int popupCount = menuBar()->actions().count(); - while (myWinMenu->actions().count() > 2) - myWinMenu->removeAction(myWinMenu->actions().last()); - - if( myWorkSpace->windowList().isEmpty() ) - { - QAction* optim = myStdActions.at(OptimId); - QAction* autoTest = myStdActions.at(AutoTestId); - QAction* stop = myStdActions.at(StopId); - - if( myNbDocuments ) { - myFilePopup->insertMenu( myFilePopup->actions().last(), myImportPopup ); - myFilePopup->insertSeparator( myFilePopup->actions().last() ); - - menuBar()->insertMenu( menuBar()->actions().at( popupCount - 3 ), myToolsMenu ); - - if (optim) myStdToolBar->addAction( optim ); - if (autoTest) myStdToolBar->addAction( autoTest ); - if (stop) myStdToolBar->addAction( stop ); - stop->setEnabled(false); - myIsDocuments = true; - } - else { - myFilePopup->actions().removeAt( --count ); - myFilePopup->actions().removeAt( --count ); - myFilePopup->actions().removeAt( --count ); - - menuBar()->actions().removeAt( popupCount - 4 ); - - if (optim) myStdToolBar->removeAction( optim ); - if (autoTest) myStdToolBar->removeAction( autoTest ); - if (stop) myStdToolBar->removeAction( stop ); - myIsDocuments = false; - } - } -} - -Document* Application::onNewDocument() -{ - ++myNbDocuments; - - updateActions(); - - Document* aDoc = new Document( myNbDocuments, this ); - verify( connect( aDoc, SIGNAL( sendCloseDocument( Document* ) ), - SLOT( onCloseDocument( Document* ) ) ) ); - - return aDoc; -} - -void Application::onCloseDocument(Document* theDoc) -{ - --myNbDocuments; - delete theDoc; - updateActions(); -} - -void Application::onTranslate() -{ - const QObject* sentBy = sender(); - typedef void (Translate::*LPFN_IMPORT) - ( const Handle( AIS_InteractiveContext ));//, const QString& ); - - static LPFN_IMPORT lpfnImport[] = { &Translate::importBREP }; - - static QAction* actions[] = { myCCActions.at( FileImportBREPId ) }; - - for ( int i = 0; i < sizeof(actions)/sizeof(QAction*); i++ ) - { - if ( actions[i] == sentBy ) - { - Translate* anTrans = new Translate( 0 ); - MDIWindow* win = myActiveMDI;//(MDIWindow*) myWorkSpace->activeWindow(); - Handle(AIS_InteractiveContext) aContext = win->getDocument()->getContext(); - try - { - /* import */ - (anTrans->*lpfnImport[i])( aContext ); - } - catch ( Standard_Failure ) - { - /* WARNING: an exception raised but we eat it - silently because the shape seems OK - */ - } - delete anTrans; - /* commit transaction */ - win->activateAction( ViewOperations::ViewFitAllId ); - break; - } - } -} - -void Application::importBREP() -{ - Translate* anTrans = new Translate( 0 ); - MDIWindow* win = myActiveMDI;//(MDIWindow*) myWorkSpace->activeWindow(); - Handle(AIS_InteractiveContext) aContext = win->getDocument()->getContext(); - try { - /* import */ - anTrans->importBREP( aContext ); - } - catch ( Standard_Failure ) { - /* WARNING: an exception raised but we eat it - silently because the shape seems OK - */ - } - delete anTrans; - win->activateAction( ViewOperations::ViewFitAllId ); -} - -QString Application::getResourceDir() -{ - static QString resDir( getenv( "CSF_ResourcesDefaults" ) + QString( "/" ) ); - return resDir; -} - -void Application::onViewToolBar() -{ - bool show = myStdActions.at( ViewToolId )->isChecked(); - if ( show == myStdToolBar->isVisible() ) - return; - if ( show ) - myStdToolBar->show(); - else - myStdToolBar->hide(); -} - -void Application::onViewStatusBar() -{ - bool show = myStdActions.at( ViewStatusId )->isChecked(); - if ( show == statusBar()->isVisible() ) - return; - if ( show ) - statusBar()->show(); - else - statusBar()->hide(); -} - -void Application::onAbout() -{ - QMessageBox::information(this,tr("TIT_ABOUT"),tr("INF_ABOUT"), tr("BTN_OK"), - QString::null, QString::null, 0, 0); -} - -void Application::onQuit() -{ -#ifdef aaa - QWidgetList aList = stWs->windowList(); - for(MDIWindow* aWindow = (MDIWindow*) aList.first();aWindow;aWindow = (MDIWindow*) aList.next()) { - aWindow->closeEvent(0); - } - - emit sendQuit(); -#endif -} - -MDIWindow* Application::getActiveMDI() -{ - return myActiveMDI; -} - -void Application::onWindowActivated( QWidget* w ) -{ - if ( w != NULL && w->inherits( "MDIWindow" ) ){ - myActiveMDI = (MDIWindow*)w; - w->setFocus(); - } - else if (myViewDlg) - { - delete myViewDlg; myViewDlg = NULL; - } -} - -void Application::startTimer() -{ - timer.Reset(); - timer.Start(); -} - -void Application::stopTimer( int count, const char* mes, bool addToGraph, int aOpt ) -{ - Standard_Integer m,h; - Standard_Real fps,elaps,cpu; - char title[256]; - const char* message = ( mes == NULL ) ? "" : mes; - - timer.Stop(); - timer.Show( elaps, m, h, cpu ); - elaps += m * 60. + h * 3600.; - fps = Standard_Real( count ) / elaps; - if( fps > 1. ) - sprintf( title, " ====> '%s'. speed is %f frames/second", message, fps ); - else { - if( count > 1 ) { - elaps /= count; cpu /= count; - sprintf( title, " ====> '%s'. average elapsed/cpu time is %f/%f seconds", message, elaps, cpu ); - } - else { - sprintf( title," ====> '%s'. elapsed/cpu time is %f/%f seconds.", message, elaps, cpu ); - } - } - - if (addToGraph) - { - QString qmes(mes); - MDIWindow::ResultType type = MDIWindow::Undefined; - bool isOptOn = false; - if(aOpt >= 0) { - isOptOn |= (aOpt > 0); - } else { - isOptOn = Graphic3d_ArrayOfPrimitives::IsEnable(); - } - if (qmes.contains(tr("MES_DISPLAY"), Qt::CaseInsensitive)) - type = isOptOn ? MDIWindow::DisplayOpt : MDIWindow::DisplayNonOpt; - else if (qmes.contains(tr("MES_UPDATE"), Qt::CaseInsensitive)) - type = isOptOn ? MDIWindow::UpdateOpt : MDIWindow::UpdateNonOpt; - if (type != MDIWindow::Undefined) - { - addResult(type, elaps); - } - } - - QString str( title ); - cout << title << endl; - Application::getApplication()->statusBar()->showMessage( str ); - Application::getApplication()->showMessage( str ); - //printf("%s\n",title); -} - -void Application::showTimer( const char* mes ) -{ - Standard_Integer m,h; - Standard_Real elaps,cpu; - char title[256]; - const char* message = ( mes == NULL) ? "" : mes; - - timer.Show( elaps, m, h, cpu ); - elaps += m * 60. + h * 3600.; - sprintf( title," ====> '%s'. elapsed/cpu time is %f/%f seconds", message, elaps, cpu ); - - QString str( title ); - Application::getApplication()->statusBar()->showMessage( str ); - Application::getApplication()->showMessage( str ); - cout << title << endl; -} - -void Application::showMessage( QString& message ) -{ -#ifdef OUTPUT_WINDOW - myOutput->print( message ); -#endif -} - -void Application::onToggleOptim(bool state) -{ - state ? Graphic3d_ArrayOfPrimitives::Enable() : Graphic3d_ArrayOfPrimitives::Disable(); -} - -void Application::addResult(MDIWindow::ResultType item, double value) -{ - MDIWindow* activeWin = getApplication()->getActiveMDI(); - Handle(AIS_InteractiveContext) activeCtx = activeWin->getDocument()->getContext(); - - // Counting triangles... - int nbTriangles = 0; - AIS_ListOfInteractive displayedObjs; - activeCtx->DisplayedObjects(displayedObjs); - AIS_ListIteratorOfListOfInteractive dispIt(displayedObjs); - for ( ; dispIt.More(); dispIt.Next()) - { - Handle(AIS_InteractiveObject) aisObj = dispIt.Value(); - if (aisObj->IsKind(STANDARD_TYPE(Sphere_Sphere))) - { - Handle(Sphere_Sphere) sphere = Handle(Sphere_Sphere)::DownCast(aisObj); - Standard_Real rad = sphere->Radius(); - Standard_Real defl = sphere->Sphere_BasicShape::Deflection(); - - nbTriangles += Sphere_Sphere::NbItems(Sphere_Sphere::NbPanes(rad, defl)); - } - else if (aisObj->IsKind(STANDARD_TYPE(AIS_Shape))) - { - Handle(AIS_Shape) shape = Handle(AIS_Shape)::DownCast(aisObj); - TopoDS_Shape topoShape = shape->Shape(); - TopExp_Explorer exp(topoShape, TopAbs_FACE); - for ( ; exp.More(); exp.Next()) - { - TopoDS_Face face = TopoDS::Face(exp.Current()); - if (!face.IsNull()) - { - Handle(Poly_Triangulation) triangles = - Handle(BRep_TFace)::DownCast(face.TShape())->Triangulation(); - if (!triangles.IsNull()) - { - nbTriangles += triangles->NbTriangles(); - } - } - } - } - } - activeWin->addResult(item, nbTriangles, value); -} - -QWorkspace* Application::workspace() const -{ - return myWorkSpace; -} - -void Application::keyPressEvent(QKeyEvent* e) -{ - if (e->key() == Qt::Key_Escape) - myEscPressed = true; -} - -void Application::onAutoTest() -{ - AutoTestDlg autoDlg(getApplication()); - if (autoDlg.exec() == QDialog::Accepted) - { - QApplication::setOverrideCursor( Qt::WaitCursor ); - myEscPressed = false; - myStopPressed = false; - QAction* stop = myStdActions.at(StopId); - - stop->setEnabled(true); - - // Define the range for testing - int startItems = autoDlg.getStartNbItems(); - int stopItems = autoDlg.getStopNbItems(); - int step = autoDlg.getStep(); - bool isTe = autoDlg.isText(); - if (stopItems < startItems) stopItems = startItems; - - Standard_Real radius = 100; // default sphere radius - gp_Pnt pos(0, 0, 0); // default sphere center position - - Handle(AIS_InteractiveContext) ctx = getActiveMDI()->getDocument()->getContext(); - // Main loop - for (int currItems = startItems; currItems <= stopItems; currItems += step) - { - for (int useOptim = 0; useOptim < 2; useOptim++) - { - qApp->processEvents(); - if (myEscPressed || myStopPressed) - { - QApplication::restoreOverrideCursor(); - stop->setEnabled(false); - return; - } - - // Toggle optimization - useOptim || isTe ? Graphic3d_ArrayOfPrimitives::Enable() : Graphic3d_ArrayOfPrimitives::Disable(); - - // Remove all old objects - AIS_ListOfInteractive displayedObjs; - ctx->DisplayedObjects(displayedObjs); - AIS_ListIteratorOfListOfInteractive dispIt(displayedObjs); - for ( ; dispIt.More(); dispIt.Next()) - { - Handle(AIS_InteractiveObject) obj = dispIt.Value(); - if (!obj->IsKind(STANDARD_TYPE(AIS_Trihedron))) - ctx->Remove(obj, false); - } - ctx->UpdateCurrentViewer(); - - getActiveMDI()->getView()->SetScale(3.0316); - - // Generate new sphere - Standard_Integer nbPanes = Sphere_Sphere::NbPanes(currItems); - Standard_Real deflection = Sphere_Sphere::Deflection(radius, nbPanes); - Handle(Sphere_Sphere) sphere = new Sphere_Sphere(pos, radius, deflection, - 1/*myVNormalsFlag*/, 0/*myVColorsFlag*/, 0/*myVTexelsFlag*/, isTe, useOptim); - - // Display the sphere - ctx->SetDisplayMode( sphere, getActiveMDI()->getDisplayMode(), false ); - Application::startTimer(); - ctx->Display( sphere, false ); - Application::stopTimer( 0, "Display Sphere::Sphere", true, useOptim); - - qApp->processEvents(); - if (myEscPressed || myStopPressed) - { - QApplication::restoreOverrideCursor(); - stop->setEnabled(false); - return; - } - - // Update the viewer - Application::startTimer(); - getActiveMDI()->getView()->Update(); - Application::stopTimer( 0, "UPDATE", true, useOptim); - } - } - QApplication::restoreOverrideCursor(); - stop->setEnabled(false); - } -} - -/* ------------------ class OutputWindow ----------------- */ -OutputWindow::OutputWindow( QWidget* parent ) : QWidget( parent ), myLineCounter( 0 ) -{ - setWindowTitle( "Output window" ); - resize( 400, 300 ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - myLineEdit = new QTextEdit( this ); - - topLayout->addWidget( myLineEdit ); -} - -OutputWindow::~OutputWindow() -{ -} - -void OutputWindow::print( QString& s ) -{ - myLineEdit->append( QString().setNum( myLineCounter ) + s ); - myLineCounter++; -} - -void Application::InitApp() -{ - onNewDocument(); -} - -void Application::onStop() -{ - myStopPressed = true; -} - -void Application::onEditViewProperties() -{ - if ( !myViewDlg ) { - myViewDlg = new ViewDlg(this); - verify( connect( myWorkSpace, SIGNAL( windowActivated( QWidget* ) ), - myViewDlg, SLOT( Update() ) ) ); - } - myViewDlg->raise(); - myViewDlg->show(); -} - -void Application::updateViewDlg() -{ - if(myViewDlg) myViewDlg->Update(); -} \ No newline at end of file diff --git a/samples/qt/Graphic3dDemo/src/AutoTestDlg.cxx b/samples/qt/Graphic3dDemo/src/AutoTestDlg.cxx deleted file mode 100755 index ac2709169b..0000000000 --- a/samples/qt/Graphic3dDemo/src/AutoTestDlg.cxx +++ /dev/null @@ -1,169 +0,0 @@ -#include -#include -#include - -#include "Application.h" -#include "AutoTestDlg.h" -#include "global.h" - -AutoTestDlg::AutoTestDlg(QWidget* parent) -: QDialog(parent) -{ - setModal( true ); - setWindowTitle(tr("DLG_AUTO_TEST")); - QString dir = Application::getResourceDir(); - QPixmap autoIcon( dir + tr( "ICON_AUTO_TEST" ) ); - setWindowIcon(autoIcon); - - QGridLayout* pMainLayout = new QGridLayout(this); - pMainLayout->setMargin(5); - pMainLayout->setSpacing(5); - - QLabel* lab = new QLabel(tr("LAB_START"), this); - pMainLayout->addWidget(lab, 0, 0); - - lab = new QLabel(tr("LAB_STOP"), this); - pMainLayout->addWidget(lab, 1, 0); - - lab = new QLabel(tr("LAB_STEP"), this); - pMainLayout->addWidget(lab, 2, 0); - - const int MinNbOfItems = 100000; // to see noticable effect - const int MaxNbOfItems = 1000000; // to avoid too long computations - const int ItemsStep = 100000; - const int MinStep = 50000; - const int StepStep = 50000; - - myStartSpin = new QSpinBox(this); - myStartSpin->setMinimum(MinNbOfItems); - myStartSpin->setMaximum(MaxNbOfItems); - myStartSpin->setSingleStep(ItemsStep); - pMainLayout->addWidget(myStartSpin, 0, 1); - verify(connect(myStartSpin, SIGNAL(valueChanged(int)), SLOT(checkStepSpinState()))); - - myStopSpin = new QSpinBox(this); - myStopSpin->setMinimum(MinNbOfItems); - myStopSpin->setMaximum(MaxNbOfItems); - myStartSpin->setSingleStep(ItemsStep); - pMainLayout->addWidget(myStopSpin, 1, 1); - verify(connect(myStopSpin, SIGNAL(valueChanged(int)), SLOT(setStartMaxValue(int)))); - verify(connect(myStopSpin, SIGNAL(valueChanged(int)), SLOT(checkStepSpinState()))); - - const int StopSpinDefaultValue = 2 * myStartSpin -> minimum(); - myStopSpin -> setValue(StopSpinDefaultValue); - myStartSpin -> setMaximum(myStopSpin -> value()); - - myStepSpin = new QSpinBox(this); - myStepSpin->setMinimum(MinStep); - myStepSpin->setMaximum(MaxNbOfItems - MinNbOfItems); - myStepSpin->setSingleStep(StepStep); - pMainLayout->addWidget(myStepSpin, 2, 1); - - lab = new QLabel(tr("LAB_ITEMS"), this); - pMainLayout->addWidget(lab, 0, 2); - - lab = new QLabel(tr("LAB_ITEMS"), this); - pMainLayout->addWidget(lab, 1, 2); - - lab = new QLabel(tr("LAB_ITEMS"), this); - pMainLayout->addWidget(lab, 2, 2); - - QFrame* separator = new QFrame(this); - separator->setFrameStyle(QFrame::HLine | QFrame::Sunken); - pMainLayout->addWidget(separator, 3, 0, 1, 3 ); - - QHBoxLayout* hcbox = new QHBoxLayout(); - hcbox->setSpacing(5); - - myTeCheck = new QCheckBox(tr( "MEN_BTN_TEXT" ), this); - hcbox->addWidget(myTeCheck); - verify(connect(myTeCheck, SIGNAL(clicked()), this, SLOT(onText()))); - - hcbox->addSpacing( 5 ); - - pMainLayout->addLayout(hcbox, 4, 0, 1, 3); - - QHBoxLayout* hbox = new QHBoxLayout(); - hbox->setSpacing(5); - - QPushButton* btn = new QPushButton(tr("BTN_START"), this); -// btn->setDefault(true); - verify(connect(btn, SIGNAL(clicked()), this, SLOT(onStart()))); - btn->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - hbox->addWidget(btn); - btn = new QPushButton(tr("BTN_CANCEL"), this); - verify(connect(btn, SIGNAL(clicked()), this, SLOT(onCancel()))); - btn->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); - hbox->addWidget(btn); - hbox->addSpacing(5); - pMainLayout->addLayout(hbox, 5, 0, 1, 3); -} - -void AutoTestDlg::onStart() -{ - accept(); -} - -void AutoTestDlg::onCancel() -{ - reject(); -} - -void AutoTestDlg::setStartMaxValue(int i) -{ - myStartSpin -> setMaximum(i); - if (myStartSpin -> value() > myStartSpin -> maximum()) - myStartSpin -> setValue(myStartSpin -> maximum()); -} - -void AutoTestDlg::checkStepSpinState() -{ - if (isVisible()) - { - if (myStartSpin -> value() == myStopSpin -> value()) - myStepSpin -> setEnabled(false); - else - myStepSpin -> setEnabled(true); - } -} - -void AutoTestDlg::onText() -{ - int MinNbOfItems, MaxNbOfItems, DefaultStartSpinVal, DefaultStopSpinVal, - ItemsStep, MinStep, StepStep; - - if (myTeCheck -> isChecked()) - { - MinNbOfItems = 1000; // to see noticeable effect - MaxNbOfItems = 100000; // to avoid too long computations - DefaultStartSpinVal = 10000; - DefaultStopSpinVal = 20000; - ItemsStep = 10000; - MinStep = 5000; - StepStep = 5000; - } - else - { - MinNbOfItems = 100000; // to see noticeable effect - MaxNbOfItems = 1000000; // to avoid too long computations - DefaultStartSpinVal = 100000; - DefaultStopSpinVal = 200000; - ItemsStep = 100000; - MinStep = 50000; - StepStep = 50000; - } - - myStartSpin -> setRange(MinNbOfItems, MaxNbOfItems); - myStartSpin -> setSingleStep(ItemsStep); - myStartSpin -> setValue(DefaultStartSpinVal); - - myStopSpin -> setRange(MinNbOfItems, MaxNbOfItems); - myStopSpin -> setSingleStep(ItemsStep); - - myStopSpin -> setValue(DefaultStopSpinVal); - myStartSpin -> setMaximum(myStopSpin -> value()); - - myStepSpin -> setRange(MinStep, MaxNbOfItems - MinNbOfItems); - myStepSpin -> setSingleStep(StepStep); - myStepSpin -> setValue(MinStep); -} \ No newline at end of file diff --git a/samples/qt/Graphic3dDemo/src/Document.cxx b/samples/qt/Graphic3dDemo/src/Document.cxx deleted file mode 100755 index 0a4277987d..0000000000 --- a/samples/qt/Graphic3dDemo/src/Document.cxx +++ /dev/null @@ -1,147 +0,0 @@ -#include - -#ifndef WNT -#include -#else -#include -#endif - -#include - -#include "Application.h" -#include "Document.h" -#include "global.h" - - - -Handle(V3d_Viewer) Document::Viewer( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain, - const Standard_Real ViewSize ) -{ -#ifndef WNT - static Handle(Graphic3d_GraphicDevice) defaultdevice; - - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_GraphicDevice( aDisplay ); - - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, - V3d_XposYnegZpos,Quantity_NOC_MIDNIGHTBLUE, - V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT); -#else - static Handle(Graphic3d_WNTGraphicDevice) defaultdevice; - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_WNTGraphicDevice(); - - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, - V3d_XposYnegZpos,Quantity_NOC_MIDNIGHTBLUE, - V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT); -#endif // WNT -} - -Document::Document( int theIndex, Application* app ) -: QObject( app ) -{ - myIndex = theIndex; - myNbViews = 0; - myApp = app; - - TCollection_ExtendedString a3DName("Visual3D"); - myViewer = Viewer( getenv( "DISPLAY" ), a3DName.ToExtString(), "", 1000.0 ); - myViewer->SetDefaultLights(); - myViewer->SetLightOn(); - myViewer->SetZBufferManagment(false); - myContext = new AIS_InteractiveContext( myViewer ); - - createNewView(); - - myOperations = new ViewOperations( myContext ); -} - -Document::~Document() -{ - qDeleteAll( myViews ); -} - -Application* Document::getApplication() -{ - return myApp; -} - -void Document::createNewView( V3d_TypeOfView type ) -{ - QWorkspace* ws = myApp->getWorkspace(); - - MDIWindow* w = new MDIWindow( this, ws, type ); - myViews.append( w ); - ws->addWindow( w ); - - //connect( w, SIGNAL( message(const QString&, int) ), myApp->statusBar(), SLOT( message(const QString&, int )) ); - verify( connect( w, SIGNAL( sendCloseView( MDIWindow* ) ), - SLOT( onCloseView( MDIWindow* ) ) ) ); - - QString aName; - w->setWindowTitle( aName.sprintf( "3D Viewer_%d:%d", myIndex, ++myNbViews ) ); - - QString dir = Application::getResourceDir(); - w->setWindowIcon( QPixmap( dir + tr( "ICON_DOC" ) ) ); - - // show the very first window in maximized mode - if ( ws->windowList().isEmpty() ) - w->showMaximized(); - else - w->show(); -} - -void Document::createMagView( int xMin, int yMin, int xMax, int yMax ) -{ -#ifdef old - Handle(V3d_View) currentView = - ( (MDIWindow*) myApp->getWorkspace()->activeWindow() )->getView(); - createNewView( false ); - MDIWindow* newView = myViews.last(); - Handle(V3d_View) nView = newView->getView(); - - newView->show(); - nView->FitAll(); - //nView->ZFitAll(); - //nView->Redraw(); - //nView->WindowFitAll( xMin, yMin, xMax, yMax ); - nView->SetMagnify( currentView->Window(), currentView, 10, 10, 100, 100 ); - //nView->SetMagnify( nView->Window(), currentView, xMin, yMin, xMax, yMax ); -#endif -} - -void Document::onCloseView(MDIWindow* theView) -{ - if ( countOfWindow() == 1 ) - emit sendCloseDocument( this ); - else - removeView( theView ); -} - -void Document::removeView(MDIWindow* theView) -{ - myViews.removeAll( theView ); - //delete theView; -} - -int Document::countOfWindow() -{ - return myViews.count(); -} - -Handle(AIS_InteractiveContext)& Document::getContext() -{ - return myContext; -} - -void Document::onWireframe() -{ - myOperations->onWireframe(); -} - -void Document::onShading() -{ - myOperations->onShading(); -} diff --git a/samples/qt/Graphic3dDemo/src/Graph.cpp b/samples/qt/Graphic3dDemo/src/Graph.cpp deleted file mode 100755 index b5274d51e1..0000000000 --- a/samples/qt/Graphic3dDemo/src/Graph.cpp +++ /dev/null @@ -1,3017 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File : Graph.cpp -// Created : 26.03.02 -// Author : Vadim SANDLER -////////////////////////////////////////////////////////////////////// - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -static const char* const zoomCursorImage[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................................", -"................................", -".#######........................", -"..aaaaaaa.......................", -"................................", -".............#####..............", -"...........##.aaaa##............", -"..........#.aa.....a#...........", -".........#.a.........#..........", -".........#a..........#a.........", -"........#.a...........#.........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -".........#...........#.a........", -".........#a..........#a.........", -".........##.........#.a.........", -"........#####.....##.a..........", -".......###aaa#####.aa...........", -"......###aa...aaaaa.......#.....", -".....###aa................#a....", -"....###aa.................#a....", -"...###aa...............#######..", -"....#aa.................aa#aaaa.", -".....a....................#a....", -"..........................#a....", -"...........................a....", -"................................", -"................................", -"................................", -"................................"}; - -static const char* const zoomXCursorImage[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................................", -"................................", -"................................", -"................................", -"................................", -".............#####..............", -"...........##.aaaa##............", -"..........#.aa.....a#...........", -"....a....#.a.........#.....a....", -"...aa....#a..........#a....aa...", -"..a#a...#.a...........#....a#a..", -".a##aa..#a............#a..aa##a.", -"a#####..#a............#a..#####a", -".a##aa..#a............#a..aa##a.", -"..a#a...#a............#a...a#a..", -"...aa....#...........#.a...aa...", -"....a....#a..........#a....a....", -".........##.........#.a.........", -"........#####.....##.a..........", -".......###aaa#####.aa...........", -"......###aa...aaaaa.............", -".....###aa......................", -"....###aa.......................", -"...###aa........................", -"....#aa.........................", -".....a..........................", -"................................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - -static const char* const zoomYCursorImage[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................a...............", -"...............a#a..............", -"..............a###a.............", -".............a#####a............", -"............aaaa#aaaa...........", -"...............a#a..............", -"................................", -"................................", -".............#####..............", -"...........##.aaaa##............", -"..........#.aa.....a#...........", -".........#.a.........#..........", -".........#a..........#a.........", -"........#.a...........#.........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -".........#...........#.a........", -".........#a..........#a.........", -".........##.........#.a.........", -"........#####.....##.a..........", -".......###aaa#####.aa...........", -"......###aa...aaaaa.............", -".....###aa......................", -"....###aa.......................", -"...###aa.......a#a..............", -"....#aa.....aaaa#aaaa...........", -".....a.......a#####a............", -"..............a###a.............", -"...............a#a..............", -"................a..............."}; - -#define SPACING_SIZE 5 // spacing -#define TICK_SIZE 3 // axes tick size -#define ARROW_LENGTH 20 // axis arrow size -#define ARROW_WIDTH 3 // ... -#define MIN_GRID_STEP 20 // minimum grid size in pixels -#define MIN_SENSIBILITY_SIZE 10 // minimum sensibility size -#define MIN(x, y) ( (x) < (y) ? (x) : (y) ) -#define MAX(x, y) ( (x) > (y) ? (x) : (y) ) - -////////////////////////////////////////////////////////////////////// -// GraphView -////////////////////////////////////////////////////////////////////// - -//================================================================ -// Function : GraphView::GraphView -// Purpose : Constructor -//================================================================ -GraphView::GraphView(QWidget* parent) -: QWidget(parent), // WResizeNoErase | WRepaintNoErase - myRubberBand(0) -{ - // reseting legend - myLegend = 0; - // setting default cursors - setOperationCursor(voNone, Qt::ArrowCursor); - setOperationCursor(voZoom, QCursor(QPixmap((const char**)zoomCursorImage))); - setOperationCursor(voZoomX, QCursor(QPixmap((const char**)zoomXCursorImage))); - setOperationCursor(voZoomY, QCursor(QPixmap((const char**)zoomYCursorImage))); - setOperationCursor(voPan, Qt::SizeAllCursor); - setOperationCursor(voPanX, Qt::SizeHorCursor); - setOperationCursor(voPanY, Qt::SizeVerCursor); - setOperationCursor(voRect, Qt::PointingHandCursor); - // setting default mouse-keyboard hot combinations - setOperationButton(voZoom, Qt::LeftButton, Qt::ControlModifier); - setOperationButton(voZoomX, Qt::LeftButton, Qt::AltModifier); - setOperationButton(voZoomY, Qt::RightButton, Qt::AltModifier); - setOperationButton(voPan, Qt::RightButton, Qt::ControlModifier); - setOperationButton(voPanX, Qt::LeftButton , Qt::ShiftModifier); - setOperationButton(voPanY, Qt::RightButton, Qt::ShiftModifier); - setOperationButton(voRect, Qt::LeftButton, Qt::ControlModifier | Qt::ShiftModifier); - // enabling operations globally - setOperationsEnabled(true); - // disable view operations by default - setOperationEnabled(voZoom, false); - setOperationEnabled(voZoomX, false); - setOperationEnabled(voZoomY, false); - setOperationEnabled(voPan, false); - setOperationEnabled(voPanX, false); - setOperationEnabled(voPanY, false); - setOperationEnabled(voRect, false); - // creating colors - myColors.append (Qt::white); - myColors.append (Qt::blue); - myColors.append (Qt::gray); - myColors.append (Qt::darkGreen); - myColors.append (Qt::magenta); - myColors.append (Qt::darkGray); - myColors.append (Qt::red); - myColors.append (Qt::darkBlue); - myColors.append (Qt::darkYellow); - myColors.append (Qt::cyan); - myColors.append (Qt::darkRed); - myColors.append (Qt::darkCyan); - myColors.append (Qt::yellow); - myColors.append (Qt::darkMagenta); - myColors.append (Qt::green); - myColors.append (Qt::black); - // creating line styles - myLines.append (Qt::SolidLine); - myLines.append (Qt::DashLine); - myLines.append (Qt::DotLine); - myLines.append (Qt::DashDotLine); - myLines.append (Qt::DashDotDotLine); - // initializing graph view - myOperation = myForcedOp = voNone; // clearing current operation - myOrigin = GraphNode(0.0, 0.0); // setting origin to (0,0) - setScale(1.0); // setting scale to 1.0 - myShowGrid = true; // enabling grid drawing - myShowAxes = true; // enabling axes drawing - myShowTitle = true; // enabling title drawing - myShowAxesTitle = true; // enabling axes titles drawing - myShowTickMarks = true; // enabling tick marks drawing - myShowTooltips = true; // enabling tooltips - myShowMarkers = true; // enabling markers drawing - setGridStep (100.0, 100.0); // setting default floating grid step - setFixedGridStep(100, 100); // setting default fixed grid step - setGridIntervals(10, 10); // setting default grid intervals - setGridMode(gmFixed); // default grid mode is FIXED - myMarkerSize = 9; // default marker size - setSensibilitySize(MIN_SENSIBILITY_SIZE); // default sensibility size - // starting watching mouse events - setMouseTracking (true); - // setting background color - changeBackgroundColor(0); -} - -//================================================================ -// Function : GraphView::~GraphView -// Purpose : Destructor -//================================================================ -GraphView::~GraphView() { - qDeleteAll( myItems ); -} - -//================================================================ -// Function : GraphView::eventFilter -// Purpose : event filter -//================================================================ -bool GraphView::eventFilter(QObject* object, QEvent* event) { - if ( ( event->type() == QEvent::MouseButtonPress || - event->type() == QEvent::KeyPress ) && - object != this) { - startOperation(voNone); - qApp->removeEventFilter(this); - } - return QWidget::eventFilter(object, event); -} - -//================================================================ -// Function : GraphView::setOperationCursor -// Purpose : sets cursor for certain view operation -//================================================================ -void GraphView::setOperationCursor (const ViewOperation operation, - const QCursor& newCursor) { - switch(operation) { - case voZoom: - myZoomCursor = newCursor; - break; - case voZoomX: - myZoomXCursor = newCursor; - break; - case voZoomY: - myZoomYCursor = newCursor; - break; - case voPan: - myPanCursor = newCursor; - break; - case voPanX: - myPanXCursor = newCursor; - break; - case voPanY: - myPanYCursor = newCursor; - break; - case voRect: - myRectCursor = newCursor; - break; - case voNone: - default: - myDefCursor = newCursor; - break; - } -} - -//================================================================ -// Function : GraphView::getOperationCursor -// Purpose : gets cursor for certain view operation -//================================================================ -QCursor GraphView::getOperationCursor (const ViewOperation operation) const { - switch(operation) { - case voZoom: - return myZoomCursor; - case voZoomX: - return myZoomXCursor; - case voZoomY: - return myZoomYCursor; - case voPan: - return myPanCursor; - case voPanX: - return myPanXCursor; - case voPanY: - return myPanYCursor; - case voRect: - return myRectCursor; - case voNone: - default: - break; - } - return myDefCursor; -} - -//================================================================ -// Function : GraphView::setOperationsEnabled -// Purpose : globally enable/disables operations -//================================================================ -void GraphView::setOperationsEnabled(bool on) { - myEnableGlobal = on; -} - -//================================================================ -// Function : GraphView::setOperationEnabled -// Purpose : enables/disables view operation -//================================================================ -void GraphView::setOperationEnabled(const ViewOperation operation, - bool enable) { - switch(operation) { - case voZoom: - myEnableZoom = enable; - break; - case voZoomX: - myEnableZoomX = enable; - break; - case voZoomY: - myEnableZoomY = enable; - break; - case voPan: - myEnablePan = enable; - break; - case voPanX: - myEnablePanX = enable; - break; - case voPanY: - myEnablePanY = enable; - break; - case voRect: - myEnableRect = enable; - break; - } -} - -//================================================================ -// Function : GraphView::isOperationEnabled -// Purpose : returns 'true' if view operation is enabled -//================================================================ -bool GraphView::isOperationEnabled(const ViewOperation operation) const { - switch(operation) { - case voZoom: - return myEnableZoom; - case voZoomX: - return myEnableZoomX; - case voZoomY: - return myEnableZoomY; - case voPan: - return myEnablePan; - case voPanX: - return myEnablePanX; - case voPanY: - return myEnablePanY; - case voRect: - return myEnableRect; - } - return false; -} - -//================================================================ -// Function : GraphView::setOperationButton -// Purpose : sets view operation key-mousebutton combination -//================================================================ -void GraphView::setOperationButton(const ViewOperation operation, - const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier) { - switch (operation) { - case voZoom: - myZoomKey = OperationButton(button, modifier); - break; - case voZoomX: - myZoomXKey = OperationButton(button, modifier); - break; - case voZoomY: - myZoomYKey = OperationButton(button, modifier); - break; - case voPan: - myPanKey = OperationButton(button, modifier); - break; - case voPanX: - myPanXKey = OperationButton(button, modifier); - break; - case voPanY: - myPanYKey = OperationButton(button, modifier); - break; - case voRect: - myRectKey = OperationButton(button, modifier); - break; - } -} - -//================================================================ -// Function : GraphView::getOperationButton -// Purpose : gets operation key-mousebutton combination -//================================================================ -void GraphView::getOperationButton(const ViewOperation operation, - Qt::MouseButtons& button, - Qt::KeyboardModifiers& modifier) const { - switch (operation) { - case voZoom: - button = myZoomKey.button; - modifier = myZoomKey.modifier; - break; - case voZoomX: - button = myZoomXKey.button; - modifier = myZoomXKey.modifier; - break; - case voZoomY: - button = myZoomYKey.button; - modifier = myZoomYKey.modifier; - break; - case voPan: - button = myPanKey.button; - modifier = myPanKey.modifier; - break; - case voPanX: - button = myPanXKey.button; - modifier = myPanXKey.modifier; - break; - case voPanY: - button = myPanYKey.button; - modifier = myPanYKey.modifier; - break; - case voRect: - button = myRectKey.button; - modifier = myRectKey.modifier; - break; - case voNone: - default: - button = Qt::NoButton; - modifier = Qt::NoModifier; - break; - } -} - -//================================================================ -// Function : GraphView::testOperation -// Purpose : tests for operation key-mousebutton combination -//================================================================ -bool GraphView::testOperation (const ViewOperation operation, - const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier) const { - switch (operation) { - case voZoom: - return myZoomKey.button == button && myZoomKey.modifier == modifier; - case voZoomX: - return myZoomXKey.button == button && myZoomXKey.modifier == modifier; - case voZoomY: - return myZoomYKey.button == button && myZoomYKey.modifier == modifier; - case voPan: - return myPanKey.button == button && myPanKey.modifier == modifier; - case voPanX: - return myPanXKey.button == button && myPanXKey.modifier == modifier; - case voPanY: - return myPanYKey.button == button && myPanYKey.modifier == modifier; - case voRect: - return myRectKey.button == button && myRectKey.modifier == modifier; - default: - break; - } - return false; -} - -//================================================================ -// Function : GraphView::testOperation -// Purpose : tests key-mousebutton combination and -// returns view operation if any matches -//================================================================ -GraphView::ViewOperation GraphView::testOperation(const Qt::MouseButtons button, - const Qt::KeyboardModifiers modifier) const { - if (testOperation(voZoom, button, modifier)) - return voZoom; - if (testOperation(voZoomX, button, modifier)) - return voZoomX; - if (testOperation(voZoomY, button, modifier)) - return voZoomY; - if (testOperation(voPan, button, modifier)) - return voPan; - if (testOperation(voPanX, button, modifier)) - return voPanX; - if (testOperation(voPanY, button, modifier)) - return voPanY; - if (testOperation(voRect, button, modifier)) - return voRect; - return voNone; -} - -//================================================================ -// Function : GraphView::reset -// Purpose : resets view - sets origin to 0.0 and scales to 1.0 -//================================================================ -void GraphView::reset() { - myOrigin = GraphNode(0.0, 0.0); - myXScale = 1.0; - myYScale = 1.0; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::fitAll -// Purpose : fits viewer so display all data -//================================================================ -void GraphView::fitAll() { - QRect pRect = getGraphRect(); - if (!pRect.isValid() || - pRect.right() == pRect.left() || - pRect.top() == pRect.bottom()) - return; - GraphItem* item; - double xMin = DBL_MAX; - double xMax = -DBL_MAX; - double yMin = DBL_MAX; - double yMax = -DBL_MAX; - int cnt = 0; - foreach (item, myItems ) { - int i; - cnt += item->count(); - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - if (node->x() < xMin) - xMin = node->x(); - if (node->x() > xMax) - xMax = node->x(); - if (node->y() < yMin) - yMin = node->y(); - if (node->y() > yMax) - yMax = node->y(); - } - } - if (cnt > 0) { - double xOr = xMin; - double yOr = yMin; - double dx = xMax - xMin; - double dy = yMax - yMin; - int idx = pRect.width(); - int idy = pRect.height(); - if (dx > 0) { - myXScale = dx * 1.001 / idx; - } - else { - myXScale = 10 * fabs(xMin) / idx; - xOr = xMin - 5 * fabs(xMin); - } - if (dy > 0) { - myYScale = dy * 1.001 / idy; - } - else { - myYScale = 10 * fabs(yMin) / idy; - yOr = yMin - 5 * fabs(yMin); - } - myOrigin = GraphNode(xOr, yOr); - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::fitData -// Purpose : fits viewer to display certain data -//================================================================ -void GraphView::fitData(const double xMin, const double xMax, - const double yMin, const double yMax) { - QRect pRect = getGraphRect(); - if (xMin == xMax || yMin == yMax) - return; - double xOr = (xMin < xMax) ? xMin : xMax; - double yOr = (yMin < yMax) ? yMin : yMax; - double dx = fabs(xMax - xMin); - double dy = fabs(yMax - yMin); - int idx = pRect.width(); - int idy = pRect.height(); - - myXScale = dx * 1.001 / idx; - myYScale = dy * 1.001 / idy; - myOrigin = GraphNode(xOr, yOr); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::fitDataX -// Purpose : fits viewer to display certain data along horizontal axis -//================================================================ -void GraphView::fitDataX(const double xMin, const double xMax) { - QRect pRect = getGraphRect(); - if (xMin == xMax) - return; - double xOr = (xMin < xMax) ? xMin : xMax; - double dx = fabs(xMax - xMin); - int idx = pRect.width(); - myXScale = dx * 1.001 / idx; - myOrigin = GraphNode(xOr, myOrigin.y()); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::fitDataY -// Purpose : fits viewer to display certain data along vertical axis -//================================================================ -void GraphView::fitDataY(const double yMin, const double yMax) { - QRect pRect = getGraphRect(); - if (yMin == yMax) - return; - double yOr = (yMin < yMax) ? yMin : yMax; - double dy = fabs(yMax - yMin); - int idy = pRect.height(); - myYScale = dy * 1.001 / idy; - myOrigin = GraphNode(myOrigin.x(), yOr); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::pan -// Purpose : performs pan operation by dx, dy pixels -//================================================================ -void GraphView::pan(const int dx, const int dy) { - myOrigin = GraphNode(myOrigin.x() - dx * myXScale, - myOrigin.y() + dy * myYScale); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::zoom -// Purpose : performs zoom operation by dx, dy pixels -//================================================================ -void GraphView::zoom(const int dx, const int dy) { - double dl = sqrt((double)dx * dx + (double)dy * dy); - bool sn = (abs(dx) > abs(dy)) ? (dx > 0) : (dy > 0); - double pw = pow( 2.0, (dl / 100.0 * ( sn ? (1.0) : (-1.0)) ) ); - - if (dx != 0 && dy != 0) { - myXScale /= pw; - myYScale /= pw; - } - else - if (dy == 0) - myXScale /= pow( 2.0, ((double)dx)/100 ); - else - if (dx == 0) - myYScale /= pow( 2.0, ((double)dy)/100 ); - - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::startViewOperation -// Purpose : starts operation if it is enabled -//================================================================ -void GraphView::startViewOperation(const ViewOperation operation) { - if (myOperation != voNone) { - onFinishOperation(); - startOperation(voNone); - } - if (isOperationsEnabled() && isOperationEnabled(operation)) { - setCursor(getOperationCursor(operation)); - myForcedOp = operation; - qApp->installEventFilter(this); - } -} - -//================================================================ -// Function : GraphView::showMarkers -// Purpose : enables/disables internal markers drawing -//================================================================ -void GraphView::showMarkers(bool show) { - myShowMarkers = show; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::showTooltips -// Purpose : enables/disables tooltips -//================================================================ -void GraphView::showTooltips(bool show) { - myShowTooltips = show; -} - -//================================================================ -// Function : GraphView::showAxes -// Purpose : shows/hides axes -//================================================================ -void GraphView::showAxes(bool show) { - if (myShowAxes != show) { - myShowAxes = show; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::showTickMark -// Purpose : shows/hides tick-marks -//================================================================ -void GraphView::showTickMark(bool show) { - if (myShowTickMarks != show) { - myShowTickMarks = show; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::showTitle -// Purpose : shows/hides title -//================================================================ -void GraphView::showTitle (bool show) { - if (myShowTitle != show) { - myShowTitle = show; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setTitle -// Purpose : sets graph title -//================================================================ -void GraphView::setTitle(const QString& title) { - myTitle = title; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::showAxesTitle -// Purpose : shows/hides axes title -//================================================================ -void GraphView::showAxesTitle (bool show) { - if (myShowAxesTitle != show) { - myShowAxesTitle = show; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setXTitle -// Purpose : sets graph X axis title -//================================================================ -void GraphView::setXTitle(const QString& title) { - myXTitle = title; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::setYTitle -// Purpose : sets graph Y axis title -//================================================================ -void GraphView::setYTitle(const QString& title) { - myYTitle = title; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::showGrid -// Purpose : shows/hides grid -//================================================================ -void GraphView::showGrid(bool show) { - if (myShowGrid != show) { - myShowGrid = show; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setGridStep -// Purpose : sets grid step by x, y axes, -// doesn't change step if it is <= 0 -//================================================================ -void GraphView::setGridStep(const double x, const double y, bool turn) { - if (x > 0) { - myGridStepX = x; - } - if (y > 0) { - myGridStepY = y; - } - if (turn) - myGridMode = gmFloating; - if (myShowGrid) - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::getGridStep -// Purpose : gets grid step for x, y axes and returns true if grid is not fixed -//================================================================ -bool GraphView::getGridStep(double& x, double& y) const { - x = myGridStepX; - y = myGridStepY; - return (myGridMode == gmFloating); -} - -//================================================================ -// Function : GraphView::setFixedGridStep -// Purpose : sets fixed grid step for x, y axes in pixels, -// doesn't change step if it is less 0 -//================================================================ -void GraphView::setFixedGridStep(const int x, const int y, bool turn) { - if (x > 0) { - myGridPStepX = x; - if (myGridPStepX < MIN_GRID_STEP) - myGridPStepX = MIN_GRID_STEP; - } - if (y > 0) { - myGridPStepY = y; - if (myGridPStepY < MIN_GRID_STEP) - myGridPStepY = MIN_GRID_STEP; - } - if (turn) - myGridMode = gmFixed; - if (myShowGrid) - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::getFixedGridStep -// Purpose : gets fixed grid step for x, y axes in pixels -// and returns true if grid is fixed -//================================================================ -bool GraphView::getFixedGridStep(int& x, int& y) const { - x = myGridPStepX; - y = myGridPStepY; - return (myGridMode == gmFixed); -} - -//================================================================ -// Function : GraphView::setGridIntervals -// Purpose : sets number of grid intervals (INTERVALS mode) for x, y axes, -// doesn't change if <= 0 -//================================================================ -void GraphView::setGridIntervals(const int xInt, - const int yInt, - bool turn) { - if (xInt > 0) { - myGridIntX = xInt; - } - if (yInt > 0) { - myGridIntY = yInt; - } - if (turn) - myGridMode = gmIntervals; - if (myShowGrid) - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::getGridIntervals -// Purpose : gets number of grid intervals (INTERVALS mode) for x, y axes, -// and returns true if grid mode is INTERVALS -//================================================================ -bool GraphView::getGridIntervals(int &xInt, int &yInt) const { - xInt = myGridIntX; - yInt = myGridIntY; - return (myGridMode == gmIntervals); -} - -//================================================================ -// Function : GraphView::setGridMode -// Purpose : switches grid mode [FIXED, INTERVALS, FLOATING] -//================================================================ -void GraphView::setGridMode(const GridMode mode) { - if (myGridMode != mode) { - myGridMode = mode; - if (myShowGrid) - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setXScale -// Purpose : sets X axis scale -//================================================================ -void GraphView::setXScale(const double scale) { - if (scale > 0) { - myXScale = scale; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setYScale -// Purpose : sets Y axis scale -//================================================================ -void GraphView::setYScale(const double scale) { - if (scale > 0) { - myYScale = scale; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setScale -// Purpose : sets X, Y axis scale -//================================================================ -void GraphView::setScale(const double scale) { - if (scale > 0) { - myXScale = scale; - myYScale = scale; - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::setOrigin -// Purpose : moves axes origin to point [x, y] -//================================================================ -void GraphView::setOrigin(const double x, const double y) { - myOrigin = GraphNode(x, y); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::getOrigin -// Purpose : gets axes origin -//================================================================ -void GraphView::getOrigin(double& x, double& y) const { - x = myOrigin.x(); - y = myOrigin.y(); -} - -//================================================================ -// Function : GraphView::changeBackgroundColor -// Purpose : -//================================================================ -void GraphView::changeBackgroundColor(const int index) { - int shift = 1; - if (index >= 0 && index < getNbColors()) - shift = index; - int i; - unsigned j; - unsigned aNb = myColors.count(); - if (aNb > 1) { - for (i = 0; i < shift; i++) { - QColor tmp = myColors.first(); - for (j = 0; j < aNb - 1; j++) { - myColors[j] = myColors[j+1]; - } - myColors[aNb - 1] = tmp; - } - } - QPalette pal = palette(); - pal.setColor(QPalette::Window, myColors.first()); // QPalette::Active, - pal.setColor(QPalette::Text, myColors.last()); //QPalette::Active, - setPalette(pal); - update(); //repaint(false); - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::setTitleFont -// Purpose : sets main title font -//================================================================ -void GraphView::setTitleFont(QFont& font) { - myTitleFont = font; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::setAxesTitleFont -// Purpose : sets axes title font -//================================================================ -void GraphView::setAxesTitleFont(QFont& font) { - myAxesTitleFont = font; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::setTickMarksFont -// Purpose : sets tick marks font -//================================================================ -void GraphView::setTickMarksFont(QFont& font) { - myTickMarksFont = font; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::setLegend -// Purpose : sets legend widget -//================================================================ -void GraphView::setLegend(GraphLegend* legend) { - myLegend = legend; - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::getBorders -// Purpose : gets borders size -//================================================================ -void GraphView::getMargins(int& leftMargin, - int& rightMargin, - int& topMargin, - int& bottomMargin) { - int db = MAX(SPACING_SIZE, (getMarkerSize() + 1)/2); - topMargin = db; - bottomMargin = db; - leftMargin = db; - rightMargin = db; - - if (myShowTitle && !myTitle.isEmpty()) { - QFontMetrics fm(myTitleFont); - topMargin += ( fm.height() + SPACING_SIZE ); - } - if (myShowAxesTitle && !myXTitle.isEmpty()) { - QFontMetrics fm(myAxesTitleFont); - bottomMargin += ( fm.height() + SPACING_SIZE ); - } - if (myShowAxesTitle && !myYTitle.isEmpty()) { - QFontMetrics fm(myAxesTitleFont); - topMargin += ( fm.height() + SPACING_SIZE ); - } - if (myShowTickMarks) { - QFontMetrics fm(myTickMarksFont); - rightMargin += SPACING_SIZE * 3; - leftMargin += SPACING_SIZE * 10; - bottomMargin += ( fm.height() + SPACING_SIZE ); - topMargin += fm.height() / 2 + SPACING_SIZE; - } -} - -//================================================================ -// Function : GraphView::insertItem -// Purpose : inserts item into list -//================================================================ -void GraphView::insertItem(GraphItem* item) { - int aMarker, aColor, aLine; - getNextMarker(aMarker, aColor, aLine); - item->setMarker(aMarker, aColor, aLine); - myItems.append(item); - update(); //repaint(false); - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::removeItem -// Purpose : removes item from list -//================================================================ -void GraphView::removeItem(const int index) { - myItems.removeAt(index); - update(); //repaint(false); - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::clear -// Purpose : clears data list -//================================================================ -void GraphView::clear() { - myItems.clear(); - update(); //repaint(false); - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::getItem -// Purpose : gets item by index, returns NULL if index is out of range -//================================================================ -GraphItem* GraphView::getItem(const int index) { - return myItems.at(index); -} - -//================================================================ -// Function : GraphView::findItem -// Purpose : returns index of item in data list -//================================================================ -int GraphView::findItem(GraphItem* item) { - return myItems.indexOf(item); -} - -//================================================================ -// Function : GraphView::setSorted -// Purpose : sets/unsets items to be sorted by horizontal coordinate -//================================================================ -void GraphView::setSorted(bool sorted) { - GraphItem* item; - foreach (item, myItems) { - item->setSorted(sorted); - } - update(); //repaint(false); -} - -//================================================================ -// Function : GraphView::getRange -// Purpose : gets full data range -//================================================================ -void GraphView::getRange(double& minX, double& minY, - double& maxX, double& maxY) { - minX = DBL_MAX; - maxX = -DBL_MAX; - minY = DBL_MAX; - maxY = -DBL_MAX; - GraphItem* item; - int cnt = 0; - foreach (item, myItems) { - int i; - cnt += item->count(); - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - if (node->x() < minX) - minX = node->x(); - if (node->x() > maxX) - maxX = node->x(); - if (node->y() < minY) - minY = node->y(); - if (node->y() > maxY) - maxY = node->y(); - } - } - if (cnt <= 0) { - minX = 0.0; - minY = 0.0; - maxX = 0.0; - maxY = 0.0; - } -} - -//================================================================ -// Function : GraphView::getCurrentRange -// Purpose : gets current data range -//================================================================ -void GraphView::getCurrentRange(double& minX, double& minY, - double& maxX, double& maxY) { - minX = myOrigin.x(); - minY = myOrigin.y(); - QRect pRect = getGraphRect(); - maxX = minX + myXScale * (pRect.width() - 1); - maxY = minY + myYScale * (pRect.height() - 1); -} - -//================================================================ -// Function : GraphView::getNbColors -// Purpose : returns number of colors provided -// default value is 16 -//================================================================ -int GraphView::getNbColors(){ - return myColors.count(); -} - -//================================================================ -// Function : GraphView::getNbMarkers -// Purpose : returns number of markers provided -// default value is 11 : -// 0 - square -// 1 - circle -// 2 - triangle (looks up) -// 3 - triangle (looks down) -// 4 - cross -// 5 - rhomb -// 6 - empty square -// 7 - empty circle -// 8 - empty rhomb -// 9 - empty triangle (looks up) -// 9 - empty triangle (looks down) -//================================================================ -int GraphView::getNbMarkers() { - return 11; -} - -//================================================================ -// Function : GraphView::getNbTypeLines -// Purpose : returns number of type lines provided -// default value is 5 : -// 0 - SolidLine -// 1 - DashLine -// 2 - DotLine -// 3 - DashDotLine -// 4 - DashDotDotLine -//================================================================ -int GraphView::getNbTypeLines() { - return myLines.count(); -} - -//================================================================ -// Function : GraphView::setMarkerSize -// Purpose : sets marker size -//================================================================ -void GraphView::setMarkerSize(const int size) { - myMarkerSize = size; - update(); //repaint(false); - if (myLegend) - myLegend->updateMe(); -} - -//================================================================ -// Function : GraphView::tip -// Purpose : handles tooltips for the view -//================================================================ -QRect GraphView::tip(const QPoint& point, QString& tipText) { - if (!myShowTooltips/* || !myShowMarkers */) - return QRect(0, 0, -1, -1); - QRect where(QPoint(0,0), QSize(getMarkerSize(), getMarkerSize())); - where.moveCenter(point); - unsigned i; - QRect pRect = this->getGraphRect(); - long minLength = -1; - QListIterator iter(myItems); - iter.toBack(); - while (iter.hasPrevious()) { - GraphItem* aItem = iter.previous(); - unsigned aNbNodes = aItem->count(); - for (i = 0; i < aNbNodes; i++) { - GraphNode* node = aItem->getNode(i); - long x = (long)((node->x() - myOrigin.x()) / myXScale); - long y = (long)((node->y() - myOrigin.y()) / myYScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - QPoint dst = point - QPoint(x, y); - long length = dst.x() * dst.x() + dst.y() * dst.y(); - if (where.contains(x, y) && (minLength < 0 || minLength > length)) { - tipText = QString("(") + QString::number(node->x()) + ", " + - QString::number(node->y()) + QString(")"); - if (!(aItem->getName().isEmpty())) - tipText = aItem->getName() + " : " + tipText; - minLength = length; - } - } - } - if (!tipText.isEmpty()) - return where; - else - return QRect(0, 0, -1, -1); -} - -//================================================================ -// Function : GraphView::isSameColors [static] -// Purpose : returns true if colors seem to be the same -// (i.e. difference is less than gap) -//================================================================ -bool GraphView::isSameColors(const QColor color1, - const QColor color2, - const int gap) { - int rC1, bC1, gC1; - int rC2, bC2, gC2; - color1.getRgb(&rC1, &gC1, &bC1); - color2.getRgb(&rC2, &gC2, &bC2); - return ( abs(rC1 - rC2) + abs(gC1 - gC2) + abs(bC1 - bC2) ) < gap; -} - -//================================================================ -// Function : GraphView::startOperation -// Purpose : starts/finishes view operation -//================================================================ -void GraphView::startOperation(ViewOperation theOp) { - switch (theOp) { - case voZoom: - case voZoomX: - case voZoomY: - case voPan: - case voPanX: - case voPanY: - case voRect: - if (myOperation != voNone) { - startOperation(voNone); - } - myOperation = theOp; - setCursor(getOperationCursor(myOperation)); - onStartOperation(); - break; - case voNone: - default: - setCursor(myDefCursor); - myOperation = myForcedOp = voNone; - break; - } -} - -//================================================================ -// Function : GraphView::onStartOperation -// Purpose : called on view operation starting -//================================================================ -void GraphView::onStartOperation() { - if (myOperation == voRect) { - if (!myRubberBand) - myRubberBand = new QRubberBand(QRubberBand::Rectangle, this); - QRect r = QRect(myPoint, myOtherPoint).normalized(); - myRubberBand->setGeometry( r ); - myRubberBand->setVisible(r.isValid()); - } -} - -//================================================================ -// Function : GraphView::onFinishOperation -// Purpose : called on view operation finishing -//================================================================ -void GraphView::onFinishOperation() -{ - if (myOperation == voRect) { - QRect rect(myPoint, myOtherPoint); - rect = rect.normalized(); - if (myRubberBand) myRubberBand->hide(); - if (!rect.isValid()) - return; - if (rect.width() < mySensibilitySize || rect.height() < mySensibilitySize) - return; - QRect pRect = this->getGraphRect(); - int dx = rect.left() - pRect.left(); - int dy = rect.bottom() - pRect.bottom(); - myOrigin = GraphNode(myOrigin.x() + dx * myXScale, - myOrigin.y() - dy * myYScale); - myXScale = myXScale * rect.width() / pRect.width(); - myYScale = myYScale * rect.height() / pRect.height(); - update(); //repaint(false); - } -} - -//================================================================ -// Function : GraphView::onOperation -// Purpose : called on view operation running -//================================================================ -void GraphView::onOperation(QPoint mousePos) { - int dx = mousePos.x() - myPoint.x(); - int dy = mousePos.y() - myPoint.y(); - double dl = sqrt((double)dx * dx + (double)dy * dy); - bool sn = (abs(dx) > abs(dy)) ? (dx > 0) : (dy > 0); - double pw = pow( 2.0, (dl / 100.0 * ( sn ? (1.0) : (-1.0)) ) ); - - switch (myOperation) { - case voPan: - { - myOrigin = GraphNode(myOrigin.x() - dx * myXScale, - myOrigin.y() + dy * myYScale); - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voPanX: - { - myOrigin = GraphNode(myOrigin.x() - dx * myXScale, - myOrigin.y()); - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voPanY: - { - myOrigin = GraphNode(myOrigin.x(), - myOrigin.y() + dy * myYScale); - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voZoom: - { - myXScale /= pw; - myYScale /= pw; - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voZoomX: - { - myXScale /= pow( 2.0, ((double)dx)/100 ); - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voZoomY: - { - myYScale /= pow( 2.0, ((double)dy)/100 ); - myPoint = mousePos; - update(); //repaint(false); - break; - } - case voRect: - { - myOtherPoint = mousePos; - QRect r = QRect(myPoint, myOtherPoint).normalized(); - myRubberBand->setGeometry( r ); - myRubberBand->setVisible(r.isValid()); - break; - } - } -} - -//================================================================ -// Function : GraphView::onMouseMove -// Purpose : called on mouse moving action (e.g. for highlighting item) -//================================================================ -void GraphView::onMouseMove(QPoint mousePos) { -} - -//================================================================ -// Function : GraphView::setSensibilitySize -// Purpose : sets sensibility area size -//================================================================ -void GraphView::setSensibilitySize(const int size) { - mySensibilitySize = size; - if (mySensibilitySize < MIN_SENSIBILITY_SIZE) - mySensibilitySize = MIN_SENSIBILITY_SIZE; -} - -//================================================================ -// Function : GraphView::mousePressEvent -// Purpose : MousePress event handler -//================================================================ -void GraphView::mousePressEvent( QMouseEvent *e ) { - Qt::MouseButtons aBtn = e->buttons(); - Qt::KeyboardModifiers aKey = e->modifiers(); - - // finishing current viewer operation - if (myOperation != voNone) { - onFinishOperation(); - startOperation(voNone); - } - myOtherPoint = myPoint = e->pos(); - if (myForcedOp != voNone) { - startOperation(myForcedOp); - } - else { - if (isOperationsEnabled() && isOperationEnabled(testOperation(aBtn, aKey))) - startOperation(testOperation(aBtn, aKey)); - } -} - -//================================================================ -// Function : GraphView::mouseMoveEvent -// Purpose : MouseMove event handler -//================================================================ -void GraphView::mouseMoveEvent(QMouseEvent* e) { - if (myOperation != voNone) - onOperation(e->pos()); - else - onMouseMove(e->pos()); -} - -//================================================================ -// Function : GraphView::mouseReleaseEvent -// Purpose : MouseRelease event handler -//================================================================ -void GraphView::mouseReleaseEvent(QMouseEvent *e) { - // finishing current viewer operation - if (myOperation != voNone) { - onFinishOperation(); - startOperation(voNone); - } -} - -//================================================================ -// Function : GraphView::mouseDoubleClickEvent -// Purpose : MouseDoubleClick event handler -//================================================================ -void GraphView::mouseDoubleClickEvent(QMouseEvent *e) { -} - -//================================================================ -// Function : GraphView::keyPressEvent -// Purpose : KeyPress event handler -//================================================================ -void GraphView::keyPressEvent( QKeyEvent *e ) { -// emit vpKeyEvent( e ); -} - -//================================================================ -// Function : GraphView::keyReleaseEvent -// Purpose : KeyRelease event handler -//================================================================ -void GraphView::keyReleaseEvent( QKeyEvent *e ) { -// emit vpKeyEvent( e ); -} - -//================================================================ -// Function : GraphView::resizeEvent -// Purpose : Resize event handler -//================================================================ -void GraphView::resizeEvent(QResizeEvent* e) { - QWidget::resizeEvent(e); -} - -//================================================================ -// Function : GraphView::paintEvent -// Purpose : Paint event handler -//================================================================ -void GraphView::paintEvent(QPaintEvent* e) { - QPixmap aBuffer = QPixmap(width(), height()); - aBuffer.fill(this, QPoint(0,0)); - - QRect pRect = getGraphRect(); - if ( pRect.isValid() || - pRect.right() == pRect.left() || - pRect.top() == pRect.bottom() ) { - QPainter p(&aBuffer); - // drawing grid - if (myShowGrid) { - p.save(); - drawGrid(&p); - p.restore(); - } - // or border - else { - p.save(); - drawBorder(&p); - p.restore(); - } - // drawing axes - if (myShowAxes) { - p.save(); - drawAxes(&p); - p.restore(); - } - // drawing tick marks - if (myShowTickMarks) { - p.save(); - drawTickMarks(&p); - p.restore(); - } - // drawing axes titles - if (myShowAxesTitle) { - p.save(); - drawAxesTitle(&p); - p.restore(); - } - // drawing title - if (myShowTitle) { - p.save(); - drawTitle(&p); - p.restore(); - } - // drawing data - GraphItem* aItem; - foreach (aItem, myItems) { - p.save(); - drawItem(&p, aItem); - p.restore(); - } - } - QPainter painter(this); - painter.drawPixmap(QPoint(0, 0), aBuffer); -} - -//================================================================ -// Function : GraphView::event -// Purpose : global event handler -//================================================================ -bool GraphView::event(QEvent* e) -{ - if (e->type() == QEvent::ToolTip) { - QHelpEvent* helpEvent = static_cast(e); - QString tipText; - QRect r = tip(helpEvent->pos(), tipText); - if (r.isValid() && !tipText.isEmpty() ) - QToolTip::showText(helpEvent->globalPos(), tipText, this, r); - else - QToolTip::hideText(); - } - return QWidget::event(e); -} - -//================================================================ -// Function : GraphView::getMargins -// Purpose : gets graph painting area -//================================================================ -QRect GraphView::getGraphRect() { - int topMargin; - int bottomMargin; - int leftMargin; - int rightMargin; - - getMargins(leftMargin, rightMargin, topMargin, bottomMargin); - return QRect(QPoint(leftMargin, topMargin), - QPoint(width() - rightMargin, height() - bottomMargin)); -} - -//================================================================ -// Function : GraphView::drawGrid -// Purpose : draws grid -//================================================================ -void GraphView::drawGrid(QPainter* painter) { - if (!myShowGrid) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen - painter->setPen(QPen(Qt::lightGray, 0, Qt::DotLine)); - IntList xList, yList; - this->getTickPoints(xList, yList); - unsigned i; - for (i = 0; i < xList.count(); i++) { - painter->drawLine(pRect.left() + xList[i], - pRect.top(), - pRect.left() + xList[i], - pRect.bottom()); - } - for (i = 0; i < yList.count(); i++) { - painter->drawLine(pRect.left(), - pRect.bottom() - yList[i], - pRect.right(), - pRect.bottom() - yList[i]); - } - // forcing immediate painting - //painter->flush(); -} - -//================================================================ -// Function : GraphView::drawBorder -// Purpose : draws border (it is drawn when grid is not) -//================================================================ -void GraphView::drawBorder(QPainter* painter) { - if (myShowGrid) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen - painter->setPen(QPen(Qt::lightGray, 0, Qt::DotLine)); - painter->drawLine(pRect.left(), - pRect.top(), - pRect.left(), - pRect.bottom()); - painter->drawLine(pRect.left(), - pRect.bottom(), - pRect.right(), - pRect.bottom()); - painter->drawLine(pRect.right(), - pRect.top(), - pRect.right(), - pRect.bottom()); - painter->drawLine(pRect.left(), - pRect.top(), - pRect.right(), - pRect.top()); - // forcing immediate painting - //painter->flush(); -} - -//================================================================ -// Function : GraphView::drawAxes -// Purpose : draws axes -//================================================================ -void GraphView::drawAxes(QPainter* painter) { - if (!myShowAxes) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen, brush... - painter->setPen(QPen(palette().color(QPalette::Text), 1)); // QPalette::Active, - painter->setBrush(palette().color(QPalette::Text)); // QPalette::Active, - // drawing axes lines - QPoint p1(pRect.left(), pRect.top()); - QPoint p2(pRect.left(), pRect.bottom()); - QPoint p3(pRect.right(), pRect.bottom()); - painter->drawLine(p1, p2); - painter->drawLine(p2, p3); - // drawing arrows - QPolygon ar1(3), ar2(3); - ar1[0] = p1; - ar1[1] = QPoint(pRect.left() - ARROW_WIDTH, pRect.top() + ARROW_LENGTH); - ar1[2] = QPoint(pRect.left() + ARROW_WIDTH, pRect.top() + ARROW_LENGTH); - ar2[0] = p3; - ar2[1] = QPoint(pRect.right() - ARROW_LENGTH, pRect.bottom() + ARROW_WIDTH); - ar2[2] = QPoint(pRect.right() - ARROW_LENGTH, pRect.bottom() - ARROW_WIDTH); - if (pRect.height() > ARROW_LENGTH) - painter->drawPolygon(ar1); - if (pRect.width() > ARROW_LENGTH) - painter->drawPolygon(ar2); - // forcing immediate painting - //painter->flush(); - // drawing axes marks - IntList xList, yList; - this->getTickPoints(xList, yList); - unsigned i; - // X axis marks - for (i = 0; i < xList.count(); i++) { - if (pRect.left() + xList[i] != pRect.right() && - xList[i] != 0) { - painter->drawLine(pRect.left() + xList[i], pRect.bottom() - TICK_SIZE, - pRect.left() + xList[i], pRect.bottom() + TICK_SIZE); - } - } - // Y axis marks - for (i = 0; i < yList.count(); i++) { - if (pRect.bottom() - yList[i] != pRect.top() && - yList[i] != 0) { - painter->drawLine(pRect.left() - TICK_SIZE, pRect.bottom() - yList[i], - pRect.left() + TICK_SIZE, pRect.bottom() - yList[i]); - } - } - // forcing immediate painting - //painter->flush(); -} - - -//================================================================ -// Function : GraphView::drawTickMarks -// Purpose : draws tick marks -//================================================================ -void GraphView::drawTickMarks(QPainter* painter) { - if (!myShowTickMarks) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen - painter->setPen(QPen(palette().color(QPalette::Text), 1)); //QPalette::Active, - QFontMetrics fm(myTickMarksFont); - painter->setFont(myTickMarksFont); - int aTH = fm.height(); - IntList xList, yList; - this->getTickPoints(xList, yList); - unsigned i; - // X axis tick marks - int aLast = 0; - int aFromX, aFromY; - for (i = 0; i < xList.count(); i++) { - QString xOr = QString::number(myOrigin.x() + myXScale * xList[i]); - int aTW = fm.width(xOr); - aFromY = pRect.bottom() + SPACING_SIZE; - aFromX = pRect.left() + xList[i] - aTW/2; - if (aFromX + aTW + SPACING_SIZE > width()) - aFromX = width() - aTW - SPACING_SIZE; - if (aFromX < SPACING_SIZE) - aFromX = SPACING_SIZE; - if (aFromX >= aLast) { - painter->drawText(aFromX, aFromY, aTW, aTH, Qt::AlignCenter, xOr); - aLast = aFromX + aTW + SPACING_SIZE * 2; - } - } - // Y axis tick marks - aLast = pRect.bottom() + SPACING_SIZE; - for (i = 0; i < yList.count(); i++) { - QString yOr = QString::number(myOrigin.y() + myYScale * yList[i]); - int aTW = fm.width(yOr); - aFromX = pRect.left() - aTW - SPACING_SIZE; - if (aFromX < SPACING_SIZE) - aFromX = SPACING_SIZE; - aFromY = pRect.bottom() - yList[i] - aTH/2; - if (aFromY + aTH > pRect.bottom() + SPACING_SIZE) - aFromY = pRect.bottom() + SPACING_SIZE - aTH; - if (aFromY < SPACING_SIZE) - aFromY = SPACING_SIZE; - if (aFromY + aTH <= aLast) { - painter->drawText(aFromX, aFromY, aTW, aTH, Qt::AlignCenter, yOr); - aLast = aFromY - SPACING_SIZE * 2; - } - } - // forcing immediate painting - //painter->flush(); -} - - -//================================================================ -// Function : GraphView::drawAxesTitle -// Purpose : draws axes titles -//================================================================ -void GraphView::drawAxesTitle(QPainter* painter) { - if (!myShowAxesTitle) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen - painter->setPen(palette().color(QPalette::Text)); //QPalette::Active, - QFontMetrics fm(myAxesTitleFont); - painter->setFont(myAxesTitleFont); - int aTH = fm.height(); - int aFromX, aFromY; - if (!myXTitle.isEmpty()) { - int aTW = fm.width(myXTitle); - aFromX = pRect.right() - aTW/2; - if (aFromX + aTW + SPACING_SIZE > width()) - aFromX = width() - aTW - SPACING_SIZE; - aFromY = pRect.bottom() + SPACING_SIZE; - if (myShowTickMarks) - aFromY += (aTH + SPACING_SIZE); - painter->drawText(aFromX, aFromY, aTW, aTH, Qt::AlignCenter, myXTitle); - } - if (!myYTitle.isEmpty()) { - int aTW = fm.width(myYTitle); - aFromX = pRect.left() - aTW/2; - if (aFromX < SPACING_SIZE) - aFromX = SPACING_SIZE; - aFromY = pRect.top() - aTH/2 - SPACING_SIZE - aTH; - painter->drawText(aFromX, aFromY, aTW, aTH, Qt::AlignCenter, myYTitle); - } - // forcing immediate painting - //painter->flush(); -} - -//================================================================ -// Function : GraphView::drawTitle -// Purpose : draws graph title -//================================================================ -void GraphView::drawTitle(QPainter* painter) { - if (!myShowTitle) - return; - // getting painting region - QRect pRect = getGraphRect(); - // setting pen - painter->setPen(palette().color(QPalette::Text));//QPalette::Active, - QFontMetrics fm(myTitleFont); - painter->setFont(myTitleFont); - int aTH = fm.height(); - int aFromX, aFromY; - if (!myTitle.isEmpty()) { - int aTW = fm.width(myTitle); - aFromX = pRect.left() + pRect.width() / 2 - aTW / 2; - if (aFromX + aTW + SPACING_SIZE > width()) - aFromX = width() - aTW - SPACING_SIZE; - if (aFromX < SPACING_SIZE) - aFromX = SPACING_SIZE; - aFromY = SPACING_SIZE; - painter->drawText(aFromX, aFromY, aTW, aTH, Qt::AlignCenter, myTitle); - } - // forcing immediate painting - //painter->flush(); -} - -//================================================================ -// Function : GraphView::drawItem -// Purpose : draws item -//================================================================ -void GraphView::drawItem(QPainter* painter, GraphItem* item) { - // checking item for validity - if (!item->isValid()) - return; - // getting marker, type and color of line - int aMarker = item->getMarker(); - QColor aColor = item->getColor(); - Qt::PenStyle aLine = item->getLine(); - - // getting painting region - QRect pRect = getGraphRect(); - - // setting pen for line - painter->setPen(QPen(aColor, 0, aLine)); - int i; - if (item->count() > 1) { - // drawing lines - painter->setClipRect(pRect); - painter->setClipping(true); - for (i = 0; i < item->count() - 1; i++) { - GraphNode* node1 = item->getNode(i); - GraphNode* node2 = item->getNode(i + 1); - long x1 = (long)((node1->x() - myOrigin.x()) / myXScale); - long y1 = (long)((node1->y() - myOrigin.y()) / myYScale); - x1 = pRect.left() + x1; - y1 = pRect.bottom() - y1; - long x2 = (long)((node2->x() - myOrigin.x()) / myXScale); - long y2 = (long)((node2->y() - myOrigin.y()) / myYScale); - x2 = pRect.left() + x2; - y2 = pRect.bottom() - y2; - if (intersects(pRect, x1, y1, x2, y2)) { - painter->drawLine(x1, y1, x2, y2); - } - } - - } - - painter->setClipping(false); - // drawing markers - painter->save(); - if (myShowMarkers) { - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - myOrigin.x()) / myXScale); - long y = (long)((node->y() - myOrigin.y()) / myYScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - drawMarker(painter, QPoint(x, y), aMarker, aColor); - } - } - } - else { - bool fLeft = false, fRight = false; - QPoint pLeft, pRight; - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - myOrigin.x()) / myXScale); - long y = (long)((node->y() - myOrigin.y()) / myYScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - pLeft = QPoint(x, y); - fLeft = true; - break; - } - } - for (i = item->count()-1; i >= 0; i--) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - myOrigin.x()) / myXScale); - long y = (long)((node->y() - myOrigin.y()) / myYScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - pRight = QPoint(x, y); - fRight = true; - break; - } - } - if (fLeft) - drawMarker(painter, pLeft, aMarker, aColor); - if (fRight && pLeft != pRight) - drawMarker(painter, pRight, aMarker, aColor); - } - painter->restore(); - // forcing immediate painting - //painter->flush(); -} - -#ifdef DEB -//================================================================ -// Function : GraphView::drawItem -// Purpose : draws item -//================================================================ -void GraphView::drawItem(QPainter* painter, - int pxMin, - int pxMax, - int pyMin, - int pyMax, - double xMin, - double xMax, - double yMin, - double yMax, - GraphItem* item) { - // checking item for validity - if (!item->isValid()) - return; - // getting marker, type and color of line - int aMarker = item->getMarker(); - QColor aColor = item->getColor(); - PenStyle aLine = item->getLine(); - - int ml, mr, mt, mb; - getMargins(ml, mr, mt, mb); - // getting painting region - QRect pRect = QRect(QPoint(pxMin+ml, pyMin+mt), QSize(pxMax-pxMin-ml-mr, pyMax-pyMin-mt-mb)); - double XScale = (xMax-xMin)/(pxMax-pxMin); - double YScale = (yMax-yMin)/(pyMax-pyMin); - - // setting pen for line - painter->setPen(QPen(aColor, 0, aLine)); - int i; - if (item->count() > 1) { - // drawing lines - painter->setClipRect(pRect); - painter->setClipping(true); - for (i = 0; i < item->count() - 1; i++) { - GraphNode* node1 = item->getNode(i); - GraphNode* node2 = item->getNode(i + 1); - long x1 = (long)((node1->x() - xMin) / XScale); - long y1 = (long)((node1->y() - yMin) / YScale); - x1 = pRect.left() + x1; - y1 = pRect.bottom() - y1; - long x2 = (long)((node2->x() - xMin) / XScale); - long y2 = (long)((node2->y() - yMin) / YScale); - x2 = pRect.left() + x2; - y2 = pRect.bottom() - y2; - if (intersects(pRect, x1, y1, x2, y2)) { - painter->drawLine(x1, y1, x2, y2); - } - } - painter->setClipping(false); - // drawing markers - painter->save(); - if (myShowMarkers) { - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - xMin) / XScale); - long y = (long)((node->y() - yMin) / YScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - drawMarker(painter, QPoint(x, y), aMarker, aColor); - } - } - } - else { - bool fLeft = false, fRight = false; - QPoint pLeft, pRight; - for (i = 0; i < item->count(); i++) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - xMin) / XScale); - long y = (long)((node->y() - yMin) / YScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - pLeft = QPoint(x, y); - fLeft = true; - break; - } - } - for (i = item->count()-1; i >= 0; i--) { - GraphNode* node = item->getNode(i); - long x = (long)((node->x() - xMin) / XScale); - long y = (long)((node->y() - yMin) / YScale); - x = pRect.left() + x; - y = pRect.bottom() - y; - if (pRect.contains(x, y)) { - pRight = QPoint(x, y); - fRight = true; - break; - } - } - if (fLeft) - drawMarker(painter, pLeft, aMarker, aColor); - if (fRight && pLeft != pRight) - drawMarker(painter, pRight, aMarker, aColor); - } - painter->restore(); - } - // forcing immediate painting - //painter->flush(); -} -#endif - -//================================================================ -// Function : GraphView::drawMarker -// Purpose : draws marker at position -//================================================================ -void GraphView::drawMarker(QPainter* painter, - const QPoint point, - const int marker, - const QColor& color) { - if (marker < 0) - return; - // pen - QPen pen(color, 0, Qt::SolidLine); - // drawing brush - QBrush brush(pen.color()); - // marker rect - int size = getMarkerSize(); - QRect mRect(QPoint(0,0), QSize(size, size)); - mRect.moveCenter(point); - - painter->setPen(pen); - painter->setBrush(pen.color()); - switch(marker) { - case 0: // 0 - square - { - painter->drawRect(mRect); - } - break; - case 1: // 1 - circle - { - painter->drawEllipse(mRect); - } - break; - case 2: // 2 - triangle (looks up) - { - QPolygon ar(3); - double d = sqrt(3.0); - double d1 = (double)size / (2 * d); - double d2 = (double)size * d / 3; - ar[0] = QPoint(point.x() - size/2, (int)((double)point.y() + d1)); - ar[1] = QPoint(point.x(), (int)((double)point.y() - d2)); - ar[2] = QPoint(point.x() + size/2, (int)((double)point.y() + d1)); - painter->drawPolygon(ar); - } - break; - case 3: // 3 - triangle (looks down) - { - QPolygon ar(3); - double d = sqrt(3.0); - double d1 = (double)size / (2 * d); - double d2 = (double)size * d / 3; - ar[0] = QPoint(point.x() - size/2, (int)((double)point.y() - d1)); - ar[1] = QPoint(point.x(), (int)((double)point.y() + d2)); - ar[2] = QPoint(point.x() + size/2, (int)((double)point.y() - d1)); - painter->drawPolygon(ar); - } - break; - case 4: // 4 - cross - { - painter->drawLine(mRect.left(), mRect.top(), - mRect.right(), mRect.bottom()); - painter->drawLine(mRect.left(), mRect.bottom(), - mRect.right(), mRect.top()); - } - break; - case 5: // 5 - rhomb - { - QPolygon ar(4); - ar[0] = QPoint(point.x(), mRect.top()); - ar[1] = QPoint(mRect.right(), point.y()); - ar[2] = QPoint(point.x(), mRect.bottom()); - ar[3] = QPoint(mRect.left(), point.y()); - painter->drawPolygon(ar); - } - break; - case 6: // 6 - empty square - { - painter->drawLine(mRect.left(), mRect.top(), - mRect.right(), mRect.top()); - painter->drawLine(mRect.right(), mRect.top(), - mRect.right(), mRect.bottom()); - painter->drawLine(mRect.right(), mRect.bottom(), - mRect.left(), mRect.bottom()); - painter->drawLine(mRect.left(), mRect.bottom(), - mRect.left(), mRect.top()); - } - break; - case 7: // 7 - empty circle - { - painter->drawArc(mRect, 0, 16 * 360); - } - break; - case 8: // 8 - empty rhomb - { - painter->drawLine(point.x(), mRect.top(), - mRect.right(), point.y()); - painter->drawLine(mRect.right(), point.y(), - point.x(), mRect.bottom()); - painter->drawLine(point.x(), mRect.bottom(), - mRect.left(), point.y()); - painter->drawLine(mRect.left(), point.y(), - point.x(), mRect.top()); - } - break; - case 9: // 9 - empty triangle (looks up) - { - QPolygon ar(3); - double d = sqrt(3.0); - double d1 = (double)size / (2 * d); - double d2 = (double)size * d / 3; - painter->drawLine(point.x() - size/2, (int)((double)point.y() + d1), - point.x(), (int)((double)point.y() - d2)); - painter->drawLine(point.x(), (int)((double)point.y() - d2), - point.x() + size/2, (int)((double)point.y() + d1)); - painter->drawLine(point.x() + size/2, (int)((double)point.y() + d1), - point.x() - size/2, (int)((double)point.y() + d1)); - } - break; - case 10: // 10 - empty triangle (looks down) - { - QPolygon ar(3); - double d = sqrt(3.0); - double d1 = (double)size / (2 * d); - double d2 = (double)size * d / 3; - painter->drawLine(point.x() + size/2, (int)((double)point.y() - d1), - point.x(), (int)((double)point.y() + d2)); - painter->drawLine(point.x(), (int)((double)point.y() + d2), - point.x() - size/2, (int)((double)point.y() - d1)); - painter->drawLine(point.x() - size/2, (int)((double)point.y() - d1), - point.x() + size/2, (int)((double)point.y() - d1)); - } - break; - default: - break; - } - // forcing immediate painting - //painter->flush(); -} - -//================================================================ -// Function : GraphView::getNextMarker -// Purpose : gets new unique marker for item if possible -//================================================================ -void GraphView::getNextMarker(int& typeMarker, int& color, int& typeLine) { - static int aMarker = -1; - static int aColor = -1; - static int aLine = -1; - - aMarker = (aMarker + 1) % getNbMarkers(); - aColor = (aColor + 1) % getNbColors(); - if (aColor == 0) - aColor++; - aLine = (aLine + 1) % getNbTypeLines(); - typeMarker = aMarker; - color = aColor; - typeLine = aLine; - if (!existMarker(aMarker, aColor, aLine)) - return; - int i, j, k; - for (i = 0; i < getNbMarkers(); i++) { - aMarker = (aMarker + 1) % getNbMarkers(); - for (j = 0; j < getNbColors(); j++) { - aColor = (aColor + 1) % getNbColors(); - if (aColor == 0) - aColor++; - for (k = 0; k < getNbTypeLines(); k++) { - aLine = (aLine + 1) % getNbTypeLines(); - if (!existMarker(aMarker, aColor, aLine)) { - typeMarker = aMarker; - color = aColor; - typeLine = aLine; - return; - } - } - } - } -} - -//================================================================ -// Function : GraphView::existMarker -// Purpose : checks if marker belongs to any enitity -//================================================================ -bool GraphView::existMarker(const int typeMarker, const int color, const int typeLine) { - GraphItem* aItem; - int aMarker, aColor, aLine; - QColor aRgbColor; - - foreach (aItem, myItems) { - if (aItem->isValid()) { - aItem->getMarker(aMarker, aColor, aLine); - aRgbColor = aItem->getColor(); - if (aItem->hasOwnColor()) { -/* UNCOMMENT THIS CODE TO ALLOW COMPARE DIFFERENT COLORS - if (isSameColors(getColor(aColor), aRgbColor)) - return true; -*/ - } - else { - if (aMarker == typeMarker && - aColor == color && - aLine == typeLine) - return true; - } - } - } - return false; -} - -//================================================================ -// Function : GraphView::getColor -// Purpose : gets color -//================================================================ -QColor GraphView::getColor(const int color) { - if (color >= 0 && color < (int)myColors.count()) - return myColors[color]; - return QColor(0, 0, 0); -} - -//================================================================ -// Function : GraphView::getLine -// Purpose : gets line -//================================================================ -Qt::PenStyle GraphView::getLine(const int line) { - if (line >= 0 && line < (int)myLines.count()) - return myLines[line]; - return Qt::NoPen; -} - -//================================================================ -// Function : intersects -// Purpose : returns true if line [x1,y1] - [x2,y2] intersects rectangle -// or lies inside it -//================================================================ -bool GraphView::intersects(QRect rect, long x1, long y1, long x2, long y2) -{ - // 1. check for intersecting (boundary rule) - rect = rect.normalized(); - QRect lineRect(QPoint(x1, y1), QPoint(x2, y2)); - lineRect = lineRect.normalized(); - if (!rect.intersects(lineRect)) - return false; - // 2. check for hor/vert line - if (x1 == x2 || y1 == y2) - return true; - // 3. check for rectangle corners - int tlX, tlY, trX, trY, blX, blY, brX, brY; - // ... top-left - tlX = (int)((double)(rect.top() - y1) * (x2 - x1) / (y2 - y1) + x1) - rect.left(); - tlY = (int)((double)(rect.left() - x1) * (y2 - y1) / (x2 - x1) + y1) - rect.top(); - if (tlX == 0 || tlY == 0) - return true; - // ... top-right - trX = (int)((double)(rect.top() - y1) * (x2 - x1) / (y2 - y1) + x1) - rect.right(); - trY = (int)((double)(rect.right() - x1) * (y2 - y1) / (x2 - x1) + y1) - rect.top(); - if (trX == 0 || trY == 0) - return true; - // ... bottom-left - blX = (int)((double)(rect.bottom() - y1) * (x2 - x1) / (y2 - y1) + x1) - rect.left(); - blY = (int)((double)(rect.left() - x1) * (y2 - y1) / (x2 - x1) + y1) - rect.bottom(); - if (blX == 0 || blY == 0) - return true; - // ... bottom-right - brX = (int)((double)(rect.bottom() - y1) * (x2 - x1) / (y2 - y1) + x1) - rect.right(); - brY = (int)((double)(rect.right() - x1) * (y2 - y1) / (x2 - x1) + y1) - rect.bottom(); - if (brX == 0 || brY == 0) - return true; - bool btlX = tlX < 0; - bool btlY = tlY < 0; - bool btrX = trX < 0; - bool btrY = trY < 0; - bool bblX = blX < 0; - bool bblY = blY < 0; - bool bbrX = brX < 0; - bool bbrY = brY < 0; - return !(btlX == btrX && btlX == bblX && btlX == bbrX && - btlY == btrY && btlY == bblY && btlY == bbrY); -} - -//================================================================ -// Function : GraphView::getTickPoints -// Purpose : calculates points for grid and/or tick marks -//================================================================ -void GraphView::getTickPoints(IntList& xList, IntList& yList) { - // getting painting region - QRect pRect = getGraphRect(); - int i; - // for fixed grid - if (myGridMode == gmFixed) { - // calculating X axis ticks - if (myGridPStepX >= MIN_GRID_STEP) { - i = 0; - while(pRect.left() + myGridPStepX * i <= pRect.right()) { - xList.append(myGridPStepX * i); - i++; - } - } - // calculating Y axis ticks - if (myGridPStepY >= MIN_GRID_STEP) { - i = 0; - while(pRect.bottom() - myGridPStepY * i >= pRect.top()) { - yList.append(myGridPStepY * i); - i++; - } - } - } - // for floating grid - else if (myGridMode == gmFloating) { - // drawing vertical lines - double xStep = myGridStepX / myXScale; - if ((int)xStep >= MIN_GRID_STEP) { - i = 0; - while(pRect.left() + (int)(xStep * i) <= pRect.right()) { - xList.append((int)(xStep * i)); - i++; - } - } - else { - i = 0; - while(pRect.left() + MIN_GRID_STEP * i <= pRect.right()) { - xList.append(MIN_GRID_STEP * i); - i++; - } - } - // drawing horizontal lines - double yStep = myGridStepY / myYScale; - if ((int)yStep >= MIN_GRID_STEP) { - i = 0; - while(pRect.bottom() - (int)(yStep * i) >= pRect.top()) { - yList.append((int)(yStep * i)); - i++; - } - } - else { - i = 0; - while(pRect.bottom() - MIN_GRID_STEP * i >= pRect.top()) { - yList.append(MIN_GRID_STEP * i); - i++; - } - } - } - // for intervals mode - else if (myGridMode == gmIntervals) { - // drawing vertical lines - double xStep = (double)(pRect.width()) / myGridIntX; - if ((int)xStep >= MIN_GRID_STEP) { - i = 0; - while(pRect.left() + (int)(xStep * i) <= pRect.right()) { - xList.append((int)(xStep * i)); - i++; - } - } - // drawing horizontal lines - double yStep = (double)(pRect.height()) / myGridIntY; - if ((int)yStep >= MIN_GRID_STEP) { - i = 0; - while(pRect.bottom() - (int)(yStep * i) >= pRect.top()) { - yList.append((int)(yStep * i)); - i++; - } - } - } - if (pRect.left() + xList.last() != pRect.right()) - xList.append(pRect.right() - pRect.left()); - if (pRect.bottom() - yList.last() != pRect.top()) - yList.append(pRect.bottom() - pRect.top()); -} - -////////////////////////////////////////////////////////////////////// -// GraphNode -////////////////////////////////////////////////////////////////////// - -//================================================================ -// Function : GraphNode::GraphNode -// Purpose : default constructor -//================================================================ -GraphNode::GraphNode() - : myX(0), - myY(0) { -} - -//================================================================ -// Function : GraphNode::GraphNode -// Purpose : constructor -//================================================================ -GraphNode::GraphNode(const double x, const double y) - : myX(x), - myY(y) { -} - -//================================================================ -// Function : GraphNode::GraphNode -// Purpose : copy constructor -//================================================================ -GraphNode::GraphNode(const GraphNode& node) { - myX = node.x(); - myY = node.y(); -} - -//================================================================ -// Function : GraphNode::operator== -// Purpose : operator== -//================================================================ -bool GraphNode::operator== (const GraphNode& node) { - return x() == node.x(); -} - -//================================================================ -// Function : GraphNode::operator< -// Purpose : operator< -//================================================================ -bool GraphNode::operator< (const GraphNode& node) { - return x() < node.x(); -} - -//================================================================ -// Function : GraphNode::operator> -// Purpose : operator> -//================================================================ -bool GraphNode::operator> (const GraphNode& node) { - return x() > node.x(); -} - -//================================================================ -// Function : GraphNode::operator= -// Purpose : operator= -//================================================================ -GraphNode& GraphNode::operator= (const GraphNode& node) { - myX = node.x(); - myY = node.y(); - return *this; -} - -////////////////////////////////////////////////////////////////////// -// GraphItem -////////////////////////////////////////////////////////////////////// - -//================================================================ -// Function : GraphItem::GraphItem -// Purpose : constructor -//================================================================ -GraphItem::GraphItem(GraphView* parent, QString name) - : myParent(parent) { - init(); - mySorted = false; - setName(name); - if (myParent) - myParent->insertItem(this); -} - -//================================================================ -// Function : GraphItem::~GraphItem -// Purpose : destructor -//================================================================ -GraphItem::~GraphItem() { - qDeleteAll(myNodes); -} - -//================================================================ -// Function : GraphItem::addNode -// Purpose : adds node -//================================================================ -void GraphItem::addNode(GraphNode* node) { - unsigned i; - if (mySorted) { - for (i = 0; i < myNodes.count(); i++) { - if (*(myNodes.at(i)) > *node) { - myNodes.insert(i, node); - return; - } - } - } - myNodes.append(node); -} - -//================================================================ -// Function : GraphItem::addNode -// Purpose : adds node -//================================================================ -void GraphItem::addNode(const double x, const double y) { - addNode(new GraphNode(x, y)); -} - -//================================================================ -// Function : GraphItem::addNodes -// Purpose : adds nodes -//================================================================ -void GraphItem::addNodes(NodeList& nodes) { - for (unsigned i = 0; i < nodes.count(); i++) - addNode(nodes.at(i)); -} - -//================================================================ -// Function : GraphItem::removeNode -// Purpose : removes node (and deletes it) -//================================================================ -void GraphItem::removeNode(GraphNode* node) { - myNodes.removeAll(node); -} - -//================================================================ -// Function : GraphItem::removeNode -// Purpose : removes node by index (and deletes it) -//================================================================ -void GraphItem::removeNode(int index) { - removeNode(myNodes.at(index)); -} - -//================================================================ -// Function : GraphItem::clear -// Purpose : clears list of nodes -//================================================================ -void GraphItem::clear() { - myNodes.clear(); -} - -//================================================================ -// Function : GraphItem::isValid -// Purpose : returns true if item is valid, -// i.e. has valid attributes and not empty -//================================================================ -bool GraphItem::isValid() { - if (isEmpty()) - return false; - if (myMarker < 0) - return false; - if (!myHasOwnLine && myLine < 0) - return false; - if (myHasOwnColor && !myOwnColor.isValid() || - !myHasOwnColor && myColor < 0) - return false; - return true; -} - -//================================================================ -// Function : GraphItem::setSorted -// Purpose : sets/clears flag (and reorders nodes) -//================================================================ -void GraphItem::setSorted(bool sorted) { - if (sorted != mySorted) { - mySorted = sorted; - if (mySorted) { - NodeList oldList(myNodes); - myNodes.clear(); - for (unsigned i = 0; i < oldList.count(); i++) - addNode(oldList.at(i)); - } - } -} - -//================================================================ -// Function : GraphItem::getNode -// Purpose : gets node by index -//================================================================ -GraphNode* GraphItem::getNode(const int index) { - return myNodes.at(index); -} - -//================================================================ -// Function : GraphItem::operator[] -// Purpose : gets node by index -//================================================================ -GraphNode* GraphItem::operator[](const int index) { - return myNodes.at(index); -} - -//================================================================ -// Function : GraphItem::setMarker -// Purpose : sets dynamic marker for item -//================================================================ -void GraphItem::setMarker(const int marker, - const int color, - const int line) { - myMarker = marker; - myHasOwnMarker = false; - myColor = color; - myHasOwnColor = false; - myLine = line; - myHasOwnLine = false; -} - -//================================================================ -// Function : GraphItem::setMarker -// Purpose : sets static marker for item -// (with own (NOT CHANGEABLE) marker, color and type line) -//================================================================ -void GraphItem::setMarker(const int marker, - const QColor& color, - const Qt::PenStyle line) { - myMarker = marker; - myHasOwnMarker = true; - myOwnColor = color; - myHasOwnColor = true; - myOwnLine = line; - myHasOwnLine = true; -} - -//================================================================ -// Function : GraphItem::setColor -// Purpose : sets own color -//================================================================ -void GraphItem::setColor(const QColor& color) { - myOwnColor = color; - myHasOwnColor = true; -} - -//================================================================ -// Function : GraphItem::getColor -// Purpose : returns item's color -//================================================================ -QColor GraphItem::getColor() { - if (myHasOwnColor) - return myOwnColor; - else - if (myParent) - return myParent->getColor(myColor); - return QColor(); -} - -//================================================================ -// Function : GraphItem::setLine -// Purpose : sets own line -//================================================================ -void GraphItem::setLine(const Qt::PenStyle line) { - myOwnLine = line; - myHasOwnLine = true; -} - -//================================================================ -// Function : GraphItem::getLine -// Purpose : returns item's line type -//================================================================ -Qt::PenStyle GraphItem::getLine() { - if (myHasOwnLine) - return myOwnLine; - else - if (myParent) - return myParent->getLine(myLine); - return Qt::SolidLine; -} - -//================================================================ -// Function : GraphItem::setmarker -// Purpose : sets own marker -//================================================================ -void GraphItem::setMarker(const int marker) { - myMarker = marker; - myHasOwnMarker = true; -} - -//================================================================ -// Function : GraphItem::getMarker -// Purpose : return item's marker type -//================================================================ -int GraphItem::getMarker() { - return myMarker; -} - -//================================================================ -// Function : GraphItem::getMarker -// Purpose : gets marker atributes -//================================================================ -void GraphItem::getMarker(int& marker, int& color, int& line) { - marker = myMarker; - color = myColor; - line = myLine; -} - -//================================================================ -// Function : GraphItem::init -// Purpose : performs initialization -//================================================================ -void GraphItem::init() { - // setting invalid marker - setMarker(-1, -1, -1); - myHasOwnMarker = false; - myOwnColor = QColor(255, 255, 255); - myHasOwnColor = false; - myOwnLine = Qt::SolidLine; - myHasOwnLine = false; -} - -////////////////////////////////////////////////////////////////////// -// GraphLegend -////////////////////////////////////////////////////////////////////// -#include - -#define LEGEND_ITEM_SIZE 100 - -//================================================================ -// Function : GraphLegend::GraphLegend -// Purpose : constructor -//================================================================ -GraphLegend::GraphLegend(QWidget* parent, GraphView* graph) - : QWidget(parent), - myGraph(graph) { - myGraph->setLegend(this); - setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); - setMinimumSize(1, 1); - - setTitle("LEGEND"); - myShowTitle = true; - - updateMe(); -} - -//================================================================ -// Function : GraphLegend::drawContents -// Purpose : draws contents -//================================================================ -void GraphLegend::paintEvent(QPaintEvent* e) -{ - QPainter painter(this); - QColor bgcolor = myGraph->palette().color(myGraph->backgroundRole()); - painter.fillRect(e->rect(), bgcolor); - QFontMetrics fm(font()); - int aMSize = myGraph->getMarkerSize(); - int aTH = MAX(fm.height(), aMSize); - int i; - int aNb = myGraph->getNbItems(); - int aFromX; - int aFromY = SPACING_SIZE; - painter.setPen(palette().color(QPalette::Text));//QPalette::Active, - if (myShowTitle && !myTitle.isEmpty()) { - QFontMetrics fmt(myTitleFont); - int aTWT = fmt.width(myTitle); - int aTHT = fmt.height(); - aFromX = (width() - aTWT) / 2; - painter.setFont(myTitleFont); - painter.drawText(aFromX, - aFromY, - aTWT, - aTHT, - Qt::AlignCenter, - myTitle); - aFromY += (aTHT + SPACING_SIZE); - } - aFromX = SPACING_SIZE * 2 + MAX(LEGEND_ITEM_SIZE, aMSize); - painter.setFont(font()); - for (i = 0; i < aNb; i++) { - GraphItem* item = myGraph->getItem(i); - QColor color = item->getColor(); - Qt::PenStyle line = item->getLine(); - int marker = item->getMarker(); - painter.setPen(QPen(color, 0, line)); - painter.drawLine(SPACING_SIZE, - (SPACING_SIZE + aTH ) * i + aFromY + aTH/2, - SPACING_SIZE + LEGEND_ITEM_SIZE, - (SPACING_SIZE + aTH ) * i + aFromY + aTH/2); - myGraph->drawMarker(&painter, - QPoint(SPACING_SIZE + LEGEND_ITEM_SIZE/2, - (SPACING_SIZE + aTH ) * i + aFromY + aTH/2), - marker, - color); - QString aName = item->getName(); - painter.setPen(palette().color(QPalette::Text)); //QPalette::Active, - if (aName.isEmpty()) - aName = QString("[ Item ") + QString::number(i+1) + QString(" ]"); - int aTW = fm.width(aName); - painter.drawText(aFromX, - (SPACING_SIZE + aTH ) * i + aFromY, - aTW, - aTH, - Qt::AlignLeft | Qt::AlignVCenter, - aName); - } - //painter.flush(); -} - -//================================================================ -// Function : GraphLegend::updateMe -// Purpose : updates legend contents -//================================================================ -void GraphLegend::updateMe() { - setPalette(myGraph->palette()); - //setFont(myGraph->font()); - QFont aFont = font(); - QFontMetrics fm(aFont); - int i; - int aNb = myGraph->getNbItems(); - int xSize = 0; - int ySize = (MAX(fm.height(), myGraph->getMarkerSize()) + SPACING_SIZE) * aNb + SPACING_SIZE; - for (i = 0; i < aNb; i++) { - QString aName = myGraph->getItem(i)->getName(); - if (aName.isEmpty()) - aName = QString("[ Item ") + QString::number(i+1) + QString(" ]"); - int aTW = fm.width(aName); - if (aTW > xSize) - xSize = aTW; - } - xSize += SPACING_SIZE * 3 + MAX(LEGEND_ITEM_SIZE, myGraph->getMarkerSize()); - if (myShowTitle && !myTitle.isEmpty()) { - QFontMetrics fmt(myTitleFont); - int aTWT = fmt.width(myTitle); - int aTHT = fmt.height(); - xSize = MAX(xSize, (aTWT + SPACING_SIZE * 2)); - ySize += (aTHT + SPACING_SIZE); - } - resize(xSize, ySize); - update(); -} - -//================================================================ -// Function : GraphLegend::showTitle -// Purpose : shows/hides legend title -//============================= =================================== -void GraphLegend::showTitle(bool show) { - myShowTitle = show; - updateMe(); -} - -//================================================================ -// Function : GraphLegend::setTitle -// Purpose : sets legend title -//================================================================ -void GraphLegend::setTitle(const QString& title) { - myTitle = title; - updateMe(); -} - -//================================================================ -// Function : GraphLegend::tip -// Purpose : handles tooltips for the view -//================================================================ -QRect GraphLegend::tip(const QPoint& point, QString& tipText) { - QPoint cPoint = point;//= viewportToContents(point); - GraphItem* item = itemAt(cPoint); - if (!item) - return QRect(0, 0, -1, -1); - QRect tRect = textRect(item, tipText); - QPoint tl = tRect.topLeft();//contentsToViewport(tRect.topLeft()); - QPoint br = tRect.bottomRight();//contentsToViewport(tRect.bottomRight()); - if (tl.x() < 0 || - tl.y() < 0 || - br.x() > width() || - br.y() > height()) { - return QRect(0, tl.y(), width(), tRect.height()); - } - return QRect(0, 0, -1, -1); -} - -//================================================================ -// Function : GraphLegend::itemAt -// Purpose : returns graph item which is below the point or NULL -//================================================================ -GraphItem* GraphLegend::itemAt(const QPoint& point) { - QFont aFont = font(); - QFontMetrics fm(aFont); - int aMSize = myGraph->getMarkerSize(); - int aTH = MAX(fm.height(), myGraph->getMarkerSize()); - int i; - int aFromY = SPACING_SIZE; - if (myShowTitle && !myTitle.isEmpty()) { - QFontMetrics fmt(myTitleFont); - int aTHT = fmt.height(); - aFromY += (aTHT + SPACING_SIZE); - } - if (point.y() <= aFromY) - return 0; - for (i = 0; i < myGraph->getNbItems(); i++) { - GraphItem* item = myGraph->getItem(i); - if (point.y() < aFromY + aTH) - return item; - aFromY += (aTH + SPACING_SIZE); - } - return 0; -} - -//================================================================ -// Function : GraphLegend::textRect -// Purpose : returns rect which contains item's name -//================================================================ -QRect GraphLegend::textRect(GraphItem* item, QString& tipText) { - QString aName = item->getName(); - int index = myGraph->findItem(item); - if (aName.isEmpty()) { - if (index < 0) - return QRect(0, 0, -1, -1); - aName = QString("[ Item ") + QString::number(index + 1) + QString(" ]"); - } - tipText = aName; - QFont aFont = font(); - QFontMetrics fm(aFont); - int aTH = MAX(fm.height(), myGraph->getMarkerSize()); - int aTW = fm.width(aName); - int aFromY = SPACING_SIZE; - if (myShowTitle && !myTitle.isEmpty()) { - QFontMetrics fmt(myTitleFont); - int aTHT = fmt.height(); - aFromY += (aTHT + SPACING_SIZE); - } - aFromY += (aTH + SPACING_SIZE) * index; - return QRect(SPACING_SIZE * 2 + MAX(LEGEND_ITEM_SIZE, myGraph->getMarkerSize()), - aFromY, - aTW, - aTH); -} - -//================================================================ -// Function : GraphLegend::setTitleFont -// Purpose : sets legend title font -//================================================================ -void GraphLegend::setTitleFont(QFont& font) { - myTitleFont = font; - update(); //repaint(false); -} - -//================================================================ -// Function : GraphLegend::setItemFont -// Purpose : sets item font -//================================================================ -void GraphLegend::setItemFont(QFont& font) { - setFont(font); - update(); //repaint(false); -} - -//================================================================ -// Function : GraphLegend::event -// Purpose : global event handler -//================================================================ -bool GraphLegend::event(QEvent* e) -{ - if (e->type() == QEvent::ToolTip) { - QHelpEvent* helpEvent = static_cast(e); - QString tipText; - QRect r = tip(helpEvent->pos(), tipText); - if (r.isValid() && !tipText.isEmpty() ) - QToolTip::showText(helpEvent->globalPos(), tipText, this, r); - else - QToolTip::hideText(); - } - return QWidget::event(e); -} - -//================================================================ -// Function : GraphLegend::minimumSizeHint -// Purpose : minimum size -//================================================================ -QSize GraphLegend::minimumSizeHint() const -{ - return QSize(100, 100); -} - -//================================================================ -// Function : GraphLegend::sizeHint -// Purpose : size hint -//================================================================ -QSize GraphLegend::sizeHint() const -{ - return minimumSizeHint(); -} - -////////////////////////////////////////////////////////////////////// -// GraphSplitView -////////////////////////////////////////////////////////////////////// - -//================================================================ -// Function : GraphSplitView::GraphSplitView -// Purpose : constructor -//================================================================ -GraphSplitView::GraphSplitView(QWidget* parent) -: QWidget(parent), myGraph(0) -{ - // creating window layout - QVBoxLayout* aLayout = new QVBoxLayout(this); - aLayout->setMargin(0); - - mySplitter = new QSplitter(Qt::Horizontal, this); - aLayout->addWidget(mySplitter); - - myGraph = new GraphView(mySplitter); - GraphLegend* legend = new GraphLegend(mySplitter, myGraph); - - mySplitter->setStretchFactor(0, 5); -} - -//================================================================ -// Function : GraphSplitView::getLegend -// Purpose : returns legend view -//================================================================ -GraphLegend* GraphSplitView::getLegend() -{ - return myGraph ? myGraph->getLegend() : 0; -} - -//================================================================ -// Function : GraphSplitView::showLegend -// Purpose : shows/hides legend view -//================================================================ -void GraphSplitView::showLegend(bool show) -{ - getLegend()->setVisible(show); -} - -//================================================================ -// Function : GraphSplitView::isLegendShown -// Purpose : returns true if legend is being shown -//================================================================ -bool GraphSplitView::isLegendShown() -{ - return getLegend()->isVisible(); -} diff --git a/samples/qt/Graphic3dDemo/src/Graphic3dDemo.cxx b/samples/qt/Graphic3dDemo/src/Graphic3dDemo.cxx deleted file mode 100755 index 94b225b411..0000000000 --- a/samples/qt/Graphic3dDemo/src/Graphic3dDemo.cxx +++ /dev/null @@ -1,54 +0,0 @@ -#include - -#include -#include -#include -#include -#include - -#include "global.h" -#include "Application.h" - -#define GLOBAL_CONTEXT "@default" - -class Translator : public QTranslator -{ -public: - Translator( QObject* parent = 0 ) : QTranslator( parent ) {} - virtual QString translate( const char* context, - const char* sourceText, - const char* comment = 0 ) const - { - QString res = QTranslator::translate( context, sourceText, comment ); - if( res.isNull() ) - res = QTranslator::translate( GLOBAL_CONTEXT, sourceText, comment ); - return res; - } -}; - -int main(int argc, char* argv[]) -{ - QApplication a( argc, argv ); - - QString dir( getenv( "CSF_ResourcesDefaults" ) ); - - Translator msg( 0 ), img( 0 ); - msg.load( "Sample_msg.qm", dir ); - a.installTranslator( &msg ); - - img.load( "Sample_icons.qm", dir ); - a.installTranslator( &img ); - - QPixmap pix( dir + QString( "/" ) + QObject::tr( "ICON_SAMPLE" ) ); - - Application* app = new Application(); - app->setWindowTitle( QObject::tr( "TIT_SAMPLE" ) ); - app->setWindowIcon( pix ); - - QApplication::setOverrideCursor( Qt::WaitCursor ); - app->show(); - app->InitApp(); - QApplication::restoreOverrideCursor(); - - return a.exec(); -} diff --git a/samples/qt/Graphic3dDemo/src/MDIWindow.cxx b/samples/qt/Graphic3dDemo/src/MDIWindow.cxx deleted file mode 100755 index 8d175921ab..0000000000 --- a/samples/qt/Graphic3dDemo/src/MDIWindow.cxx +++ /dev/null @@ -1,206 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "MDIWindow.h" -#include "global.h" -#include "Document.h" -#include "View.h" -#include "ViewOperations.h" -#include "Graph.h" -#include "Application.h" - -MDIWindow::MDIWindow( Document* aDocument, QWidget* parent, V3d_TypeOfView type ) -: QMainWindow( parent ) -{ - resize( 500, 300 ); - QSplitter* central = new QSplitter(Qt::Vertical, this); - - myDocument = aDocument; - Handle(AIS_InteractiveContext) cxt = myDocument->getContext(); - cxt->CurrentViewer()->SetDefaultTypeOfView( type ); - myView = new View( cxt, central, this ); - verify(connect(myView, SIGNAL(ViewInitialized()), - Application::getApplication(), SLOT(updateViewDlg()))); - - // Graph initialization - myGraphView = new GraphSplitView(central); - GraphView* pGraph = myGraphView->getGraph(); - GraphItem* pItem = new GraphItem(pGraph, tr("LEG_NONOPT_DISPLAY")); - pItem->setSorted(true); - pItem->setMarker(0, QColor( Qt::blue ), Qt::SolidLine); - pItem->addNode(0, 0); - pItem = new GraphItem(pGraph, tr("LEG_OPT_DISPLAY")); - pItem->setSorted(true); - pItem->setMarker(1, QColor( Qt::red ), Qt::SolidLine); - pItem->addNode(0, 0); - pItem = new GraphItem(pGraph, tr("LEG_NONOPT_UPDATE")); - pItem->setSorted(true); - pItem->setMarker(2, QColor( Qt::blue ), Qt::DotLine); - pItem->addNode(0, 0); - pItem = new GraphItem(pGraph, tr("LEG_OPT_UPDATE")); - pItem->setSorted(true); - pItem->setMarker(3, QColor( Qt::red ), Qt::DotLine); - pItem->addNode(0, 0); - pGraph->setXTitle(tr("LAB_TRIANGLES")); - pGraph->setYTitle(tr("LAB_SECONDS")); - pGraph->installEventFilter(this); - pGraph->setOperationEnabled(GraphView::voRect, true); - pGraph->setOperationEnabled(GraphView::voZoom, true); - pGraph->setOperationEnabled(GraphView::voZoomX, true); - pGraph->setOperationEnabled(GraphView::voZoomY, true); - pGraph->setOperationEnabled(GraphView::voPan, true); - pGraph->setOperationEnabled(GraphView::voPanX, true); - pGraph->setOperationEnabled(GraphView::voPanY, true); - - central->setStretchFactor(0, 5); - central->setStretchFactor(1, 1); - setCentralWidget( central ); - - myGraphPopup = new QMenu(pGraph); - - myOperations = new ViewOperations( myDocument->getContext() ); - - verify( connect( myView, SIGNAL( noActiveActions() ), - myOperations, SLOT( onNoActiveActions() ) ) ); - verify( connect( myOperations, SIGNAL( setCursor( const QCursor& ) ), - SLOT( setCursor( const QCursor& ) ) ) ); - - createViewActions(); - createGraphActions(); -} - -MDIWindow::~MDIWindow() -{ - delete myGraphView; -} - -Document* MDIWindow::getDocument() -{ - return myDocument; -} - -int MDIWindow::getDisplayMode() -{ - return myOperations->getDisplayMode(); -} - -void MDIWindow::closeEvent(QCloseEvent* e) -{ - emit sendCloseView( this ); -} - -void MDIWindow::createViewActions() -{ - QToolBar* aToolBar = new QToolBar( tr( "View Operations" ), this ); - addToolBar( Qt::TopToolBarArea, aToolBar ); - - QList aList = myOperations->getToolActions(); - - QActionGroup* dModeGroup = new QActionGroup( aToolBar ); - QAction* a; - - int i = 0; - foreach( a, aList ) { - aToolBar->addAction( a ); -// if ( i == 1 ) -// aToolBar->addSeparator(); - if ( i == ViewOperations::ToolWireframeId || i == ViewOperations::ToolShadingId ) { - dModeGroup->addAction( a ); - } - i++; - } - aToolBar->addSeparator(); - - aList = myOperations->getViewActions(); - foreach( a, aList ) aToolBar->addAction( a ); -} - -void MDIWindow::setCursor(const QCursor& aCursor) -{ - myView->setCursor(aCursor); -} - -void MDIWindow::defineMagView() -{ - myView->setCurrentAction(); -} - -Handle(V3d_View)& MDIWindow::getView() -{ - return myView->getView(); -} - -void MDIWindow::activateAction( ViewOperations::Action action ) -{ - myView->startAction( action ); -} - -void MDIWindow::addResult(ResultType item, int x, double y) -{ - if (item == Undefined) return; - - GraphView* pGraph = myGraphView->getGraph(); - pGraph->getItem((int)item)->addNode(x, y); - double xMin, xMax, yMin, yMax; - pGraph->getRange(xMin, yMin, xMax, yMax); - pGraph->fitData(0, xMax, 0, yMax); -} - -bool MDIWindow::eventFilter(QObject* dstObj, QEvent* event) -{ - if (event->type() == QEvent::MouseButtonPress) - { - QMouseEvent* mEvent = (QMouseEvent*)event; - if (mEvent->button() == Qt::RightButton && - !(mEvent->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier))) - graphPopup(mEvent->globalPos()); - } - return FALSE; -} - -void MDIWindow::createGraphActions() -{ - QAction* a = new QAction( tr( "MEN_GRAPH_FIT_ALL" ), this ); - a->setToolTip( tr( "TBR_GRAPH_FIT_ALL" ) ); - verify( connect( a, SIGNAL( activated() ) , this, SLOT( onGraphFitAll() ) ) ); - myGraphPopup->addAction( a ); - - myGraphPopup->addSeparator(); - - a = new QAction( tr( "MEN_GRAPH_CLEAR" ), this ); - a->setToolTip( tr( "TBR_GRAPH_CLEAR" ) ); - verify( connect( a, SIGNAL( activated() ) , this, SLOT( onGraphClear() ) ) ); - myGraphPopup->addAction( a ); -} - -void MDIWindow::graphPopup(const QPoint& pos) -{ - myGraphPopup->popup(pos); -} - -void MDIWindow::onGraphClear() -{ - GraphView* graph = myGraphView->getGraph(); - for (int i = 0; i < graph->getNbItems(); i++) - { - graph->getItem(i)->clear(); - graph->getItem(i)->addNode(0, 0); - } - graph->repaint(); -} - -void MDIWindow::onGraphFitAll() -{ - GraphView* graph = myGraphView->getGraph(); - double xMin, xMax, yMin, yMax; - graph->getRange(xMin, yMin, xMax, yMax); - graph->fitData(0, xMax, 0, yMax); -} diff --git a/samples/qt/Graphic3dDemo/src/ObjectDlg.cxx b/samples/qt/Graphic3dDemo/src/ObjectDlg.cxx deleted file mode 100755 index 449f54d2c2..0000000000 --- a/samples/qt/Graphic3dDemo/src/ObjectDlg.cxx +++ /dev/null @@ -1,291 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ObjectDlg.h" -#include "global.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -ObjectDlg::ObjectDlg( QWidget* parent, Handle(V3d_View)& view, - Handle(AIS_InteractiveContext)& cxt ) -: QDialog( parent ), - myAutoApply( true ), myView( view ), myContext( cxt ) -{ - setModal( false ); - setWindowTitle( tr( "TITLE_OBJECT_DLG" ) ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 5 ); - - QFrame* mainFrame = new QFrame( this ); - mainFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( mainFrame ); - topLayout->addSpacing( 10 ); - - // view properties - QGridLayout* pLayout = new QGridLayout( mainFrame ); - pLayout->setMargin( 5 ); - myDegModelLabel = new QLabel( tr("MEN_DLG_DEGMODEL"), mainFrame ); - myDegRatioLabel = new QLabel( tr("MEN_DLG_DEGRATIO"), mainFrame ); - - myDegModelBox = new QComboBox( mainFrame ); - myDegModelBox->addItem( tr( "MEN_DLG_NODEGENERATION" ) ); - myDegModelBox->addItem( tr( "MEN_DLG_TINYDEGENERATION" ) ); - myDegModelBox->addItem( tr( "MEN_DLG_WIREDEGENERATION" ) ); - myDegModelBox->addItem( tr( "MEN_DLG_MARKERDEGENERATION" ) ); - myDegModelBox->addItem( tr( "MEN_DLG_BBOXDEGENERATION" ) ); - myCurrentDegModel = NoDegId; - myCurrentDegRatio = 0.; - verify( connect( myDegModelBox, SIGNAL( activated( int ) ), SLOT( onDegenerateModel( int ) ) ) ); - - //QSpinBox* degRatioSpin = new QSpinBox( mainFrame ); -//QSpinBox ( QWidget * parent = 0, const char * name = 0 ) - myDegRatioSpin = new QSpinBox( mainFrame ); - myDegRatioSpin->setRange(0, 10); - myDegRatioSpin->setSingleStep(1); - verify( connect( myDegRatioSpin, SIGNAL( valueChanged( int ) ), SLOT( onDegRatio( int ) ) ) ); - - QCheckBox* showEdges = new QCheckBox( mainFrame ); - showEdges->setText( tr( "BTN_SHOWEDGES" ) ); - verify( connect( showEdges, SIGNAL( toggled( bool ) ), SLOT( onShowEdges( bool ) ) ) ); - - myEdgeStyle = new QLabel( tr("MEN_DLG_EDGESTYLE"), mainFrame ); - myEdgeWidth = new QLabel( tr("MEN_DLG_EDGEWIDTH"), mainFrame ); - - myEdgeBox = new QComboBox( mainFrame ); - myEdgeBox->addItem( tr( "MEN_DLG_EDGESOLID" ) ); - myEdgeBox->addItem( tr( "MEN_DLG_EDGEDASH" ) ); - myEdgeBox->addItem( tr( "MEN_DLG_EDGEDOT" ) ); - myEdgeBox->addItem( tr( "MEN_DLG_EDGEDOTDASH" ) ); - myCurrentEdgeStyle = SolidEdgeId; - verify( connect( myEdgeBox, SIGNAL( activated( int ) ), SLOT( onEdgeStyle( int ) ) ) ); - - //myEdgeSpin = new QSpinBox( mainFrame ); - myEdgeSpin = new QSpinBox( mainFrame ); - myEdgeSpin->setRange(1, 10); - myEdgeSpin->setSingleStep(10); - verify( connect( myEdgeSpin, SIGNAL( valueChanged( int ) ), SLOT( onEdgeWidth( int ) ) ) ); - - onShowEdges( false ); - - pLayout->addWidget( myDegModelLabel, 0, 0 ); - pLayout->addWidget( myDegRatioLabel, 1, 0 ); - pLayout->addWidget( myDegModelBox, 0, 2 ); - pLayout->addWidget( myDegRatioSpin, 1, 2 ); - pLayout->addWidget( showEdges, 2, 0 ); - pLayout->addWidget( myEdgeStyle, 3, 0 ); - pLayout->addWidget( myEdgeWidth, 4, 0 ); - pLayout->addWidget( myEdgeBox, 3, 2 ); - pLayout->addWidget( myEdgeSpin, 4, 2 ); - pLayout->setRowStretch( 5, 10 ); - pLayout->setColumnStretch( 1, 10 ); - - // apply controls - QCheckBox *autoApply; - autoApply = new QCheckBox( this ); - autoApply->setText( tr( "BTN_AUTOAPPLY" ) ); - autoApply->setChecked( true ); - verify( connect( autoApply, SIGNAL( toggled( bool ) ), SLOT( onAutoApply( bool ) ) ) ); - - QHBoxLayout* applyLayout = new QHBoxLayout(); - applyLayout->addWidget( autoApply ); - applyLayout->addStretch( 10 ); - topLayout->addLayout(applyLayout); - topLayout->addSpacing( 10 ); - - // control buttons - QPushButton *bOk, *bCancel/*, *bHelp*/; - bOk = new QPushButton( tr( "BTN_OK" ), this ); - verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) ); - bCancel = new QPushButton( tr( "BTN_CANCEL" ), this ); - verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) ); -// bHelp = new QPushButton( tr( "BTN_HELP" ), this ); -// verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) ); - - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setSpacing( 5 ); - btnLayout->addStretch( 10 ); - btnLayout->addWidget( bOk ); - btnLayout->addWidget( bCancel ); - btnLayout->addStretch( 10 ); - // btnLayout->addWidget( bHelp ); - topLayout->addLayout(btnLayout); - - QSize s = topLayout->totalMinimumSize(); - s.setWidth( s.width() + topLayout->margin() + 10 ); - s.setHeight( s.height() + topLayout->margin() + 10 ); - setFixedSize( s ); -} - -ObjectDlg::~ObjectDlg() -{ -} - -void ObjectDlg::showEvent ( QShowEvent* e ) -{ - QWidget::showEvent( e ); - - Standard_Boolean isDeg, isAnim, isEnabled; - isAnim = myView->AnimationMode( isDeg ); - isEnabled = isDeg && isAnim; - myDegModelLabel->setEnabled( isEnabled ); - myDegRatioLabel->setEnabled( isEnabled ); - myDegModelBox->setEnabled( isEnabled ); - myDegRatioSpin->setEnabled( isEnabled ); -} - -void ObjectDlg::onOk() -{ - hide(); -} - -void ObjectDlg::onCancel() -{ - hide(); -} - -void ObjectDlg::onHelp() -{ -} - -void ObjectDlg::onShowEdges( bool on ) -{ - if ( myAutoApply ) { - myEdgeStyle->setEnabled( on ); - myEdgeWidth->setEnabled( on ); - myEdgeBox->setEnabled( on ); - myEdgeSpin->setEnabled( on ); - - Handle(AIS_InteractiveObject) object; - Handle(Prs3d_ShadingAspect) aspect; - myContext->InitSelected(); - for( ; myContext->MoreSelected(); myContext->NextSelected() ) { - object = myContext->SelectedInteractive(); - aspect = object->Attributes()->ShadingAspect(); - if ( on ) - aspect->Aspect()->SetEdgeOn(); - else - aspect->Aspect()->SetEdgeOff(); - object->SetAspect( aspect ); - } - //myContext->UpdateCurrentViewer(); - myView->Update(); - } -} - -void ObjectDlg::onDegenerateModel( int index ) -{ - if ( myCurrentDegModel != index ) { - - switch ( index ) { - case NoDegId : - myDegModel = Aspect_TDM_NONE; - break; - case TinyDegId : - myDegModel = Aspect_TDM_TINY; - break; - case WireDegId : - myDegModel = Aspect_TDM_WIREFRAME; - break; - case MarkerDegId : - myDegModel = Aspect_TDM_MARKER; - break; - case BBoxDegId : - myDegModel = Aspect_TDM_BBOX; - break; - } - myCurrentDegModel = index; - updateDegenerationModel(); - } -} - -void ObjectDlg::onDegRatio( int ratio ) -{ - myCurrentDegRatio = ratio / 10.; - updateDegenerationModel(); -} - -void ObjectDlg::onEdgeStyle( int index ) -{ - if ( myCurrentEdgeStyle != index ) { - myCurrentEdgeStyle = index; - updateEdgeAspect( true ); - } -} - -void ObjectDlg::onEdgeWidth( int value ) -{ - myCurrentEdgeWidth = (float) value; - updateEdgeAspect( false ); -} - -void ObjectDlg::onAutoApply( bool on ) -{ - myAutoApply = on; -} - -void ObjectDlg::updateEdgeAspect( bool edgeStyle ) -{ - Aspect_TypeOfLine type; - if ( edgeStyle ) - switch( myCurrentEdgeStyle ) { - case SolidEdgeId : - type = Aspect_TOL_SOLID; - break; - case DashEdgeId : - type = Aspect_TOL_DASH; - break; - case DotEdgeId : - type = Aspect_TOL_DOT; - break; - case DotDashEdgeId : - type = Aspect_TOL_DOTDASH; - break; - } - Handle(AIS_InteractiveObject) object; - Handle(Prs3d_ShadingAspect) aspect; - myContext->InitSelected(); - for( ; myContext->MoreSelected(); myContext->NextSelected() ) { - object = myContext->SelectedInteractive(); - aspect = object->Attributes()->ShadingAspect(); - if ( edgeStyle ) - aspect->Aspect()->SetEdgeLineType( type ); - else - aspect->Aspect()->SetEdgeWidth( myCurrentEdgeWidth ); - object->SetAspect( aspect ); - } - if ( myAutoApply ) - //myContext->UpdateCurrentViewer(); - myView->Viewer()->Update(); -} - -void ObjectDlg::updateDegenerationModel() -{ - //myView->SetAnimationModeOff(); - Handle(AIS_InteractiveObject) object; - for( myContext->InitSelected(); myContext->MoreSelected(); myContext->NextSelected() ) { - object = myContext->SelectedInteractive(); - object->SetDegenerateModel( myDegModel, myCurrentDegRatio ); - } - //myView->SetAnimationModeOn(); - - if ( myAutoApply ) - //myView->Update(); - myContext->UpdateCurrentViewer(); -} diff --git a/samples/qt/Graphic3dDemo/src/ShapeDlg.cxx b/samples/qt/Graphic3dDemo/src/ShapeDlg.cxx deleted file mode 100755 index 44cd91299d..0000000000 --- a/samples/qt/Graphic3dDemo/src/ShapeDlg.cxx +++ /dev/null @@ -1,357 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ShapeDlg.h" -#include "Application.h" -#include "MDIWindow.h" -#include "Document.h" -#include "global.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -ShapeDlg::ShapeDlg( QWidget* parent, Handle(V3d_View)& view, - Handle(AIS_InteractiveContext)& cxt ) -: QDialog( parent ), - myView( view ), myContext( cxt ) -{ - setModal( false ); - setWindowTitle( tr( "TITLE_SHAPE_DLG" ) ); - - myRadius = 100; - myDeflection = 1.0; - myNbPanes = 0; - myNbItems = 0; - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 5 ); - - // radius frame - QFrame* rFrame = new QFrame( this ); - //rFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( rFrame ); - topLayout->addSpacing( 10 ); - - QHBoxLayout* rBox = new QHBoxLayout( rFrame ); - rBox->setMargin( 5 ); - QLabel* rad = new QLabel( tr( "MEN_DLG_RADIUS" ), rFrame ); - QDoubleSpinBox* rSpin = new QDoubleSpinBox( rFrame ); - rSpin->setRange( 1, 10000 ); - rSpin->setSingleStep( 1 ); -// rSpin->setValueDouble( myRadius ); - rSpin->setValue( myRadius ); -// verify( connect( rSpin, SIGNAL( sbdValueChanged( double ) ), SLOT( onRadiusChanged( double ) ) ) ); - verify( connect( rSpin, SIGNAL( valueChanged( double ) ), SLOT( onRadiusChanged( double ) ) ) ); - - rBox->addWidget( rad ); - rBox->addWidget( rSpin ); - rBox->addStretch( 2 ); - - // sphere position frame - QFrame* pFrame = new QFrame( this ); - QHBoxLayout* pBox = new QHBoxLayout( pFrame ); - pBox->setMargin( 5 ); - - pFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( pFrame ); - topLayout->addSpacing( 10 ); - - QLabel *lX, *lY, *lZ; - - lX = new QLabel( tr( "MEN_DLG_X" ), pFrame ); - lY = new QLabel( tr( "MEN_DLG_Y" ), pFrame ); - lZ = new QLabel( tr( "MEN_DLG_Z" ), pFrame ); - - myXSpin = new QDoubleSpinBox( pFrame ); - myXSpin->setRange( -10000, 10000 ); - myXSpin->setSingleStep( 1 ); - myXSpin->setValue( 0 ); - connect(myXSpin, SIGNAL(valueChanged (double)), SLOT(onPositionChanged())); - myYSpin = new QDoubleSpinBox( pFrame ); - myYSpin->setRange( -10000, 10000 ); - myYSpin->setSingleStep( 1 ); - myYSpin->setValue( 0 ); - connect(myYSpin, SIGNAL(valueChanged (double)), SLOT(onPositionChanged())); - myZSpin = new QDoubleSpinBox( pFrame ); - myZSpin->setRange( -10000, 10000 ); - myZSpin->setSingleStep( 1 ); - myZSpin->setValue( 0 ); - connect(myZSpin, SIGNAL(valueChanged (double)), SLOT(onPositionChanged())); - - - pBox->addStretch( 2 ); - pBox->addWidget( lX ); - pBox->addWidget( myXSpin ); - pBox->addStretch( 2 ); - pBox->addWidget( lY ); - pBox->addWidget( myYSpin ); - pBox->addStretch( 2 ); - pBox->addWidget( lZ ); - pBox->addWidget( myZSpin ); - pBox->addStretch( 2 ); - - // sphere aspect frame - QFrame* aFrame = new QFrame( this ); - QHBoxLayout* aBox = new QHBoxLayout( aFrame ); - aBox->setMargin( 5 ); - - aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( aFrame ); - topLayout->addSpacing( 10 ); - - myVNormal = new QCheckBox( aFrame ); - myVNormal->setText( tr( "MEN_BTN_VNORMAL" ) ); - myVNormal->setChecked( true ); - //verify( connect( myVNormal, SIGNAL( toggled( bool ) ), SLOT( onShowEdges( bool ) ) ) ); - - myVColor = new QCheckBox( aFrame ); - myVColor->setText( tr( "MEN_BTN_VCOLOR" ) ); - //verify( connect( myVColor, SIGNAL( toggled( bool ) ), SLOT( onShowEdges( bool ) ) ) ); - - myVTexel = new QCheckBox( aFrame ); - myVTexel->setText( tr( "MEN_BTN_VTEXEL" ) ); - //verify( connect( myVTexel, SIGNAL( toggled( bool ) ), SLOT( onShowEdges( bool ) ) ) ); - - myText = new QCheckBox( aFrame ); - myText->setText( tr( "MEN_BTN_TEXT" ) ); - verify( connect( myText, SIGNAL( clicked() ), SLOT( onText() ) ) ); - - aBox->addStretch( 2 ); - aBox->addWidget( myVNormal ); - aBox->addStretch( 2 ); - aBox->addWidget( myVColor ); - aBox->addStretch( 2 ); - aBox->addWidget( myVTexel ); - aBox->addStretch( 2 ); - aBox->addWidget( myText ); - aBox->addStretch( 2 ); - - // tesselation frame - QFrame* tFrame = new QFrame( this ); - QHBoxLayout* tBox = new QHBoxLayout( tFrame ); - tBox->setMargin( 5 ); - - tFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( tFrame ); - topLayout->addSpacing( 10 ); - - QLabel *defl, *panes, *items; - - defl = new QLabel( tr( "MEN_DLG_DEFLECTION" ), tFrame ); - panes = new QLabel( tr( "MEN_DLG_PANES" ), tFrame ); - items = new QLabel( tr( "MEN_DLG_ITEMS" ), tFrame ); - - myDefSpin = new QDoubleSpinBox( tFrame ); - myDefSpin->setRange( 0.1, 13 ); - myDefSpin->setSingleStep( 0.1 ); - myDefSpin->setValue( 1 ); - verify( connect( myDefSpin, SIGNAL( valueChanged( double ) ), SLOT( onDeflectionChanged( double ) ) ) ); - myPanesSpin = new QSpinBox( tFrame ); - myPanesSpin->setRange( 8, 10000 ); - myPanesSpin->setSingleStep( 1 ); - verify( connect( myPanesSpin, SIGNAL( valueChanged( int ) ), SLOT( onPanesChanged( int ) ) ) ); - myItemsSpin = new QSpinBox( tFrame ); - myItemsSpin->setRange( 25, 10000000 ); - myItemsSpin->setSingleStep( 1 ); - verify( connect( myItemsSpin, SIGNAL( valueChanged( int ) ), SLOT( onItemsChanged( int ) ) ) ); - - tBox->addWidget( defl ); - tBox->addWidget( myDefSpin ); - tBox->addWidget( panes ); - tBox->addWidget( myPanesSpin ); - tBox->addWidget( items ); - tBox->addWidget( myItemsSpin ); - - // control buttons - QPushButton *bOk, *bCancel/*, *bHelp*/; - bOk = new QPushButton( tr( "BTN_OK" ), this ); - bOk->setDefault(true); - verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) ); - bCancel = new QPushButton( tr( "BTN_CANCEL" ), this ); - verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) ); - verify( connect( this, SIGNAL( destroyed() ), SLOT( onCancel() ) ) ); -// bHelp = new QPushButton( tr( "BTN_HELP" ), this ); -// verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) ); - - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setSpacing( 5 ); - btnLayout->addStretch( 10 ); - btnLayout->addWidget( bOk ); - btnLayout->addWidget( bCancel ); - btnLayout->addStretch( 10 ); -// btnLayout->addWidget( bHelp ); - topLayout->addLayout( btnLayout ); - - QSize s = topLayout->totalMinimumSize(); - s.setWidth( s.width() + topLayout->margin() + 10 ); - s.setHeight( s.height() + topLayout->margin() + 10 ); - setFixedSize( s ); -} - -ShapeDlg::~ShapeDlg() -{ -} - -void ShapeDlg::showEvent ( QShowEvent* e ) -{ - QWidget::showEvent( e ); -// myXSpin->setValueDouble( 0 ); -// myYSpin->setValueDouble( 0 ); -// myZSpin->setValueDouble( 0 ); - myXSpin->setValue( 0 ); - myYSpin->setValue( 0 ); - myZSpin->setValue( 0 ); - onRadiusChanged( myRadius ); -} - -void ShapeDlg::onOk() -{ - hide(); - updateSphere(); - myShape.Nullify(); -} - -void ShapeDlg::onCancel() -{ - hide(); - myContext->Remove( myShape ); - myShape.Nullify(); -} - -void ShapeDlg::onHelp() -{ -} - -void ShapeDlg::onRadiusChanged( double value ) -{ - myRadius = value; - - myNbPanes = Sphere_Sphere::NbPanes( myRadius, myDeflection ); - myNbItems = Sphere_Sphere::NbItems( myNbPanes ); - - myPanesSpin->blockSignals( true ); - myItemsSpin->blockSignals( true ); - - myPanesSpin->setValue( myNbPanes ); - myItemsSpin->setValue( myNbItems ); - - myPanesSpin->blockSignals( false ); - myItemsSpin->blockSignals( false ); - - updateSphere(); -} - -void ShapeDlg::onItemsChanged( int value ) -{ - myNbItems = value; - myNbPanes = Sphere_Sphere::NbPanes( myNbItems ); - myDeflection = Sphere_Sphere::Deflection( myRadius, myNbPanes ); - - myDefSpin->blockSignals( true ); - myPanesSpin->blockSignals( true ); - -// myDefSpin->setValueDouble( myDeflection ); - myDefSpin->setValue( myDeflection ); - myPanesSpin->setValue( myNbPanes ); - - myDefSpin->blockSignals( false ); - myPanesSpin->blockSignals( false ); - - updateSphere(); -} - -void ShapeDlg::onPanesChanged( int value ) -{ - myNbPanes = value; - myNbItems = Sphere_Sphere::NbItems( myNbPanes ); - myDeflection = Sphere_Sphere::Deflection( myRadius, myNbPanes ); - - myDefSpin->blockSignals( true ); - myItemsSpin->blockSignals( true ); - -// myDefSpin->setValueDouble( myDeflection ); - myDefSpin->setValue( myDeflection ); - myItemsSpin->setValue( myNbItems ); - - myDefSpin->blockSignals( false ); - myItemsSpin->blockSignals( false ); - - updateSphere(); -} - -void ShapeDlg::onDeflectionChanged( double value ) -{ - myDeflection = value; - myNbPanes = Sphere_Sphere::NbPanes( myRadius, myDeflection ); - myNbItems = Sphere_Sphere::NbItems( myNbPanes ); - - myPanesSpin->blockSignals( true ); - myItemsSpin->blockSignals( true ); - - myPanesSpin->setValue( myNbPanes ); - myItemsSpin->setValue( myNbItems ); - - myPanesSpin->blockSignals( false ); - myItemsSpin->blockSignals( false ); - - updateSphere(); -} - -void ShapeDlg::onText() -{ - updateSphere(); -} - - -void ShapeDlg::updateSphere() -{ - QApplication::setOverrideCursor( Qt::WaitCursor ); - bool visible = isVisible(); - gp_Pnt myPosition( myXSpin->value(), myYSpin->value(), myZSpin->value() ); - if ( !myShape.IsNull() ) { - myContext->Remove( myShape, false ); - myShape.Nullify(); - } - - myShape = - new Sphere_Sphere( myPosition, myRadius, myDeflection, 1/*myVNormalsFlag*/, - 0/*myVColorsFlag*/, 0/*myVTexelsFlag*/, myText->isChecked(), Graphic3d_ArrayOfPrimitives::IsEnable()); - myContext->SetDisplayMode( myShape, Application::getApplication()->getActiveMDI()->getDisplayMode(), false ); - Application::startTimer(); - myContext->Display( myShape, false ); - Application::stopTimer( 0, "Display Sphere::Sphere", !visible ); - Application::startTimer(); - myView->Update(); - Application::stopTimer( 0, "UPDATE", !visible ); - QApplication::restoreOverrideCursor(); -} - -void ShapeDlg::onPositionChanged() -{ - updateSphere(); -} - -void ShapeDlg::closeEvent ( QCloseEvent* e ) -{ - onCancel(); -} diff --git a/samples/qt/Graphic3dDemo/src/Sphere_BasicShape.cxx b/samples/qt/Graphic3dDemo/src/Sphere_BasicShape.cxx deleted file mode 100755 index a34906d787..0000000000 --- a/samples/qt/Graphic3dDemo/src/Sphere_BasicShape.cxx +++ /dev/null @@ -1,71 +0,0 @@ -#define xG005 - -#include -#include -#include -#include - -//================================================== -// Function: -// Purpose : -//================================================== - -Sphere_BasicShape::Sphere_BasicShape(const TopoDS_Shape& aShape, - const Standard_Real aDeflection, - const Standard_Boolean hasVNormals, - const Standard_Boolean hasVColors, - const Standard_Boolean hasVTexels -) : -AIS_Shape(aShape), -myDeflection(aDeflection), -myVNormalsFlag(hasVNormals), -myVColorsFlag(hasVColors), -myVTexelsFlag(hasVTexels) -{ -} - -void Sphere_BasicShape::SetPosition(const gp_Pnt& aPosition) { - gp_Trsf trsf; - trsf.SetTranslationPart(gp_Vec(aPosition.XYZ())); - TopLoc_Location location(trsf); - myshape.Location(location); -} - -gp_Pnt Sphere_BasicShape::Position() const { - TopLoc_Location location = myshape.Location(); - gp_Trsf trsf = location.Transformation(); - gp_XYZ xyz = trsf.TranslationPart(); - return gp_Pnt(xyz.X(),xyz.Y(),xyz.Z()); -} - -void Sphere_BasicShape::SetVNormals(const Standard_Boolean aFlag) { - myVNormalsFlag = aFlag; -} - -Standard_Boolean Sphere_BasicShape::VNormalsFlag() const { - return myVNormalsFlag; -} - -void Sphere_BasicShape::SetVColors(const Standard_Boolean aFlag) { - myVColorsFlag = aFlag; -} - -Standard_Boolean Sphere_BasicShape::VColorsFlag() const { - return myVColorsFlag; -} - -void Sphere_BasicShape::SetVTexels(const Standard_Boolean aFlag) { - myVTexelsFlag = aFlag; -} - -Standard_Boolean Sphere_BasicShape::VTexelsFlag() const { - return myVTexelsFlag; -} - -void Sphere_BasicShape::SetDeflection(const Standard_Real aValue) { - myDeflection = aValue; -} - -Standard_Real Sphere_BasicShape::Deflection() const { - return myDeflection; -} diff --git a/samples/qt/Graphic3dDemo/src/Sphere_Sphere.cxx b/samples/qt/Graphic3dDemo/src/Sphere_Sphere.cxx deleted file mode 100755 index 9a5cd6a6a8..0000000000 --- a/samples/qt/Graphic3dDemo/src/Sphere_Sphere.cxx +++ /dev/null @@ -1,1137 +0,0 @@ -#define G005 - -#include - -#include - -#include -#include - -#include -#include -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef G005 -#include -#include -#include -#include -#endif - -#include - -Standard_CString stText="Test"; -Standard_Integer stTextHeight=10; - -static void ShadeWithVertex(const Handle(Graphic3d_Group) aGroup, - const gp_Pnt aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean isText, - const Standard_Boolean isOptText) -{ - Standard_Real R1,R2; - Standard_Real X1,Y1,Z1; - Standard_Real X2,Y2,Z2; - Standard_Real X3,Y3,Z3; - Standard_Real X4,Y4,Z4; - Standard_Real Xc,Yc,Zc; - Standard_Real Beta = 0.; - Standard_Real Alpha = 0.; - Standard_Integer nbpanes = Sphere_Sphere::NbPanes(aRadius,aDeflection); - Standard_Real Dbeta = 2.*Standard_PI/nbpanes; - Standard_Real Dalpha = 2.*Standard_PI/nbpanes; - Standard_Integer i,j; - - aPosition.Coord (Xc, Yc, Zc); - if(isText) { - Handle(Graphic3d_AspectText3d) Text3d = new Graphic3d_AspectText3d(); - Text3d->SetTextureMappedFont(isOptText); - aGroup->SetPrimitivesAspect(Text3d); - } - -#ifdef G005 - if( Graphic3d_ArrayOfPrimitives::IsEnable() ) { - Handle(Graphic3d_ArrayOfTriangles) ptri = - new Graphic3d_ArrayOfTriangles(3*nbpanes*2,0, - Standard_False,Standard_False,Standard_False,Standard_False); - Handle(Graphic3d_ArrayOfQuadrangles) pquad = - new Graphic3d_ArrayOfQuadrangles(4*nbpanes*(nbpanes/2-2),0, - Standard_False,Standard_False,Standard_False,Standard_False); - aGroup->BeginPrimitives(); - for( j=0; jAddVertex(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - } else if( j == nbpanes/2-1 ) { - ptri->AddVertex(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } else { - pquad->AddVertex(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - pquad->AddVertex(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - pquad->AddVertex(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - pquad->AddVertex(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->AddPrimitiveArray(ptri); - aGroup->AddPrimitiveArray(pquad); - aGroup->EndPrimitives(); - } else -#endif - { - aGroup->BeginPrimitives(); - Graphic3d_Array1OfVertex TriVertex(1,3*nbpanes*2); - Graphic3d_Array1OfVertex QuadVertex(1,4*nbpanes*(nbpanes/2-2)); - Aspect_Array1OfEdge TriEdge(1,3*nbpanes*2); - Aspect_Array1OfEdge QuadEdge(1,4*nbpanes*(nbpanes/2-2)); - Standard_Integer nt,nq; - for( j=nt=nq=0; jText(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else if( j == nbpanes/2-1 ) { - nt++; - TriVertex(nt).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else { - nq++; - QuadVertex(nq).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - QuadEdge(nq).SetValues(nq,nq-3,Aspect_TOE_VISIBLE); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->TriangleSet(TriVertex,TriEdge); - aGroup->QuadrangleSet(QuadVertex,QuadEdge); - aGroup->EndPrimitives(); - } -} - -static void ShadeWithVertexN(const Handle(Graphic3d_Group) aGroup, - const gp_Pnt aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean isText, - const Standard_Boolean isOptText) -{ - Standard_Real R1,R2; - Standard_Real X1,Y1,Z1; - Standard_Real X2,Y2,Z2; - Standard_Real X3,Y3,Z3; - Standard_Real X4,Y4,Z4; - Standard_Real Xc,Yc,Zc; - Standard_Real Beta = 0.; - Standard_Real Alpha = 0.; - Standard_Integer nbpanes = Sphere_Sphere::NbPanes(aRadius,aDeflection); - Standard_Real Dbeta = 2.*Standard_PI/nbpanes; - Standard_Real Dalpha = 2.*Standard_PI/nbpanes; - Standard_Integer i,j; - - aPosition.Coord (Xc, Yc, Zc); - if(isText) { - Handle(Graphic3d_AspectText3d) Text3d = new Graphic3d_AspectText3d(); - Text3d->SetTextureMappedFont(isOptText); - aGroup->SetPrimitivesAspect(Text3d); - } -#ifdef G005 - if( Graphic3d_ArrayOfPrimitives::IsEnable() ) { - Handle(Graphic3d_ArrayOfTriangles) ptri = - new Graphic3d_ArrayOfTriangles(3*nbpanes*2,0, - Standard_True,Standard_False,Standard_False,Standard_False); - Handle(Graphic3d_ArrayOfQuadrangles) pquad = - new Graphic3d_ArrayOfQuadrangles(4*nbpanes*(nbpanes/2-2),0, - Standard_True,Standard_False,Standard_False,Standard_False); - aGroup->BeginPrimitives(); - for( j=0; jAddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - } else if( j == nbpanes/2-1 ) { - ptri->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } else { - pquad->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->AddPrimitiveArray(ptri); - aGroup->AddPrimitiveArray(pquad); - aGroup->EndPrimitives(); - } else -#endif - { - aGroup->BeginPrimitives(); - Graphic3d_Array1OfVertexN TriVertex(1,3*nbpanes*2); - Graphic3d_Array1OfVertexN QuadVertex(1,4*nbpanes*(nbpanes/2-2)); - Aspect_Array1OfEdge TriEdge(1,3*nbpanes*2); - Aspect_Array1OfEdge QuadEdge(1,4*nbpanes*(nbpanes/2-2)); - Standard_Integer nt,nq; - for( j=nt=nq=0; jText(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - TriVertex(nt).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else if( j == nbpanes/2-1 ) { - nt++; - TriVertex(nt).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - TriVertex(nt).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else { - nq++; - QuadVertex(nq).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - QuadEdge(nq).SetValues(nq,nq-3,Aspect_TOE_VISIBLE); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->TriangleSet(TriVertex,TriEdge); - aGroup->QuadrangleSet(QuadVertex,QuadEdge); - aGroup->EndPrimitives(); - } -} - -static void ShadeWithVertexC(const Handle(Graphic3d_Group) aGroup, - const gp_Pnt aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean isText, - const Standard_Boolean isOptText) -{ - Standard_Real R1,R2; - Standard_Real X1,Y1,Z1; - Standard_Real X2,Y2,Z2; - Standard_Real X3,Y3,Z3; - Standard_Real X4,Y4,Z4; - Standard_Real Xc,Yc,Zc; - Standard_Real Beta = 0.; - Standard_Real Alpha = 0.; - Standard_Integer nbpanes = Sphere_Sphere::NbPanes(aRadius,aDeflection); - Standard_Real Dbeta = 2.*Standard_PI/nbpanes; - Standard_Real Dalpha = 2.*Standard_PI/nbpanes; - Quantity_Color C1,C2,C3,C4; - Standard_Integer i,j; - - aPosition.Coord (Xc, Yc, Zc); - if(isText) { - Handle(Graphic3d_AspectText3d) Text3d = new Graphic3d_AspectText3d(); - Text3d->SetTextureMappedFont(isOptText); - aGroup->SetPrimitivesAspect(Text3d); - } -#ifdef G005 - if( Graphic3d_ArrayOfPrimitives::IsEnable() ) { - Handle(Graphic3d_ArrayOfTriangles) ptri = - new Graphic3d_ArrayOfTriangles(3*nbpanes*2,0, - Standard_False,Standard_True,Standard_False,Standard_False); - Handle(Graphic3d_ArrayOfQuadrangles) pquad = - new Graphic3d_ArrayOfQuadrangles(4*nbpanes*(nbpanes/2-2),0, - Standard_False,Standard_True,Standard_False,Standard_False); - aGroup->BeginPrimitives(); - for( j=0; jAddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc),C3); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - } else if( j == nbpanes/2-1 ) { - ptri->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc),C4); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } else { - pquad->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc),C3); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc),C4); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->AddPrimitiveArray(ptri); - aGroup->AddPrimitiveArray(pquad); - aGroup->EndPrimitives(); - } else -#endif - { - aGroup->BeginPrimitives(); - Graphic3d_Array1OfVertexC TriVertex(1,3*nbpanes*2); - Graphic3d_Array1OfVertexC QuadVertex(1,4*nbpanes*(nbpanes/2-2)); - Aspect_Array1OfEdge TriEdge(1,3*nbpanes*2); - Aspect_Array1OfEdge QuadEdge(1,4*nbpanes*(nbpanes/2-2)); - Standard_Integer nt,nq; - for( j=nt=nq=0; jText(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetColor(C1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetColor(C2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - TriVertex(nt).SetColor(C3); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else if( j == nbpanes/2-1 ) { - nt++; - TriVertex(nt).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetColor(C1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetColor(C2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - TriVertex(nt).SetColor(C4); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else { - nq++; - QuadVertex(nq).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - QuadVertex(nq).SetColor(C1); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - QuadVertex(nq).SetColor(C2); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - QuadVertex(nq).SetColor(C3); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - QuadVertex(nq).SetColor(C4); - QuadEdge(nq).SetValues(nq,nq-3,Aspect_TOE_VISIBLE); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->TriangleSet(TriVertex,TriEdge); - aGroup->QuadrangleSet(QuadVertex,QuadEdge); - aGroup->EndPrimitives(); - } -} - -static void ShadeWithVertexNC(const Handle(Graphic3d_Group) aGroup, - const gp_Pnt aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean isText, - const Standard_Boolean isOptText) -{ - Standard_Real R1,R2; - Standard_Real X1,Y1,Z1; - Standard_Real X2,Y2,Z2; - Standard_Real X3,Y3,Z3; - Standard_Real X4,Y4,Z4; - Standard_Real Xc,Yc,Zc; - Standard_Real Beta = 0.; - Standard_Real Alpha = 0.; - Standard_Integer nbpanes = Sphere_Sphere::NbPanes(aRadius,aDeflection); - Standard_Real Dbeta = 2.*Standard_PI/nbpanes; - Standard_Real Dalpha = 2.*Standard_PI/nbpanes; - Quantity_Color C1,C2,C3,C4; - Standard_Integer i,j; - - aPosition.Coord (Xc, Yc, Zc); - if(isText) { - Handle(Graphic3d_AspectText3d) Text3d = new Graphic3d_AspectText3d(); - Text3d->SetTextureMappedFont(isOptText); - aGroup->SetPrimitivesAspect(Text3d); - } -#ifdef G005 - if( Graphic3d_ArrayOfPrimitives::IsEnable() ) { - Handle(Graphic3d_ArrayOfTriangles) ptri = - new Graphic3d_ArrayOfTriangles(3*nbpanes*2,0, - Standard_True,Standard_True,Standard_False,Standard_False); - Handle(Graphic3d_ArrayOfQuadrangles) pquad = - new Graphic3d_ArrayOfQuadrangles(4*nbpanes*(nbpanes/2-2),0, - Standard_True,Standard_True,Standard_False,Standard_False); - aGroup->BeginPrimitives(); - for( j=0; jAddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius),C3); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - } else if( j == nbpanes/2-1 ) { - ptri->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius),C4); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } else { - pquad->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius),C1); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius),C2); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius),C3); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius),C4); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->AddPrimitiveArray(ptri); - aGroup->AddPrimitiveArray(pquad); - aGroup->EndPrimitives(); - } else -#endif - { - aGroup->BeginPrimitives(); - Graphic3d_Array1OfVertexNC TriVertex(1,3*nbpanes*2); - Graphic3d_Array1OfVertexNC QuadVertex(1,4*nbpanes*(nbpanes/2-2)); - Aspect_Array1OfEdge TriEdge(1,3*nbpanes*2); - Aspect_Array1OfEdge QuadEdge(1,4*nbpanes*(nbpanes/2-2)); - Standard_Integer nt,nq; - for( j=nt=nq=0; jText(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriVertex(nt).SetColor(C1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriVertex(nt).SetColor(C2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - TriVertex(nt).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - TriVertex(nt).SetColor(C3); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else if( j == nbpanes/2-1 ) { - nt++; - TriVertex(nt).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriVertex(nt).SetColor(C1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriVertex(nt).SetColor(C2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - TriVertex(nt).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - TriVertex(nt).SetColor(C4); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else { - nq++; - QuadVertex(nq).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - QuadVertex(nq).SetColor(C1); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - QuadVertex(nq).SetColor(C2); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - QuadVertex(nq).SetColor(C3); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - QuadVertex(nq).SetColor(C4); - QuadEdge(nq).SetValues(nq,nq-3,Aspect_TOE_VISIBLE); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->TriangleSet(TriVertex,TriEdge); - aGroup->QuadrangleSet(QuadVertex,QuadEdge); - aGroup->EndPrimitives(); - } -} - -static void ShadeWithVertexNT(const Handle(Graphic3d_Group) aGroup, - const gp_Pnt aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean isText, - const Standard_Boolean isOptText) -{ - Standard_Real R1,R2; - Standard_Real X1,Y1,Z1; - Standard_Real X2,Y2,Z2; - Standard_Real X3,Y3,Z3; - Standard_Real X4,Y4,Z4; - Standard_Real Xc,Yc,Zc; - Standard_Real Beta = 0.; - Standard_Real Alpha = 0.; - Standard_Integer nbpanes = Sphere_Sphere::NbPanes(aRadius,aDeflection); - Standard_Real Dbeta = 2.*Standard_PI/nbpanes; - Standard_Real Dalpha = 2.*Standard_PI/nbpanes; - Standard_Real Tx1,Ty1,Tx2,Ty2; - Standard_Integer i,j; - - aPosition.Coord (Xc, Yc, Zc); - if(isText) { - Handle(Graphic3d_AspectText3d) Text3d = new Graphic3d_AspectText3d(); - Text3d->SetTextureMappedFont(isOptText); - aGroup->SetPrimitivesAspect(Text3d); - } -#ifdef G005 - if( Graphic3d_ArrayOfPrimitives::IsEnable() ) { - Handle(Graphic3d_ArrayOfTriangles) ptri = - new Graphic3d_ArrayOfTriangles(3*nbpanes*2,0, - Standard_True,Standard_False,Standard_True,Standard_False); - Handle(Graphic3d_ArrayOfQuadrangles) pquad = - new Graphic3d_ArrayOfQuadrangles(4*nbpanes*(nbpanes/2-2),0, - Standard_True,Standard_False,Standard_True,Standard_False); - aGroup->BeginPrimitives(); - for( j=0; jAddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius), - gp_Pnt2d(Tx1,Ty1)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius), - gp_Pnt2d(Tx1,Ty2)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius), - gp_Pnt2d(Tx2,Ty2)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - } else if( j == nbpanes/2-1 ) { - ptri->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius), - gp_Pnt2d(Tx1,Ty1)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius), - gp_Pnt2d(Tx1,Ty2)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - ptri->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius), - gp_Pnt2d(Tx2,Ty1)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } else { - pquad->AddVertex(gp_Pnt(X1+Xc,Y1+Yc,Z1+Zc), - gp_Vec(X1/aRadius,Y1/aRadius,Z1/aRadius), - gp_Pnt2d(Tx1,Ty1)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X2+Xc,Y2+Yc,Z2+Zc), - gp_Vec(X2/aRadius,Y2/aRadius,Z2/aRadius), - gp_Pnt2d(Tx1,Ty2)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X3+Xc,Y3+Yc,Z3+Zc), - gp_Vec(X3/aRadius,Y3/aRadius,Z3/aRadius), - gp_Pnt2d(Tx2,Ty2)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - pquad->AddVertex(gp_Pnt(X4+Xc,Y4+Yc,Z4+Zc), - gp_Vec(X4/aRadius,Y4/aRadius,Z4/aRadius), - gp_Pnt2d(Tx2,Ty1)); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->AddPrimitiveArray(ptri); - aGroup->AddPrimitiveArray(pquad); - aGroup->EndPrimitives(); - } else -#endif - { - aGroup->BeginPrimitives(); - Graphic3d_Array1OfVertexNT TriVertex(1,3*nbpanes*2); - Graphic3d_Array1OfVertexNT QuadVertex(1,4*nbpanes*(nbpanes/2-2)); - Aspect_Array1OfEdge TriEdge(1,3*nbpanes*2); - Aspect_Array1OfEdge QuadEdge(1,4*nbpanes*(nbpanes/2-2)); - Standard_Integer nt,nq; - for( j=nt=nq=0; jText(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx1,Ty1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx1,Ty2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - TriVertex(nt).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx2,Ty2); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else if( j == nbpanes/2-1 ) { - nt++; - TriVertex(nt).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - TriVertex(nt).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx1,Ty1); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - TriVertex(nt).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx1,Ty2); - TriEdge(nt).SetValues(nt,nt+1,Aspect_TOE_VISIBLE); - nt++; - TriVertex(nt).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - TriVertex(nt).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - TriVertex(nt).SetTextureCoordinate(Tx2,Ty1); - TriEdge(nt).SetValues(nt,nt-2,Aspect_TOE_VISIBLE); - } else { - nq++; - QuadVertex(nq).SetCoord(X1+Xc,Y1+Yc,Z1+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X1+Xc,Y1+Yc,Z1+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X1/aRadius,Y1/aRadius,Z1/aRadius); - QuadVertex(nq).SetTextureCoordinate(Tx1,Ty1); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X2+Xc,Y2+Yc,Z2+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X2+Xc,Y2+Yc,Z2+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X2/aRadius,Y2/aRadius,Z2/aRadius); - QuadVertex(nq).SetTextureCoordinate(Tx1,Ty2); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X3+Xc,Y3+Yc,Z3+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X3+Xc,Y3+Yc,Z3+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X3/aRadius,Y3/aRadius,Z3/aRadius); - QuadVertex(nq).SetTextureCoordinate(Tx2,Ty2); - QuadEdge(nq).SetValues(nq,nq+1,Aspect_TOE_VISIBLE); - nq++; - QuadVertex(nq).SetCoord(X4+Xc,Y4+Yc,Z4+Zc); - if(isText) aGroup->Text(stText,Graphic3d_Vertex(X4+Xc,Y4+Yc,Z4+Zc), stTextHeight); - QuadVertex(nq).SetNormal(X4/aRadius,Y4/aRadius,Z4/aRadius); - QuadVertex(nq).SetTextureCoordinate(Tx2,Ty1); - QuadEdge(nq).SetValues(nq,nq-3,Aspect_TOE_VISIBLE); - } - } - } -// aGroup->BeginPrimitives(); - aGroup->TriangleSet(TriVertex,TriEdge); - aGroup->QuadrangleSet(QuadVertex,QuadEdge); - aGroup->EndPrimitives(); - } -} - -//================================================== -// Function: -// Purpose : -//================================================== - -Sphere_Sphere::Sphere_Sphere(const gp_Pnt& aPosition, - const Standard_Real aRadius, - const Standard_Real aDeflection, - const Standard_Boolean hasVNormals, - const Standard_Boolean hasVColors, - const Standard_Boolean hasVTexels, - const Standard_Boolean hasText, - const Standard_Boolean isOptText -) : -Sphere_BasicShape(BRepPrimAPI_MakeSphere(aRadius).Shape(), -aDeflection,hasVNormals,hasVColors,hasVTexels), -myRadius(aRadius), -myText(hasText), -myOptText(isOptText) -{ - gp_Trsf trsf; - trsf.SetTranslation(gp_Vec(aPosition.X(),aPosition.Y(),aPosition.Z())); - TopLoc_Location location(trsf); - myshape.Location(location); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= -void Sphere_Sphere::Compute( - const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, - const Handle(Prs3d_Presentation)& aPrs, - const Standard_Integer aMode) -{ - aPrs->Clear(); - if(myshape.IsNull()) return; - - // wire,edge,vertex -> pas de HLR + priorite display superieure - Standard_Integer TheType = (Standard_Integer) myshape.ShapeType(); - if(TheType>4 && TheType<8) { - aPrs->SetVisual(Graphic3d_TOS_ALL); - aPrs->SetDisplayPriority(TheType+2); - } - - switch (aMode) { - case 0:{ - try { StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer); } - catch (Standard_Failure) { -#ifdef DEB - cout << "Sphere_Sphere::Compute() failed"<< endl; -#endif - cout << "a Shape should be incorrect : No Compute can be maked on it "<< endl; - } - break; - } - case 1: - { - Handle(Graphic3d_Group) group = Prs3d_Root::CurrentGroup(aPrs); - Handle(Graphic3d_AspectFillArea3d) aspect = myDrawer->ShadingAspect()->Aspect(); - aspect->SuppressBackFace(); - group->SetPrimitivesAspect(aspect); - gp_Pnt position = Position(); - Standard_Integer shadeAspect(0); - if( myVNormalsFlag ) shadeAspect |= 1; - if( myVColorsFlag ) shadeAspect |= 2; - if( myVTexelsFlag ) shadeAspect |= 4; - switch( shadeAspect ) { - default: - case 0: - ShadeWithVertex(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 1: - ShadeWithVertexN(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 2: - { - Graphic3d_MaterialAspect material = aspect->FrontMaterial(); - material.SetReflectionModeOff(Graphic3d_TOR_AMBIENT); - material.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE); - material.SetReflectionModeOff(Graphic3d_TOR_SPECULAR); - material.SetReflectionModeOff(Graphic3d_TOR_EMISSION); - aspect->SetFrontMaterial(material); - group->SetPrimitivesAspect(aspect); - } - ShadeWithVertexC(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 3: - ShadeWithVertexNC(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 4: -// ShadeWithVertexT(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 5: - ShadeWithVertexNT(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 6: -// ShadeWithVertexCT(group,position,myRadius,myDeflection,myText, myOptText); - break; - case 7: -// ShadeWithVertexNCT(group,position,myRadius,myDeflection,myText, myOptText); - break; - } - Standard_Real value = Transparency() ; - if( value > 0. ) { - SetTransparency( value ); - } - break; - } - case 2: - { - } - } - aPrs->ReCompute(); // for hidden line recomputation if necessary... -} - -void Sphere_Sphere::SetRadius(const Standard_Real aRadius) { - myRadius = aRadius; -} - -Standard_Real Sphere_Sphere::Radius() const { - return myRadius; -} - -Standard_Integer Sphere_Sphere::NbPanes(const Standard_Real aRadius, - const Standard_Real aDeflection) { - if( aRadius <= 0. ) return 0; - Standard_Real h = aRadius-Abs(aDeflection); - Standard_Real da = 2.*ACos(h/aRadius); - Standard_Integer nbpanes = Standard_Integer(2.*Standard_PI/da); - nbpanes = nbpanes/2*2; - return nbpanes; -} - -Standard_Integer Sphere_Sphere::NbPanes(const Standard_Integer nbItems) { - return Standard_Integer(Sqrt(2*nbItems)); -} - -Standard_Integer Sphere_Sphere::NbItems(const Standard_Integer nbPanes) { - return nbPanes*nbPanes/2; -} - -Standard_Real Sphere_Sphere::Deflection(const Standard_Real aRadius, - const Standard_Integer nbPanes) { - Standard_Real da = 2.*Standard_PI/nbPanes; - Standard_Real h = aRadius*Cos(da/2.); - return (aRadius-h); -} diff --git a/samples/qt/Graphic3dDemo/src/Translate.cxx b/samples/qt/Graphic3dDemo/src/Translate.cxx deleted file mode 100755 index 0528085ec8..0000000000 --- a/samples/qt/Graphic3dDemo/src/Translate.cxx +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include -#include - -#include "Translate.h" -#include "Application.h" -#include "Document.h" -#include "MDIWindow.h" -#include "global.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -// STL -//#include -//#include -//#include -//#include - -#ifdef a -#include "OSD_Timer.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -Translate::Translate( QObject* parent ): -QObject( parent ) -{ -} - -Translate::~Translate() -{ -} - -/*! - Selects a file from standard dialog acoording to selection - 'filter' -*/ -QString Translate::selectFileName( const QString& filter, bool isImport ) const -{ - return isImport ? - QFileDialog::getOpenFileName( QApplication::activeWindow(), tr("INF_APP_IMPORT"), QString::null, filter ) : - QFileDialog::getSaveFileName( QApplication::activeWindow(), tr("INF_APP_EXPORT"), QString::null, filter ); - /* - QFileDialog fd ( 0, 0, true ); - fd.setFilters( filter ); - if(isImport) - fd.setCaption ( tr("INF_APP_IMPORT") ); - int ret = fd.exec(); - - qApp->processEvents(); - - return ( ret == QDialog::Accepted ? fd.selectedFile() : QString::null ); - */ -} - -Handle(TopTools_HSequenceOfShape) -Translate::BuildSequenceFromContext(const Handle(AIS_InteractiveContext)& cxt) -{ - Handle(TopTools_HSequenceOfShape) sequence = new TopTools_HSequenceOfShape(); - Handle(AIS_InteractiveObject) object; - AIS_ListOfInteractive displayed; - cxt->DisplayedObjects( displayed ); - - AIS_ListIteratorOfListOfInteractive it( displayed ); - for ( ; it.More(); it.Next() ) { - object = it.Value(); - if ( object->IsKind( STANDARD_TYPE( AIS_Shape ) ) ) { - TopoDS_Shape shape = Handle(AIS_Shape)::DownCast( object )->Shape(); - sequence->Append( shape ); - } - } - -#ifdef OLD_CODE - for(anInteractiveContext->InitCurrent();anInteractiveContext->MoreCurrent();anInteractiveContext->NextCurrent()) - { - picked = anInteractiveContext->Current(); - if (anInteractiveContext->Current()->IsKind(STANDARD_TYPE(AIS_Shape))) - { - TopoDS_Shape aShape = Handle(AIS_Shape)::DownCast(picked)->Shape(); - aSequence->Append(aShape); - } - } -#endif //OLD_CODE - return sequence; -} - -void Translate::importBREP(const Handle(AIS_InteractiveContext) theContext) -{ - static QString filter = "BREP Files (*.brep )"; - importBREP(theContext,filter); -} - -void Translate::importBREP(const Handle(AIS_InteractiveContext) theContext, const QString& filter) -{ - QString file = selectFileName( filter, true ); - if ( !file.isNull() ) { - QApplication::setOverrideCursor( Qt::WaitCursor ); - if(!importBREP(theContext, (const Standard_CString) file.toLatin1().constData())) { - QApplication::restoreOverrideCursor(); - QMessageBox::information ( QApplication::activeWindow(),tr("TIT_ERROR"), tr("INF_TRANSLATE_ERROR"), tr("BTN_OK"), - QString::null, QString::null, 0, 0); - qApp->processEvents(); /* update desktop */ - } else - QApplication::restoreOverrideCursor(); - } -} - -bool Translate::importBREP(const Handle(AIS_InteractiveContext) theContext, const Standard_CString theFileName) -{ - Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape(); - TopoDS_Shape aShape; - BRep_Builder aBuilder; - - Application::startTimer(); - Standard_Boolean result = BRepTools::Read(aShape,theFileName,aBuilder); - Application::stopTimer( 0, "Loading BREP file" ); - - if(result) - aSequence->Append(aShape); - - int curMode = - ( (MDIWindow*)Application::getApplication()->getActiveMDI() )->getDisplayMode(); - - for(int i=1;i<= aSequence->Length();i++) { - - Application::startTimer(); - Handle(AIS_Shape) shape = new AIS_Shape( aSequence->Value( i ) ); - Application::stopTimer( 0, "Build shape" ); - Application::startTimer(); - theContext->Display( shape, curMode, 0, false ); - Application::stopTimer( 0, "Display" ); - } - Application::startTimer(); - theContext->UpdateCurrentViewer(); - Application::stopTimer( 0, "Update" ); - - return result; -} - diff --git a/samples/qt/Graphic3dDemo/src/View.cxx b/samples/qt/Graphic3dDemo/src/View.cxx deleted file mode 100755 index 091145b8d1..0000000000 --- a/samples/qt/Graphic3dDemo/src/View.cxx +++ /dev/null @@ -1,883 +0,0 @@ -#if !defined WNT -#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */ -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "View.h" -#include "global.h" -#include "Application.h" -#include "ViewOperations.h" - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include - -#ifdef WNT -#include -#include -#else -#include -#include -#include -#include -#include -#undef QT_CLEAN_NAMESPACE -#include -#include -#endif - - -// the key for multi selection : -#define MULTISELECTIONKEY Qt::ShiftModifier - -// the key for shortcut ( use to activate dynamic rotation, panning ) -#define CASCADESHORTCUTKEY Qt::ControlModifier - -// for elastic bean selection -#define ValZWMin 1 - -View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent, MDIWindow* mdi ) -: QWidget( parent ), myMDI( mdi ), myRubberBand( 0 ) -{ - setBackgroundRole( QPalette::NoRole );//NoBackground ); - // set focus policy to threat QContextMenuEvent from keyboard - setFocusPolicy( Qt::StrongFocus ); - setAttribute( Qt::WA_PaintOnScreen ); - setAttribute( Qt::WA_NoSystemBackground ); - -#ifndef WNT - XSynchronize( x11Display(), true ); // it is possible to use QApplication::syncX(); -#endif - - myObjDlg = NULL; - myShapeDlg = NULL; - myFirst = true; - myContext = theContext; - - myCycleCounter = -1; - - myXmin=0; - myYmin=0; - myXmax=0; - myYmax=0; - myCurZoom=0; - -#if !defined WNT - XVisualInfo* pVisualInfo; - if ( x11Display() ) { - /* Initialization with the default VisualID - */ - Visual *v = DefaultVisual( x11Display(), DefaultScreen( x11Display() ) ); - int visualID = XVisualIDFromVisual( v ); - - /* 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; - - Window p = RootWindow( x11Display(), DefaultScreen(x11Display()) ); - a.colormap = XCreateColormap( x11Display(), RootWindow(x11Display(), - pVisualInfo->screen), pVisualInfo->visual, AllocNone ); - a.background_pixel = backgroundColor().pixel(); - a.border_pixel = black.pixel(); - if ( parentWidget() ) - p = parentWidget()->winId(); - - Window w = XCreateWindow( x11Display(), p, x(), y(), width(), height(), - 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual, - CWBackPixel | CWBorderPixel | CWColormap, &a ); - 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 // !defined WNT - - // will be set in OnInitial update, but, for more security : - myCurrentMode = CurAction3d_Nothing; - setMouseTracking( true ); - myView = NULL; -} - -View::~View() -{ -} - -void View::init() -{ - myView = myContext->CurrentViewer()->CreateView(); - int windowHandle = (int) winId(); - short hi, lo; - lo = (short) windowHandle; - hi = (short) ( windowHandle >> 16 ); -#ifdef WNT - Handle(WNT_Window) hWnd = - new WNT_Window( Handle(Graphic3d_WNTGraphicDevice):: - DownCast( myContext->CurrentViewer()->Device() ) , (int) hi, (int) lo ); -#else - Handle(Xw_Window) hWnd = - new Xw_Window( Handle(Graphic3d_GraphicDevice):: - DownCast( myContext->CurrentViewer()->Device() ), - (int) hi, (int) lo, Xw_WQ_SAMEQUALITY, Quantity_NOC_BLACK ); -#endif // WNT - myView->SetWindow( hWnd ); - if ( !hWnd->IsMapped() ) - hWnd->Map(); - myView->SetBackgroundColor(Quantity_NOC_GRAY40); - myView->MustBeResized(); - - Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement( gp::XOY() ); - myTrihedron = new AIS_Trihedron( anAxis ); - myContext->Display( myTrihedron ); - - //myView->SetAntialiasingOn(); - myComputedModeIsOn = true; - myView->SetScale(3.0316); - - // This is to update View properties dialog - emit ViewInitialized(); -} - -void View::paintEvent ( QPaintEvent * e) -{ - if(myFirst) { - init(); - myFirst = false; - } - QApplication::setOverrideCursor( Qt::WaitCursor ); - Application::startTimer(); - myView->Redraw(); - Application::stopTimer( 0, "View REDRAW", false ); - QApplication::restoreOverrideCursor(); -} - -void View::resizeEvent ( QResizeEvent * e) -{ -// QApplication::syncX(); - if(!myView.IsNull()) { - myView->MustBeResized(); - } -} - -void View::mousePressEvent(QMouseEvent* e) -{ - if ( e->button() == Qt::LeftButton ) { - onLButtonDown(e->modifiers(),e->pos()); - } else if(e->button() == Qt::RightButton ) { - onRButtonDown(e->modifiers(),e->pos()); - } -} - -void View::mouseReleaseEvent(QMouseEvent* e) -{ - if ( e->button() == Qt::LeftButton ) { - onLButtonUp(e->modifiers(),e->pos()); - } else if(e->button() == Qt::RightButton ) { - onRButtonUp(e->modifiers(),e->pos()); - } -} - -void View::mouseMoveEvent(QMouseEvent* e) -{ - onMouseMove(e->buttons(),e->modifiers(),e->pos()); -} - -void View::onLButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point ) -{ - // save the current mouse coordinate in min - myXmin=point.x(); myYmin=point.y(); - myXmax=point.x(); myYmax=point.y(); - - if ( nFlags == CASCADESHORTCUTKEY ) { - // Button MB1 down Control :start zomming - // SetCursor(AfxGetApp()->LoadStandardCursor()); - } - else { // if ( Ctrl ) - switch (myCurrentMode) { - - case CurAction3d_Nothing : // start a drag - if (nFlags == MULTISELECTIONKEY) - MultiDragEvent(myXmax,myYmax,-1); - else - DragEvent(myXmax,myYmax,-1); - break; - case CurAction3d_DynamicZooming : // noting - break; - case CurAction3d_WindowZooming : - case CurAction3d_MagnifyView : - break; - case CurAction3d_DynamicPanning :// noting - break; - case CurAction3d_GlobalPanning :// noting - break; - case CurAction3d_DynamicRotation : - if (!myComputedModeIsOn){ - myView->SetComputedMode(false); - } - myView->SetAnimationModeOn(); - myView->StartRotation(point.x(),point.y()); - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - } - } -} - -void View::onRButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point ) -{ - if ( nFlags == CASCADESHORTCUTKEY ) { - if ( !myComputedModeIsOn ) - myView->SetComputedMode(false); -// Standard_Boolean anim, deg; -// anim = myView->AnimationMode( deg ); -// if ( anim /*&& deg*/ ) { - myCycleCounter = 0; - Application::startTimer(); - myView->SetAnimationModeOn(); -// myView->SetAnimationMode(true,true); -// myContext->DeactivateStandardMode( TopAbs_SHAPE ); -// } - myView->StartRotation( point.x(),point.y() ); - } - else - Popup(); -} - -void View::onLButtonUp(Qt::KeyboardModifiers nFlags, const QPoint point) -{ - if ( nFlags == CASCADESHORTCUTKEY ) - { - return; - } - else // if ( Ctrl ) - { - switch ( myCurrentMode ) - { - case CurAction3d_Nothing : - if (point.x() == myXmin && point.y() == myYmin) - { // no offset between down and up --> selectEvent - myXmax=point.x(); - myYmax=point.y(); - if (nFlags == MULTISELECTIONKEY ) - MultiInputEvent(point.x(),point.y()); - else - InputEvent (point.x(),point.y()); - } else - { - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); - myXmax=point.x(); - myYmax=point.y(); - if (nFlags == MULTISELECTIONKEY) - MultiDragEvent(point.x(),point.y(),1); - else - DragEvent(point.x(),point.y(),1); - } - break; - case CurAction3d_DynamicZooming : - // SetCursor(AfxGetApp()->LoadStandardCursor()); - myCurrentMode = CurAction3d_Nothing; - emit noActiveActions(); - break; - - case CurAction3d_WindowZooming : - case CurAction3d_MagnifyView : - - DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False ); - myXmax = point.x(); - myYmax = point.y(); - - if ( ( abs( myXmin - myXmax ) > ValZWMin ) || - ( abs( myYmin - myYmax ) > ValZWMin ) ) { - - if ( myCurrentMode == CurAction3d_MagnifyView ) - myMDI->getDocument()->createMagView( myXmin, myYmin, myXmax, myYmax ); - else - myView->WindowFitAll( myXmin, myYmin, myXmax, myYmax ); - } - myCurrentMode = CurAction3d_Nothing; - emit noActiveActions(); - break; - - case CurAction3d_DynamicPanning : - myCurrentMode = CurAction3d_Nothing; - emit noActiveActions(); - break; - case CurAction3d_GlobalPanning : - myView->Place(point.x(),point.y(),myCurZoom); - myCurrentMode = CurAction3d_Nothing; - emit noActiveActions(); - break; - case CurAction3d_DynamicRotation : - myCurrentMode = CurAction3d_Nothing; - myView->SetAnimationModeOff(); - emit noActiveActions(); - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - } //switch (myCurrentMode) - } // else // if ( Ctrl ) -} - -void View::onRButtonUp(Qt::KeyboardModifiers nFlags, const QPoint point) -{ - QApplication::setOverrideCursor( Qt::WaitCursor ); - // reset computed mode according to the stored one - // --> dynamic rotation may have change it - - if (!myComputedModeIsOn) - { - myView->SetComputedMode(false); - myComputedModeIsOn = Standard_False; - } else - { - myView->SetComputedMode(false); - myComputedModeIsOn = Standard_True; - } - - //if ( myView->AnimationModeIsOn() ) { - myView->SetAnimationModeOff(); - Application::stopTimer( myCycleCounter, "Animation next UPDATE", false ); - //} - myCycleCounter = -1; - - myView->Update(); - QApplication::restoreOverrideCursor(); -} - -void View::onMouseMove(Qt::MouseButtons btns, Qt::KeyboardModifiers nFlags, const QPoint point) -{ - // ============================ LEFT BUTTON ======================= - if ( btns == Qt::LeftButton ) { - if ( nFlags == CASCADESHORTCUTKEY ) - { - // move with MB1 and Control : on the dynamic zooming - // Do the zoom in function of mouse's coordinates - myView->Zoom(myXmax,myYmax,point.x(),point.y()); - // save the current mouse coordinate in min - myXmax = point.x(); - myYmax = point.y(); - } - else // if ( Ctrl ) - { - switch (myCurrentMode) - { - case CurAction3d_Nothing : - myXmax = point.x(); - myYmax = point.y(); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False); - if (nFlags == MULTISELECTIONKEY) - MultiDragEvent(myXmax,myYmax,0); - else - DragEvent(myXmax,myYmax,0); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True); - break; - case CurAction3d_DynamicZooming : - myView->Zoom(myXmax,myYmax,point.x(),point.y()); - // save the current mouse coordinate in min \n"; - myXmax=point.x(); myYmax=point.y(); - break; - case CurAction3d_WindowZooming : - case CurAction3d_MagnifyView : - myXmax = point.x(); myYmax = point.y(); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);//,LongDash); - DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True);//,LongDash); - break; - case CurAction3d_DynamicPanning : - myView->Pan(point.x()-myXmax,myYmax-point.y()); // Realize the panning - myXmax = point.x(); - myYmax = point.y(); - break; - case CurAction3d_GlobalPanning : // nothing - break; - case CurAction3d_DynamicRotation : - myView->Rotation(point.x(),point.y()); -// myView->Redraw(); - break; - default : - Standard_Failure::Raise(" incompatible Current Mode "); - break; - }// switch (myCurrentMode) - }// if ( nFlags == CASCADESHORTCUTKEY ) else - } else // if ( btns == MK_LBUTTON) - // ============================ MIDDLE BUTTON ======================= - if ( btns == Qt::MidButton ) { - if ( nFlags == CASCADESHORTCUTKEY ) - { - myView->Pan(point.x()-myXmax,myYmax-point.y()); // Realize the panning - myXmax = point.x(); - myYmax = point.y(); - - } - } else // if ( btns == MK_MBUTTON) - // ============================ RIGHT BUTTON ======================= - if ( btns == Qt::RightButton ) { - if ( nFlags == CASCADESHORTCUTKEY ) - { - myView->Rotation(point.x(),point.y()); - } - }else //if ( btns == MK_RBUTTON) - // ============================ NO BUTTON ======================= - { // No buttons - myXmax = point.x(); myYmax = point.y(); - if (nFlags == MULTISELECTIONKEY) - MultiMoveEvent(point.x(),point.y()); - else - MoveEvent(point.x(),point.y()); - } - //Standard_Boolean anim, deg; - //anim = myView->AnimationMode( deg ); - //if ( anim /*&& deg*/ ) { - if ( myCycleCounter != -1 ) { - if ( myCycleCounter == 0 ) - Application::showTimer( "Animation first UPDATE" ); - myCycleCounter++; - } - //} -} - -void View::DragEvent( int x, int y, int TheState ) -{ - // TheState == -1 button down - // TheState == 0 move - // TheState == 1 button up - - static int theButtonDownX=0; - static int theButtonDownY=0; - - if (TheState == -1) - { - theButtonDownX=x; - theButtonDownY=y; - } - - if (TheState == 0) { - myContext->Select(theButtonDownX,theButtonDownY,x,y,myView); - } -} - -void View::InputEvent( int x, int y ) -{ - Application::startTimer(); - myContext->Select(); - Application::stopTimer( 0, "Single selection", false ); -} - -void View::MoveEvent( int x, int y ) -{ - myContext->MoveTo(x,y,myView); -} - -void View::MultiMoveEvent( int x, int y ) -{ - myContext->MoveTo(x,y,myView); -} - -void View::MultiDragEvent( int x, int y, int TheState ) -{ - static int theButtonDownX=0; - static int theButtonDownY=0; - - if (TheState == -1) - { theButtonDownX=x; theButtonDownY=y;} - - if (TheState == 0) { - myContext->ShiftSelect(theButtonDownX,theButtonDownY,x,y,myView); - emit selectionChanged(); - } -} - -void View::MultiInputEvent( int x, int y ) -{ - myContext->ShiftSelect(); - emit selectionChanged(); -} - -void View::Popup() -{ - QMenu* popMenu = new QMenu( this ); - - if( myContext->NbCurrents()) { - QAction* a; - myContext->InitCurrent(); - if (! myContext->Current()->IsKind(STANDARD_TYPE(AIS_Trihedron))) - { - a = new QAction( tr( "MEN_POP_OBJPROP" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onEditObjectProperties() ) ) ); - popMenu->addAction( a ); - - QMenu* dMode = popMenu->addMenu( tr( "MEN_POP_DISPLAYMODE" ) ); - - a = new QAction( tr( "MEN_POP_WIREFRAME" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onWireframeMode() ) ) ); - dMode->addAction( a ); - - a = new QAction( tr( "MEN_POP_SHADING" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onShadingMode() ) ) ); - dMode->addAction( a ); - } - a = new QAction( tr( "MEN_POP_REMOVEOBJECT" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onRemoveObject() ) ) ); - popMenu->addAction( a ); - } - else { - QAction* a = new QAction( tr( "MEN_POP_VIEWPROP" ), this ); - verify( connect( a, SIGNAL( activated() ), Application::getApplication(), SLOT( onEditViewProperties() ) ) ); - popMenu->addAction( a ); - - a = new QAction( tr( "MEN_POP_IMPORT" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onImportObject() ) ) ); - popMenu->addAction( a ); - - popMenu->addSeparator(); - if ( myContext->IsDisplayed( myTrihedron ) ) { - a = new QAction( tr( "MEN_POP_ERASETRIHEDRON" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onEraseTrihedron() ) ) ); - popMenu->addAction( a ); - } - else { - a = new QAction( tr( "MEN_POP_DISPLAYTRIHEDRON" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onDisplayTrihedron() ) ) ); - popMenu->addAction( a ); - } - - popMenu->addSeparator(); - a = new QAction( tr( "MEN_POP_CREATESHAPE" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onCreateShape() ) ) ); - popMenu->addAction( a ); - - QMenu* loadObj = popMenu->addMenu( tr( "MEN_POP_LOADOBJECT" ) ); - - a = new QAction( tr( "MEN_POP_BOX" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onLoadBox() ) ) ); - loadObj->addAction( a ); - - a = new QAction( tr( "MEN_POP_SPHERE" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onLoadSphere() ) ) ); - loadObj->addAction( a ); - - a = new QAction( tr( "MEN_POP_TORUS" ), this ); - verify( connect( a, SIGNAL( activated() ), SLOT( onLoadTorus() ) ) ); - loadObj->addAction( a ); - -// a = new QAction( tr( "MEN_POP_LINE" ), this ); -// verify( connect( a, SIGNAL( activated() ), SLOT( onLoadLine() ) ) ); -// loadObj->addAction( a ); - } - popMenu->exec( QCursor::pos() ); -} - -void View::DrawRectangle( int MinX, int MinY, int MaxX, int MaxY, bool Draw ) -{ - if ( !myRubberBand ) - myRubberBand = new QRubberBand( QRubberBand::Rectangle, this ); - - myRubberBand->setGeometry( QRect( QPoint( MinX, MinY ), QPoint( MaxX, MaxY ) ).normalized() ); - myRubberBand->setVisible( Draw ); -/* - QPainter thePainter(this); - thePainter.setRasterOp(Qt::XorROP); - thePainter.setPen(Qt::white); - static int StoredMinX, StoredMaxX, StoredMinY, StoredMaxY; - static bool m_IsVisible; - - QRect aRect; - if ( m_IsVisible && !Draw) // move or up : erase at the old position - { - aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY)); - thePainter.drawRect(aRect); - m_IsVisible = false; - } - - StoredMinX = (MinX < MaxX) ? MinX: MaxX ; - StoredMinY = (MinY < MaxY) ? MinY: MaxY ; - StoredMaxX = (MinX > MaxX) ? MinX: MaxX ; - StoredMaxY = (MinY > MaxY) ? MinY: MaxY ; - - if (Draw) // move : draw - { - aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY)); - thePainter.drawRect(aRect); - m_IsVisible = true; - } - */ -} - -void View::onImportObject() -{ - Application::getApplication()->importBREP(); -} - -void View::setCurrentAction() -{ - myCurrentMode = CurAction3d_MagnifyView; -} - -void View::onBackground() -{ - QColor aColor ; - Standard_Real R1; - Standard_Real G1; - Standard_Real B1; - myView->BackgroundColor(Quantity_TOC_RGB,R1,G1,B1); - aColor.setRgb(R1*255,G1*255,B1*255); - - QColor aRetColor = QColorDialog::getColor(aColor); - - if(aRetColor.isValid()) { - R1 = aRetColor.red()/255.; - G1 = aRetColor.green()/255.; - B1 = aRetColor.blue()/255.; - myView->SetBackgroundColor(Quantity_TOC_RGB,R1,G1,B1); - } - myView->Redraw(); -} - -Handle(V3d_View)& View::getView() -{ - return myView; -} - -void View::startAction( ViewOperations::Action action ) -{ - switch( action ) { - case ViewOperations::ViewFitAllId : - myView->FitAll(); - break; - case ViewOperations::ViewFitAreaId : - myCurrentMode = CurAction3d_WindowZooming; - break; - case ViewOperations::ViewZoomId : - myCurrentMode = CurAction3d_DynamicZooming; - break; - case ViewOperations::ViewPanId : - myCurrentMode = CurAction3d_DynamicPanning; - break; - case ViewOperations::ViewGlobalPanId : - myCurZoom = myView->Scale(); - // Do a Global Zoom - myView->FitAll(); - // Set the mode - myCurrentMode = CurAction3d_GlobalPanning; - break; - case ViewOperations::ViewFrontId : - myView->SetProj( V3d_Xpos ); - myView->FitAll(); - break; - case ViewOperations::ViewBackId : - myView->SetProj( V3d_Xneg ); - myView->FitAll(); - break; - case ViewOperations::ViewTopId : - myView->SetProj( V3d_Zpos ); - myView->FitAll(); - break; - case ViewOperations::ViewBottomId : - myView->SetProj( V3d_Zneg ); - myView->FitAll(); - break; - case ViewOperations::ViewLeftId : - myView->SetProj( V3d_Ypos ); - myView->FitAll(); - break; - case ViewOperations::ViewRightId : - myView->SetProj( V3d_Yneg ); - myView->FitAll(); - break; - case ViewOperations::ViewAxoId : - myView->SetProj( V3d_XposYnegZpos ); - myView->FitAll(); - break; - case ViewOperations::ViewRotationId : - myCurrentMode = CurAction3d_DynamicRotation; - break; - case ViewOperations::ViewResetId : - myView->Reset(); - break; - } -} - -void View::onCreateShape() -{ - myView->SetScale(3.0316); - if ( !myShapeDlg ) - myShapeDlg = new ShapeDlg( Application::getApplication(), myView, myContext ); - myShapeDlg->show(); -} - -void View::onLoadBox() -{ - myView->SetScale(1.0); - Standard_Real size = myContext->CurrentViewer()->DefaultViewSize() / 4.; - gp_Pnt origin( -size / 2., -size / 2., -size / 2. ); - //myContext->DefaultDrawer()->ShadingAspect()->SetColor(Quantity_NOC_RED); - Handle(AIS_Shape) box = - new AIS_Shape( BRepPrimAPI_MakeBox( origin, size, size, size ).Shape() ); - myContext->SetDisplayMode( box, myMDI->getDisplayMode(), false ); - - Application::startTimer(); - myContext->Display( box, false ); - Application::stopTimer( 0, "Display Box" ); - - Application::startTimer(); - myView->Update(); - Application::stopTimer( 0, "UPDATE" ); -} - -void View::onLoadSphere() -{ - myView->SetScale(1.0); - Standard_Real radius = myContext->CurrentViewer()->DefaultViewSize() / 4.; - Handle(AIS_Shape) sphere = - new AIS_Shape( BRepPrimAPI_MakeSphere( radius ).Shape() ); - myContext->SetDisplayMode( sphere, myMDI->getDisplayMode(), false ); - - Application::startTimer(); - myContext->Display( sphere, false ); - Application::stopTimer( 0, "Display Sphere" ); - - Application::startTimer(); - //myContext->UpdateCurrentViewer(); - myView->Update(); - Application::stopTimer( 0, "UPDATE" ); -} - -void View::onLoadTorus() -{ - myView->SetScale(1.0); - Handle(V3d_Viewer) viewer = myContext->CurrentViewer(); - Standard_Real r1 = viewer->DefaultViewSize() / 3.; - Standard_Real r2 = viewer->DefaultViewSize() / 6.; - Handle(AIS_Shape) torus = new AIS_Shape( BRepPrimAPI_MakeTorus( r1,r2 ).Shape() ); - myContext->SetDisplayMode( torus, myMDI->getDisplayMode(), false ); - - Application::startTimer(); - myContext->Display( torus, false ); - Application::stopTimer( 0, "Display Torus" ); - - Application::startTimer(); - //myContext->UpdateCurrentViewer(); - myView->Update(); - Application::stopTimer( 0, "UPDATE" ); -} - -void View::onLoadLine() -{ - myView->SetScale(1.0); - Handle(AIS_Line) line = - new AIS_Line( new Geom_Line( gp_Pnt( 0, 0, 0), gp_Dir( 0, 0, 1) ) ); - myContext->Display( line ); - myContext->UpdateCurrentViewer(); -} - -void View::onEditObjectProperties() -{ - if ( !myObjDlg ) - myObjDlg = new ObjectDlg( Application::getApplication(), myView, myContext ); - myObjDlg->show(); -} - -void View::onRemoveObject() -{ - myContext->InitSelected(); - for( ; myContext->MoreSelected(); myContext->InitSelected() ) - myContext->Remove( myContext->SelectedInteractive(), false ); - myContext->UpdateCurrentViewer(); -} - -void View::onWireframeMode() -{ - myContext->InitSelected(); - for( ; myContext->MoreSelected(); myContext->NextSelected() ) { - Handle(AIS_InteractiveObject) obj = myContext->SelectedInteractive(); - //myContext->Erase( obj, false ); - //myContext->Display( obj, /*0, 0,*/ false ); - //myContext->Activate( obj, 0 ); - myContext->SetDisplayMode( obj, 0 ); - } - myContext->UpdateCurrentViewer(); -} - -void View::onShadingMode() -{ - - myContext->InitSelected(); - for( ; myContext->MoreSelected(); myContext->NextSelected() ) { - Handle(AIS_InteractiveObject) obj = myContext->SelectedInteractive(); - //myContext->Erase( obj, false ); - //myContext->Display( obj /*, 1, 0*/, false ); - //myContext->Activate( obj, 0 ); - myContext->SetDisplayMode( obj, 1 ); - } - myContext->UpdateCurrentViewer(); - -} - -void View::onDisplayTrihedron() -{ - myContext->Display( myTrihedron ); -} - -void View::onEraseTrihedron() -{ - myContext->Erase( myTrihedron ); -} - diff --git a/samples/qt/Graphic3dDemo/src/ViewDlg.cxx b/samples/qt/Graphic3dDemo/src/ViewDlg.cxx deleted file mode 100755 index f8f564884c..0000000000 --- a/samples/qt/Graphic3dDemo/src/ViewDlg.cxx +++ /dev/null @@ -1,248 +0,0 @@ -// ViewDlg.cpp: implementation of the ViewDlg class. -// -////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include -#include -#include - -#include - -#include "Application.h" -#include "ViewDlg.h" -#include "global.h" - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ ) -:QDialog( parent ), - myAutoApply( true ), /*myView( view ),*/ myApplyAllViews(false) -{ - setModal( false ); - setWindowTitle( tr( "TITLE_VIEW_DLG" ) ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 5 ); - - QFrame* mainFrame = new QFrame( this ); - mainFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); - topLayout->addWidget( mainFrame ); - topLayout->addSpacing( 10 ); - - // view properties - QGridLayout* pLayout = new QGridLayout( mainFrame ); - pLayout->setMargin( 5 ); - myZBufferBox = new QCheckBox( mainFrame );; - myZBufferBox->setText( tr( "BTN_ZBUFFER" ) ); - verify( connect( myZBufferBox, SIGNAL( toggled( bool ) ), SLOT( onZBuffer( bool ) ) ) ); - - myAnimBox = new QCheckBox( mainFrame ); - myAnimBox->setText( tr( "BTN_ANIMATION" ) ); - verify( connect( myAnimBox, SIGNAL( toggled( bool ) ), SLOT( onAnimation( bool ) ) ) ); - - myDegBox = new QCheckBox( mainFrame ); - myDegBox->setText( tr( "BTN_DEGENERATION" ) ); - verify( connect( myDegBox, SIGNAL( toggled( bool ) ), SLOT( onDegeneration( bool ) ) ) ); - - pLayout->addWidget( myZBufferBox, 0, 0 ); - pLayout->addWidget( myAnimBox, 1, 0 ); - pLayout->addWidget( myDegBox, 2, 0 ); - pLayout->setRowStretch( 3, 10 ); - pLayout->setColumnStretch( 1, 10 ); - - // apply controls - QCheckBox *autoApply, *applyAllViews; - autoApply = new QCheckBox( this ); - autoApply->setText( tr( "BTN_AUTOAPPLY" ) ); - autoApply->setChecked( true ); - verify( connect( autoApply, SIGNAL( toggled( bool ) ), SLOT( onAutoApply( bool ) ) ) ); - applyAllViews = new QCheckBox( this ); - applyAllViews->setText( tr( "BTN_APPLYALLVIEWS" ) ); - verify( connect( applyAllViews, SIGNAL( toggled( bool ) ), - SLOT( onApplyAllViews( bool ) ) ) ); - - QHBoxLayout* applyLayout = new QHBoxLayout(); - applyLayout->addWidget( autoApply ); - applyLayout->addStretch( 10 ); - applyLayout->addWidget( applyAllViews ); - topLayout->addLayout( applyLayout ); - topLayout->addSpacing( 10 ); - - // control buttons - QPushButton *bOk, *bCancel/*, *bHelp*/; - - bOk = new QPushButton( tr( "BTN_OK" ), this ); - verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) ); - bOk->setDefault(true); - bCancel = new QPushButton( tr( "BTN_CANCEL" ), this ); - verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) ); - - -// bHelp = new QPushButton( tr( "BTN_HELP" ), this ); -// verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) ); - - QHBoxLayout* btnLayout = new QHBoxLayout(); - btnLayout->setSpacing( 5 ); - btnLayout->addStretch( 10 ); - btnLayout->addWidget( bOk ); - btnLayout->addWidget( bCancel ); - btnLayout->addStretch( 10 ); -// btnLayout->addWidget( bHelp ); - topLayout->addLayout( btnLayout ); - - QSize s = topLayout->totalMinimumSize(); - s.setWidth( s.width() + topLayout->margin() + 10 ); - s.setHeight( s.height() + topLayout->margin() + 10 ); - setFixedSize( s ); - - Handle(V3d_View) aView = Application::getApplication()->getActiveMDI()->getView(); - myIsAnim = aView->AnimationMode(myIsDeg); -} - -ViewDlg::~ViewDlg() -{ -} - -void ViewDlg::showEvent ( QShowEvent* e ) -{ - Update(); - QWidget::showEvent( e ); -} - -void ViewDlg::onOk() -{ - hide(); - bool Auto = myAutoApply; - - myAutoApply = true; - onZBuffer(myZBufferBox->isChecked()); - onAnimation(myAnimBox->isChecked()); - onDegeneration(myDegBox->isChecked()); - myAutoApply = Auto; -} - -void ViewDlg::onCancel() -{ - hide(); -} - -void ViewDlg::onHelp() -{ -} - -void ViewDlg::onZBuffer( bool on ) -{ - QWidgetList aWidgetList; - Handle(V3d_View) aView; - QWidget* aWidget; - - if (!myApplyAllViews) - aWidgetList.append(Application::getApplication()->getActiveMDI()); - else - aWidgetList = Application::getWorkspace()->windowList(); - - if ( myAutoApply ){ - foreach(aWidget, aWidgetList){ - if ( !aWidget ) continue; - MDIWindow* aMDIWindow = (MDIWindow*)aWidget; - aView = aMDIWindow->getView(); - if ( on ) - aView->SetVisualization( V3d_ZBUFFER ); - else - aView->SetVisualization( V3d_WIREFRAME ); - } - } -} - -void ViewDlg::onAnimation( bool on ) -{ - QWidgetList aWidgetList; - Handle(V3d_View) aView; - - myIsAnim = on; - myDegBox->setEnabled( myIsAnim ); - if (!myIsAnim) myDegBox->setChecked(false); - - if (!myApplyAllViews) - aWidgetList.append(Application::getApplication()->getActiveMDI()); - else - aWidgetList = Application::getWorkspace()->windowList(); - - if ( myAutoApply ){ - QWidget* aWidget; - foreach(aWidget, aWidgetList){ - if ( !aWidget ) continue; - MDIWindow* aMDIWindow = (MDIWindow*)aWidget; - aView = aMDIWindow->getView(); - aView->SetAnimationMode( myIsAnim, myIsDeg ); - aView->Redraw(); - aView->SetImmediateUpdate(true); - aView->Update(); - } - } -} - -void ViewDlg::onDegeneration( bool on ) -{ - QWidgetList aWidgetList; - Handle(V3d_View) aView; - QWidget* aWidget; - - if (!myApplyAllViews) - aWidgetList.append(Application::getApplication()->getActiveMDI()); - else - aWidgetList = Application::getWorkspace()->windowList(); - - - myIsDeg = on; - if ( myAutoApply ){ - foreach(aWidget, aWidgetList){ - if ( !aWidget ) continue; - MDIWindow* aMDIWindow = (MDIWindow*)aWidget; - aView = aMDIWindow->getView(); - aView->SetAnimationMode( myIsAnim, myIsDeg ); - } - } -} - -void ViewDlg::onAutoApply( bool on ) -{ - myAutoApply = on; -} - -void ViewDlg::onApplyAllViews( bool on ) -{ - myApplyAllViews = on; -} - -void ViewDlg::Update() -{ - MDIWindow* anActiveMDIWindow = Application::getApplication()->getActiveMDI(); - if (anActiveMDIWindow){ - Handle(V3d_View) aView = anActiveMDIWindow->getView(); - if(!aView.IsNull()){ - - myIsAnim = aView->AnimationMode( myIsDeg ); - myAnimBox->blockSignals( true ); - myDegBox->blockSignals( true ); - myAnimBox->setChecked( myIsAnim ); - myDegBox->setChecked( myIsDeg ); - myDegBox->setEnabled( myIsAnim ); - myAnimBox->blockSignals( false ); - myDegBox->blockSignals( false ); - - myZBufferBox->blockSignals(true); - V3d_TypeOfVisualization aVisuType = aView->Visualization(); - if(aVisuType == V3d_WIREFRAME) - myZBufferBox -> setChecked(false); - else - myZBufferBox -> setChecked(true); - myZBufferBox->blockSignals(false); - } - } -} diff --git a/samples/qt/Graphic3dDemo/src/ViewOperations.cxx b/samples/qt/Graphic3dDemo/src/ViewOperations.cxx deleted file mode 100755 index edf3b1b519..0000000000 --- a/samples/qt/Graphic3dDemo/src/ViewOperations.cxx +++ /dev/null @@ -1,328 +0,0 @@ -#include "ViewOperations.h" -#include "global.h" -//#include "Material.h" -//#include "Transparency.h" -#include "Application.h" -#include "Document.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - - - static QCursor* defCursor = NULL; - static QCursor* handCursor = NULL; - static QCursor* panCursor = NULL; - static QCursor* zoomCursor = NULL; - static QCursor* rotCursor = NULL; - -ViewOperations::ViewOperations( QObject* parent) -: QObject( parent ) -{ - myContext = NULL; -} - -ViewOperations::ViewOperations( Handle(AIS_InteractiveContext) theContext, - QObject* parent) -: QObject( parent ) -{ - myContext = theContext; - initActions(); - initViewActions(); -} - -ViewOperations::~ViewOperations() -{ - myContext = NULL; -} - -void ViewOperations::onWireframe() -{ - AIS_ListOfInteractive displayed; - myContext->DisplayedObjects( displayed ); - AIS_ListIteratorOfListOfInteractive it( displayed ); - for ( ; it.More(); it.Next() ) - myContext->SetDisplayMode( it.Value(), 0 ); -#ifdef a - for(myContext->InitCurrent();myContext->MoreCurrent();myContext->NextCurrent()) - myContext->SetDisplayMode(myContext->Current(),0); -#endif -} - -void ViewOperations::onShading() -{ - QApplication::setOverrideCursor( Qt::WaitCursor ); - - AIS_ListOfInteractive displayed; - myContext->DisplayedObjects( displayed ); - AIS_ListIteratorOfListOfInteractive it( displayed ); - for ( ; it.More(); it.Next() ) - myContext->SetDisplayMode( it.Value(), 1 ); - -#ifdef a - for(myContext->InitCurrent();myContext->MoreCurrent();myContext->NextCurrent()) - myContext->SetDisplayMode(myContext->Current(),1); -#endif - QApplication::restoreOverrideCursor(); -} - -void ViewOperations::initActions() -{ - initCursors(); - initToolActions(); -} - -void ViewOperations::initCursors() -{ - if( !defCursor ) - defCursor = new QCursor( Qt::ArrowCursor ); - if( !handCursor ) - handCursor = new QCursor( Qt::PointingHandCursor ); - if( !panCursor ) - panCursor = new QCursor( Qt::SizeAllCursor ); - - QString dir( Application::getResourceDir() ); - if( !zoomCursor ) - zoomCursor = new QCursor( QPixmap( dir + tr( "ICON_CURSOR_ZOOM" ) ) ); - if( !rotCursor ) - rotCursor = new QCursor( QPixmap( dir + tr( "ICON_CURSOR_ROTATE" ) ) ); -} - -QList ViewOperations::getViewActions() -{ - return myViewActions; -} - -void ViewOperations::initViewActions() -{ - if ( myViewActions.count() ) - return; - - QString dir = Application::getResourceDir(); - - QAction* a; - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FITALL" ) ), "", this ); - a->setToolTip( tr( "TBR_FITALL" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewFitAllId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FITAREA" ) ), "", this ); - a->setToolTip( tr( "TBR_FITAREA" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) ); - myViewActions.insert( ViewFitAreaId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_ZOOM" ) ), "", this ); - a->setToolTip( tr( "TBR_ZOOM" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) ); - myViewActions.insert( ViewZoomId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_PAN" ) ), "", this ); - a->setToolTip( tr( "TBR_PAN" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) ); - myViewActions.insert( ViewPanId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_GLOBALPAN" ) ), "", this ); - a->setToolTip( tr( "TBR_GLOBALPAN" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) ); - myViewActions.insert( ViewGlobalPanId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FRONT" ) ), "", this ); - a->setToolTip( tr( "TBR_FRONT" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewFrontId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_BACK" ) ), "", this ); - a->setToolTip( tr( "TBR_BACK" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewBackId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_TOP" ) ), "", this ); - a->setToolTip( tr( "TBR_TOP" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewTopId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_BOTTOM" ) ), "", this ); - a->setToolTip( tr( "TBR_BOTTOM" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewBottomId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_LEFT" ) ), "", this ); - a->setToolTip( tr( "TBR_LEFT" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewLeftId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_RIGHT" ) ), "", this ); - a->setToolTip( tr( "TBR_RIGHT" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewRightId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_AXO" ) ), "", this ); - a->setToolTip( tr( "TBR_AXO" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewAxoId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_ROTATION" ) ), "", this ); - a->setToolTip( tr( "TBR_ROTATION" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) ); - myViewActions.insert( ViewRotationId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_VIEW_RESET" ) ), "", this ); - a->setToolTip( tr( "TBR_RESET" ) ); - verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) ); - myViewActions.insert( ViewResetId, a ); -} - -void ViewOperations::updateToggled( bool isOn ) -{ - if( !isOn ) - return; - - QAction* sentBy = (QAction*) sender(); - - for ( int i = ViewFitAllId;i <= ViewResetId ; i++) - { - QAction* anAction = myViewActions.at(i); - if( (anAction == myViewActions.at(ViewFitAreaId)) || - (anAction == myViewActions.at(ViewZoomId)) || - (anAction == myViewActions.at(ViewPanId)) || - (anAction == myViewActions.at(ViewGlobalPanId)) || - (anAction == myViewActions.at(ViewRotationId))) { - if (anAction && (anAction != sentBy)) { - anAction->setCheckable(true); - anAction->setChecked(false); - } else { - if(sentBy == myViewActions.at(ViewFitAreaId)) - emit setCursor(*handCursor); - else if (sentBy == myViewActions.at(ViewZoomId)) - emit setCursor(*zoomCursor); - else if (sentBy == myViewActions.at(ViewPanId)) - emit setCursor(*panCursor); - else if (sentBy == myViewActions.at(ViewGlobalPanId)) - emit setCursor(*defCursor); - else if (sentBy == myViewActions.at(ViewRotationId)) - emit setCursor(*rotCursor); - sentBy->setCheckable(false); - } - } - } -} - -QList ViewOperations::getToolActions() -{ - initToolActions(); - return myToolActions; -} - -void ViewOperations::initToolActions() -{ - if( myToolActions.count() ) - return; - - QString dir = Application::getResourceDir(); - - //QAction* a = new QAction( tr( "TBR_TOOL_MAGVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ), - // "", 0, this ); - //verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) ); - //myToolActions->insert( MagViewId, a ); - -// QAction* a = new QAction( tr( "TBR_TOOL_AXOVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ), -// "", 0, this ); -// verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) ); -// myToolActions->insert( AxoViewId, a ); - -// a = new QAction( tr( "TBR_TOOL_PERVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ), -// "", 0, this ); -// verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) ); -// myToolActions->insert( PerViewId, a ); - - QAction* a = new QAction( QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ), "", this ); - a->setToolTip( tr( "TBR_TOOL_WIRE" ) ); - a->setCheckable( true ); - verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) ); - myToolActions.insert( ToolWireframeId, a ); - - a = new QAction( QPixmap( dir + tr( "ICON_TOOL_SHAD") ), "", this ); - a->setToolTip( tr( "TBR_TOOL_SHAD" ) ); - a->setCheckable( true ); - a->setChecked( true ); - verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) ); - myToolActions.insert( ToolShadingId, a ); -} - -void ViewOperations::onToolAction() -{ - QAction* sentBy = (QAction*) sender(); - //MDIWindow* win = (MDIWindow*) Application::getWorkspace()->activeWindow(); - MDIWindow* win = (MDIWindow*)Application::getApplication()->getActiveMDI(); - Document* doc = win->getDocument(); - -// if( sentBy == myToolActions->at( MagViewId ) ) -// win->defineMagView(); - -// if( sentBy == myToolActions->at( PerViewId ) ) -// doc->createNewView( V3d_PERSPECTIVE ); - -// if( sentBy == myToolActions->at( AxoViewId ) ) -// doc->createNewView(); - - if( sentBy == myToolActions.at( ToolWireframeId ) ) - doc->onWireframe(); - - if( sentBy == myToolActions.at( ToolShadingId ) ) - doc->onShading(); -} - -int ViewOperations::getDisplayMode() -{ - bool on = myToolActions.at( ToolWireframeId )->isChecked(); - return on ? 0 : 1; -} - -void ViewOperations::onNoActiveActions() -{ - for ( int i = ViewFitAllId;i <= ViewResetId ; i++ ) { - QAction* anAction = myViewActions.at( i ); - if( ( anAction == myViewActions.at( ViewFitAreaId ) ) || - ( anAction == myViewActions.at( ViewZoomId ) ) || - ( anAction == myViewActions.at( ViewPanId ) ) || - ( anAction == myViewActions.at( ViewGlobalPanId ) ) || - ( anAction == myViewActions.at( ViewRotationId ) ) ) { - - emit setCursor( *defCursor ); - anAction->setCheckable( true ); - anAction->setChecked( false ); - } - } -} - -void ViewOperations::onActionActivated() -{ - QAction* a = (QAction*) sender(); - //MDIWindow* win = (MDIWindow*) Application::getWorkspace()->activeWindow(); - MDIWindow* win = (MDIWindow*) Application::getApplication()->getActiveMDI(); - int index = myViewActions.indexOf( a ); - if ( index != -1 ) - win->activateAction( (Action)index ); -}