+++ /dev/null
-# 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
+++ /dev/null
-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>
-{{{
-}}}
-
-###############################################################################
-
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="Graph"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\win32/bin"
- IntermediateDirectory=".\win32/obj"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="$(QTDIR)\include\QtCore,$(QTDIR)\include\QtGui,$(QTDIR)\include\Qt,$(QTDIR)\include,inc"
- PreprocessorDefinitions="NDEBUG;QT_DLL;WIN32;_WINDOWS;_USRDLL;GRAPH_EXPORTS"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\win32/obj/Graph.pch"
- AssemblerListingLocation=".\win32/obj/"
- ObjectFile=".\win32/obj/"
- ProgramDataBaseFileName=".\win32/obj/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib QtCore4.lib QtGui4.lib qtmain.lib"
- OutputFile=".\win32/bin/Graph.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="$(QTDIR)\lib"
- ProgramDatabaseFile=".\win32/bin/Graph.pdb"
- ImportLibrary=".\win32/bin/Graph.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\win32/bin/Graph.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="2057"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\win32/bind"
- IntermediateDirectory=".\win32/objd"
- ConfigurationType="2"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="$(QTDIR)\include\QtCore,$(QTDIR)\include\QtGui,$(QTDIR)\include\Qt,$(QTDIR)\include,inc"
- PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;GRAPH_EXPORTS;QT_DLL"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\win32/objd/Graph.pch"
- AssemblerListingLocation=".\win32/objd/"
- ObjectFile=".\win32/objd/"
- ProgramDataBaseFileName=".\win32/objd/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib QtCored4.lib QtGuid4.lib qtmaind.lib"
- OutputFile=".\win32/bind/Graph.dll"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="$(QTDIR)\lib"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\win32/bind/Graph.pdb"
- ImportLibrary=".\win32/bind/Graph.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\win32/bind/Graph.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="2057"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
- <File
- RelativePath="src\Graph.cpp">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="NDEBUG;QT_DLL;WIN32;_WINDOWS;_MBCS;_USRDLL;GRAPH_EXPORTS;$(NoInherit)"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;GRAPH_EXPORTS;QT_DLL;$(NoInherit)"
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl">
- <File
- RelativePath="inc\Graph.h">
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-# 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
+++ /dev/null
-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>
-{{{
-}}}
-
-###############################################################################
-
+++ /dev/null
-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
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="Graphic3dDemo"
- SccProjectName=""
- SccLocalPath="">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\win32/bind"
- IntermediateDirectory=".\win32/objd"
- ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="inc,$(CASROOT)\inc,$(QTDIR)\include\QtCore,$(QTDIR)\include\QtGui,,$(QTDIR)\include\Qt,$(QTDIR)\include"
- PreprocessorDefinitions="_DEBUG;WIN32;WNT;QT_DLL"
- BasicRuntimeChecks="3"
- RuntimeLibrary="1"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\win32/objd/Graphic3dDemo.pch"
- AssemblerListingLocation=".\win32/objd/"
- ObjectFile=".\win32/objd/"
- ProgramDataBaseFileName=".\win32/objd/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- DebugInformationFormat="4"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="TKernel.lib TKV3d.lib TKService.lib PTKernel.lib TKG3d.lib TKSTL.lib TKBrep.lib TKPrim.lib TKTopAlgo.lib TKG2d.lib TKMath.lib QtCored4.lib QtGuid4.lib qtmaind.lib odbc32.lib odbccp32.lib Graph.lib"
- OutputFile=".\win32/bind/Graphic3dDemo.exe"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="$(CASROOT)\win32\libd,$(QTDIR)\lib,win32\bind"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile=".\win32/bind/Graphic3dDemo.pdb"
- SubSystem="2"
- EntryPointSymbol="mainCRTStartup"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\win32/bind/Graphic3dDemo.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="2057"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\win32/bin"
- IntermediateDirectory=".\win32/obj"
- ConfigurationType="1"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- AdditionalIncludeDirectories="inc,$(CASROOT)\inc,$(QTDIR)\include\QtCore,$(QTDIR)\include\QtGui,,$(QTDIR)\include\Qt,$(QTDIR)\include"
- PreprocessorDefinitions="NDEBUG;WIN32;WNT;QT_DLL"
- StringPooling="TRUE"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="TRUE"
- UsePrecompiledHeader="2"
- PrecompiledHeaderFile=".\win32/obj/Graphic3dDemo.pch"
- AssemblerListingLocation=".\win32/obj/"
- ObjectFile=".\win32/obj/"
- ProgramDataBaseFileName=".\win32/obj/"
- WarningLevel="3"
- SuppressStartupBanner="TRUE"
- CompileAs="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="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 qtmain.lib odbc32.lib odbccp32.lib Graph.lib"
- OutputFile=".\win32/bin/Graphic3dDemo.exe"
- LinkIncremental="1"
- SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="$(CASROOT)\win32\lib,$(QTDIR)\lib,win32\bin"
- ProgramDatabaseFile=".\win32/bin/Graphic3dDemo.pdb"
- SubSystem="2"
- EntryPointSymbol="mainCRTStartup"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="TRUE"
- SuppressStartupBanner="TRUE"
- TargetEnvironment="1"
- TypeLibraryName=".\win32/bin/Graphic3dDemo.tlb"
- HeaderFileName=""/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="2057"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
- <File
- RelativePath="src\Application.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\AutoTestDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\Document.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\Graphic3dDemo.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\MDIWindow.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\ObjectDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\ShapeDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\Sphere_BasicShape.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\src\Sphere_Sphere.cxx">
- </File>
- <File
- RelativePath="src\Translate.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\View.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\ViewDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="src\ViewOperations.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl">
- <File
- RelativePath="inc\Application.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\AutoTestDlg.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\Document.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\global.h">
- </File>
- <File
- RelativePath="inc\Graph.h">
- </File>
- <File
- RelativePath="inc\Handle_Sphere_BasicShape.hxx">
- </File>
- <File
- RelativePath="inc\Handle_Sphere_Sphere.hxx">
- </File>
- <File
- RelativePath="inc\MDIWindow.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\ObjectDlg.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\ShapeDlg.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\Sphere_BasicShape.hxx">
- </File>
- <File
- RelativePath="inc\Sphere_BasicShape.ixx">
- </File>
- <File
- RelativePath="inc\Sphere_BasicShape.jxx">
- </File>
- <File
- RelativePath="inc\Sphere_Sphere.hxx">
- </File>
- <File
- RelativePath="inc\Sphere_Sphere.ixx">
- </File>
- <File
- RelativePath="inc\Sphere_Sphere.jxx">
- </File>
- <File
- RelativePath="inc\Translate.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\View.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\ViewDlg.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="inc\ViewOperations.h">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Moc'ing $(InputName).h ..."
- CommandLine="$(QTDIR)\bin\moc.exe $(InputDir)\$(InputName).h -o .\win32\inc\moc_$(InputName).cxx
-"
- Outputs=".\win32\inc\moc_$(InputName).cxx"/>
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
- <File
- RelativePath=".\res\Sample_icons.ts">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Generation $(InputName).qm..."
- CommandLine=""$(QTDIR)\bin\lrelease" "$(InputPath)" -qm "win32\res\$(InputName).qm"
-"
- Outputs="win32\res\$(InputName).qm"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Generation $(InputName).qm..."
- CommandLine=""$(QTDIR)\bin\lrelease" "$(InputPath)" -qm "win32\res\$(InputName).qm"
-"
- Outputs="win32\res\$(InputName).qm"/>
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\res\Sample_msg.ts">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Generation $(InputName).qm..."
- CommandLine=""$(QTDIR)\bin\lrelease" "$(InputPath)" -qm "win32\res\$(InputName).qm""
- Outputs="win32\res\$(InputName).qm"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCustomBuildTool"
- Description="Generation $(InputName).qm..."
- CommandLine=""$(QTDIR)\bin\lrelease" "$(InputPath)" -qm "win32\res\$(InputName).qm""
- Outputs="win32\res\$(InputName).qm"/>
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="moc"
- Filter="">
- <File
- RelativePath="win32\inc\moc_Application.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_AutoTestDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_Document.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_MDIWindow.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_ObjectDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_ShapeDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_Translate.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_View.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_ViewDlg.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- <File
- RelativePath="win32\inc\moc_ViewOperations.cxx">
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""
- BasicRuntimeChecks="3"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- AdditionalIncludeDirectories=""
- PreprocessorDefinitions=""/>
- </FileConfiguration>
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-@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
+++ /dev/null
-@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
+++ /dev/null
-@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
+++ /dev/null
-#ifndef APPLICATION_H
-#define APPLICATION_H
-
-#include <qmainwindow.h>
-#include <qaction.h>
-#include <qtoolbar.h>
-#include <qmenu.h>
-#include <qworkspace.h>
-#include <qlist.h>
-
-#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<QAction*> myStdActions;
- QList<QAction*> 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
+++ /dev/null
-#ifndef AUTOTESTDLG_H
-#define AUTOTESTDLG_H
-
-#include <qdialog.h>
-#include <qspinbox.h>
-#include <qcheckbox.h>
-#include <qobject.h>
-
-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
+++ /dev/null
-#ifndef DOCUMENT_H
-#define DOCUMENT_H
-
-#include <qobject.h>
-#include <qlist.h>
-
-#include "MDIWindow.h"
-#include "ViewOperations.h"
-
-#include <AIS_InteractiveContext.hxx>
-#include <V3d_Viewer.hxx>
-#include <V3d_TypeOfView.hxx>
-
-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<MDIWindow*> myViews;
- Handle_V3d_Viewer myViewer;
- Handle_AIS_InteractiveContext myContext;
- ViewOperations* myOperations;
- int myIndex;
- int myNbViews;
-};
-
-#endif
+++ /dev/null
-// 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 <qwidget.h>
-#include <qpixmap.h>
-#include <qcursor.h>
-#include <qlist.h>
-#include <qsplitter.h>
-#include <qlayout.h>
-#include <qcolor.h>
-#include <qrubberband.h>
-
-//================================================================
-// 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<GraphNode*> 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 <Sorted> flag, true by default
- bool isSorted() { return mySorted; }
-// sets/clears <Sorted> 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;
-// <Sort coordinates> flag
- bool mySorted;
-};
-
-typedef QList<GraphItem*> ItemList;
-typedef QList<QColor> ColorList;
-typedef QList<Qt::PenStyle> LineList;
-typedef QList<int> 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 <Enable operations> 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
+++ /dev/null
-// 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 <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_AIS_Shape_HeaderFile
-#include <Handle_AIS_Shape.hxx>
-#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
+++ /dev/null
-// 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 <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_Sphere_BasicShape_HeaderFile
-#include <Handle_Sphere_BasicShape.hxx>
-#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
+++ /dev/null
-#ifndef MDIWINDOW_H
-#define MDIWINDOW_H
-
-#include <qmainwindow.h>
-#include <V3d_View.hxx>
-#include <V3d_TypeOfView.hxx>
-
-#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
+++ /dev/null
-#ifndef OBJECTDLG_H
-#define OBJECTDLG_H
-
-#include <qdialog.h>
-
-#include <Aspect_TypeOfDegenerateModel.hxx>
-#include <V3d_View.hxx>
-#include <AIS_InteractiveContext.hxx>
-
-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
+++ /dev/null
-#ifndef SHAPEDLG_H
-#define SHAPEDLG_H
-
-#include <qdialog.h>
-
-#include <Aspect_TypeOfDegenerateModel.hxx>
-#include <V3d_View.hxx>
-#include <AIS_InteractiveContext.hxx>
-//#include <GUIA_Sphere.hxx>
-#include <Sphere_Sphere.hxx>
-
-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
+++ /dev/null
-// 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 <Standard.hxx>
-#endif
-#ifndef _Handle_Sphere_BasicShape_HeaderFile
-#include <Handle_Sphere_BasicShape.hxx>
-#endif
-
-#include <Standard_Real.hxx>
-#include <Standard_Boolean.hxx>
-#include <AIS_Shape.hxx>
-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
+++ /dev/null
-// 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 <Sphere_BasicShape.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#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() {}
-
+++ /dev/null
-#include <TopoDS_Shape.hxx>
-#include <gp_Pnt.hxx>
-#include <Sphere_BasicShape.hxx>
+++ /dev/null
-// 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 <Standard.hxx>
-#endif
-#ifndef _Handle_Sphere_Sphere_HeaderFile
-#include <Handle_Sphere_Sphere.hxx>
-#endif
-
-#include <Standard_Real.hxx>
-#include <Sphere_BasicShape.hxx>
-#include <Standard_Boolean.hxx>
-#include <Handle_PrsMgr_PresentationManager3d.hxx>
-#include <Handle_Prs3d_Presentation.hxx>
-#include <Standard_Integer.hxx>
-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
+++ /dev/null
-// 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 <Sphere_Sphere.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#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() {}
-
+++ /dev/null
-#include <gp_Pnt.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Sphere_Sphere.hxx>
+++ /dev/null
-#ifndef TRANSLATE_H
-#define TRANSLATE_H
-
-#include <qobject.h>
-#include <AIS_InteractiveContext.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <Storage_Error.hxx>
-#include <TCollection_AsciiString.hxx>
-#include "MgtBRep_TriangleMode.hxx"
-#include <STEPControl_StepModelType.hxx>
-
-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
+++ /dev/null
-#ifndef VIEW_H
-#define VIEW_H
-
-#include <qwidget.h>
-
-#include <AIS_InteractiveContext.hxx>
-#include <V3d_View.hxx>
-#include <AIS_Trihedron.hxx>
-
-#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
+++ /dev/null
-// 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 <qdialog.h>
-
-#include <V3d_View.hxx>
-
-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
+++ /dev/null
-#ifndef VIEWOPERATIONS_H
-#define VIEWOPERATIONS_H
-
-#include <qobject.h>
-#include <qlist.h>
-#include <qaction.h>
-
-#include <AIS_InteractiveContext.hxx>
-
-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<QAction*> getViewActions();
- QList<QAction*> 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<QAction*> myViewActions;
- QList<QAction*> myToolActions;
-};
-
-#endif
+++ /dev/null
-#ifndef GLOBAL_H
-#define GLOBAL_H
-
-#include <qobject.h>
-#include <qstring.h>
-
-#if defined WNT
-#ifdef _DEBUG
-#include <assert.h>
-#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
+++ /dev/null
-<!DOCTYPE TS>
-<TS version="1.1" >
- <context>
- <name>Application</name>
- <message>
- <source>ICON_AUTO_TEST</source>
- <translation>../../res/auto.png</translation>
- </message>
- <message>
- <source>ICON_CASCADE</source>
- <translation>../../res/cascade.png</translation>
- </message>
- <message>
- <source>ICON_CLOSE</source>
- <translation>../../res/close.png</translation>
- </message>
- <message>
- <source>ICON_HELP</source>
- <translation>../../res/help.png</translation>
- </message>
- <message>
- <source>ICON_NEW</source>
- <translation>../../res/new.png</translation>
- </message>
- <message>
- <source>ICON_OPTIM</source>
- <translation>../../res/optim.png</translation>
- </message>
- <message>
- <source>ICON_STOP</source>
- <translation>../../res/stop.png</translation>
- </message>
- <message>
- <source>ICON_TILE</source>
- <translation>../../res/tile.png</translation>
- </message>
- </context>
- <context>
- <name>Document</name>
- <message>
- <source>ICON_DOC</source>
- <translation>../../res/document.png</translation>
- </message>
- </context>
- <context>
- <name>QObject</name>
- <message>
- <source>ICON_SAMPLE</source>
- <translation>../../res/lamp.png</translation>
- </message>
- </context>
- <context>
- <name>ViewOperations</name>
- <message>
- <source>ICON_CURSOR_ROTATE</source>
- <translation>../../res/cursor_rotate.png</translation>
- </message>
- <message>
- <source>ICON_CURSOR_ZOOM</source>
- <translation>../../res/cursor_zoom.png</translation>
- </message>
- <message>
- <source>ICON_TOOL_SHAD</source>
- <translation>../../res/tool_shading.png</translation>
- </message>
- <message>
- <source>ICON_TOOL_WIRE</source>
- <translation>../../res/tool_wireframe.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_AXO</source>
- <translation>../../res/view_axo.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_BACK</source>
- <translation>../../res/view_back.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_BOTTOM</source>
- <translation>../../res/view_bottom.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_FITALL</source>
- <translation>../../res/view_fitall.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_FITAREA</source>
- <translation>../../res/view_fitarea.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_FRONT</source>
- <translation>../../res/view_front.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_GLOBALPAN</source>
- <translation>../../res/view_glpan.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_LEFT</source>
- <translation>../../res/view_left.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_PAN</source>
- <translation>../../res/view_pan.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_RESET</source>
- <translation>../../res/view_reset.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_RIGHT</source>
- <translation>../../res/view_right.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_ROTATION</source>
- <translation>../../res/view_rotate.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_TOP</source>
- <translation>../../res/view_top.png</translation>
- </message>
- <message>
- <source>ICON_VIEW_ZOOM</source>
- <translation>../../res/view_zoom.png</translation>
- </message>
- </context>
-</TS>
+++ /dev/null
-<!DOCTYPE TS>
-<TS version="1.1" >
- <context>
- <name>@default</name>
- <message>
- <source>BTN_APPLYALLVIEWS</source>
- <translation>Apply on all views</translation>
- </message>
- <message>
- <source>BTN_AUTOAPPLY</source>
- <translation>Apply immediately</translation>
- </message>
- <message>
- <source>BTN_CANCEL</source>
- <translation>Cancel</translation>
- </message>
- <message>
- <source>BTN_DEGENERATION</source>
- <translation>Enable degeneration</translation>
- </message>
- <message>
- <source>BTN_HELP</source>
- <translation>Help</translation>
- </message>
- <message>
- <source>BTN_OK</source>
- <translation>Ok</translation>
- </message>
- <message>
- <source>BTN_ZBUFFER</source>
- <translation>Enable ZBuffer</translation>
- </message>
- <message>
- <source>INF_APP_EXPORT</source>
- <translation>Export file</translation>
- </message>
- <message>
- <source>INF_APP_IMPORT</source>
- <translation>Import file</translation>
- </message>
- <message>
- <source>INF_DATA_ERROR</source>
- <translation>Incorrect Data.</translation>
- </message>
- <message>
- <source>INF_FACET_ERROR</source>
- <translation>At least one shape doesn't contain facetes.</translation>
- </message>
- <message>
- <source>INF_NOTHING_ERROR</source>
- <translation>Nothing to transfer.</translation>
- </message>
- <message>
- <source>INF_NULL_SHAPE</source>
- <translation>No objects found to be saved.</translation>
- </message>
- <message>
- <source>INF_TRANSLATE_ERROR</source>
- <translation>The translation is not done.</translation>
- </message>
- <message>
- <source>INF_WRITING_ERROR</source>
- <translation>Writing has failed.</translation>
- </message>
- <message>
- <source>MEN_DLG_DEFERRED</source>
- <translation>deferred</translation>
- </message>
- <message>
- <source>MEN_DLG_DMODE</source>
- <translation>Activate display mode</translation>
- </message>
- <message>
- <source>MEN_DLG_IMMEDIATE</source>
- <translation>immediate</translation>
- </message>
- <message>
- <source>TIT_ERROR</source>
- <translation>Error</translation>
- </message>
- </context>
- <context>
- <name>Application</name>
- <message>
- <source>INF_ABOUT</source>
- <translation>New OpenGL functionality testings.</translation>
- </message>
- <message>
- <source>INF_READY</source>
- <translation>Ready</translation>
- </message>
- <message>
- <source>MEN_ABOUT</source>
- <translation>&About</translation>
- </message>
- <message>
- <source>MEN_CASCADE</source>
- <translation>&Cascade</translation>
- </message>
- <message>
- <source>MEN_CLOSE</source>
- <translation>&Close</translation>
- </message>
- <message>
- <source>MEN_EXPORT_BREP</source>
- <translation>&Brep ...</translation>
- </message>
- <message>
- <source>MEN_EXPORT_STL</source>
- <translation>&Stl ...</translation>
- </message>
- <message>
- <source>MEN_FILE</source>
- <translation>&File</translation>
- </message>
- <message>
- <source>MEN_FILE_EXPORT</source>
- <translation>&Export</translation>
- </message>
- <message>
- <source>MEN_FILE_IMPORT</source>
- <translation>&Import</translation>
- </message>
- <message>
- <source>MEN_HELP</source>
- <translation>&Help</translation>
- </message>
- <message>
- <source>MEN_IMPORT_BREP</source>
- <translation>&Brep ...</translation>
- </message>
- <message>
- <source>MEN_IMPORT_STL</source>
- <translation>Stl ...</translation>
- </message>
- <message>
- <source>MEN_NEW</source>
- <translation>&New 3D Viewer</translation>
- </message>
- <message>
- <source>MEN_OPTIM</source>
- <translation>Turn on/off graphic optimization</translation>
- </message>
- <message>
- <source>MEN_QUIT</source>
- <translation>&Quit</translation>
- </message>
- <message>
- <source>MEN_STATUS_BAR</source>
- <translation>&Statusbar</translation>
- </message>
- <message>
- <source>MEN_TILE</source>
- <translation>&Tile</translation>
- </message>
- <message>
- <source>MEN_TOOLS</source>
- <translation>&Tools</translation>
- </message>
- <message>
- <source>MEN_TOOL_BAR</source>
- <translation>&Toolbar</translation>
- </message>
- <message>
- <source>MEN_VIEW</source>
- <translation>&View</translation>
- </message>
- <message>
- <source>MEN_WINDOWS</source>
- <translation>&Window</translation>
- </message>
- <message>
- <source>MES_DISPLAY</source>
- <translation>Display</translation>
- </message>
- <message>
- <source>MES_UPDATE</source>
- <translation>Update</translation>
- </message>
- <message>
- <source>TBR_ABOUT</source>
- <translation>About</translation>
- </message>
- <message>
- <source>TBR_AUTO_TEST</source>
- <translation>Start automatic testing ...</translation>
- </message>
- <message>
- <source>TBR_CLOSE</source>
- <translation>Close</translation>
- </message>
- <message>
- <source>TBR_EXPORT_BREP</source>
- <translation>Brep ...</translation>
- </message>
- <message>
- <source>TBR_EXPORT_STL</source>
- <translation>Stl ...</translation>
- </message>
- <message>
- <source>TBR_FILE_EXPORT</source>
- <translation>Export</translation>
- </message>
- <message>
- <source>TBR_FILE_IMPORT</source>
- <translation>Import</translation>
- </message>
- <message>
- <source>TBR_IMPORT_BREP</source>
- <translation>Brep ...</translation>
- </message>
- <message>
- <source>TBR_NEW</source>
- <translation>New 3D Viewer</translation>
- </message>
- <message>
- <source>TBR_OPTIM</source>
- <translation>Turn on/off graphic optimization</translation>
- </message>
- <message>
- <source>TBR_QUIT</source>
- <translation>Quit</translation>
- </message>
- <message>
- <source>TBR_STATUS_BAR</source>
- <translation>Statusbar</translation>
- </message>
- <message>
- <source>TBR_STOP</source>
- <translation>Stop automatic testing</translation>
- </message>
- <message>
- <source>TBR_TOOL_BAR</source>
- <translation>Toolbar</translation>
- </message>
- <message>
- <source>TIT_ABOUT</source>
- <translation>About...</translation>
- </message>
- </context>
- <context>
- <name>AutoTestDlg</name>
- <message>
- <source>BTN_START</source>
- <translation>Start</translation>
- </message>
- <message>
- <source>DLG_AUTO_TEST</source>
- <translation>Automatic performance testing</translation>
- </message>
- <message>
- <source>LAB_ITEMS</source>
- <translation>elements</translation>
- </message>
- <message>
- <source>LAB_START</source>
- <translation>Start with sphere containing</translation>
- </message>
- <message>
- <source>LAB_STEP</source>
- <translation>Step</translation>
- </message>
- <message>
- <source>LAB_STOP</source>
- <translation>Stop at</translation>
- </message>
- <message>
- <source>MEN_BTN_TEXT</source>
- <translation>Test Text Performance</translation>
- </message>
- </context>
- <context>
- <name>MDIWindow</name>
- <message>
- <source>LAB_SECONDS</source>
- <translation>Time, sec.</translation>
- </message>
- <message>
- <source>LAB_TRIANGLES</source>
- <translation>Number of Triangles</translation>
- </message>
- <message>
- <source>LEG_NONOPT_DISPLAY</source>
- <translation>Non-optimized Display</translation>
- </message>
- <message>
- <source>LEG_NONOPT_UPDATE</source>
- <translation>Non-optimized Update</translation>
- </message>
- <message>
- <source>LEG_OPT_DISPLAY</source>
- <translation>Optimized Display</translation>
- </message>
- <message>
- <source>LEG_OPT_UPDATE</source>
- <translation>Optimized Update</translation>
- </message>
- <message>
- <source>MEN_GRAPH_CLEAR</source>
- <translation>Clear</translation>
- </message>
- <message>
- <source>MEN_GRAPH_FIT_ALL</source>
- <translation>Fit All</translation>
- </message>
- <message>
- <source>TBR_GRAPH_CLEAR</source>
- <translation>Clear</translation>
- </message>
- <message>
- <source>TBR_GRAPH_FIT_ALL</source>
- <translation>Fit All</translation>
- </message>
- </context>
- <context>
- <name>ObjectDlg</name>
- <message>
- <source>BTN_SHOWEDGES</source>
- <translation>Show edges</translation>
- </message>
- <message>
- <source>MEN_DLG_BBOXDEGENERATION</source>
- <translation>Degenerate to bounding box</translation>
- </message>
- <message>
- <source>MEN_DLG_DEGMODEL</source>
- <translation>Degenerate model</translation>
- </message>
- <message>
- <source>MEN_DLG_DEGRATIO</source>
- <translation>Degenerate ratio</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGEDASH</source>
- <translation>Dash style</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGEDOT</source>
- <translation>Dot style</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGEDOTDASH</source>
- <translation>DotDash style</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGESOLID</source>
- <translation>Solid</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGESTYLE</source>
- <translation>Edge style</translation>
- </message>
- <message>
- <source>MEN_DLG_EDGEWIDTH</source>
- <translation>Edge width</translation>
- </message>
- <message>
- <source>MEN_DLG_MARKERDEGENERATION</source>
- <translation>Degenerate to markers</translation>
- </message>
- <message>
- <source>MEN_DLG_NODEGENERATION</source>
- <translation>No degeneration</translation>
- </message>
- <message>
- <source>MEN_DLG_TINYDEGENERATION</source>
- <translation>Degenerate tiny</translation>
- </message>
- <message>
- <source>MEN_DLG_WIREDEGENERATION</source>
- <translation>Degenerate to wireframe</translation>
- </message>
- <message>
- <source>TITLE_OBJECT_DLG</source>
- <translation>Edit object properties</translation>
- </message>
- </context>
- <context>
- <name>QObject</name>
- <message>
- <source>TIT_SAMPLE</source>
- <translation>Visualization Performance Meter</translation>
- </message>
- </context>
- <context>
- <name>ShapeDlg</name>
- <message>
- <source>MEN_BTN_TEXT</source>
- <translation>Display Text</translation>
- </message>
- <message>
- <source>MEN_BTN_VCOLOR</source>
- <translation>Vertex colors</translation>
- </message>
- <message>
- <source>MEN_BTN_VNORMAL</source>
- <translation>Vertex normals</translation>
- </message>
- <message>
- <source>MEN_BTN_VTEXEL</source>
- <translation>Vertex texels</translation>
- </message>
- <message>
- <source>MEN_DLG_DEFLECTION</source>
- <translation>Chordial deflection</translation>
- </message>
- <message>
- <source>MEN_DLG_ITEMS</source>
- <translation>Nb items</translation>
- </message>
- <message>
- <source>MEN_DLG_PANES</source>
- <translation>Nb panes</translation>
- </message>
- <message>
- <source>MEN_DLG_RADIUS</source>
- <translation>radius</translation>
- </message>
- <message>
- <source>MEN_DLG_X</source>
- <translation>X</translation>
- </message>
- <message>
- <source>MEN_DLG_Y</source>
- <translation>Y</translation>
- </message>
- <message>
- <source>MEN_DLG_Z</source>
- <translation>Z</translation>
- </message>
- <message>
- <source>TITLE_SHAPE_DLG</source>
- <translation>Create sphere</translation>
- </message>
- </context>
- <context>
- <name>View</name>
- <message>
- <source>MEN_POP_BOX</source>
- <translation>Box</translation>
- </message>
- <message>
- <source>MEN_POP_CREATESHAPE</source>
- <translation>Create shape ...</translation>
- </message>
- <message>
- <source>MEN_POP_DISPLAYMODE</source>
- <translation>Display mode</translation>
- </message>
- <message>
- <source>MEN_POP_DISPLAYTRIHEDRON</source>
- <translation>Display trihedron</translation>
- </message>
- <message>
- <source>MEN_POP_ERASETRIHEDRON</source>
- <translation>Erase trihedron</translation>
- </message>
- <message>
- <source>MEN_POP_IMPORT</source>
- <translation>Import object ...</translation>
- </message>
- <message>
- <source>MEN_POP_LINE</source>
- <translation>Line</translation>
- </message>
- <message>
- <source>MEN_POP_LOADOBJECT</source>
- <translation>Load object</translation>
- </message>
- <message>
- <source>MEN_POP_OBJPROP</source>
- <translation>Edit object properties ...</translation>
- </message>
- <message>
- <source>MEN_POP_REMOVEOBJECT</source>
- <translation>Remove object</translation>
- </message>
- <message>
- <source>MEN_POP_SHADING</source>
- <translation>Shading</translation>
- </message>
- <message>
- <source>MEN_POP_SPHERE</source>
- <translation>Sphere</translation>
- </message>
- <message>
- <source>MEN_POP_TORUS</source>
- <translation>Torus</translation>
- </message>
- <message>
- <source>MEN_POP_VIEWPROP</source>
- <translation>Edit view properties ...</translation>
- </message>
- <message>
- <source>MEN_POP_WIREFRAME</source>
- <translation>Wireframe</translation>
- </message>
- </context>
- <context>
- <name>ViewDlg</name>
- <message>
- <source>BTN_ANIMATION</source>
- <translation>Enable view animation</translation>
- </message>
- <message>
- <source>TITLE_VIEW_DLG</source>
- <translation>Edit view properties</translation>
- </message>
- </context>
- <context>
- <name>ViewOperations</name>
- <message>
- <source>TBR_AXO</source>
- <translation>Axo</translation>
- </message>
- <message>
- <source>TBR_BACK</source>
- <translation>Back</translation>
- </message>
- <message>
- <source>TBR_BOTTOM</source>
- <translation>Bottom</translation>
- </message>
- <message>
- <source>TBR_FITALL</source>
- <translation>FitAll</translation>
- </message>
- <message>
- <source>TBR_FITAREA</source>
- <translation>Zoom Window</translation>
- </message>
- <message>
- <source>TBR_FRONT</source>
- <translation>Front</translation>
- </message>
- <message>
- <source>TBR_GLOBALPAN</source>
- <translation>Global Panning</translation>
- </message>
- <message>
- <source>TBR_LEFT</source>
- <translation>Left</translation>
- </message>
- <message>
- <source>TBR_PAN</source>
- <translation>Dynamic Panning</translation>
- </message>
- <message>
- <source>TBR_RESET</source>
- <translation>Reset</translation>
- </message>
- <message>
- <source>TBR_RIGHT</source>
- <translation>Right</translation>
- </message>
- <message>
- <source>TBR_ROTATION</source>
- <translation>Dynamic Rotation</translation>
- </message>
- <message>
- <source>TBR_TOOL_AXOVIEW</source>
- <translation>Axonometric view</translation>
- </message>
- <message>
- <source>TBR_TOOL_MAGVIEW</source>
- <translation>Magnify view</translation>
- </message>
- <message>
- <source>TBR_TOOL_PERVIEW</source>
- <translation>Perspective view</translation>
- </message>
- <message>
- <source>TBR_TOOL_SHAD</source>
- <translation>Shading</translation>
- </message>
- <message>
- <source>TBR_TOOL_WIRE</source>
- <translation>Wireframe</translation>
- </message>
- <message>
- <source>TBR_TOP</source>
- <translation>Top</translation>
- </message>
- <message>
- <source>TBR_ZOOM</source>
- <translation>Dynamic Zooming</translation>
- </message>
- </context>
-</TS>
+++ /dev/null
-#include <stdio.h>
-
-#include <AIS_InteractiveContext.hxx>
-#include <OSD_Timer.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS_Face.hxx>
-#include <Poly_Triangulation.hxx>
-#include <BRep_TFace.hxx>
-#include <TopoDS.hxx>
-#include <Sphere_Sphere.hxx>
-#include <AIS_Trihedron.hxx>
-
-#include <qapplication.h>
-#include <qframe.h>
-#include <qworkspace.h>
-#include <qstatusbar.h>
-#include <qmenubar.h>
-#include <qmessagebox.h>
-#include <qtextedit.h>
-#include <qlayout.h>
-#include <qevent.h>
-
-#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<QAction*>( 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
+++ /dev/null
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-
-#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
+++ /dev/null
-#include <qstatusbar.h>
-
-#ifndef WNT
-#include <Graphic3d_GraphicDevice.hxx>
-#else
-#include <Graphic3d_WNTGraphicDevice.hxx>
-#endif
-
-#include <V3d_View.hxx>
-
-#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();
-}
+++ /dev/null
-///////////////////////////////////////////////////////////////////////
-// File : Graph.cpp
-// Created : 26.03.02
-// Author : Vadim SANDLER
-//////////////////////////////////////////////////////////////////////
-
-#include <Graph.h>
-
-#include <math.h>
-#include <float.h>
-
-#include <qpainter.h>
-#include <qapplication.h>
-#include <qbitmap.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpolygon.h>
-#include <qevent.h>
-#include <qtooltip.h>
-
-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<GraphItem*> 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<QHelpEvent*>(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 <Sorted> 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 <qlabel.h>
-
-#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<QHelpEvent*>(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();
-}
+++ /dev/null
-#include <stdlib.h>
-
-#include <qmainwindow.h>
-#include <qapplication.h>
-#include <qtranslator.h>
-#include <qpixmap.h>
-#include <qtranslator.h>
-
-#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();
-}
+++ /dev/null
-#include <qlayout.h>
-#include <qframe.h>
-#include <qtoolbar.h>
-#include <qfiledialog.h>
-#include <qapplication.h>
-#include <qmessagebox.h>
-#include <qaction.h>
-#include <qsplitter.h>
-#include <qmenu.h>
-#include <qevent.h>
-
-#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<QAction*> 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);
-}
+++ /dev/null
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qframe.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-
-#include <Aspect_TypeOfLine.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <V3d_TypeOfVisualization.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Drawer.hxx>
-
-#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();
-}
+++ /dev/null
-#include <qapplication.h>
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qframe.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-#include <qspinbox.h>
-
-#include <Aspect_TypeOfLine.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <V3d_TypeOfVisualization.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Drawer.hxx>
-#include <Graphic3d_ArrayOfPrimitives.hxx>
-
-#include <Sphere_Sphere.hxx>
-#include <gp_Pnt.hxx>
-
-#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();
-}
+++ /dev/null
-#define xG005
-
-#include <Sphere_BasicShape.ixx>
-#include <TopLoc_Location.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_XYZ.hxx>
-
-//==================================================
-// 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;
-}
+++ /dev/null
-#define G005
-
-#include <Sphere_Sphere.ixx>
-
-#include <BRepPrimAPI_MakeSphere.hxx>
-
-#include <AIS_InteractiveContext.hxx>
-#include <AIS_Drawer.hxx>
-
-#include <Prs3d_Root.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Prs3d_LineAspect.hxx>
-
-#include <StdPrs_WFDeflectionShape.hxx>
-
-#include <Precision.hxx>
-
-#include <Aspect_Array1OfEdge.hxx>
-
-#include <Graphic3d_Structure.hxx>
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_Array1OfVertex.hxx>
-#include <Graphic3d_Array1OfVertexN.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Graphic3d_Array1OfVertexNC.hxx>
-#include <Graphic3d_Array1OfVertexNT.hxx>
-#ifdef G005
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Graphic3d_ArrayOfQuadrangles.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Vec.hxx>
-#endif
-
-#include <Graphic3d_AspectText3d.hxx>
-
-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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- C1.SetValues(0.5+X1/aRadius/2.,
- 0.5+Y1/aRadius/2.,0.5+Z1/aRadius/2.,Quantity_TOC_RGB);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- C2.SetValues(0.5+X2/aRadius/2.,
- 0.5+Y2/aRadius/2.,0.5+Z2/aRadius/2.,Quantity_TOC_RGB);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- C3.SetValues(0.5+X3/aRadius/2.,
- 0.5+Y3/aRadius/2.,0.5+Z3/aRadius/2.,Quantity_TOC_RGB);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- C4.SetValues(0.5+X4/aRadius/2.,
- 0.5+Y4/aRadius/2.,0.5+Z4/aRadius/2.,Quantity_TOC_RGB);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- C1.SetValues(0.5+X1/aRadius/2.,
- 0.5+Y1/aRadius/2.,0.5+Z1/aRadius/2.,Quantity_TOC_RGB);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- C2.SetValues(0.5+X2/aRadius/2.,
- 0.5+Y2/aRadius/2.,0.5+Z2/aRadius/2.,Quantity_TOC_RGB);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- C3.SetValues(0.5+X3/aRadius/2.,
- 0.5+Y3/aRadius/2.,0.5+Z3/aRadius/2.,Quantity_TOC_RGB);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- C4.SetValues(0.5+X4/aRadius/2.,
- 0.5+Y4/aRadius/2.,0.5+Z4/aRadius/2.,Quantity_TOC_RGB);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- C1.SetValues(0.5+X1/aRadius/2.,
- 0.5+Y1/aRadius/2.,0.5+Z1/aRadius/2.,Quantity_TOC_RGB);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- C2.SetValues(0.5+X2/aRadius/2.,
- 0.5+Y2/aRadius/2.,0.5+Z2/aRadius/2.,Quantity_TOC_RGB);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- C3.SetValues(0.5+X3/aRadius/2.,
- 0.5+Y3/aRadius/2.,0.5+Z3/aRadius/2.,Quantity_TOC_RGB);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- C4.SetValues(0.5+X4/aRadius/2.,
- 0.5+Y4/aRadius/2.,0.5+Z4/aRadius/2.,Quantity_TOC_RGB);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- C1.SetValues(0.5+X1/aRadius/2.,
- 0.5+Y1/aRadius/2.,0.5+Z1/aRadius/2.,Quantity_TOC_RGB);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- C2.SetValues(0.5+X2/aRadius/2.,
- 0.5+Y2/aRadius/2.,0.5+Z2/aRadius/2.,Quantity_TOC_RGB);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- C3.SetValues(0.5+X3/aRadius/2.,
- 0.5+Y3/aRadius/2.,0.5+Z3/aRadius/2.,Quantity_TOC_RGB);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- C4.SetValues(0.5+X4/aRadius/2.,
- 0.5+Y4/aRadius/2.,0.5+Z4/aRadius/2.,Quantity_TOC_RGB);
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- Ty1 = Standard_Real(j)/nbpanes/2.;
- Ty2 = Standard_Real(j+1)/nbpanes/2.;
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- Tx1 = Standard_Real(i)/nbpanes;
- Tx2 = Standard_Real(i+1)/nbpanes;
- if( j == 0 ) {
- 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(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; j<nbpanes/2; j++ ) {
- Alpha = 0.;
- R1 = aRadius*sin(Beta);
- Z1 = Z4 = aRadius*cos(Beta);
- Beta += Dbeta;
- R2 = aRadius*sin(Beta);
- Z2 = Z3 = aRadius*cos(Beta);
- Ty1 = Standard_Real(j)/nbpanes/2.;
- Ty2 = Standard_Real(j+1)/nbpanes/2.;
- for( i=0; i<nbpanes; i++ ) {
- X1 = R1*cos(Alpha);
- Y1 = R1*sin(Alpha);
- X2 = R2*cos(Alpha);
- Y2 = R2*sin(Alpha);
- Alpha += Dalpha;
- X3 = R2*cos(Alpha);
- Y3 = R2*sin(Alpha);
- X4 = R1*cos(Alpha);
- Y4 = R1*sin(Alpha);
- Tx1 = Standard_Real(i)/nbpanes;
- Tx2 = Standard_Real(i+1)/nbpanes;
- if( j == 0 ) {
- 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(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);
-}
+++ /dev/null
-#include <qfiledialog.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
-
-#include "Translate.h"
-#include "Application.h"
-#include "Document.h"
-#include "MDIWindow.h"
-#include "global.h"
-
-#include <StlAPI_Writer.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <TopExp_Explorer.hxx>
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_Line.hxx>
-#include <PTColStd_TransientPersistentMap.hxx>
-#include <TopoDS_Compound.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-
-
-// STL
-//#include <Mesh_InteractiveObject.hxx>
-//#include <Mesh_STLRead.hxx>
-//#include <Mesh_Drawer.hxx>
-//#include <Mesh_Model.hxx>
-
-#ifdef a
-#include "OSD_Timer.hxx"
-#include <FSD_File.hxx>
-#include <ShapeSchema.hxx>
-#include <Storage_Data.hxx>
-#include <PTopoDS_HShape.hxx>
-#include <Storage_HSeqOfRoot.hxx>
-#include <Storage_Root.hxx>
-#include <PTColStd_PersistentTransientMap.hxx>
-#include <MgtBRep.hxx>
-#include <TCollection_ExtendedString.hxx>
-#include <IGESControl_Reader.hxx>
-#include <IGESControl_Controller.hxx>
-#include <IGESControl_Writer.hxx>
-#include <Interface_Static.hxx>
-#include <STEPControl_Reader.hxx>
-#include <Interface_TraceFile.hxx>
-#include <STEPControl_Writer.hxx>
-#include <TColStd_SequenceOfAsciiString.hxx>
-#include <TColStd_SequenceOfExtendedString.hxx>
-#include <VrmlAPI_Writer.hxx>
-#endif
-
-Translate::Translate( QObject* parent ):
-QObject( parent )
-{
-}
-
-Translate::~Translate()
-{
-}
-
-/*!
- Selects a file from standard dialog acoording to selection
- 'filter'
-*/
-QString Translate::selectFileName( const QString& filter, bool isImport ) const
-{
- return isImport ?
- QFileDialog::getOpenFileName( QApplication::activeWindow(), tr("INF_APP_IMPORT"), QString::null, filter ) :
- QFileDialog::getSaveFileName( QApplication::activeWindow(), tr("INF_APP_EXPORT"), QString::null, filter );
- /*
- QFileDialog fd ( 0, 0, true );
- fd.setFilters( filter );
- if(isImport)
- fd.setCaption ( tr("INF_APP_IMPORT") );
- int ret = fd.exec();
-
- qApp->processEvents();
-
- return ( ret == QDialog::Accepted ? fd.selectedFile() : QString::null );
- */
-}
-
-Handle(TopTools_HSequenceOfShape)
-Translate::BuildSequenceFromContext(const Handle(AIS_InteractiveContext)& cxt)
-{
- Handle(TopTools_HSequenceOfShape) sequence = new TopTools_HSequenceOfShape();
- Handle(AIS_InteractiveObject) object;
- AIS_ListOfInteractive displayed;
- cxt->DisplayedObjects( displayed );
-
- AIS_ListIteratorOfListOfInteractive it( displayed );
- for ( ; it.More(); it.Next() ) {
- object = it.Value();
- if ( object->IsKind( STANDARD_TYPE( AIS_Shape ) ) ) {
- TopoDS_Shape shape = Handle(AIS_Shape)::DownCast( object )->Shape();
- sequence->Append( shape );
- }
- }
-
-#ifdef OLD_CODE
- for(anInteractiveContext->InitCurrent();anInteractiveContext->MoreCurrent();anInteractiveContext->NextCurrent())
- {
- picked = anInteractiveContext->Current();
- if (anInteractiveContext->Current()->IsKind(STANDARD_TYPE(AIS_Shape)))
- {
- TopoDS_Shape aShape = Handle(AIS_Shape)::DownCast(picked)->Shape();
- aSequence->Append(aShape);
- }
- }
-#endif //OLD_CODE
- return sequence;
-}
-
-void Translate::importBREP(const Handle(AIS_InteractiveContext) theContext)
-{
- static QString filter = "BREP Files (*.brep )";
- importBREP(theContext,filter);
-}
-
-void Translate::importBREP(const Handle(AIS_InteractiveContext) theContext, const QString& filter)
-{
- QString file = selectFileName( filter, true );
- if ( !file.isNull() ) {
- QApplication::setOverrideCursor( Qt::WaitCursor );
- if(!importBREP(theContext, (const Standard_CString) file.toLatin1().constData())) {
- QApplication::restoreOverrideCursor();
- QMessageBox::information ( QApplication::activeWindow(),tr("TIT_ERROR"), tr("INF_TRANSLATE_ERROR"), tr("BTN_OK"),
- QString::null, QString::null, 0, 0);
- qApp->processEvents(); /* update desktop */
- } else
- QApplication::restoreOverrideCursor();
- }
-}
-
-bool Translate::importBREP(const Handle(AIS_InteractiveContext) theContext, const Standard_CString theFileName)
-{
- Handle(TopTools_HSequenceOfShape) aSequence = new TopTools_HSequenceOfShape();
- TopoDS_Shape aShape;
- BRep_Builder aBuilder;
-
- Application::startTimer();
- Standard_Boolean result = BRepTools::Read(aShape,theFileName,aBuilder);
- Application::stopTimer( 0, "Loading BREP file" );
-
- if(result)
- aSequence->Append(aShape);
-
- int curMode =
- ( (MDIWindow*)Application::getApplication()->getActiveMDI() )->getDisplayMode();
-
- for(int i=1;i<= aSequence->Length();i++) {
-
- Application::startTimer();
- Handle(AIS_Shape) shape = new AIS_Shape( aSequence->Value( i ) );
- Application::stopTimer( 0, "Build shape" );
- Application::startTimer();
- theContext->Display( shape, curMode, 0, false );
- Application::stopTimer( 0, "Display" );
- }
- Application::startTimer();
- theContext->UpdateCurrentViewer();
- Application::stopTimer( 0, "Update" );
-
- return result;
-}
-
+++ /dev/null
-#if !defined WNT
-#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */
-#endif
-
-#include <qapplication.h>
-#include <qpainter.h>
-#include <qmenu.h>
-#include <qcolordialog.h>
-#include <qcursor.h>
-#include <qevent.h>
-#include <qrubberband.h>
-
-#include "View.h"
-#include "global.h"
-#include "Application.h"
-#include "ViewOperations.h"
-
-
-#include <V3d_PerspectiveView.hxx>
-#include <Visual3d_View.hxx>
-#include <Graphic3d_NameOfMaterial.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepPrimAPI_MakeTorus.hxx>
-#include <gp_Pnt.hxx>
-#include <gp.hxx>
-#include <Geom_Axis2Placement.hxx>
-#include <AIS_Shape.hxx>
-#include <AIS_Line.hxx>
-#include <Geom_Line.hxx>
-#include <AIS_Trihedron.hxx>
-//#include <TopAbs_ShapeEnum.hxx>
-
-#ifdef WNT
-#include <WNT_Window.hxx>
-#include <Graphic3d_WNTGraphicDevice.hxx>
-#else
-#include <GL/glx.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xmu/StdCmap.h>
-#undef QT_CLEAN_NAMESPACE
-#include <Xw_Window.hxx>
-#include <Graphic3d_GraphicDevice.hxx>
-#endif
-
-
-// the key for multi selection :
-#define MULTISELECTIONKEY Qt::ShiftModifier
-
-// the key for shortcut ( use to activate dynamic rotation, panning )
-#define CASCADESHORTCUTKEY Qt::ControlModifier
-
-// for elastic bean selection
-#define ValZWMin 1
-
-View::View( Handle(AIS_InteractiveContext) theContext, QWidget* parent, MDIWindow* mdi )
-: QWidget( parent ), myMDI( mdi ), myRubberBand( 0 )
-{
- setBackgroundRole( QPalette::NoRole );//NoBackground );
- // set focus policy to threat QContextMenuEvent from keyboard
- setFocusPolicy( Qt::StrongFocus );
- setAttribute( Qt::WA_PaintOnScreen );
- setAttribute( Qt::WA_NoSystemBackground );
-
-#ifndef WNT
- XSynchronize( x11Display(), true ); // it is possible to use QApplication::syncX();
-#endif
-
- myObjDlg = NULL;
- myShapeDlg = NULL;
- myFirst = true;
- myContext = theContext;
-
- myCycleCounter = -1;
-
- myXmin=0;
- myYmin=0;
- myXmax=0;
- myYmax=0;
- myCurZoom=0;
-
-#if !defined WNT
- XVisualInfo* pVisualInfo;
- if ( x11Display() ) {
- /* Initialization with the default VisualID
- */
- Visual *v = DefaultVisual( x11Display(), DefaultScreen( x11Display() ) );
- int visualID = XVisualIDFromVisual( v );
-
- /* Here we use the settings from
- Optimizer_ViewInfo::TxglCreateWindow()
- */
- int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1,
- GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1,
- GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER,
- None };
- pVisualInfo = ::glXChooseVisual (x11Display(), DefaultScreen(x11Display()), visualAttr);
-
- if ( isVisible() )
- hide();
-
- XSetWindowAttributes a;
-
- Window p = RootWindow( x11Display(), DefaultScreen(x11Display()) );
- a.colormap = XCreateColormap( x11Display(), RootWindow(x11Display(),
- pVisualInfo->screen), pVisualInfo->visual, AllocNone );
- a.background_pixel = backgroundColor().pixel();
- a.border_pixel = black.pixel();
- if ( parentWidget() )
- p = parentWidget()->winId();
-
- Window w = XCreateWindow( x11Display(), p, x(), y(), width(), height(),
- 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual,
- CWBackPixel | CWBorderPixel | CWColormap, &a );
- Window *cmw;
- Window *cmwret;
- int count;
- if ( XGetWMColormapWindows( x11Display(), topLevelWidget()->winId(),
- &cmwret, &count ) ) {
- cmw = new Window[count+1];
- memcpy( (char *)cmw, (char *)cmwret, sizeof(Window)*count );
- XFree( (char *)cmwret );
- int i;
- for (i = 0; i < count; i++) {
- if ( cmw[i] == winId() ) { /* replace old window */
- cmw[i] = w;
- break;
- }
- }
- if ( i >= count ) /* append new window */
- cmw[count++] = w;
- } else {
- count = 1;
- cmw = new Window[count];
- cmw[0] = w;
- }
- /* Creating new window (with good VisualID) for this widget */
- create( w );
- XSetWMColormapWindows( x11Display(), topLevelWidget()->winId(), cmw, count );
- delete [] cmw;
-
- if ( isVisible() )
- show();
- if ( pVisualInfo ) {
- XFree( (char *)pVisualInfo );
- }
- XFlush( x11Display() );
- }
-#endif // !defined WNT
-
- // will be set in OnInitial update, but, for more security :
- myCurrentMode = CurAction3d_Nothing;
- setMouseTracking( true );
- myView = NULL;
-}
-
-View::~View()
-{
-}
-
-void View::init()
-{
- myView = myContext->CurrentViewer()->CreateView();
- int windowHandle = (int) winId();
- short hi, lo;
- lo = (short) windowHandle;
- hi = (short) ( windowHandle >> 16 );
-#ifdef WNT
- Handle(WNT_Window) hWnd =
- new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::
- DownCast( myContext->CurrentViewer()->Device() ) , (int) hi, (int) lo );
-#else
- Handle(Xw_Window) hWnd =
- new Xw_Window( Handle(Graphic3d_GraphicDevice)::
- DownCast( myContext->CurrentViewer()->Device() ),
- (int) hi, (int) lo, Xw_WQ_SAMEQUALITY, Quantity_NOC_BLACK );
-#endif // WNT
- myView->SetWindow( hWnd );
- if ( !hWnd->IsMapped() )
- hWnd->Map();
- myView->SetBackgroundColor(Quantity_NOC_GRAY40);
- myView->MustBeResized();
-
- Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement( gp::XOY() );
- myTrihedron = new AIS_Trihedron( anAxis );
- myContext->Display( myTrihedron );
-
- //myView->SetAntialiasingOn();
- myComputedModeIsOn = true;
- myView->SetScale(3.0316);
-
- // This is to update View properties dialog
- emit ViewInitialized();
-}
-
-void View::paintEvent ( QPaintEvent * e)
-{
- if(myFirst) {
- init();
- myFirst = false;
- }
- QApplication::setOverrideCursor( Qt::WaitCursor );
- Application::startTimer();
- myView->Redraw();
- Application::stopTimer( 0, "View REDRAW", false );
- QApplication::restoreOverrideCursor();
-}
-
-void View::resizeEvent ( QResizeEvent * e)
-{
-// QApplication::syncX();
- if(!myView.IsNull()) {
- myView->MustBeResized();
- }
-}
-
-void View::mousePressEvent(QMouseEvent* e)
-{
- if ( e->button() == Qt::LeftButton ) {
- onLButtonDown(e->modifiers(),e->pos());
- } else if(e->button() == Qt::RightButton ) {
- onRButtonDown(e->modifiers(),e->pos());
- }
-}
-
-void View::mouseReleaseEvent(QMouseEvent* e)
-{
- if ( e->button() == Qt::LeftButton ) {
- onLButtonUp(e->modifiers(),e->pos());
- } else if(e->button() == Qt::RightButton ) {
- onRButtonUp(e->modifiers(),e->pos());
- }
-}
-
-void View::mouseMoveEvent(QMouseEvent* e)
-{
- onMouseMove(e->buttons(),e->modifiers(),e->pos());
-}
-
-void View::onLButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point )
-{
- // save the current mouse coordinate in min
- myXmin=point.x(); myYmin=point.y();
- myXmax=point.x(); myYmax=point.y();
-
- if ( nFlags == CASCADESHORTCUTKEY ) {
- // Button MB1 down Control :start zomming
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- }
- else { // if ( Ctrl )
- switch (myCurrentMode) {
-
- case CurAction3d_Nothing : // start a drag
- if (nFlags == MULTISELECTIONKEY)
- MultiDragEvent(myXmax,myYmax,-1);
- else
- DragEvent(myXmax,myYmax,-1);
- break;
- case CurAction3d_DynamicZooming : // noting
- break;
- case CurAction3d_WindowZooming :
- case CurAction3d_MagnifyView :
- break;
- case CurAction3d_DynamicPanning :// noting
- break;
- case CurAction3d_GlobalPanning :// noting
- break;
- case CurAction3d_DynamicRotation :
- if (!myComputedModeIsOn){
- myView->SetComputedMode(false);
- }
- myView->SetAnimationModeOn();
- myView->StartRotation(point.x(),point.y());
- break;
- default :
- Standard_Failure::Raise(" incompatible Current Mode ");
- break;
- }
- }
-}
-
-void View::onRButtonDown( Qt::KeyboardModifiers nFlags, const QPoint point )
-{
- if ( nFlags == CASCADESHORTCUTKEY ) {
- if ( !myComputedModeIsOn )
- myView->SetComputedMode(false);
-// Standard_Boolean anim, deg;
-// anim = myView->AnimationMode( deg );
-// if ( anim /*&& deg*/ ) {
- myCycleCounter = 0;
- Application::startTimer();
- myView->SetAnimationModeOn();
-// myView->SetAnimationMode(true,true);
-// myContext->DeactivateStandardMode( TopAbs_SHAPE );
-// }
- myView->StartRotation( point.x(),point.y() );
- }
- else
- Popup();
-}
-
-void View::onLButtonUp(Qt::KeyboardModifiers nFlags, const QPoint point)
-{
- if ( nFlags == CASCADESHORTCUTKEY )
- {
- return;
- }
- else // if ( Ctrl )
- {
- switch ( myCurrentMode )
- {
- case CurAction3d_Nothing :
- if (point.x() == myXmin && point.y() == myYmin)
- { // no offset between down and up --> selectEvent
- myXmax=point.x();
- myYmax=point.y();
- if (nFlags == MULTISELECTIONKEY )
- MultiInputEvent(point.x(),point.y());
- else
- InputEvent (point.x(),point.y());
- } else
- {
- DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);
- myXmax=point.x();
- myYmax=point.y();
- if (nFlags == MULTISELECTIONKEY)
- MultiDragEvent(point.x(),point.y(),1);
- else
- DragEvent(point.x(),point.y(),1);
- }
- break;
- case CurAction3d_DynamicZooming :
- // SetCursor(AfxGetApp()->LoadStandardCursor());
- myCurrentMode = CurAction3d_Nothing;
- emit noActiveActions();
- break;
-
- case CurAction3d_WindowZooming :
- case CurAction3d_MagnifyView :
-
- DrawRectangle( myXmin, myYmin, myXmax, myYmax, Standard_False );
- myXmax = point.x();
- myYmax = point.y();
-
- if ( ( abs( myXmin - myXmax ) > ValZWMin ) ||
- ( abs( myYmin - myYmax ) > ValZWMin ) ) {
-
- if ( myCurrentMode == CurAction3d_MagnifyView )
- myMDI->getDocument()->createMagView( myXmin, myYmin, myXmax, myYmax );
- else
- myView->WindowFitAll( myXmin, myYmin, myXmax, myYmax );
- }
- myCurrentMode = CurAction3d_Nothing;
- emit noActiveActions();
- break;
-
- case CurAction3d_DynamicPanning :
- myCurrentMode = CurAction3d_Nothing;
- emit noActiveActions();
- break;
- case CurAction3d_GlobalPanning :
- myView->Place(point.x(),point.y(),myCurZoom);
- myCurrentMode = CurAction3d_Nothing;
- emit noActiveActions();
- break;
- case CurAction3d_DynamicRotation :
- myCurrentMode = CurAction3d_Nothing;
- myView->SetAnimationModeOff();
- emit noActiveActions();
- break;
- default :
- Standard_Failure::Raise(" incompatible Current Mode ");
- break;
- } //switch (myCurrentMode)
- } // else // if ( Ctrl )
-}
-
-void View::onRButtonUp(Qt::KeyboardModifiers nFlags, const QPoint point)
-{
- QApplication::setOverrideCursor( Qt::WaitCursor );
- // reset computed mode according to the stored one
- // --> dynamic rotation may have change it
-
- if (!myComputedModeIsOn)
- {
- myView->SetComputedMode(false);
- myComputedModeIsOn = Standard_False;
- } else
- {
- myView->SetComputedMode(false);
- myComputedModeIsOn = Standard_True;
- }
-
- //if ( myView->AnimationModeIsOn() ) {
- myView->SetAnimationModeOff();
- Application::stopTimer( myCycleCounter, "Animation next UPDATE", false );
- //}
- myCycleCounter = -1;
-
- myView->Update();
- QApplication::restoreOverrideCursor();
-}
-
-void View::onMouseMove(Qt::MouseButtons btns, Qt::KeyboardModifiers nFlags, const QPoint point)
-{
- // ============================ LEFT BUTTON =======================
- if ( btns == Qt::LeftButton ) {
- if ( nFlags == CASCADESHORTCUTKEY )
- {
- // move with MB1 and Control : on the dynamic zooming
- // Do the zoom in function of mouse's coordinates
- myView->Zoom(myXmax,myYmax,point.x(),point.y());
- // save the current mouse coordinate in min
- myXmax = point.x();
- myYmax = point.y();
- }
- else // if ( Ctrl )
- {
- switch (myCurrentMode)
- {
- case CurAction3d_Nothing :
- myXmax = point.x();
- myYmax = point.y();
- DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);
- if (nFlags == MULTISELECTIONKEY)
- MultiDragEvent(myXmax,myYmax,0);
- else
- DragEvent(myXmax,myYmax,0);
- DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True);
- break;
- case CurAction3d_DynamicZooming :
- myView->Zoom(myXmax,myYmax,point.x(),point.y());
- // save the current mouse coordinate in min \n";
- myXmax=point.x(); myYmax=point.y();
- break;
- case CurAction3d_WindowZooming :
- case CurAction3d_MagnifyView :
- myXmax = point.x(); myYmax = point.y();
- DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);//,LongDash);
- DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True);//,LongDash);
- break;
- case CurAction3d_DynamicPanning :
- myView->Pan(point.x()-myXmax,myYmax-point.y()); // Realize the panning
- myXmax = point.x();
- myYmax = point.y();
- break;
- case CurAction3d_GlobalPanning : // nothing
- break;
- case CurAction3d_DynamicRotation :
- myView->Rotation(point.x(),point.y());
-// myView->Redraw();
- break;
- default :
- Standard_Failure::Raise(" incompatible Current Mode ");
- break;
- }// switch (myCurrentMode)
- }// if ( nFlags == CASCADESHORTCUTKEY ) else
- } else // if ( btns == MK_LBUTTON)
- // ============================ MIDDLE BUTTON =======================
- if ( btns == Qt::MidButton ) {
- if ( nFlags == CASCADESHORTCUTKEY )
- {
- myView->Pan(point.x()-myXmax,myYmax-point.y()); // Realize the panning
- myXmax = point.x();
- myYmax = point.y();
-
- }
- } else // if ( btns == MK_MBUTTON)
- // ============================ RIGHT BUTTON =======================
- if ( btns == Qt::RightButton ) {
- if ( nFlags == CASCADESHORTCUTKEY )
- {
- myView->Rotation(point.x(),point.y());
- }
- }else //if ( btns == MK_RBUTTON)
- // ============================ NO BUTTON =======================
- { // No buttons
- myXmax = point.x(); myYmax = point.y();
- if (nFlags == MULTISELECTIONKEY)
- MultiMoveEvent(point.x(),point.y());
- else
- MoveEvent(point.x(),point.y());
- }
- //Standard_Boolean anim, deg;
- //anim = myView->AnimationMode( deg );
- //if ( anim /*&& deg*/ ) {
- if ( myCycleCounter != -1 ) {
- if ( myCycleCounter == 0 )
- Application::showTimer( "Animation first UPDATE" );
- myCycleCounter++;
- }
- //}
-}
-
-void View::DragEvent( int x, int y, int TheState )
-{
- // TheState == -1 button down
- // TheState == 0 move
- // TheState == 1 button up
-
- static int theButtonDownX=0;
- static int theButtonDownY=0;
-
- if (TheState == -1)
- {
- theButtonDownX=x;
- theButtonDownY=y;
- }
-
- if (TheState == 0) {
- myContext->Select(theButtonDownX,theButtonDownY,x,y,myView);
- }
-}
-
-void View::InputEvent( int x, int y )
-{
- Application::startTimer();
- myContext->Select();
- Application::stopTimer( 0, "Single selection", false );
-}
-
-void View::MoveEvent( int x, int y )
-{
- myContext->MoveTo(x,y,myView);
-}
-
-void View::MultiMoveEvent( int x, int y )
-{
- myContext->MoveTo(x,y,myView);
-}
-
-void View::MultiDragEvent( int x, int y, int TheState )
-{
- static int theButtonDownX=0;
- static int theButtonDownY=0;
-
- if (TheState == -1)
- { theButtonDownX=x; theButtonDownY=y;}
-
- if (TheState == 0) {
- myContext->ShiftSelect(theButtonDownX,theButtonDownY,x,y,myView);
- emit selectionChanged();
- }
-}
-
-void View::MultiInputEvent( int x, int y )
-{
- myContext->ShiftSelect();
- emit selectionChanged();
-}
-
-void View::Popup()
-{
- QMenu* popMenu = new QMenu( this );
-
- if( myContext->NbCurrents()) {
- QAction* a;
- myContext->InitCurrent();
- if (! myContext->Current()->IsKind(STANDARD_TYPE(AIS_Trihedron)))
- {
- a = new QAction( tr( "MEN_POP_OBJPROP" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onEditObjectProperties() ) ) );
- popMenu->addAction( a );
-
- QMenu* dMode = popMenu->addMenu( tr( "MEN_POP_DISPLAYMODE" ) );
-
- a = new QAction( tr( "MEN_POP_WIREFRAME" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onWireframeMode() ) ) );
- dMode->addAction( a );
-
- a = new QAction( tr( "MEN_POP_SHADING" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onShadingMode() ) ) );
- dMode->addAction( a );
- }
- a = new QAction( tr( "MEN_POP_REMOVEOBJECT" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onRemoveObject() ) ) );
- popMenu->addAction( a );
- }
- else {
- QAction* a = new QAction( tr( "MEN_POP_VIEWPROP" ), this );
- verify( connect( a, SIGNAL( activated() ), Application::getApplication(), SLOT( onEditViewProperties() ) ) );
- popMenu->addAction( a );
-
- a = new QAction( tr( "MEN_POP_IMPORT" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onImportObject() ) ) );
- popMenu->addAction( a );
-
- popMenu->addSeparator();
- if ( myContext->IsDisplayed( myTrihedron ) ) {
- a = new QAction( tr( "MEN_POP_ERASETRIHEDRON" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onEraseTrihedron() ) ) );
- popMenu->addAction( a );
- }
- else {
- a = new QAction( tr( "MEN_POP_DISPLAYTRIHEDRON" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onDisplayTrihedron() ) ) );
- popMenu->addAction( a );
- }
-
- popMenu->addSeparator();
- a = new QAction( tr( "MEN_POP_CREATESHAPE" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onCreateShape() ) ) );
- popMenu->addAction( a );
-
- QMenu* loadObj = popMenu->addMenu( tr( "MEN_POP_LOADOBJECT" ) );
-
- a = new QAction( tr( "MEN_POP_BOX" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onLoadBox() ) ) );
- loadObj->addAction( a );
-
- a = new QAction( tr( "MEN_POP_SPHERE" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onLoadSphere() ) ) );
- loadObj->addAction( a );
-
- a = new QAction( tr( "MEN_POP_TORUS" ), this );
- verify( connect( a, SIGNAL( activated() ), SLOT( onLoadTorus() ) ) );
- loadObj->addAction( a );
-
-// a = new QAction( tr( "MEN_POP_LINE" ), this );
-// verify( connect( a, SIGNAL( activated() ), SLOT( onLoadLine() ) ) );
-// loadObj->addAction( a );
- }
- popMenu->exec( QCursor::pos() );
-}
-
-void View::DrawRectangle( int MinX, int MinY, int MaxX, int MaxY, bool Draw )
-{
- if ( !myRubberBand )
- myRubberBand = new QRubberBand( QRubberBand::Rectangle, this );
-
- myRubberBand->setGeometry( QRect( QPoint( MinX, MinY ), QPoint( MaxX, MaxY ) ).normalized() );
- myRubberBand->setVisible( Draw );
-/*
- QPainter thePainter(this);
- thePainter.setRasterOp(Qt::XorROP);
- thePainter.setPen(Qt::white);
- static int StoredMinX, StoredMaxX, StoredMinY, StoredMaxY;
- static bool m_IsVisible;
-
- QRect aRect;
- if ( m_IsVisible && !Draw) // move or up : erase at the old position
- {
- aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY));
- thePainter.drawRect(aRect);
- m_IsVisible = false;
- }
-
- StoredMinX = (MinX < MaxX) ? MinX: MaxX ;
- StoredMinY = (MinY < MaxY) ? MinY: MaxY ;
- StoredMaxX = (MinX > MaxX) ? MinX: MaxX ;
- StoredMaxY = (MinY > MaxY) ? MinY: MaxY ;
-
- if (Draw) // move : draw
- {
- aRect.setRect( StoredMinX, StoredMinY, abs(StoredMaxX-StoredMinX), abs(StoredMaxY-StoredMinY));
- thePainter.drawRect(aRect);
- m_IsVisible = true;
- }
- */
-}
-
-void View::onImportObject()
-{
- Application::getApplication()->importBREP();
-}
-
-void View::setCurrentAction()
-{
- myCurrentMode = CurAction3d_MagnifyView;
-}
-
-void View::onBackground()
-{
- QColor aColor ;
- Standard_Real R1;
- Standard_Real G1;
- Standard_Real B1;
- myView->BackgroundColor(Quantity_TOC_RGB,R1,G1,B1);
- aColor.setRgb(R1*255,G1*255,B1*255);
-
- QColor aRetColor = QColorDialog::getColor(aColor);
-
- if(aRetColor.isValid()) {
- R1 = aRetColor.red()/255.;
- G1 = aRetColor.green()/255.;
- B1 = aRetColor.blue()/255.;
- myView->SetBackgroundColor(Quantity_TOC_RGB,R1,G1,B1);
- }
- myView->Redraw();
-}
-
-Handle(V3d_View)& View::getView()
-{
- return myView;
-}
-
-void View::startAction( ViewOperations::Action action )
-{
- switch( action ) {
- case ViewOperations::ViewFitAllId :
- myView->FitAll();
- break;
- case ViewOperations::ViewFitAreaId :
- myCurrentMode = CurAction3d_WindowZooming;
- break;
- case ViewOperations::ViewZoomId :
- myCurrentMode = CurAction3d_DynamicZooming;
- break;
- case ViewOperations::ViewPanId :
- myCurrentMode = CurAction3d_DynamicPanning;
- break;
- case ViewOperations::ViewGlobalPanId :
- myCurZoom = myView->Scale();
- // Do a Global Zoom
- myView->FitAll();
- // Set the mode
- myCurrentMode = CurAction3d_GlobalPanning;
- break;
- case ViewOperations::ViewFrontId :
- myView->SetProj( V3d_Xpos );
- myView->FitAll();
- break;
- case ViewOperations::ViewBackId :
- myView->SetProj( V3d_Xneg );
- myView->FitAll();
- break;
- case ViewOperations::ViewTopId :
- myView->SetProj( V3d_Zpos );
- myView->FitAll();
- break;
- case ViewOperations::ViewBottomId :
- myView->SetProj( V3d_Zneg );
- myView->FitAll();
- break;
- case ViewOperations::ViewLeftId :
- myView->SetProj( V3d_Ypos );
- myView->FitAll();
- break;
- case ViewOperations::ViewRightId :
- myView->SetProj( V3d_Yneg );
- myView->FitAll();
- break;
- case ViewOperations::ViewAxoId :
- myView->SetProj( V3d_XposYnegZpos );
- myView->FitAll();
- break;
- case ViewOperations::ViewRotationId :
- myCurrentMode = CurAction3d_DynamicRotation;
- break;
- case ViewOperations::ViewResetId :
- myView->Reset();
- break;
- }
-}
-
-void View::onCreateShape()
-{
- myView->SetScale(3.0316);
- if ( !myShapeDlg )
- myShapeDlg = new ShapeDlg( Application::getApplication(), myView, myContext );
- myShapeDlg->show();
-}
-
-void View::onLoadBox()
-{
- myView->SetScale(1.0);
- Standard_Real size = myContext->CurrentViewer()->DefaultViewSize() / 4.;
- gp_Pnt origin( -size / 2., -size / 2., -size / 2. );
- //myContext->DefaultDrawer()->ShadingAspect()->SetColor(Quantity_NOC_RED);
- Handle(AIS_Shape) box =
- new AIS_Shape( BRepPrimAPI_MakeBox( origin, size, size, size ).Shape() );
- myContext->SetDisplayMode( box, myMDI->getDisplayMode(), false );
-
- Application::startTimer();
- myContext->Display( box, false );
- Application::stopTimer( 0, "Display Box" );
-
- Application::startTimer();
- myView->Update();
- Application::stopTimer( 0, "UPDATE" );
-}
-
-void View::onLoadSphere()
-{
- myView->SetScale(1.0);
- Standard_Real radius = myContext->CurrentViewer()->DefaultViewSize() / 4.;
- Handle(AIS_Shape) sphere =
- new AIS_Shape( BRepPrimAPI_MakeSphere( radius ).Shape() );
- myContext->SetDisplayMode( sphere, myMDI->getDisplayMode(), false );
-
- Application::startTimer();
- myContext->Display( sphere, false );
- Application::stopTimer( 0, "Display Sphere" );
-
- Application::startTimer();
- //myContext->UpdateCurrentViewer();
- myView->Update();
- Application::stopTimer( 0, "UPDATE" );
-}
-
-void View::onLoadTorus()
-{
- myView->SetScale(1.0);
- Handle(V3d_Viewer) viewer = myContext->CurrentViewer();
- Standard_Real r1 = viewer->DefaultViewSize() / 3.;
- Standard_Real r2 = viewer->DefaultViewSize() / 6.;
- Handle(AIS_Shape) torus = new AIS_Shape( BRepPrimAPI_MakeTorus( r1,r2 ).Shape() );
- myContext->SetDisplayMode( torus, myMDI->getDisplayMode(), false );
-
- Application::startTimer();
- myContext->Display( torus, false );
- Application::stopTimer( 0, "Display Torus" );
-
- Application::startTimer();
- //myContext->UpdateCurrentViewer();
- myView->Update();
- Application::stopTimer( 0, "UPDATE" );
-}
-
-void View::onLoadLine()
-{
- myView->SetScale(1.0);
- Handle(AIS_Line) line =
- new AIS_Line( new Geom_Line( gp_Pnt( 0, 0, 0), gp_Dir( 0, 0, 1) ) );
- myContext->Display( line );
- myContext->UpdateCurrentViewer();
-}
-
-void View::onEditObjectProperties()
-{
- if ( !myObjDlg )
- myObjDlg = new ObjectDlg( Application::getApplication(), myView, myContext );
- myObjDlg->show();
-}
-
-void View::onRemoveObject()
-{
- myContext->InitSelected();
- for( ; myContext->MoreSelected(); myContext->InitSelected() )
- myContext->Remove( myContext->SelectedInteractive(), false );
- myContext->UpdateCurrentViewer();
-}
-
-void View::onWireframeMode()
-{
- myContext->InitSelected();
- for( ; myContext->MoreSelected(); myContext->NextSelected() ) {
- Handle(AIS_InteractiveObject) obj = myContext->SelectedInteractive();
- //myContext->Erase( obj, false );
- //myContext->Display( obj, /*0, 0,*/ false );
- //myContext->Activate( obj, 0 );
- myContext->SetDisplayMode( obj, 0 );
- }
- myContext->UpdateCurrentViewer();
-}
-
-void View::onShadingMode()
-{
-
- myContext->InitSelected();
- for( ; myContext->MoreSelected(); myContext->NextSelected() ) {
- Handle(AIS_InteractiveObject) obj = myContext->SelectedInteractive();
- //myContext->Erase( obj, false );
- //myContext->Display( obj /*, 1, 0*/, false );
- //myContext->Activate( obj, 0 );
- myContext->SetDisplayMode( obj, 1 );
- }
- myContext->UpdateCurrentViewer();
-
-}
-
-void View::onDisplayTrihedron()
-{
- myContext->Display( myTrihedron );
-}
-
-void View::onEraseTrihedron()
-{
- myContext->Erase( myTrihedron );
-}
-
+++ /dev/null
-// ViewDlg.cpp: implementation of the ViewDlg class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include <qlayout.h>
-#include <qpushbutton.h>
-#include <qframe.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qcombobox.h>
-
-#include <V3d_TypeOfVisualization.hxx>
-
-#include "Application.h"
-#include "ViewDlg.h"
-#include "global.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-ViewDlg::ViewDlg( QWidget* parent/*, Handle(V3d_View)& view*/ )
-:QDialog( parent ),
- myAutoApply( true ), /*myView( view ),*/ myApplyAllViews(false)
-{
- setModal( false );
- setWindowTitle( tr( "TITLE_VIEW_DLG" ) );
-
- QVBoxLayout* topLayout = new QVBoxLayout( this );
- topLayout->setMargin( 5 );
-
- QFrame* mainFrame = new QFrame( this );
- mainFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
- topLayout->addWidget( mainFrame );
- topLayout->addSpacing( 10 );
-
- // view properties
- QGridLayout* pLayout = new QGridLayout( mainFrame );
- pLayout->setMargin( 5 );
- myZBufferBox = new QCheckBox( mainFrame );;
- myZBufferBox->setText( tr( "BTN_ZBUFFER" ) );
- verify( connect( myZBufferBox, SIGNAL( toggled( bool ) ), SLOT( onZBuffer( bool ) ) ) );
-
- myAnimBox = new QCheckBox( mainFrame );
- myAnimBox->setText( tr( "BTN_ANIMATION" ) );
- verify( connect( myAnimBox, SIGNAL( toggled( bool ) ), SLOT( onAnimation( bool ) ) ) );
-
- myDegBox = new QCheckBox( mainFrame );
- myDegBox->setText( tr( "BTN_DEGENERATION" ) );
- verify( connect( myDegBox, SIGNAL( toggled( bool ) ), SLOT( onDegeneration( bool ) ) ) );
-
- pLayout->addWidget( myZBufferBox, 0, 0 );
- pLayout->addWidget( myAnimBox, 1, 0 );
- pLayout->addWidget( myDegBox, 2, 0 );
- pLayout->setRowStretch( 3, 10 );
- pLayout->setColumnStretch( 1, 10 );
-
- // apply controls
- QCheckBox *autoApply, *applyAllViews;
- autoApply = new QCheckBox( this );
- autoApply->setText( tr( "BTN_AUTOAPPLY" ) );
- autoApply->setChecked( true );
- verify( connect( autoApply, SIGNAL( toggled( bool ) ), SLOT( onAutoApply( bool ) ) ) );
- applyAllViews = new QCheckBox( this );
- applyAllViews->setText( tr( "BTN_APPLYALLVIEWS" ) );
- verify( connect( applyAllViews, SIGNAL( toggled( bool ) ),
- SLOT( onApplyAllViews( bool ) ) ) );
-
- QHBoxLayout* applyLayout = new QHBoxLayout();
- applyLayout->addWidget( autoApply );
- applyLayout->addStretch( 10 );
- applyLayout->addWidget( applyAllViews );
- topLayout->addLayout( applyLayout );
- topLayout->addSpacing( 10 );
-
- // control buttons
- QPushButton *bOk, *bCancel/*, *bHelp*/;
-
- bOk = new QPushButton( tr( "BTN_OK" ), this );
- verify( connect( bOk, SIGNAL( clicked() ), SLOT( onOk() ) ) );
- bOk->setDefault(true);
- bCancel = new QPushButton( tr( "BTN_CANCEL" ), this );
- verify( connect( bCancel, SIGNAL( clicked() ), SLOT( onCancel() ) ) );
-
-
-// bHelp = new QPushButton( tr( "BTN_HELP" ), this );
-// verify( connect( bHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ) );
-
- QHBoxLayout* btnLayout = new QHBoxLayout();
- btnLayout->setSpacing( 5 );
- btnLayout->addStretch( 10 );
- btnLayout->addWidget( bOk );
- btnLayout->addWidget( bCancel );
- btnLayout->addStretch( 10 );
-// btnLayout->addWidget( bHelp );
- topLayout->addLayout( btnLayout );
-
- QSize s = topLayout->totalMinimumSize();
- s.setWidth( s.width() + topLayout->margin() + 10 );
- s.setHeight( s.height() + topLayout->margin() + 10 );
- setFixedSize( s );
-
- Handle(V3d_View) aView = Application::getApplication()->getActiveMDI()->getView();
- myIsAnim = aView->AnimationMode(myIsDeg);
-}
-
-ViewDlg::~ViewDlg()
-{
-}
-
-void ViewDlg::showEvent ( QShowEvent* e )
-{
- Update();
- QWidget::showEvent( e );
-}
-
-void ViewDlg::onOk()
-{
- hide();
- bool Auto = myAutoApply;
-
- myAutoApply = true;
- onZBuffer(myZBufferBox->isChecked());
- onAnimation(myAnimBox->isChecked());
- onDegeneration(myDegBox->isChecked());
- myAutoApply = Auto;
-}
-
-void ViewDlg::onCancel()
-{
- hide();
-}
-
-void ViewDlg::onHelp()
-{
-}
-
-void ViewDlg::onZBuffer( bool on )
-{
- QWidgetList aWidgetList;
- Handle(V3d_View) aView;
- QWidget* aWidget;
-
- if (!myApplyAllViews)
- aWidgetList.append(Application::getApplication()->getActiveMDI());
- else
- aWidgetList = Application::getWorkspace()->windowList();
-
- if ( myAutoApply ){
- foreach(aWidget, aWidgetList){
- if ( !aWidget ) continue;
- MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
- aView = aMDIWindow->getView();
- if ( on )
- aView->SetVisualization( V3d_ZBUFFER );
- else
- aView->SetVisualization( V3d_WIREFRAME );
- }
- }
-}
-
-void ViewDlg::onAnimation( bool on )
-{
- QWidgetList aWidgetList;
- Handle(V3d_View) aView;
-
- myIsAnim = on;
- myDegBox->setEnabled( myIsAnim );
- if (!myIsAnim) myDegBox->setChecked(false);
-
- if (!myApplyAllViews)
- aWidgetList.append(Application::getApplication()->getActiveMDI());
- else
- aWidgetList = Application::getWorkspace()->windowList();
-
- if ( myAutoApply ){
- QWidget* aWidget;
- foreach(aWidget, aWidgetList){
- if ( !aWidget ) continue;
- MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
- aView = aMDIWindow->getView();
- aView->SetAnimationMode( myIsAnim, myIsDeg );
- aView->Redraw();
- aView->SetImmediateUpdate(true);
- aView->Update();
- }
- }
-}
-
-void ViewDlg::onDegeneration( bool on )
-{
- QWidgetList aWidgetList;
- Handle(V3d_View) aView;
- QWidget* aWidget;
-
- if (!myApplyAllViews)
- aWidgetList.append(Application::getApplication()->getActiveMDI());
- else
- aWidgetList = Application::getWorkspace()->windowList();
-
-
- myIsDeg = on;
- if ( myAutoApply ){
- foreach(aWidget, aWidgetList){
- if ( !aWidget ) continue;
- MDIWindow* aMDIWindow = (MDIWindow*)aWidget;
- aView = aMDIWindow->getView();
- aView->SetAnimationMode( myIsAnim, myIsDeg );
- }
- }
-}
-
-void ViewDlg::onAutoApply( bool on )
-{
- myAutoApply = on;
-}
-
-void ViewDlg::onApplyAllViews( bool on )
-{
- myApplyAllViews = on;
-}
-
-void ViewDlg::Update()
-{
- MDIWindow* anActiveMDIWindow = Application::getApplication()->getActiveMDI();
- if (anActiveMDIWindow){
- Handle(V3d_View) aView = anActiveMDIWindow->getView();
- if(!aView.IsNull()){
-
- myIsAnim = aView->AnimationMode( myIsDeg );
- myAnimBox->blockSignals( true );
- myDegBox->blockSignals( true );
- myAnimBox->setChecked( myIsAnim );
- myDegBox->setChecked( myIsDeg );
- myDegBox->setEnabled( myIsAnim );
- myAnimBox->blockSignals( false );
- myDegBox->blockSignals( false );
-
- myZBufferBox->blockSignals(true);
- V3d_TypeOfVisualization aVisuType = aView->Visualization();
- if(aVisuType == V3d_WIREFRAME)
- myZBufferBox -> setChecked(false);
- else
- myZBufferBox -> setChecked(true);
- myZBufferBox->blockSignals(false);
- }
- }
-}
+++ /dev/null
-#include "ViewOperations.h"
-#include "global.h"
-//#include "Material.h"
-//#include "Transparency.h"
-#include "Application.h"
-#include "Document.h"
-
-#include <qcolordialog.h>
-#include <qapplication.h>
-#include <qsignalmapper.h>
-#include <qworkspace.h>
-#include <qpixmap.h>
-#include <qcursor.h>
-#include <qaction.h>
-
-#include <V3d_TypeOfView.hxx>
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-
-#include <Quantity_Color.hxx>
-
-
- static QCursor* defCursor = NULL;
- static QCursor* handCursor = NULL;
- static QCursor* panCursor = NULL;
- static QCursor* zoomCursor = NULL;
- static QCursor* rotCursor = NULL;
-
-ViewOperations::ViewOperations( QObject* parent)
-: QObject( parent )
-{
- myContext = NULL;
-}
-
-ViewOperations::ViewOperations( Handle(AIS_InteractiveContext) theContext,
- QObject* parent)
-: QObject( parent )
-{
- myContext = theContext;
- initActions();
- initViewActions();
-}
-
-ViewOperations::~ViewOperations()
-{
- myContext = NULL;
-}
-
-void ViewOperations::onWireframe()
-{
- AIS_ListOfInteractive displayed;
- myContext->DisplayedObjects( displayed );
- AIS_ListIteratorOfListOfInteractive it( displayed );
- for ( ; it.More(); it.Next() )
- myContext->SetDisplayMode( it.Value(), 0 );
-#ifdef a
- for(myContext->InitCurrent();myContext->MoreCurrent();myContext->NextCurrent())
- myContext->SetDisplayMode(myContext->Current(),0);
-#endif
-}
-
-void ViewOperations::onShading()
-{
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- AIS_ListOfInteractive displayed;
- myContext->DisplayedObjects( displayed );
- AIS_ListIteratorOfListOfInteractive it( displayed );
- for ( ; it.More(); it.Next() )
- myContext->SetDisplayMode( it.Value(), 1 );
-
-#ifdef a
- for(myContext->InitCurrent();myContext->MoreCurrent();myContext->NextCurrent())
- myContext->SetDisplayMode(myContext->Current(),1);
-#endif
- QApplication::restoreOverrideCursor();
-}
-
-void ViewOperations::initActions()
-{
- initCursors();
- initToolActions();
-}
-
-void ViewOperations::initCursors()
-{
- if( !defCursor )
- defCursor = new QCursor( Qt::ArrowCursor );
- if( !handCursor )
- handCursor = new QCursor( Qt::PointingHandCursor );
- if( !panCursor )
- panCursor = new QCursor( Qt::SizeAllCursor );
-
- QString dir( Application::getResourceDir() );
- if( !zoomCursor )
- zoomCursor = new QCursor( QPixmap( dir + tr( "ICON_CURSOR_ZOOM" ) ) );
- if( !rotCursor )
- rotCursor = new QCursor( QPixmap( dir + tr( "ICON_CURSOR_ROTATE" ) ) );
-}
-
-QList<QAction*> ViewOperations::getViewActions()
-{
- return myViewActions;
-}
-
-void ViewOperations::initViewActions()
-{
- if ( myViewActions.count() )
- return;
-
- QString dir = Application::getResourceDir();
-
- QAction* a;
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FITALL" ) ), "", this );
- a->setToolTip( tr( "TBR_FITALL" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewFitAllId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FITAREA" ) ), "", this );
- a->setToolTip( tr( "TBR_FITAREA" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) );
- myViewActions.insert( ViewFitAreaId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_ZOOM" ) ), "", this );
- a->setToolTip( tr( "TBR_ZOOM" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) );
- myViewActions.insert( ViewZoomId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_PAN" ) ), "", this );
- a->setToolTip( tr( "TBR_PAN" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) );
- myViewActions.insert( ViewPanId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_GLOBALPAN" ) ), "", this );
- a->setToolTip( tr( "TBR_GLOBALPAN" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) );
- myViewActions.insert( ViewGlobalPanId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_FRONT" ) ), "", this );
- a->setToolTip( tr( "TBR_FRONT" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewFrontId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_BACK" ) ), "", this );
- a->setToolTip( tr( "TBR_BACK" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewBackId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_TOP" ) ), "", this );
- a->setToolTip( tr( "TBR_TOP" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewTopId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_BOTTOM" ) ), "", this );
- a->setToolTip( tr( "TBR_BOTTOM" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewBottomId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_LEFT" ) ), "", this );
- a->setToolTip( tr( "TBR_LEFT" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewLeftId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_RIGHT" ) ), "", this );
- a->setToolTip( tr( "TBR_RIGHT" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewRightId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_AXO" ) ), "", this );
- a->setToolTip( tr( "TBR_AXO" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewAxoId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_ROTATION" ) ), "", this );
- a->setToolTip( tr( "TBR_ROTATION" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( toggled( bool ) ), SLOT( updateToggled( bool ) ) ) );
- myViewActions.insert( ViewRotationId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_VIEW_RESET" ) ), "", this );
- a->setToolTip( tr( "TBR_RESET" ) );
- verify( connect( a, SIGNAL( activated() ), SLOT( onActionActivated() ) ) );
- myViewActions.insert( ViewResetId, a );
-}
-
-void ViewOperations::updateToggled( bool isOn )
-{
- if( !isOn )
- return;
-
- QAction* sentBy = (QAction*) sender();
-
- for ( int i = ViewFitAllId;i <= ViewResetId ; i++)
- {
- QAction* anAction = myViewActions.at(i);
- if( (anAction == myViewActions.at(ViewFitAreaId)) ||
- (anAction == myViewActions.at(ViewZoomId)) ||
- (anAction == myViewActions.at(ViewPanId)) ||
- (anAction == myViewActions.at(ViewGlobalPanId)) ||
- (anAction == myViewActions.at(ViewRotationId))) {
- if (anAction && (anAction != sentBy)) {
- anAction->setCheckable(true);
- anAction->setChecked(false);
- } else {
- if(sentBy == myViewActions.at(ViewFitAreaId))
- emit setCursor(*handCursor);
- else if (sentBy == myViewActions.at(ViewZoomId))
- emit setCursor(*zoomCursor);
- else if (sentBy == myViewActions.at(ViewPanId))
- emit setCursor(*panCursor);
- else if (sentBy == myViewActions.at(ViewGlobalPanId))
- emit setCursor(*defCursor);
- else if (sentBy == myViewActions.at(ViewRotationId))
- emit setCursor(*rotCursor);
- sentBy->setCheckable(false);
- }
- }
- }
-}
-
-QList<QAction*> ViewOperations::getToolActions()
-{
- initToolActions();
- return myToolActions;
-}
-
-void ViewOperations::initToolActions()
-{
- if( myToolActions.count() )
- return;
-
- QString dir = Application::getResourceDir();
-
- //QAction* a = new QAction( tr( "TBR_TOOL_MAGVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ),
- // "", 0, this );
- //verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) );
- //myToolActions->insert( MagViewId, a );
-
-// QAction* a = new QAction( tr( "TBR_TOOL_AXOVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ),
-// "", 0, this );
-// verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) );
-// myToolActions->insert( AxoViewId, a );
-
-// a = new QAction( tr( "TBR_TOOL_PERVIEW" ), QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ),
-// "", 0, this );
-// verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) );
-// myToolActions->insert( PerViewId, a );
-
- QAction* a = new QAction( QPixmap( dir + tr( "ICON_TOOL_WIRE" ) ), "", this );
- a->setToolTip( tr( "TBR_TOOL_WIRE" ) );
- a->setCheckable( true );
- verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) );
- myToolActions.insert( ToolWireframeId, a );
-
- a = new QAction( QPixmap( dir + tr( "ICON_TOOL_SHAD") ), "", this );
- a->setToolTip( tr( "TBR_TOOL_SHAD" ) );
- a->setCheckable( true );
- a->setChecked( true );
- verify( connect( a, SIGNAL( activated() ), SLOT( onToolAction() ) ) );
- myToolActions.insert( ToolShadingId, a );
-}
-
-void ViewOperations::onToolAction()
-{
- QAction* sentBy = (QAction*) sender();
- //MDIWindow* win = (MDIWindow*) Application::getWorkspace()->activeWindow();
- MDIWindow* win = (MDIWindow*)Application::getApplication()->getActiveMDI();
- Document* doc = win->getDocument();
-
-// if( sentBy == myToolActions->at( MagViewId ) )
-// win->defineMagView();
-
-// if( sentBy == myToolActions->at( PerViewId ) )
-// doc->createNewView( V3d_PERSPECTIVE );
-
-// if( sentBy == myToolActions->at( AxoViewId ) )
-// doc->createNewView();
-
- if( sentBy == myToolActions.at( ToolWireframeId ) )
- doc->onWireframe();
-
- if( sentBy == myToolActions.at( ToolShadingId ) )
- doc->onShading();
-}
-
-int ViewOperations::getDisplayMode()
-{
- bool on = myToolActions.at( ToolWireframeId )->isChecked();
- return on ? 0 : 1;
-}
-
-void ViewOperations::onNoActiveActions()
-{
- for ( int i = ViewFitAllId;i <= ViewResetId ; i++ ) {
- QAction* anAction = myViewActions.at( i );
- if( ( anAction == myViewActions.at( ViewFitAreaId ) ) ||
- ( anAction == myViewActions.at( ViewZoomId ) ) ||
- ( anAction == myViewActions.at( ViewPanId ) ) ||
- ( anAction == myViewActions.at( ViewGlobalPanId ) ) ||
- ( anAction == myViewActions.at( ViewRotationId ) ) ) {
-
- emit setCursor( *defCursor );
- anAction->setCheckable( true );
- anAction->setChecked( false );
- }
- }
-}
-
-void ViewOperations::onActionActivated()
-{
- QAction* a = (QAction*) sender();
- //MDIWindow* win = (MDIWindow*) Application::getWorkspace()->activeWindow();
- MDIWindow* win = (MDIWindow*) Application::getApplication()->getActiveMDI();
- int index = myViewActions.indexOf( a );
- if ( index != -1 )
- win->activateAction( (Action)index );
-}