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 a401e7a62f..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/auto.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/cascade.png b/samples/qt/Graphic3dDemo/res/cascade.png
deleted file mode 100755
index 9cd171538d..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/cascade.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/close.png b/samples/qt/Graphic3dDemo/res/close.png
deleted file mode 100755
index b7126e002d..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/close.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/cursor_rotate.png b/samples/qt/Graphic3dDemo/res/cursor_rotate.png
deleted file mode 100755
index a3cb0c1ecc..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/cursor_rotate.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/cursor_zoom.png b/samples/qt/Graphic3dDemo/res/cursor_zoom.png
deleted file mode 100755
index 0020fea39f..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/cursor_zoom.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/document.png b/samples/qt/Graphic3dDemo/res/document.png
deleted file mode 100755
index 1ba28fff33..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/document.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/help.png b/samples/qt/Graphic3dDemo/res/help.png
deleted file mode 100755
index e57336285e..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/help.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/lamp.png b/samples/qt/Graphic3dDemo/res/lamp.png
deleted file mode 100755
index a5a6775c33..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/lamp.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/new.png b/samples/qt/Graphic3dDemo/res/new.png
deleted file mode 100755
index 953757a62f..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/new.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/optim.png b/samples/qt/Graphic3dDemo/res/optim.png
deleted file mode 100755
index c469b93182..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/optim.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/stop.png b/samples/qt/Graphic3dDemo/res/stop.png
deleted file mode 100755
index 778955b77a..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/stop.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/tile.png b/samples/qt/Graphic3dDemo/res/tile.png
deleted file mode 100755
index b3e6d7b5a3..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/tile.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/tool_shading.png b/samples/qt/Graphic3dDemo/res/tool_shading.png
deleted file mode 100755
index d418286008..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/tool_shading.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/tool_wireframe.png b/samples/qt/Graphic3dDemo/res/tool_wireframe.png
deleted file mode 100755
index c5e4a1179e..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/tool_wireframe.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_axo.png b/samples/qt/Graphic3dDemo/res/view_axo.png
deleted file mode 100755
index cac2bc2f51..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_axo.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_back.png b/samples/qt/Graphic3dDemo/res/view_back.png
deleted file mode 100755
index 0798f52938..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_back.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_bottom.png b/samples/qt/Graphic3dDemo/res/view_bottom.png
deleted file mode 100755
index c7cfdc208a..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_bottom.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_fitall.png b/samples/qt/Graphic3dDemo/res/view_fitall.png
deleted file mode 100755
index 21d2f423ef..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_fitall.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_fitarea.png b/samples/qt/Graphic3dDemo/res/view_fitarea.png
deleted file mode 100755
index f20f5c0554..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_fitarea.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_front.png b/samples/qt/Graphic3dDemo/res/view_front.png
deleted file mode 100755
index a9e99c59b6..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_front.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_glpan.png b/samples/qt/Graphic3dDemo/res/view_glpan.png
deleted file mode 100755
index 02a9c1cb8d..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_glpan.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_left.png b/samples/qt/Graphic3dDemo/res/view_left.png
deleted file mode 100755
index 7d25b6ab2f..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_left.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_pan.png b/samples/qt/Graphic3dDemo/res/view_pan.png
deleted file mode 100755
index 0e9a6a5a03..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_pan.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_reset.png b/samples/qt/Graphic3dDemo/res/view_reset.png
deleted file mode 100755
index 38849fd694..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_reset.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_right.png b/samples/qt/Graphic3dDemo/res/view_right.png
deleted file mode 100755
index 5540220cfa..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_right.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_rotate.png b/samples/qt/Graphic3dDemo/res/view_rotate.png
deleted file mode 100755
index 7e5d013b9f..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_rotate.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_top.png b/samples/qt/Graphic3dDemo/res/view_top.png
deleted file mode 100755
index b788de36fb..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_top.png and /dev/null differ
diff --git a/samples/qt/Graphic3dDemo/res/view_zoom.png b/samples/qt/Graphic3dDemo/res/view_zoom.png
deleted file mode 100755
index 1b50a37bc8..0000000000
Binary files a/samples/qt/Graphic3dDemo/res/view_zoom.png and /dev/null differ
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