]> OCCT Git - occt-copy.git/commitdiff
0021189: Clean up KAS:dev:ros and Products
authorvro <vro@opencascade.com>
Fri, 5 Oct 2012 10:17:17 +0000 (14:17 +0400)
committervro <vro@opencascade.com>
Fri, 5 Oct 2012 10:17:17 +0000 (14:17 +0400)
Removal of VoxelClient
VoxelDemo sample is redesigned so that it doesn't require compilation of OpenGl classes. It refers to TKOpenGl.dll as to an external library.
Some minor bugs are fixed in OCAF and Viewer 3d standard MFC samples

38 files changed:
adm/UDLIST
samples/mfc/standard/04_Viewer3d/src/Viewer3dView.cpp
samples/mfc/standard/06_Ocaf/src/OcafApp.cpp
samples/mfc/standard/06_Ocaf/src/OcafDoc.cpp
samples/qt/VoxelDemo/VoxelDemo.sln [new file with mode: 0644]
samples/qt/VoxelDemo/VoxelDemo.vcproj [new file with mode: 0644]
samples/qt/VoxelDemo/inc/Application.h [new file with mode: 0644]
samples/qt/VoxelDemo/inc/ConversionThread.h [new file with mode: 0644]
samples/qt/VoxelDemo/inc/Timer.h [new file with mode: 0644]
samples/qt/VoxelDemo/inc/Viewer.h [new file with mode: 0644]
samples/qt/VoxelDemo/inc/VoxelClient_VisDrawer.h [new file with mode: 0644]
samples/qt/VoxelDemo/msvc.bat [new file with mode: 0644]
samples/qt/VoxelDemo/src/Application.cpp [new file with mode: 0644]
samples/qt/VoxelDemo/src/ConversionThread.cpp [new file with mode: 0644]
samples/qt/VoxelDemo/src/Main.cpp [new file with mode: 0644]
samples/qt/VoxelDemo/src/Timer.cpp [new file with mode: 0644]
samples/qt/VoxelDemo/src/Viewer.cpp [new file with mode: 0644]
samples/qt/VoxelDemo/src/VoxelClient_VisDrawer.cxx [new file with mode: 0644]
samples/qt/voxeldemo/OpenGl/OpenGl.vcproj [deleted file]
samples/qt/voxeldemo/VoxelDemo-vc8.sln [deleted file]
samples/qt/voxeldemo/VoxelDemo-vc9.sln [deleted file]
samples/qt/voxeldemo/VoxelDemo.vcproj [deleted file]
samples/qt/voxeldemo/env.bat [deleted file]
samples/qt/voxeldemo/inc/Application.h [deleted file]
samples/qt/voxeldemo/inc/ConversionThread.h [deleted file]
samples/qt/voxeldemo/inc/Timer.h [deleted file]
samples/qt/voxeldemo/inc/Viewer.h [deleted file]
samples/qt/voxeldemo/msvc.bat [deleted file]
samples/qt/voxeldemo/run.bat [deleted file]
samples/qt/voxeldemo/src/Application.cpp [deleted file]
samples/qt/voxeldemo/src/ConversionThread.cpp [deleted file]
samples/qt/voxeldemo/src/Main.cpp [deleted file]
samples/qt/voxeldemo/src/Timer.cpp [deleted file]
samples/qt/voxeldemo/src/Viewer.cpp [deleted file]
src/OS/Visualization.tcl
src/VoxelClient/FILES [deleted file]
src/VoxelClient/VoxelClient_VisDrawer.cxx [deleted file]
src/VoxelClient/VoxelClient_VisDrawer.h [deleted file]

index 2165d54dd056b2be9572cf80acf5c1b866f36beb..c2f073ced85b7c26e5f4ef0fd6852eaa52ebf7dd 100644 (file)
@@ -207,7 +207,6 @@ t TKShHealing
 t TKTopAlgo
 t TKXMesh
 n InterfaceGraphic
-n VoxelClient
 p AIS
 p AIS2D
 p AlienImage
index 70da435841fa2c72fa8e0586946f64118a32a22f..d04a262957c98c614d94152d745691e03d608980 100755 (executable)
@@ -1088,11 +1088,30 @@ GetDocument()->UpdateResultMessageDlg("SetAntialiasingOn/SetAntialiasingOff",Mes
 void CViewer3dView::OnClearLights() 
 {
 //     Setting Off all viewer active lights
+    TColStd_ListOfTransient lights;
        for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())
-               myView->Viewer()->SetLightOff(myView->Viewer()->ActiveLight());
+    {
+        lights.Append(myView->Viewer()->ActiveLight());
+    }
+    TColStd_ListIteratorOfListOfTransient itrLights(lights);
+    for (; itrLights.More(); itrLights.Next())
+    {
+        Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
+        myView->Viewer()->SetLightOff(light);
+    }
+
 //     Setting Off all view active lights
-       for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())
-               myView->SetLightOff(myView->ActiveLight());
+    lights.Clear();
+    for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())
+    {
+        lights.Append(myView->ActiveLight());
+    }
+    itrLights.Initialize(lights);
+    for (; itrLights.More(); itrLights.Next())
+    {
+        Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());
+        myView->SetLightOff(light);
+    }
 
        myView->Viewer()->SetDefaultLights();// Setting the default lights on
 
@@ -1101,10 +1120,31 @@ void CViewer3dView::OnClearLights()
        myView->Update();
 
 TCollection_AsciiString Message("\
+//     Setting Off all viewer active lights\n\
+TColStd_ListOfTransient lights;\n\
 for(myView->Viewer()->InitActiveLights(); myView->Viewer()->MoreActiveLights(); myView->Viewer()->NextActiveLights())\n\
-       myView->Viewer()->SetLightOff(myView->Viewer()->ActiveLight()); //Setting Off all viewer active lights\n\
+{\n\
+    lights.Append(myView->Viewer()->ActiveLight());\n\
+}\n\
+TColStd_ListIteratorOfListOfTransient itrLights(lights);\n\
+for (; itrLights.More(); itrLights.Next())\n\
+{\n\
+    Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
+    myView->Viewer()->SetLightOff(light);\n\
+}\n\
+\n\
+//     Setting Off all view active lights\n\
+lights.Clear();\n\
 for(myView->InitActiveLights(); myView->MoreActiveLights(); myView->NextActiveLights())\n\
-       myView->SetLightOff(myView->ActiveLight()); //Setting Off all view active lights\n\
+{\n\
+    lights.Append(myView->ActiveLight());\n\
+}\n\
+itrLights.Initialize(lights);\n\
+for (; itrLights.More(); itrLights.Next())\n\
+{\n\
+    Handle(V3d_Light) light = Handle(V3d_Light)::DownCast(itrLights.Value());\n\
+    myView->SetLightOff(light);\n\
+}\n\
 \n\
 myView->Viewer()->SetDefaultLights();// Setting the default lights on\n\
   ");
index ed5d3a87583596a99845928b1115e3603eda6493..6a106f528884272c7ffac023b3b2868ce4a7abda 100755 (executable)
@@ -143,7 +143,7 @@ BOOL COcafApp::IsViewExisting(CDocument * pDoc, CRuntimeClass * pViewClass, CVie
 void COcafApp::OnFileOpen() 
 {
        CFileDialog aDlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY,
-          "OCAFSample(STA) (*.sta)|*.sta|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||");
+          "OCAFSample(STD) (*.std)|*.std|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||");
 
        if (aDlg.DoModal() != IDOK) 
         return;
index 75234c6a649ccee46466aadb559ff5bc9400f097..329dff7d163361e9fe056f873b9c44ef6080eeee 100755 (executable)
@@ -603,7 +603,8 @@ D->CommitCommand(); \n\
 
                // Get the TOcafFunction_CutDriver using its Standard_GUID in the TFunction_DriverTable
                Handle(TOcafFunction_CutDriver) myCutDriver;
-               TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver);
+               if (TFunction_DriverTable::Get()->FindDriver(myDriverID, myCutDriver))
+            myCutDriver->Init(LabObject);
 
                // Recompute the cut object if it must be (look at the MustExecute function code)
 //             if (myCutDriver->MustExecute(log))
@@ -904,21 +905,21 @@ void COcafDoc::OnFileSaveAs()
        CString Filter;
 
        if (TPathName.SearchFromEnd(".xml") > 0){
-               Filter = "OCAFSample(XML) (*.xml)|*.xml|OCAFSample(STA) (*.sta)|*.sta|OCAFSample(Binary) (*.cbf)|*.cbf||";
+               Filter = "OCAFSample(XML) (*.xml)|*.xml|OCAFSample(STD) (*.std)|*.std|OCAFSample(Binary) (*.cbf)|*.cbf||";
        }
        else if (TPathName.SearchFromEnd(".cbf") > 0){
-               Filter = "OCAFSample(Binary) (*.cbf)|*.cbf|OCAFSample(STA) (*.sta)|*.sta|OCAFSample(XML) (*.xml)|*.xml||";
+               Filter = "OCAFSample(Binary) (*.cbf)|*.cbf|OCAFSample(STD) (*.std)|*.std|OCAFSample(XML) (*.xml)|*.xml||";
        }
        else{
-               Filter = "OCAFSample(STA) (*.sta)|*.sta|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||";
+               Filter = "OCAFSample(STD) (*.std)|*.std|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||";
        }
        
        CFileDialog dlg(FALSE,
-                       "sta",
+                       "std",
                        GetTitle(),
                        OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
                        Filter,
-//                     "sta Files (*.sta)|*.sta; |All Files (*.*)|*.*||", 
+//                     "std Files (*.std)|*.std; |All Files (*.*)|*.*||", 
                        NULL );
        
 
@@ -930,8 +931,8 @@ void COcafDoc::OnFileSaveAs()
        CWaitCursor aWaitCursor;
        CString CSPath = dlg.GetPathName();
 
-//     if((CSPath.Find(CString(".sta")))==-1 )
-//             CSPath = CSPath + ".sta";
+//     if((CSPath.Find(CString(".std")))==-1 )
+//             CSPath = CSPath + ".std";
 
        cout << "Save As " << CSPath << endl;
        PathName=CSPath;
@@ -1042,11 +1043,11 @@ m_App->SaveAs(myOcafDoc,(TCollection_ExtendedString) TPath); \n\
        }
 
        CFileDialog dlg(FALSE,
-                       "sta",
+                       "std",
                        GetTitle(),
                        OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
-                       "OCAFSample(STA) (*.sta)|*.sta|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||",
-//                     "sta Files (*.sta)|*.sta; |All Files (*.*)|*.*||", 
+                       "OCAFSample(STD) (*.std)|*.std|OCAFSample(XML) (*.xml)|*.xml|OCAFSample(Binary) (*.cbf)|*.cbf||",
+//                     "std Files (*.std)|*.std; |All Files (*.*)|*.*||", 
                        NULL );
 
        if (dlg.DoModal() != IDOK) return;
@@ -1088,8 +1089,8 @@ m_App->SaveAs(myOcafDoc,(TCollection_ExtendedString) TPath); \n\
    }
 
 
-//     if((CSPath.Find(CString(".sta")))==-1 )
-//             CSPath = CSPath + ".sta";
+//     if((CSPath.Find(CString(".std")))==-1 )
+//             CSPath = CSPath + ".std";
 
 //     cout << "Save As " << CSPath << endl;
 //     PathName=CSPath;
diff --git a/samples/qt/VoxelDemo/VoxelDemo.sln b/samples/qt/VoxelDemo/VoxelDemo.sln
new file mode 100644 (file)
index 0000000..1e5a741
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VoxelDemo", "VoxelDemo.vcproj", "{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|Win32.ActiveCfg = Debug|Win32
+               {EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Debug|Win32.Build.0 = Debug|Win32
+               {EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|Win32.ActiveCfg = Release|Win32
+               {EF9DFAE9-E10E-42D4-87D1-52431728AFDF}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/samples/qt/VoxelDemo/VoxelDemo.vcproj b/samples/qt/VoxelDemo/VoxelDemo.vcproj
new file mode 100644 (file)
index 0000000..538b89c
--- /dev/null
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="windows-1251"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="8,00"
+       Name="VoxelDemo"
+       ProjectGUID="{EF9DFAE9-E10E-42D4-87D1-52431728AFDF}"
+       RootNamespace="VoxelDemo"
+       Keyword="Win32Proj"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="$(CSF_OPT_INC);.\inc"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WNT"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="true"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="opengl32.lib glu32.lib TKernel.lib TKMath.lib TKGeomBase.lib TKV3d.lib TKService.lib TKG3d.lib TKVoxel.lib TKTopAlgo.lib TKBRep.lib TKPrim.lib TKOpenGl.lib vfw32.lib QtCore4.lib QtGui4.lib "
+                               LinkIncremental="2"
+                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32D)"
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               AdditionalIncludeDirectories="$(CSF_OPT_INC);.\inc"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WNT"
+                               RuntimeLibrary="2"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               Detect64BitPortabilityProblems="true"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               AdditionalDependencies="opengl32.lib glu32.lib TKernel.lib TKMath.lib TKGeomBase.lib TKV3d.lib TKService.lib TKG3d.lib TKVoxel.lib TKTopAlgo.lib TKBRep.lib TKPrim.lib TKOpenGl.lib vfw32.lib QtCore4.lib QtGui4.lib "
+                               LinkIncremental="1"
+                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32)"
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCWebDeploymentTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="Source Files"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+                       >
+                       <File
+                               RelativePath=".\src\Application.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\src\ConversionThread.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\src\Main.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\src\Timer.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\src\Viewer.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\src\VoxelClient_VisDrawer.cxx"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Header Files"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+                       >
+                       <File
+                               RelativePath=".\inc\Application.h"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="moc.exe inc\$(InputFileName) -o moc\moc_$(InputName).cpp"
+                                               Outputs="moc\moc_$(InputName).cpp"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="moc.exe inc\$(InputFileName) -o moc\moc_$(InputName).cpp"
+                                               Outputs="moc\moc_$(InputName).cpp"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath=".\inc\ConversionThread.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\inc\Timer.h"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\inc\Viewer.h"
+                               >
+                               <FileConfiguration
+                                       Name="Debug|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="moc.exe inc\$(InputFileName) -o moc\moc_$(InputName).cpp&#x0D;&#x0A;"
+                                               Outputs="moc\moc_$(InputName).cpp"
+                                       />
+                               </FileConfiguration>
+                               <FileConfiguration
+                                       Name="Release|Win32"
+                                       >
+                                       <Tool
+                                               Name="VCCustomBuildTool"
+                                               CommandLine="moc.exe inc\$(InputFileName) -o moc\moc_$(InputName).cpp&#x0D;&#x0A;"
+                                               Outputs="moc\moc_$(InputName).cpp"
+                                       />
+                               </FileConfiguration>
+                       </File>
+                       <File
+                               RelativePath=".\inc\VoxelClient_VisDrawer.h"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="Resource Files"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+                       >
+               </Filter>
+               <Filter
+                       Name="moc"
+                       >
+                       <File
+                               RelativePath=".\moc\moc_Application.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\moc\moc_Viewer.cpp"
+                               >
+                       </File>
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/samples/qt/VoxelDemo/inc/Application.h b/samples/qt/VoxelDemo/inc/Application.h
new file mode 100644 (file)
index 0000000..59e63ea
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef APPLICATION_H
+#define APPLICATION_H
+
+#include <qmainwindow.h>
+#include <AIS_Shape.hxx>
+#include <Voxel_Prs.hxx>
+#include <Voxel_BoolDS.hxx>
+#include <Voxel_ColorDS.hxx>
+#include "Viewer.h"
+
+class Application: public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    Application();
+    ~Application();
+
+protected:
+    void closeEvent( QCloseEvent* );
+
+private slots:
+    void box();
+    void cylinder();
+    void torus();
+    void sphere();
+    void choose();
+    void load( const QString & );
+    void load( const TopoDS_Shape & );
+    void save();
+    void open();
+
+    void testBoolDS();
+    void testColorDS();
+    void testFloatDS();
+    void testOctBoolDS();
+    void testROctBoolDS();
+
+    void testFuseBoolDS();
+    void testFuseColorDS();
+    void testFuseFloatDS();
+    void testCutBoolDS();
+    void testCutColorDS();
+    void testCutFloatDS();
+    
+    void convert2bool();
+    void convert2color();
+    void convert(const int );
+
+    void setNbX();
+    void setNbY();
+    void setNbZ();
+
+    void setScanSide();
+
+    void setVolumicBoolValue();
+    void setVolumicColorValue();
+
+    void setQuadrangleSize();
+    void setPointSize();
+
+    void setColorMinValue();
+    void setColorMaxValue();
+
+    void setUsageOfGLlists();
+    
+    void setDisplayedXMin();
+    void setDisplayedXMax();
+    void setDisplayedYMin();
+    void setDisplayedYMax();
+    void setDisplayedZMin();
+    void setDisplayedZMax();
+
+    void displayPoints();
+    void displayNearestPoints();
+    void displayBoxes();
+    void displayNearestBoxes();
+
+    void displayColorScale();
+    
+    void displayWaves();
+    void displayCut();
+    void displayCollisions();
+
+    void about();
+
+private:
+    void display(Voxel_VoxelDisplayMode );
+    void initPrs();
+
+       Viewer* myViewer;
+       Handle(AIS_Shape) myShape;
+       Handle(Voxel_Prs) myVoxels;
+       Voxel_BoolDS* myBoolVoxels;
+       Voxel_ColorDS* myColorVoxels;
+       int myNbX;
+       int myNbY;
+       int myNbZ;
+    unsigned char myScanSide;
+    bool myVolumicBoolValue;
+    unsigned char myVolumicColorValue;
+    int myQuadrangleSize;
+    int myPointSize;
+    unsigned char myColorMinValue;
+    unsigned char myColorMaxValue;
+    double myDisplayedXMin;
+    double myDisplayedXMax;
+    double myDisplayedYMin;
+    double myDisplayedYMax;
+    double myDisplayedZMin;
+    double myDisplayedZMax;
+};
+
+#endif // APPLICATION_H
diff --git a/samples/qt/VoxelDemo/inc/ConversionThread.h b/samples/qt/VoxelDemo/inc/ConversionThread.h
new file mode 100644 (file)
index 0000000..7e66a94
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _CONVERSIONTHREAD_H_
+#define _CONVERSIONTHREAD_H_
+
+#include <QThread.h>
+//#include <Voxel_Converter.hxx>
+#include <Voxel_FastConverter.hxx>
+
+class ConversionThread : public QThread
+{
+
+public:
+
+    ConversionThread();
+    ~ConversionThread();
+
+//    void setConverter(Voxel_Converter*     converter);
+    void setConverter(Voxel_FastConverter* converter);
+
+    void setVolumicValue(const int value);
+    void setScanSide(const int side);
+    void setThreadIndex(const int ithread);
+
+    int* getProgress();
+
+protected:
+
+    void run();
+
+private:
+
+//    Voxel_Converter*     myConverter;
+    Voxel_FastConverter* myFastConverter;
+
+    int myVolumicValue;
+    int myScanSide;
+    int myThreadIndex;
+    int myProgress;
+};
+
+#endif // _CONVERSIONTHREAD_H_
\ No newline at end of file
diff --git a/samples/qt/VoxelDemo/inc/Timer.h b/samples/qt/VoxelDemo/inc/Timer.h
new file mode 100644 (file)
index 0000000..338d7dc
--- /dev/null
@@ -0,0 +1,33 @@
+// Timer.h: interface for the Timer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_)
+#define AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <OSD_Timer.hxx>
+
+class Timer  
+{
+public:
+       Standard_EXPORT Timer();
+       Standard_EXPORT Timer(const char* filename);
+       Standard_EXPORT ~Timer();
+       Standard_EXPORT void Start();
+       Standard_EXPORT void Stop();
+       Standard_EXPORT void Continue();
+       Standard_EXPORT void Reset();
+  Standard_EXPORT float Seconds();
+  Standard_EXPORT int Minutes();
+       Standard_EXPORT void Print(char* label);
+
+private:
+       OSD_Timer myTimer;
+       FILE* myWriter;
+};
+
+#endif // !defined(AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_)
diff --git a/samples/qt/VoxelDemo/inc/Viewer.h b/samples/qt/VoxelDemo/inc/Viewer.h
new file mode 100644 (file)
index 0000000..ee57227
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _VIEWER_H_
+#define _VIEWER_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <QWidget.h>
+
+#include <AIS_InteractiveContext.hxx>
+#include <V3d_View.hxx>
+
+#include <Voxel_Prs.hxx>
+#include <Voxel_Selector.hxx>
+
+class Viewer : public QWidget 
+{
+       
+       Q_OBJECT
+
+public:
+
+       Viewer(QWidget* parent);
+       virtual ~Viewer();
+
+       Handle(AIS_InteractiveContext) getIC() const { return myIC; }
+       Handle(V3d_View) getView() const { return myView; }
+    Voxel_Selector& getSelector() { return mySelector; }
+    void setPrs(const Handle(Voxel_Prs)& prs) { myPrs = prs; }
+       virtual QPaintEngine*          paintEngine() const;
+
+signals:
+       
+       void mousePressed(Qt::KeyboardModifiers,int,int);
+       void mouseMoved(Qt::KeyboardModifiers,int,int);
+       void mouseReleased(Qt::KeyboardModifiers,int,int);
+       void mouseDoubleClick(Qt::KeyboardModifiers,int,int);
+
+protected:
+       virtual void paintEvent(QPaintEvent* pEvent);
+       virtual void resizeEvent(QResizeEvent* rsEvent);
+       virtual void mousePressEvent(QMouseEvent* mpEvent);
+       virtual void mouseMoveEvent(QMouseEvent* mmEvent);
+       virtual void mouseReleaseEvent(QMouseEvent* mrEvent);
+       virtual void mouseDoubleClickEvent(QMouseEvent* mdcEvent);
+
+private:
+       Handle(AIS_InteractiveContext) myIC;
+       Handle(V3d_View)               myView;
+
+       bool myRotate;
+       bool myZoom;
+       bool myPan;
+
+       QPoint myStartPnt;
+
+    void setDegenerateMode(const bool );
+
+    Voxel_Selector mySelector;
+    Handle(Voxel_Prs) myPrs;
+};
+
+#endif // _VIEWER_H_
diff --git a/samples/qt/VoxelDemo/inc/VoxelClient_VisDrawer.h b/samples/qt/VoxelDemo/inc/VoxelClient_VisDrawer.h
new file mode 100644 (file)
index 0000000..cb89ac2
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 1999-2012 OPEN CASCADE SAS
+
+ The content of this file is subject to the Open CASCADE Technology Public
+ License Version 6.5 (the "License"). You may not use the content of this file
+ except in compliance with the License. Please obtain a copy of the License
+ at http://www.opencascade.org and read it completely before using this file.
+
+ The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+ main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+
+ The Original Code and all software distributed under the License is
+ distributed on an "AS IS" basis, without warranty of any kind, and the
+ Initial Developer hereby disclaims all such warranties, including without
+ limitation, any warranties of merchantability, fitness for a particular
+ purpose or non-infringement. Please see the License for the specific terms
+ and conditions governing the rights and limitations under the License.
+
+*/
+
+#ifndef _VOXEL_VISDRAWER_H_
+#define _VOXEL_VISDRAWER_H_
+
+#include "Voxel_VisData.h"
+#include <Graphic3d_CBounds.hxx>
+
+class VoxelClient_VisDrawer
+{
+public:
+
+  class VisElement;
+
+public:
+
+    Standard_EXPORT static void Init();
+
+       Standard_EXPORT VoxelClient_VisDrawer(Voxel_VisData* theData);
+       Standard_EXPORT virtual ~VoxelClient_VisDrawer();
+
+       Standard_EXPORT void EvalMinMax(Graphic3d_CBounds& theMinMax) const;
+       Standard_EXPORT void Display(const Standard_Boolean theHighlight);
+
+private:
+    
+       Standard_EXPORT void DisplayVoxels(const Standard_Boolean theHighlight);
+       Standard_EXPORT void DisplayPoints(const Standard_Boolean nearest);
+       Standard_EXPORT void DisplayBoxes(const Standard_Boolean nearest);
+    Standard_EXPORT void HighlightVoxel();
+       
+    Standard_EXPORT void DisplayTriangulation(const Standard_Boolean theHighlight);
+
+       Voxel_VisData* myData;
+};
+
+#endif // _VOXEL_VISDRAWER_H_
diff --git a/samples/qt/VoxelDemo/msvc.bat b/samples/qt/VoxelDemo/msvc.bat
new file mode 100644 (file)
index 0000000..fc42168
--- /dev/null
@@ -0,0 +1,6 @@
+set CASROOT=D:\OCC653\ros
+set QTDIR=D:\qt\4.8.2
+set PATH=%QTDIR%\bin;%PATH%
+
+call %CASROOT%/env.bat %1 %2 %3
+call %CASROOT%/msvc.bat %1 %2 %3 VoxelDemo.sln
diff --git a/samples/qt/VoxelDemo/src/Application.cpp b/samples/qt/VoxelDemo/src/Application.cpp
new file mode 100644 (file)
index 0000000..c4379b0
--- /dev/null
@@ -0,0 +1,2366 @@
+#include "Application.h"
+#include "ConversionThread.h"
+#include "Timer.h"
+
+#include <QPixmap.h>
+#include <QToolButton.h>
+#include <QWhatsThis.h>
+#include <QMenu.h>
+#include <QMenuBar.h>
+#include <QStatusBar.h>
+#include <QApplication.h>
+#include <QFileDialog.h>
+#include <QMessageBox.h>
+#include <QInputDialog.h>
+#include <QCloseEvent>
+
+#include <Voxel_BoolDS.hxx>
+#include <Voxel_ColorDS.hxx>
+#include <Voxel_FloatDS.hxx>
+#include <Voxel_OctBoolDS.hxx>
+#include <Voxel_ROctBoolDS.hxx>
+#include <Voxel_BooleanOperation.hxx>
+#include <Voxel_CollisionDetection.hxx>
+#include <Voxel_FastConverter.hxx>
+#include <Voxel_Writer.hxx>
+#include <Voxel_Reader.hxx>
+#include <VoxelClient_VisDrawer.h>
+
+#include <BRepTools.hxx>
+#include <BRepBndLib.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepPrimAPI_MakeTorus.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <Aspect_ColorScale.hxx>
+
+#include <Windows.h>
+
+Application::Application()
+    : QMainWindow( 0 )
+{
+    // File
+    QMenu * file = menuBar()->addMenu( "&File" );
+
+    QAction* a;
+    // Box
+    a = new QAction("Box", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(box()));
+    file->addAction(a);
+    // Cylinder
+    a = new QAction("Cylinder", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(cylinder()));
+    file->addAction(a);
+    // Torus
+    a = new QAction("Torus", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(torus()));
+    file->addAction(a);
+    // Sphere
+    a = new QAction("Sphere", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(sphere()));
+    file->addAction(a);
+    // Load shape...
+    a = new QAction("Load shape...", this);
+    a->setShortcut(tr("Ctrl+O"));
+    connect(a, SIGNAL(triggered()), this, SLOT(choose()));
+    file->addAction(a);
+
+    file->addSeparator();
+
+    // Open
+    a = new QAction("Open", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(open()));
+    file->addAction(a);
+
+    // Save
+    a = new QAction("Save", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(save()));
+    file->addAction(a);
+
+    file->addSeparator();
+
+    // Quit
+    a = new QAction("&Quit", this);
+    a->setShortcut(tr("Ctrl+Q"));
+    connect(a, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
+    file->addAction(a);
+
+    menuBar()->addSeparator();
+
+
+#ifdef TEST
+    QMenu * test = menuBar()->addMenu( "Test" );
+
+    a = new QAction("Test boolean", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testBoolDS()));
+    test->addAction(a);
+
+    a = new QAction("Test color", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testColorDS()));
+    test->addAction(a);
+
+    a = new QAction("Test float", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testFloatDS()));
+    test->addAction(a);
+
+    a = new QAction("Test boolean / 8", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testOctBoolDS()));
+    test->addAction(a);
+
+    a = new QAction("Test boolean / 8 / 8..", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testROctBoolDS()));
+    test->addAction(a);
+
+    test->addSeparator();
+
+    a = new QAction("Test fusion of booleans", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testFuseBoolDS()));
+    test->addAction(a);
+
+    a = new QAction("Test fusion of colors", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testFuseColorDS()));
+    test->addAction(a);
+
+    a = new QAction("Test fusion of floating-points", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testFuseFloatDS()));
+    test->addAction(a);
+
+    a = new QAction("Test cutting of booleans", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testCutBoolDS()));
+    test->addAction(a);
+
+    a = new QAction("Test cutting of booleans", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testCutColorDS()));
+    test->addAction(a);
+
+    a = new QAction("Test cutting of floating-points", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(testCutFloatDS()));
+    test->addAction(a);
+
+#endif // TEST
+
+    QMenu * converter = menuBar()->addMenu( "Converter" );
+
+#ifdef TEST
+    
+    a = new QAction("Number of splits along X", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setNbX()));
+    converter->addAction(a);
+
+    a = new QAction("Number of splits along Y", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setNbY()));
+    converter->addAction(a);
+
+    a = new QAction("Number of splits along Z", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setNbZ()));
+    converter->addAction(a);
+
+    converter->addSeparator();
+
+    a = new QAction("Side of scanning", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setScanSide()));
+    converter->addAction(a);
+
+    converter->addSeparator();
+
+    a = new QAction("Volumic value of 1bit voxels", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setVolumicBoolValue()));
+    converter->addAction(a);
+    
+    a = new QAction("Volumic value of 4bit voxels", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setVolumicColorValue()));
+    converter->addAction(a);
+
+    converter->addSeparator();
+
+#endif // TEST
+
+    a = new QAction("Convert to 1bit voxels", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(convert2bool()));
+    converter->addAction(a);
+
+    a = new QAction("Convert to 4bit voxels", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(convert2color()));
+    converter->addAction(a);
+
+    QMenu * vis = menuBar()->addMenu( "&Visualization" );
+
+    a = new QAction("Points", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayPoints()));
+    vis->addAction(a);
+
+#ifdef TEST
+    
+    a = new QAction("Nearest points", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayNearestPoints()));
+    vis->addAction(a);
+
+#endif // TEST
+
+    a = new QAction("Boxes", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayBoxes()));
+    vis->addAction(a);
+
+#ifdef TEST
+
+    a = new QAction("Nearest boxes", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayNearestBoxes()));
+    vis->addAction(a);
+
+#endif // TEST
+    
+    vis->addSeparator();
+
+    a = new QAction("Point size", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setPointSize()));
+    vis->addAction(a);
+    
+    a = new QAction("Quadrangle size (%)", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setQuadrangleSize()));
+    vis->addAction(a);
+
+    vis->addSeparator();
+
+    a = new QAction("Color min value", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setColorMinValue()));
+    vis->addAction(a);
+
+    a = new QAction("Color max value", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setColorMaxValue()));
+    vis->addAction(a);
+
+#ifdef TEST
+
+    vis->addSeparator();
+
+    a = new QAction("Use GL lists", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setUsageOfGLlists()));
+    vis->addAction(a);
+
+#endif // TEST
+
+    vis->addSeparator();
+
+    a = new QAction("Displayed X min", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedXMin()));
+    vis->addAction(a);
+
+    a = new QAction("Displayed X max", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedXMax()));
+    vis->addAction(a);
+
+    a = new QAction("Displayed Y min", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedYMin()));
+    vis->addAction(a);
+
+    a = new QAction("Displayed Y max", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedYMax()));
+    vis->addAction(a);
+
+    a = new QAction("Displayed Z min", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedZMin()));
+    vis->addAction(a);
+
+    a = new QAction("Displayed Z max", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedZMax()));
+    vis->addAction(a);
+
+
+    QMenu * demo = menuBar()->addMenu( "Demo" );
+
+    a = new QAction("Waves", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayWaves()));
+    demo->addAction(a);
+
+    a = new QAction("Cut", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayCut()));
+    demo->addAction(a);
+
+    a = new QAction("Collisions", this);
+    connect(a, SIGNAL(triggered()), this, SLOT(displayCollisions()));
+    demo->addAction(a);
+
+
+    QMenu * help = menuBar()->addMenu( "Help" );
+
+    a = new QAction("About", this);
+    a->setShortcut(tr("F1"));
+    connect(a, SIGNAL(triggered()), this, SLOT(about()));
+    help->addAction(a);
+
+
+    myViewer = new Viewer( this );
+    myViewer->setFocus();
+    setCentralWidget( myViewer );
+    statusBar()->showMessage( "Ready", 2000 );
+
+       myNbX = 100;
+       myNbY = 100;
+       myNbZ = 100;
+
+    myScanSide = 7;
+
+    myVolumicBoolValue = false;
+    myVolumicColorValue = 0;
+
+    myQuadrangleSize = 40;
+    
+    myColorMinValue = 1;
+    myColorMaxValue = 15;
+
+       myBoolVoxels = 0;
+       myColorVoxels = 0;
+
+    myDisplayedXMin = -DBL_MAX;
+    myDisplayedXMax =  DBL_MAX;
+    myDisplayedYMin = -DBL_MAX;
+    myDisplayedYMax =  DBL_MAX;
+    myDisplayedZMin = -DBL_MAX;
+    myDisplayedZMax =  DBL_MAX;
+
+       VoxelClient_VisDrawer::Init();
+
+    resize( 450, 600 );
+}
+
+Application::~Application()
+{
+       if (myBoolVoxels)
+               delete myBoolVoxels;
+       if (myColorVoxels)
+               delete myColorVoxels;
+}
+
+void Application::choose()
+{
+    QString fn = QFileDialog::getOpenFileName( this, QString::null, QString::null, "*.brep");
+    if ( !fn.isEmpty() )
+               load( fn );
+    else
+               statusBar()->showMessage( "Loading aborted", 2000 );
+}
+
+void Application::load( const QString &fileName )
+{
+    QFile f( fileName );
+    if ( !f.open( QIODevice::ReadOnly ) )
+               return;
+
+    // Read shape
+       TopoDS_Shape S;
+       BRep_Builder B;
+       if (!BRepTools::Read(S, (char*) fileName.constData(), B))
+               statusBar()->showMessage( "Loading failed", 2000 );
+    
+    load(S);
+}
+
+void Application::open()
+{
+    QString fn = QFileDialog::getOpenFileName( this, QString::null, QString::null, "*.vx");
+    if ( fn.isEmpty() || !QFile::exists(fn) )
+    {
+               statusBar()->showMessage( "Open aborted", 2000 );
+        return;
+    }
+
+    Timer timer;
+    timer.Start();
+
+    // Read the voxels
+    Voxel_Reader reader;
+    if (!reader.Read((char*)fn.constData()))
+    {
+               statusBar()->showMessage( "Open failed... sorry", 2000 );
+        return;
+    }
+
+    timer.Stop();
+    timer.Print("Open");
+
+    // Release current voxels
+    if (myBoolVoxels)
+    {
+        delete myBoolVoxels;
+        myBoolVoxels = 0;
+    }
+    if (myColorVoxels)
+    {
+        delete myColorVoxels;
+        myColorVoxels = 0;
+    }
+
+    // Take the voxels
+    if (reader.IsBoolVoxels())
+    {
+        myBoolVoxels = (Voxel_BoolDS*) reader.GetBoolVoxels();
+        myViewer->getSelector().SetVoxels(*myBoolVoxels);
+    }
+    else if (reader.IsColorVoxels())
+    {
+        myColorVoxels = (Voxel_ColorDS*) reader.GetColorVoxels();
+        myViewer->getSelector().SetVoxels(*myColorVoxels);
+    }
+    
+    // Display the voxels
+    myViewer->getIC()->EraseAll(false, false);
+    Voxel_DS* ds = myBoolVoxels;
+    if (!ds)
+        ds = myColorVoxels;
+    if (ds)
+    {
+        myDisplayedXMin = ds->GetX() - 10.0 * Precision::Confusion();
+        myDisplayedXMax = ds->GetX() + ds->GetXLen() + 10.0 * Precision::Confusion();
+        myDisplayedYMin = ds->GetY() - 10.0 * Precision::Confusion();
+        myDisplayedYMax = ds->GetY() + ds->GetYLen() + 10.0 * Precision::Confusion();
+        myDisplayedZMin = ds->GetZ() - 10.0 * Precision::Confusion();
+        myDisplayedZMax = ds->GetZ() + ds->GetZLen() + 10.0 * Precision::Confusion();
+    }
+
+    // Init visual data
+    initPrs();
+
+    // Set voxels and display
+    Handle(Poly_Triangulation) empty;
+    myVoxels->SetBoolVoxels(myBoolVoxels);
+       myVoxels->SetColorVoxels(myColorVoxels);
+    myVoxels->SetTriangulation(empty);
+    if (myViewer->getIC()->IsDisplayed(myVoxels))
+        myViewer->getIC()->Redisplay(myVoxels, false);
+    else
+           myViewer->getIC()->Display(myVoxels, false);
+   
+    // Color scale
+    if (myColorVoxels)
+        displayColorScale();
+    else
+        myViewer->getView()->ColorScaleErase();
+
+       myViewer->getView()->FitAll();
+
+    statusBar()->showMessage( "Ready.", 2000 );
+}
+
+void Application::save()
+{
+    QString fn = QFileDialog::getSaveFileName( this, QString::null, QString::null, "*.vx");
+    if ( fn.isEmpty() )
+    {
+               statusBar()->showMessage( "Storage aborted", 2000 );
+        return;
+    }
+    if (fn.indexOf(".vx", -1, Qt::CaseInsensitive) == -1)
+        fn += ".vx";
+
+    Timer timer;
+    timer.Start();
+
+    // Write the voxels
+    Voxel_Writer writer;
+    writer.SetFormat(Voxel_VFF_BINARY);
+    if (myBoolVoxels)
+        writer.SetVoxels(*myBoolVoxels);
+    else if (myColorVoxels)
+        writer.SetVoxels(*myColorVoxels);
+    else
+    {
+               statusBar()->showMessage( "Nothing to store", 2000 );
+        return;
+    }
+    if (!writer.Write((char*)fn.constData()))
+    {
+               statusBar()->showMessage( "Storage failed... sorry", 2000 );
+        return;
+    }
+
+    timer.Stop();
+    timer.Print("Save");
+
+    statusBar()->showMessage( "Saved.", 2000 );
+}
+
+void Application::closeEvent( QCloseEvent* ce )
+{
+    ce->accept();
+}
+
+void Application::about()
+{
+    QMessageBox::about( this, "Voxel demo-application",
+                       "This example demonstrates simple usage of "
+                       "voxel models of Open CASCADE.");
+}
+
+void Application::testBoolDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. BoolDS:
+
+       timer.Start();
+
+       Voxel_BoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds.Set(ix, iy, iz, false);
+                               else
+                                       ds.Set(ix, iy, iz, true);
+                       }
+               }
+       }
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               bool value = ds.Get(ix, iy, iz) == Standard_True;
+                               if (ix & 0x01)
+                               {
+                                       if (value != false)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                                       if (value != true)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("BoolDS");
+}
+
+void Application::testColorDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. ColorDS:
+
+       timer.Start();
+
+       Voxel_ColorDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                if (ix & 0x01)
+                           ds.Set(ix, iy, iz, 8);
+                else
+                    ds.Set(ix, iy, iz, 7);
+                       }
+               }
+       }
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               unsigned char value = ds.Get(ix, iy, iz);
+                if (ix & 0x01)
+                {
+                                   if (value != 8)
+                                           cout<<"Wrong value!"<<endl;
+                }
+                else
+                {
+                                   if (value != 7)
+                                           cout<<"Wrong value!"<<endl;
+                }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("ColorDS");
+}
+
+void Application::testFloatDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. FloatDS:
+
+       timer.Start();
+
+       Voxel_FloatDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                if (ix & 0x01)
+                           ds.Set(ix, iy, iz, 8.8f);
+                else
+                    ds.Set(ix, iy, iz, 7.7f);
+                       }
+               }
+       }
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               float value = ds.Get(ix, iy, iz);
+                if (ix & 0x01)
+                {
+                                   if (value != 8.8f)
+                                           cout<<"Wrong value!"<<endl;
+                }
+                else
+                {
+                                   if (value != 7.7f)
+                                           cout<<"Wrong value!"<<endl;
+                }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("FloatDS");
+}
+
+void Application::testOctBoolDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 30, nby = 30, nbz = 30;
+
+
+       // 1. OctBoolDS:
+
+       timer.Start();
+
+       Voxel_OctBoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                {
+                                       ds.Set(ix, iy, iz, true);
+                }
+                               else
+                {
+                    for (int i = 0; i < 8; i++)
+                    {
+                        if (i & 0x01)
+                                               ds.Set(ix, iy, iz, i, true);
+                        else
+                            ds.Set(ix, iy, iz, i, false);
+                    }
+                }
+                       }
+               }
+       }
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                               {
+                               bool value = ds.Get(ix, iy, iz) == Standard_True;
+                                       if (value != true)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                    for (int i = 0; i < 8; i++)
+                    {
+                        if (i & 0x01)
+                        {
+                                       bool value = ds.Get(ix, iy, iz, i) == Standard_True;
+                                               if (value != true)
+                                                       cout<<"Wrong value!"<<endl;
+                        }
+                        else
+                        {
+                                       bool value = ds.Get(ix, iy, iz, i) == Standard_True;
+                                               if (value != false)
+                                                       cout<<"Wrong value!"<<endl;
+                        }
+                    }
+                               }
+                       }
+               }
+       }
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                               {
+                    for (int i = 0; i < 8; i++)
+                    {
+                        ds.Set(ix, iy, iz, i, true);
+                    }
+                               }
+                else
+                {
+                    for (int i = 0; i < 8; i++)
+                    {
+                        ds.Set(ix, iy, iz, i, false);
+                    }
+                }
+                       }
+               }
+       }
+
+    ds.OptimizeMemory();
+
+       timer.Stop();
+       timer.Print("OctBoolDS");
+}
+
+void Application::testROctBoolDS()
+{
+       Timer timer;
+       int ix, iy, iz, i, j;
+       int nbx = 30, nby = 30, nbz = 30;
+
+       // 1. ROctBoolDS:
+
+       timer.Start();
+
+       Voxel_ROctBoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+    for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                ds.Set(ix, iy, iz, true);
+                       }
+               }
+       }
+
+    for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                for (i = 0; i < 8; i++)
+                {
+                    for (j = 0; j < 8; j++)
+                    {
+                        ds.Set(ix, iy, iz, i, j, true);
+                    }
+                }
+                       }
+               }
+       }
+
+    ds.OptimizeMemory();
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                if (ds.Deepness(ix, iy, iz) == 0)
+                {
+                    bool value = ds.Get(ix, iy, iz);
+                    if (value != true)
+                        cout<<"Wrong value..."<<endl;
+                }
+                if (ds.Deepness(ix, iy, iz) == 1)
+                {
+                    for (i = 0; i < 8; i++)
+                    {
+                        bool value = ds.Get(ix, iy, iz, i);
+                        if (value != true)
+                            cout<<"Wrong value..."<<endl;
+                    }
+                }
+                if (ds.Deepness(ix, iy, iz) == 2)
+                {
+                    for (i = 0; i < 8; i++)
+                    {
+                        for (j = 0; j < 8; j++)
+                        {
+                            bool value = ds.Get(ix, iy, iz, i, j);
+                            if (value != true)
+                                cout<<"Wrong value..."<<endl;
+                        }
+                    }
+                }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("ROctBoolDS");
+
+
+    // Test converter
+    TopoDS_Shape S = BRepPrimAPI_MakeSphere(100.0);
+
+    timer.Start();
+
+    int progress = 0;
+    Voxel_ROctBoolDS* ds2 = new Voxel_ROctBoolDS;
+    Voxel_FastConverter converter(S, *ds2, 0.1, myNbX, myNbY, myNbZ, 1);
+    converter.Convert(progress);
+    ds2->OptimizeMemory();
+
+       timer.Stop();
+       timer.Print("ROctBoolDS::converter");
+
+
+    // Display 
+    myViewer->getIC()->EraseAll(false, false);
+    initPrs();
+    myVoxels->SetBoolVoxels(0);
+       myVoxels->SetColorVoxels(0);
+    Handle(Poly_Triangulation) empty;
+    myVoxels->SetTriangulation(empty);
+    myVoxels->SetROctBoolVoxels(ds2);
+    myViewer->getIC()->Display(myVoxels, false);
+    myViewer->getView()->ColorScaleErase();
+       myViewer->getView()->FitAll();
+    myViewer->getSelector().SetVoxels(*ds2);
+}
+
+void Application::testFuseBoolDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two BoolDS:
+
+       timer.Start();
+
+       Voxel_BoolDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_BoolDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, false);
+                               else
+                                       ds2.Set(ix, iy, iz, true);
+                       }
+               }
+       }
+
+    // 2. Fuse them
+
+    Voxel_BooleanOperation fuser;
+    if (!fuser.Fuse(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               bool value = ds1.Get(ix, iy, iz) == Standard_True;
+                               if (ix & 0x01)
+                               {
+                                       if (value != false)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                                       if (value != true)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Fusion of BoolDS");
+}
+
+void Application::testFuseColorDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two ColorDS:
+
+       timer.Start();
+
+       Voxel_ColorDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_ColorDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               ds1.Set(ix, iy, iz, 11);
+                       }
+               }
+       }
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, 3);
+                               else
+                                       ds2.Set(ix, iy, iz, 5);
+                       }
+               }
+       }
+
+    // 2. Fuse them
+
+    Voxel_BooleanOperation fuser;
+    if (!fuser.Fuse(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               unsigned char value = ds1.Get(ix, iy, iz);
+                               if (ix & 0x01)
+                               {
+                                       if (value != 14)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                                       if (value != 15)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Fusion of ColorDS");
+}
+
+void Application::testFuseFloatDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two FloatDS:
+
+       timer.Start();
+
+       Voxel_FloatDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_FloatDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               ds1.Set(ix, iy, iz, 11.1f);
+                       }
+               }
+       }
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, 3.3f);
+                               else
+                                       ds2.Set(ix, iy, iz, 5.5f);
+                       }
+               }
+       }
+
+    // 2. Fuse them
+
+    Voxel_BooleanOperation fuser;
+    if (!fuser.Fuse(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               float value = ds1.Get(ix, iy, iz);
+                               if (ix & 0x01)
+                               {
+                    if (fabs(value - 14.4f) > 0.001)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                    if (fabs(value - 16.6f) > 0.001)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Fusion of FloatDS");
+}
+
+void Application::testCutBoolDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two BoolDS:
+
+       timer.Start();
+
+       Voxel_BoolDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_BoolDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               ds1.Set(ix, iy, iz, true);
+                       }
+               }
+       }
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, false);
+                               else
+                                       ds2.Set(ix, iy, iz, true);
+                       }
+               }
+       }
+
+    // 2. Cut them
+
+    Voxel_BooleanOperation cutter;
+    if (!cutter.Cut(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               bool value = ds1.Get(ix, iy, iz) == Standard_True;
+                               if (ix & 0x01)
+                               {
+                                       if (value != true)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                                       if (value != false)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Cut of BoolDS");
+}
+
+void Application::testCutColorDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two ColorDS:
+
+       timer.Start();
+
+       Voxel_ColorDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_ColorDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               ds1.Set(ix, iy, iz, 11);
+                       }
+               }
+       }
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, 3);
+                               else
+                                       ds2.Set(ix, iy, iz, 5);
+                       }
+               }
+       }
+
+    // 2. Cut them
+
+    Voxel_BooleanOperation cutter;
+    if (!cutter.Cut(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               unsigned char value = ds1.Get(ix, iy, iz);
+                               if (ix & 0x01)
+                               {
+                                       if (value != 8)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                                       if (value != 6)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Cut of ColorDS");
+}
+
+void Application::testCutFloatDS()
+{
+       Timer timer;
+       int ix, iy, iz;
+       int nbx = 100, nby = 100, nbz = 100;
+
+
+       // 1. Set two FloatDS:
+
+       timer.Start();
+
+       Voxel_FloatDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+       Voxel_FloatDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               ds1.Set(ix, iy, iz, 11.1f);
+                       }
+               }
+       }
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               if (ix & 0x01)
+                                       ds2.Set(ix, iy, iz, 3.3f);
+                               else
+                                       ds2.Set(ix, iy, iz, 5.5f);
+                       }
+               }
+       }
+
+    // 2. Cut them
+
+    Voxel_BooleanOperation cutter;
+    if (!cutter.Cut(ds1, ds2))
+        cout<<"The operation failed..."<<endl;
+
+    // 3. Check result
+
+       for (ix = 0; ix < nbx; ix++)
+       {
+               for (iy = 0; iy < nby; iy++)
+               {
+                       for (iz = 0; iz < nbz; iz++)
+                       {
+                               float value = ds1.Get(ix, iy, iz);
+                               if (ix & 0x01)
+                               {
+                    if (fabs(value - 7.8f) > 0.001)
+                                       cout<<"Wrong value!"<<endl;
+                               }
+                               else
+                               {
+                    if (fabs(value - 5.6f) > 0.001)
+                                               cout<<"Wrong value!"<<endl;
+                               }
+                       }
+               }
+       }
+
+       timer.Stop();
+       timer.Print("Cut of FloatDS");
+}
+
+void Application::convert2bool()
+{
+    convert(0);
+}
+
+void Application::convert2color()
+{
+    convert(1);
+}
+
+void Application::convert(const int ivoxel)
+{
+       TopoDS_Shape S;
+       if (!myShape.IsNull())
+               S = myShape->Shape();
+    if (S.IsNull())
+       {
+               QMessageBox::warning( this, "Voxel demo-application", "No shape for conversion!");
+               return;
+       }
+
+    switch (ivoxel)
+    {
+        case 0:
+        {
+               if (!myBoolVoxels)
+                       myBoolVoxels = new Voxel_BoolDS;
+            if (myColorVoxels)
+            {
+                delete myColorVoxels;
+                myColorVoxels = 0;
+            }
+            break;
+        }
+        case 1:
+        {
+               if (!myColorVoxels)
+                       myColorVoxels = new Voxel_ColorDS;
+            if (myBoolVoxels)
+            {
+                delete myBoolVoxels;
+                myBoolVoxels = 0;
+            }
+            break;
+        }
+    }
+
+    switch (ivoxel)
+    {
+        case 0:
+        {
+            Timer timer;
+            timer.Start();
+
+            /*
+            int progress;
+            Voxel_Converter converter(S, *myBoolVoxels, myNbX, myNbY, myNbZ);
+               if (!converter.Convert(progress, myVolumicBoolValue, myScanSide))
+               {
+                       QMessageBox::warning( this, "Voxel demo-application", "Conversion failed...");
+                       return;
+               }
+            */
+
+            /*
+            Voxel_Converter converter(S, *myBoolVoxels, myNbX, myNbY, myNbZ, 2);
+            ConversionThread thread1, thread2;
+            
+            thread1.setConverter(&converter);
+            thread2.setConverter(&converter);
+
+            thread1.setVolumicValue(myVolumicBoolValue);
+            thread2.setVolumicValue(myVolumicBoolValue);
+
+            thread1.setScanSide(myScanSide);
+            thread2.setScanSide(myScanSide);
+
+            thread1.setThreadIndex(1);
+            thread2.setThreadIndex(2);
+
+            thread1.start();
+            thread2.start();
+
+            while (thread1.running() || thread2.running())
+            {
+                ::Sleep(100);
+            }
+            */
+
+            /*
+            int progress;
+            Voxel_FastConverter converter(S, *myBoolVoxels, 0.1, myNbX, myNbY, myNbZ, 1);
+            converter.Convert(progress, 1);
+            //if (myVolumicBoolValue)
+            //    converter.FillInVolume(myVolumicBoolValue);
+            */
+
+            Voxel_FastConverter converter(S, *myBoolVoxels, 0.1, myNbX, myNbY, myNbZ, 2);
+            ConversionThread thread1, thread2;
+            
+            thread1.setConverter(&converter);
+            thread2.setConverter(&converter);
+
+            thread1.setThreadIndex(1);
+            thread2.setThreadIndex(2);
+
+            thread1.start();
+            thread2.start();
+
+            while (thread1.isRunning() || thread2.isRunning())
+            {
+                ::Sleep(100);
+            }
+
+            timer.Print("Converter");
+
+            myViewer->getSelector().SetVoxels(*myBoolVoxels);
+            break;
+        }
+        case 1:
+        {
+
+            Timer timer;
+            timer.Start();
+
+            /*
+            int progress;
+            Voxel_Converter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ);
+               if (!converter.Convert(progress, myVolumicColorValue, myScanSide))
+               {
+                       QMessageBox::warning( this, "Voxel demo-application", "Conversion failed...");
+                       return;
+               }
+            */
+
+            /*
+            Voxel_Converter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ, 2);
+            ConversionThread thread1, thread2;
+            
+            thread1.setConverter(&converter);
+            thread2.setConverter(&converter);
+
+            thread1.setVolumicValue(myVolumicColorValue);
+            thread2.setVolumicValue(myVolumicColorValue);
+
+            thread1.setScanSide(myScanSide);
+            thread2.setScanSide(myScanSide);
+
+            thread1.setThreadIndex(1);
+            thread2.setThreadIndex(2);
+
+            thread1.start();
+            thread2.start();
+
+            while (thread1.running() || thread2.running())
+            {
+                ::Sleep(100);
+            }
+            */
+
+            /*
+            int progress;
+            Voxel_FastConverter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ, 1);
+            converter.Convert(progress, 1);
+            if (myVolumicColorValue)
+                converter.FillInVolume(myVolumicColorValue);
+            */
+
+            Voxel_FastConverter converter(S, *myColorVoxels, 0.1, myNbX, myNbY, myNbZ, 2);
+            ConversionThread thread1, thread2;
+            
+            thread1.setConverter(&converter);
+            thread2.setConverter(&converter);
+
+            thread1.setThreadIndex(1);
+            thread2.setThreadIndex(2);
+
+            thread1.start();
+            thread2.start();
+
+            while (thread1.isRunning() || thread2.isRunning())
+            {
+                ::Sleep(100);
+            }
+
+            timer.Print("Converter");
+
+
+            // Set color for demonstration
+            double maxd = 
+                fabs(myColorVoxels->GetX()) > fabs(myColorVoxels->GetY()) ? 
+                fabs(myColorVoxels->GetX()) : fabs(myColorVoxels->GetY());
+            maxd = maxd > fabs(myColorVoxels->GetZ()) ? maxd : fabs(myColorVoxels->GetZ());
+            maxd = maxd > fabs(myColorVoxels->GetX() + myColorVoxels->GetXLen()) ?
+                maxd : fabs(myColorVoxels->GetX() + myColorVoxels->GetXLen());
+            maxd = maxd > fabs(myColorVoxels->GetY() + myColorVoxels->GetYLen()) ?
+                maxd : fabs(myColorVoxels->GetY() + myColorVoxels->GetYLen());
+            maxd = maxd > fabs(myColorVoxels->GetZ() + myColorVoxels->GetZLen()) ?
+                maxd : fabs(myColorVoxels->GetZ() + myColorVoxels->GetZLen());
+            for (int ix = 0; ix < myNbX; ix++)
+            {
+                for (int iy = 0; iy < myNbY; iy++)
+                {
+                    for (int iz = 0; iz < myNbZ; iz++)
+                    {
+                        unsigned char value = myColorVoxels->Get(ix, iy, iz);
+                        if (value)
+                        {
+                            double xc, yc, zc, xd, yd, zd;
+                            myColorVoxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            xd = fabs(xc);
+                            yd = fabs(yc);
+                            zd = fabs(zc);
+                            double mind = xd < yd ? xd : yd;
+                            mind = zd < mind ? zd : mind;
+                            value = unsigned char(15.0 * (maxd - mind) / maxd);
+                            if (value <= 0)
+                                value = 1;
+                            myColorVoxels->Set(ix, iy, iz, value);
+                        }
+                    }
+                }
+            }
+
+            myViewer->getSelector().SetVoxels(*myColorVoxels);
+            break;
+        }
+    }
+
+    myViewer->getIC()->EraseAll(false, false);
+
+    Voxel_DS* ds = myBoolVoxels;
+    if (!ds)
+        ds = myColorVoxels;
+    if (ds)
+    {
+        myDisplayedXMin = ds->GetX() - 10.0 * Precision::Confusion();
+        myDisplayedXMax = ds->GetX() + ds->GetXLen() + 10.0 * Precision::Confusion();
+        myDisplayedYMin = ds->GetY() - 10.0 * Precision::Confusion();
+        myDisplayedYMax = ds->GetY() + ds->GetYLen() + 10.0 * Precision::Confusion();
+        myDisplayedZMin = ds->GetZ() - 10.0 * Precision::Confusion();
+        myDisplayedZMax = ds->GetZ() + ds->GetZLen() + 10.0 * Precision::Confusion();
+    }
+
+    // Init visual data
+    initPrs();
+
+    // Set voxels and display
+    Handle(Poly_Triangulation) empty;
+    myVoxels->SetBoolVoxels(myBoolVoxels);
+       myVoxels->SetColorVoxels(myColorVoxels);
+    myVoxels->SetTriangulation(empty);
+    if (myViewer->getIC()->IsDisplayed(myVoxels))
+        myViewer->getIC()->Redisplay(myVoxels, false);
+    else
+           myViewer->getIC()->Display(myVoxels, false);
+    
+    // Color scale
+    if (myColorVoxels)
+        displayColorScale();
+    else
+        myViewer->getView()->ColorScaleErase();
+
+       myViewer->getView()->FitAll();
+}
+
+void Application::setNbX()
+{
+       bool ok;
+       myNbX = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbX,
+                                                                                                                1, 100000, 1, &ok);
+}
+
+void Application::setNbY()
+{
+       bool ok;
+       myNbY = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbY,
+                                                                                                                1, 100000, 1, &ok);
+}
+
+void Application::setNbZ()
+{
+       bool ok;
+       myNbZ = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbZ,
+                                                                                                                1, 100000, 1, &ok);
+}
+
+void Application::setColorMinValue()
+{
+       bool ok;
+       myColorMinValue = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Minimum value for color [0 .. 15]:", myColorMinValue,
+                                                                0, 15, 1, &ok);
+    if (!myVoxels.IsNull())
+        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
+}
+
+void Application::setColorMaxValue()
+{
+       bool ok;
+       myColorMaxValue = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Maximum value for color [0 .. 15]:", myColorMaxValue,
+                                                                0, 15, 1, &ok);
+    if (!myVoxels.IsNull())
+        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
+}
+
+void Application::setUsageOfGLlists()
+{
+    int res = QMessageBox::question( this, "Voxel demo-application", "Press Yes to use GL lists and No not to use them.", QMessageBox::Yes, QMessageBox::No);
+    if (!myVoxels.IsNull())
+        myVoxels->SetUsageOfGLlists(res == QMessageBox::Yes);
+}
+
+void Application::setDisplayedXMin()
+{
+       myDisplayedXMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum X value:", myDisplayedXMin);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setDisplayedXMax()
+{
+       myDisplayedXMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum X value:", myDisplayedXMax);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setDisplayedYMin()
+{
+       myDisplayedYMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum Y value:", myDisplayedYMin);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setDisplayedYMax()
+{
+       myDisplayedYMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum Y value:", myDisplayedYMax);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setDisplayedZMin()
+{
+       myDisplayedZMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum Z value:", myDisplayedZMin);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setDisplayedZMax()
+{
+       myDisplayedZMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum Z value:", myDisplayedZMax);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
+                               myDisplayedYMin, myDisplayedYMax,
+                               myDisplayedZMin, myDisplayedZMax);
+    }
+}
+
+void Application::setScanSide()
+{
+       myScanSide = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Side of scanning (1: +X side, 2: +Y side, 3: +Z side, 4: +X & +Y sides, .. 7: +X, +Y,& +Z sides):", 
+                                 myScanSide, 1, 7, 1);
+}
+
+void Application::setVolumicBoolValue()
+{
+       myVolumicBoolValue = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Volumic value on voxelization [0 .. 1]:", 
+                                 myVolumicBoolValue, 0, 1, 1);
+}
+
+void Application::setVolumicColorValue()
+{
+       myVolumicColorValue = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Volumic value on voxelization [0 .. 15]:", 
+                                 myVolumicColorValue, 0, 15, 1);
+}
+
+void Application::setQuadrangleSize()
+{
+       myQuadrangleSize = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Size of quadrangles (0% .. 100%):", 
+                                 myQuadrangleSize, 1, 100, 10);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetQuadrangleSize(myQuadrangleSize);
+    }
+}
+
+void Application::setPointSize()
+{
+       myPointSize = 
+               QInputDialog::getInteger(this, "Voxel demo-application", "Size of points (1 .. 10):", 
+                                 myPointSize, 1, 10, 1);
+    if (!myVoxels.IsNull())
+    {
+        myVoxels->SetPointSize(myPointSize);
+    }
+}
+
+void Application::display(Voxel_VoxelDisplayMode mode)
+{
+    if (myVoxels.IsNull() || !myViewer->getIC()->IsDisplayed(myVoxels))
+    {
+               QMessageBox::warning( this, "Voxel demo-application", "Voxels are not displayed");
+               return;
+       }
+
+    myVoxels->SetDisplayMode(mode);
+
+    if (myColorVoxels)
+        displayColorScale();
+    else
+        myViewer->getView()->ColorScaleErase();
+
+    myViewer->getIC()->Redisplay(myVoxels, true);
+}
+
+void Application::displayPoints()
+{
+    display(Voxel_VDM_POINTS);
+}
+
+void Application::displayNearestPoints()
+{
+    display(Voxel_VDM_NEARESTPOINTS);
+}
+
+void Application::displayBoxes()
+{
+    display(Voxel_VDM_BOXES);
+}
+
+void Application::displayNearestBoxes()
+{
+    display(Voxel_VDM_NEARESTBOXES);
+}
+
+void Application::displayColorScale()
+{
+       Handle(Aspect_ColorScale) color_scale = myViewer->getView()->ColorScale();
+       if (!color_scale.IsNull())
+       {
+        int nb_colors = 1<<4 /* 4 bits */;
+        color_scale->SetRange(0, nb_colors - 1);
+        color_scale->SetNumberOfIntervals(nb_colors);
+               color_scale->SetPosition(0.01, 0.5 - 0.01);
+               color_scale->SetSize(0.5 - 0.01, 0.5 - 0.01);
+       }
+    myViewer->getView()->ColorScaleDisplay();
+}
+
+void Application::displayWaves()
+{
+    myViewer->getIC()->EraseAll(false, false);
+
+    // Make voxels
+    if (myBoolVoxels)
+    {
+        delete myBoolVoxels;
+        myBoolVoxels = 0;
+    }
+    if (myColorVoxels)
+        delete myColorVoxels;
+
+    int nbx = 500, nby = 50, nbz = 50;
+    double xlen = 100.0, ylen = 100.0, zlen = 20.0;
+    double dx = xlen / (double) nbx, dy = ylen / (double) nby, dz = zlen / (double) nbz;
+    myColorVoxels = new Voxel_ColorDS(0.0, 0.0, 0.0, xlen, ylen, zlen, nbx, nby, nbz);
+
+    // Initial state - no colors
+    int ix, iy, iz;
+    for (ix = 0; ix < nbx; ix++)
+    {
+        for (iy = 0; iy < nby; iy++)
+        {
+            for (iz = 0; iz < nbz; iz++)
+            {
+                myColorVoxels->Set(ix, iy, iz, 0);
+            }
+        }
+    }
+
+    // Init visual data
+    initPrs();
+    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
+    myVoxels->SetUsageOfGLlists(false);
+       myVoxels->SetBoolVoxels(myBoolVoxels);
+       myVoxels->SetColorVoxels(myColorVoxels);
+    if (myViewer->getIC()->IsDisplayed(myVoxels))
+        myViewer->getIC()->Redisplay(myVoxels, false);
+    else
+           myViewer->getIC()->Display(myVoxels, false);
+    myViewer->getView()->FitAll();
+
+    // Prepare arrays of values
+    // X&Z values
+    int i = 0, di = 5 /* nb waves */;
+    int* zvalues = new int[nbx];
+    unsigned char* xvalues = new unsigned char[nbx];
+    for (ix = 0; ix < nbx; ix++, i += di)
+    {
+        if (i > nbx || i < 0)
+        {
+            di *= -1;
+            i += di;
+        }
+        double rad = -M_PI / 2.0 + double(i) / (double) nbx * M_PI;
+        double c = cos(rad);
+        xvalues[ix] = 15.0 * c;
+        if (xvalues[ix] == 0)
+            xvalues[ix] = 1;
+        zvalues[ix] = (nbz - 2) * c;
+    }
+
+    // Make waves
+    unsigned char value = 0;
+    for (i = 0; i <= 100; i++)
+    {
+        for (ix = 0; ix < nbx; ix++)
+        {
+            int ixi = ix + i;
+            if (ixi >= nbx)
+                ixi -= nbx;
+            for (iz = 0; iz < nbz; iz++)
+            {
+                value = 0;
+                if (iz < zvalues[ixi])
+                    value = xvalues[ixi];
+                for (iy = 0; iy < nby; iy++)
+                {
+                    myColorVoxels->Set(ix, iy, iz, value);
+                }
+            }
+        }
+        myViewer->getIC()->Redisplay(myVoxels, true);
+        qApp->processEvents();
+    }
+
+    delete[] xvalues;
+    delete[] zvalues;
+}
+
+void Application::initPrs()
+{
+       if (myVoxels.IsNull())
+    {
+               myVoxels = new Voxel_Prs;
+        myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
+        myVoxels->SetColor(Quantity_NOC_WHITE);
+        myVoxels->SetPointSize(1.0);
+        myVoxels->SetSmoothPoints(false);
+        myVoxels->SetQuadrangleSize(myQuadrangleSize);
+        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
+        // Colors of ColorDS
+        int nb_colors = 16 /* 4 bits */;
+        Handle(Quantity_HArray1OfColor) colors = new Quantity_HArray1OfColor(0, nb_colors - 1);
+        for (int icolor = 0; icolor < nb_colors; icolor++)
+        {
+            Quantity_Color color;
+            Aspect_ColorScale::FindColor(icolor, 0, nb_colors - 1, nb_colors, color);
+            colors->SetValue(icolor, color);
+        }
+        myVoxels->SetColors(colors);
+        myViewer->setPrs(myVoxels);
+    }
+    else
+    {
+        myViewer->getIC()->RecomputePrsOnly(myVoxels, false);
+    }
+}
+
+void Application::box()
+{
+    gp_Ax2 axes(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
+    TopoDS_Shape S = BRepPrimAPI_MakeBox(axes, 100, 100, 100);
+    load(S);
+}
+
+void Application::cylinder()
+{
+    TopoDS_Shape S = BRepPrimAPI_MakeCylinder(50, 100);
+    load(S);
+}
+
+void Application::torus()
+{
+    TopoDS_Shape S = BRepPrimAPI_MakeTorus(100, 20);
+    load(S);
+}
+
+void Application::sphere()
+{
+    TopoDS_Shape S = BRepPrimAPI_MakeSphere(100);
+    load(S);
+}
+
+void Application::load(const TopoDS_Shape& S)
+{
+       myViewer->getIC()->EraseAll(false, false);
+
+    // Delete voxels of previous shape.
+    if (myBoolVoxels)
+    {
+        delete myBoolVoxels;
+        myBoolVoxels = 0;
+    }
+    if (myColorVoxels)
+    {
+        delete myColorVoxels;
+        myColorVoxels = 0;
+    }
+    
+    // Set view size
+    Bnd_Box box;
+    double xmin, ymin, zmin, xmax, ymax, zmax, length = 0;
+    BRepBndLib::Add(S, box);
+    box.Get(xmin, ymin, zmin, xmax, ymax, zmax);
+    length = xmax - xmin > ymax - ymin ? xmax - xmin : ymax - ymin;
+    length = length > zmax - zmin ? length : zmax - zmin;
+    length *= 2.0;
+    myViewer->getView()->SetSize(length);
+    myViewer->getView()->SetZSize(length);
+
+    // Display shape
+       if (myShape.IsNull())
+       {
+               myShape = new AIS_Shape(S);
+               myShape->SetDisplayMode(1);
+        myShape->UnsetSelectionMode();
+       }
+       else
+       {
+               myShape->Set(S);
+        myViewer->getIC()->RecomputePrsOnly(myShape, false);
+       }
+    if (myViewer->getIC()->IsDisplayed(myShape))
+        myViewer->getIC()->Redisplay(myShape, false);
+    else
+           myViewer->getIC()->Display(myShape, false);
+       myViewer->getView()->FitAll();
+}
+
+void Application::displayCut()
+{
+    myViewer->getIC()->EraseAll(false, false);
+
+    // Make a sphere with a lot of toruses, 
+    // cut the toruses from the sphere.
+    TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(100.0);
+    TopoDS_Shape torus1 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt( 80,   0, 20), gp::DZ()), 30, 10);
+    TopoDS_Shape torus2 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(  0,  80, 20), gp::DZ()), 30, 10);
+    TopoDS_Shape torus3 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(-80,   0, 20), gp::DZ()), 30, 10);
+    TopoDS_Shape torus4 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(  0, -80, 20), gp::DZ()), 30, 10);
+
+    // Compute bounding box of the shapes
+    Bnd_Box box;
+    BRepBndLib::Add(sphere, box);
+    BRepBndLib::Add(torus1, box);
+    BRepBndLib::Add(torus2, box);
+    BRepBndLib::Add(torus3, box);
+    BRepBndLib::Add(torus4, box);
+
+    // Nullify voxels
+    if (myColorVoxels)
+    {
+        delete myColorVoxels;
+        myColorVoxels = 0;
+    }
+    if (myBoolVoxels)
+    {
+        delete myBoolVoxels;
+        myBoolVoxels = 0;
+    }
+
+    Timer timer;
+    timer.Start();
+
+    // Create a cube of voxels
+    int nbx = 100, nby = 100, nbz = 100;
+    double xmin, ymin, zmin, xmax, ymax, zmax;
+    box.Get(xmin, ymin, zmin, xmax, ymax, zmax);
+    myColorVoxels = new Voxel_ColorDS(xmin, ymin, zmin, 
+                                      xmax - xmin, ymax - ymin, zmax - zmin,
+                                      nbx, nby, nbz);
+    Voxel_ColorDS vtorus(xmin, ymin, zmin, 
+                         xmax - xmin, ymax - ymin, zmax - zmin,
+                         nbx, nby, nbz);
+
+    // Make a cube of voxels for the sphere.
+    int progress;
+    Voxel_FastConverter converter(sphere, *myColorVoxels, 0.1, nbx, nby, nbz);
+    converter.Convert(progress);
+    converter.FillInVolume(15);
+   
+    // Torus 1
+    Voxel_FastConverter converter1(torus1, vtorus, 0.1, nbx, nby, nbz);
+    converter1.Convert(progress);
+    converter1.FillInVolume(3);
+   
+    // Torus 2
+    Voxel_FastConverter converter2(torus2, vtorus, 0.1, nbx, nby, nbz);
+    converter2.Convert(progress);
+    converter2.FillInVolume(7);
+   
+    // Torus 3
+    Voxel_FastConverter converter3(torus3, vtorus, 0.1, nbx, nby, nbz);
+    converter3.Convert(progress);
+    converter3.FillInVolume(10);
+   
+    // Torus 4
+    Voxel_FastConverter converter4(torus4, vtorus, 0.1, nbx, nby, nbz);
+    converter4.Convert(progress);
+    converter4.FillInVolume(12);
+
+    // Cut
+    Voxel_BooleanOperation cutter;
+    cutter.Cut(*myColorVoxels, vtorus);
+
+    // Remove volumic voxels
+    converter.FillInVolume(0);
+
+    timer.Stop();
+    timer.Print("Cut");
+
+    // Display
+    initPrs();
+    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
+    myVoxels->SetUsageOfGLlists(true);
+       myVoxels->SetBoolVoxels(myBoolVoxels);
+       myVoxels->SetColorVoxels(myColorVoxels);
+    if (myViewer->getIC()->IsDisplayed(myVoxels))
+        myViewer->getIC()->Redisplay(myVoxels, false);
+    else
+           myViewer->getIC()->Display(myVoxels, false);
+    myViewer->getView()->FitAll();
+}
+
+void Application::displayCollisions()
+{
+    myViewer->getIC()->EraseAll(false, false);
+
+    // Make a big box with a lot of small spheres inside.
+    double x = 0.0, y = 0.0, z = 0.0, xlen = 100.0, ylen = 100.0, zlen = 100.0, r = 10.0;
+    gp_Pnt P1(x, y, z); // center point of moving sphere (S1).
+    TopoDS_Shape B   = BRepPrimAPI_MakeBox(gp_Pnt(x-r, y-r, z-r), gp_Pnt(xlen+r, ylen+r, zlen+r));
+    TopoDS_Shape S1  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       z),       gp::DZ()), r / 2.0);
+    TopoDS_Shape S2  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       z),       gp::DZ()), r);
+    TopoDS_Shape S3  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       z),       gp::DZ()), r);
+    TopoDS_Shape S4  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., z),       gp::DZ()), r);
+    TopoDS_Shape S5  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., z),       gp::DZ()), r);
+    TopoDS_Shape S6  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., z),       gp::DZ()), r);
+    TopoDS_Shape S7  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    z),       gp::DZ()), r);
+    TopoDS_Shape S8  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    z),       gp::DZ()), r);
+    TopoDS_Shape S9  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    z),       gp::DZ()), r);
+    TopoDS_Shape S10 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S11 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S12 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S13 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S14 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S15 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S16 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S17 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S18 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    zlen/2.), gp::DZ()), r);
+    TopoDS_Shape S19 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       zlen),    gp::DZ()), r);
+    TopoDS_Shape S20 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       zlen),    gp::DZ()), r);
+    TopoDS_Shape S21 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       zlen),    gp::DZ()), r);
+    TopoDS_Shape S22 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., zlen),    gp::DZ()), r);
+    TopoDS_Shape S23 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., zlen),    gp::DZ()), r);
+    TopoDS_Shape S24 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., zlen),    gp::DZ()), r);
+    TopoDS_Shape S25 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    zlen),    gp::DZ()), r);
+    TopoDS_Shape S26 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    zlen),    gp::DZ()), r);
+    TopoDS_Shape S27 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    zlen),    gp::DZ()), r);
+
+    // Planes of the big box
+    gp_Ax2 xminusPlane(gp_Pnt(x,    y,    z),    gp::DX());
+    gp_Ax2 xplusPlane (gp_Pnt(xlen, y,    z),    gp::DX());
+    gp_Ax2 yminusPlane(gp_Pnt(x,    y,    z),    gp::DY());
+    gp_Ax2 yplusPlane (gp_Pnt(x,    ylen, z),    gp::DY());
+    gp_Ax2 zminusPlane(gp_Pnt(x,    y,    z),    gp::DZ());
+    gp_Ax2 zplusPlane (gp_Pnt(x,    y,    zlen), gp::DZ());
+
+    // Nullify voxels
+    if (myColorVoxels)
+    {
+        delete myColorVoxels;
+        myColorVoxels = 0;
+    }
+    if (myBoolVoxels)
+    {
+        delete myBoolVoxels;
+        myBoolVoxels = 0;
+    }
+
+    // Prepare visualization
+    initPrs();
+    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
+    myVoxels->SetColor(Quantity_NOC_RED);
+    myVoxels->SetPointSize(4);
+    myVoxels->SetSmoothPoints(false);
+    myVoxels->SetUsageOfGLlists(false);
+       myVoxels->SetColorVoxels(myColorVoxels);
+
+    // Display all shapes
+    double transparency = 0.9;
+    Handle(AIS_Shape) aisB   = new AIS_Shape(B);
+    Handle(AIS_Shape) aisS1  = new AIS_Shape(S1);
+    Handle(AIS_Shape) aisS2  = new AIS_Shape(S2);
+    Handle(AIS_Shape) aisS3  = new AIS_Shape(S3);
+    Handle(AIS_Shape) aisS4  = new AIS_Shape(S4);
+    Handle(AIS_Shape) aisS5  = new AIS_Shape(S5);
+    Handle(AIS_Shape) aisS6  = new AIS_Shape(S6);
+    Handle(AIS_Shape) aisS7  = new AIS_Shape(S7);
+    Handle(AIS_Shape) aisS8  = new AIS_Shape(S8);
+    Handle(AIS_Shape) aisS9  = new AIS_Shape(S9);
+    Handle(AIS_Shape) aisS10 = new AIS_Shape(S10);
+    Handle(AIS_Shape) aisS11 = new AIS_Shape(S11);
+    Handle(AIS_Shape) aisS12 = new AIS_Shape(S12);
+    Handle(AIS_Shape) aisS13 = new AIS_Shape(S13);
+    Handle(AIS_Shape) aisS14 = new AIS_Shape(S14);
+    Handle(AIS_Shape) aisS15 = new AIS_Shape(S15);
+    Handle(AIS_Shape) aisS16 = new AIS_Shape(S16);
+    Handle(AIS_Shape) aisS17 = new AIS_Shape(S17);
+    Handle(AIS_Shape) aisS18 = new AIS_Shape(S18);
+    Handle(AIS_Shape) aisS19 = new AIS_Shape(S19);
+    Handle(AIS_Shape) aisS20 = new AIS_Shape(S20);
+    Handle(AIS_Shape) aisS21 = new AIS_Shape(S21);
+    Handle(AIS_Shape) aisS22 = new AIS_Shape(S22);
+    Handle(AIS_Shape) aisS23 = new AIS_Shape(S23);
+    Handle(AIS_Shape) aisS24 = new AIS_Shape(S24);
+    Handle(AIS_Shape) aisS25 = new AIS_Shape(S25);
+    Handle(AIS_Shape) aisS26 = new AIS_Shape(S26);
+    Handle(AIS_Shape) aisS27 = new AIS_Shape(S27);
+    aisS1-> SetDisplayMode(1);
+    aisS2-> SetDisplayMode(1);
+    aisS3-> SetDisplayMode(1);
+    aisS4-> SetDisplayMode(1);
+    aisS5-> SetDisplayMode(1);
+    aisS6-> SetDisplayMode(1);
+    aisS7-> SetDisplayMode(1);
+    aisS8-> SetDisplayMode(1);
+    aisS9-> SetDisplayMode(1);
+    aisS10->SetDisplayMode(1);
+    aisS11->SetDisplayMode(1);
+    aisS12->SetDisplayMode(1);
+    aisS13->SetDisplayMode(1);
+    aisS14->SetDisplayMode(1);
+    aisS15->SetDisplayMode(1);
+    aisS16->SetDisplayMode(1);
+    aisS17->SetDisplayMode(1);
+    aisS18->SetDisplayMode(1);
+    aisS19->SetDisplayMode(1);
+    aisS20->SetDisplayMode(1);
+    aisS21->SetDisplayMode(1);
+    aisS22->SetDisplayMode(1);
+    aisS23->SetDisplayMode(1);
+    aisS24->SetDisplayMode(1);
+    aisS25->SetDisplayMode(1);
+    aisS26->SetDisplayMode(1);
+    aisS27->SetDisplayMode(1);
+    aisB->  UnsetSelectionMode();
+    aisS1-> UnsetSelectionMode();
+    aisS2-> UnsetSelectionMode();
+    aisS3-> UnsetSelectionMode();
+    aisS4-> UnsetSelectionMode();
+    aisS5-> UnsetSelectionMode();
+    aisS6-> UnsetSelectionMode();
+    aisS7-> UnsetSelectionMode();
+    aisS8-> UnsetSelectionMode();
+    aisS9-> UnsetSelectionMode();
+    aisS10->UnsetSelectionMode();
+    aisS11->UnsetSelectionMode();
+    aisS12->UnsetSelectionMode();
+    aisS13->UnsetSelectionMode();
+    aisS14->UnsetSelectionMode();
+    aisS15->UnsetSelectionMode();
+    aisS16->UnsetSelectionMode();
+    aisS17->UnsetSelectionMode();
+    aisS18->UnsetSelectionMode();
+    aisS19->UnsetSelectionMode();
+    aisS20->UnsetSelectionMode();
+    aisS21->UnsetSelectionMode();
+    aisS22->UnsetSelectionMode();
+    aisS23->UnsetSelectionMode();
+    aisS24->UnsetSelectionMode();
+    aisS25->UnsetSelectionMode();
+    aisS26->UnsetSelectionMode();
+    aisS27->UnsetSelectionMode();
+    aisS1-> SetTransparency(2.0 * transparency / 3.0);
+    aisS2-> SetTransparency(transparency);
+    aisS3-> SetTransparency(transparency);
+    aisS4-> SetTransparency(transparency);
+    aisS5-> SetTransparency(transparency);
+    aisS6-> SetTransparency(transparency);
+    aisS7-> SetTransparency(transparency);
+    aisS8-> SetTransparency(transparency);
+    aisS9-> SetTransparency(transparency);
+    aisS10->SetTransparency(transparency);
+    aisS11->SetTransparency(transparency);
+    aisS12->SetTransparency(transparency);
+    aisS13->SetTransparency(transparency);
+    aisS14->SetTransparency(transparency);
+    aisS15->SetTransparency(transparency);
+    aisS16->SetTransparency(transparency);
+    aisS17->SetTransparency(transparency);
+    aisS18->SetTransparency(transparency);
+    aisS19->SetTransparency(transparency);
+    aisS20->SetTransparency(transparency);
+    aisS21->SetTransparency(transparency);
+    aisS22->SetTransparency(transparency);
+    aisS23->SetTransparency(transparency);
+    aisS24->SetTransparency(transparency);
+    aisS25->SetTransparency(transparency);
+    aisS26->SetTransparency(transparency);
+    aisS27->SetTransparency(transparency);
+    myViewer->getIC()->Display(aisB, false);
+    myViewer->getIC()->Display(aisS1, false);
+    myViewer->getIC()->Display(aisS2, false);
+    myViewer->getIC()->Display(aisS3, false);
+    myViewer->getIC()->Display(aisS4, false);
+    myViewer->getIC()->Display(aisS5, false);
+    myViewer->getIC()->Display(aisS6, false);
+    myViewer->getIC()->Display(aisS7, false);
+    myViewer->getIC()->Display(aisS8, false);
+    myViewer->getIC()->Display(aisS9, false);
+    myViewer->getIC()->Display(aisS10, false);
+    myViewer->getIC()->Display(aisS11, false);
+    myViewer->getIC()->Display(aisS12, false);
+    myViewer->getIC()->Display(aisS13, false);
+    myViewer->getIC()->Display(aisS14, false);
+    myViewer->getIC()->Display(aisS15, false);
+    myViewer->getIC()->Display(aisS16, false);
+    myViewer->getIC()->Display(aisS17, false);
+    myViewer->getIC()->Display(aisS18, false);
+    myViewer->getIC()->Display(aisS19, false);
+    myViewer->getIC()->Display(aisS20, false);
+    myViewer->getIC()->Display(aisS21, false);
+    myViewer->getIC()->Display(aisS22, false);
+    myViewer->getIC()->Display(aisS23, false);
+    myViewer->getIC()->Display(aisS24, false);
+    myViewer->getIC()->Display(aisS25, false);
+    myViewer->getIC()->Display(aisS26, false);
+    myViewer->getIC()->Display(aisS27, false);
+
+    // Prepare computer of collisions
+    double deflection = 0.1;
+    int nbx = 100, nby = 100, nbz = 100;
+    
+    Voxel_CollisionDetection coldet(deflection, nbx, nby, nbz);
+    coldet.SetUsageOfVolume(false);
+    coldet.KeepCollisions(false);
+    coldet.AddShape(S1);
+    coldet.AddShape(S2);
+    coldet.AddShape(S3);
+    coldet.AddShape(S4);
+    coldet.AddShape(S5);
+    coldet.AddShape(S6);
+    coldet.AddShape(S7);
+    coldet.AddShape(S8);
+    coldet.AddShape(S9);
+    coldet.AddShape(S10);
+    coldet.AddShape(S11);
+    coldet.AddShape(S12);
+    coldet.AddShape(S13);
+    coldet.AddShape(S14);
+    coldet.AddShape(S15);
+    coldet.AddShape(S16);
+    coldet.AddShape(S17);
+    coldet.AddShape(S18);
+    coldet.AddShape(S19);
+    coldet.AddShape(S20);
+    coldet.AddShape(S21);
+    coldet.AddShape(S22);
+    coldet.AddShape(S23);
+    coldet.AddShape(S24);
+    coldet.AddShape(S25);
+    coldet.AddShape(S26);
+    coldet.AddShape(S27);
+    //coldet.AddShape(BRepPrimAPI_MakeBox(gp_Pnt(x, y, z), gp_Pnt(xlen, ylen, zlen)));
+    
+    Bnd_Box box;
+    BRepBndLib::Add(B, box);
+    coldet.SetBoundaryBox(box);
+
+    coldet.Voxelize();
+
+    // Move one of the spheres inside the box
+    // and compute collisions
+    gp_Trsf trsf;
+    gp_Vec vmove(1, 0.5, 0.25);
+
+    int imove = 0, nb_moves = 900;
+    while (imove < nb_moves)
+    {
+        // Move
+        trsf.SetTranslation(vmove);
+        TopLoc_Location loc(trsf);
+        S1.Move(loc);
+        P1.Translate(vmove);
+        
+        // Check whether S1 is inside the big box
+        // Detect the plane S1 touches to.
+        if (P1.X() < x)
+            vmove.Mirror(xminusPlane);
+        else if (P1.X() > xlen)
+            vmove.Mirror(xplusPlane);
+        else if (P1.Y() < y)
+            vmove.Mirror(yminusPlane);
+        else if (P1.Y() > ylen)
+            vmove.Mirror(yplusPlane);
+        else if (P1.Z() < z)
+            vmove.Mirror(zminusPlane);
+        else if (P1.Z() > zlen)
+            vmove.Mirror(zplusPlane);
+
+        // Compute collisions
+        coldet.ReplaceShape(1, S1);
+        coldet.Voxelize(1); // only the first sphere (S1)
+        coldet.Compute();
+        myBoolVoxels = &((Voxel_BoolDS&) coldet.GetCollisions());
+
+        // Redisplay S1
+        aisS1->Set(S1);
+        myViewer->getIC()->Redisplay(aisS1, false);
+
+        // Display the collisions
+        myVoxels->SetBoolVoxels(myBoolVoxels);
+        if (myViewer->getIC()->IsDisplayed(myVoxels))
+            myViewer->getIC()->Redisplay(myVoxels, true);
+        else
+        {
+               myViewer->getIC()->Display(myVoxels, false);
+            myViewer->getView()->FitAll();
+        }
+
+        imove++;
+        qApp->processEvents();
+    }
+
+    // Copy the result of collision detection
+    int ix, iy, iz;
+    myBoolVoxels = new Voxel_BoolDS(coldet.GetCollisions().GetX(), 
+                                    coldet.GetCollisions().GetY(), 
+                                    coldet.GetCollisions().GetZ(), 
+                                    coldet.GetCollisions().GetXLen(), 
+                                    coldet.GetCollisions().GetYLen(), 
+                                    coldet.GetCollisions().GetZLen(), 
+                                    nbx, nby, nbz);
+    for (ix = 0; ix < nbx; ix++)
+    {
+        for (iy = 0; iy < nby; iy++)
+        {
+            for (iz = 0; iz < nbz; iz++)
+            {
+                if (coldet.GetCollisions().Get(ix, iy, iz))
+                    myBoolVoxels->Set(ix, iy, iz, Standard_True);
+            }
+        }
+    }
+    myVoxels->SetBoolVoxels(myBoolVoxels);
+}
\ No newline at end of file
diff --git a/samples/qt/VoxelDemo/src/ConversionThread.cpp b/samples/qt/VoxelDemo/src/ConversionThread.cpp
new file mode 100644 (file)
index 0000000..6fee824
--- /dev/null
@@ -0,0 +1,58 @@
+#include "ConversionThread.h"
+
+ConversionThread::ConversionThread():QThread(),
+/*myConverter(0),*/myFastConverter(0),
+myVolumicValue(0),myScanSide(1),
+myThreadIndex(1)
+{
+
+}
+
+ConversionThread::~ConversionThread()
+{
+
+}
+
+/*
+void ConversionThread::setConverter(Voxel_Converter* converter)
+{
+    myConverter = converter;
+    myFastConverter = 0;
+}
+*/
+
+void ConversionThread::setConverter(Voxel_FastConverter* converter)
+{
+    myFastConverter = converter;
+    //myConverter = 0;
+}
+
+void ConversionThread::setVolumicValue(const int value)
+{
+    myVolumicValue = value;
+}
+
+void ConversionThread::setScanSide(const int side)
+{
+    myScanSide = side;
+}
+
+void ConversionThread::setThreadIndex(const int ithread)
+{
+    myThreadIndex = ithread;
+}
+
+int* ConversionThread::getProgress()
+{
+    return &myProgress;
+}
+
+void ConversionThread::run()
+{
+    if (/*!myConverter && */!myFastConverter)
+        return;
+    //if (myConverter)
+    //    myConverter->Convert(myProgress, myVolumicValue, myScanSide, myThreadIndex);
+    //else
+        myFastConverter->Convert(myProgress, myThreadIndex);
+}
diff --git a/samples/qt/VoxelDemo/src/Main.cpp b/samples/qt/VoxelDemo/src/Main.cpp
new file mode 100644 (file)
index 0000000..e5f9175
--- /dev/null
@@ -0,0 +1,13 @@
+#include <qapplication.h>
+#include "application.h"
+
+int main( int argc, char ** argv ) 
+{
+    QApplication a( argc, argv );
+
+    Application *w = new Application();
+    w->setWindowTitle( "Voxel demo-application" );
+    w->show();
+    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
+    return a.exec();
+}
diff --git a/samples/qt/VoxelDemo/src/Timer.cpp b/samples/qt/VoxelDemo/src/Timer.cpp
new file mode 100644 (file)
index 0000000..d8a3f3e
--- /dev/null
@@ -0,0 +1,67 @@
+// Timer.cpp: implementation of the Timer class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#include "Timer.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+Timer::Timer():myWriter(0) {}
+
+Timer::Timer(const char* filename)
+{
+       myWriter = fopen(filename, "a");
+}
+
+Timer::~Timer()
+{
+       if (myWriter)
+               fclose(myWriter);
+}
+
+void Timer::Start() {
+       myTimer.Reset();
+       myTimer.Start();
+}
+
+void Timer::Stop() {
+       myTimer.Stop();
+}
+
+void Timer::Continue() {
+       myTimer.Start();
+}
+
+void Timer::Reset() {
+       myTimer.Reset();
+}
+
+float Timer::Seconds() {
+  Standard_Real sec, cpu;
+  Standard_Integer minutes, hours;
+  myTimer.Show(sec, minutes, hours, cpu);
+  return (float) sec;
+}
+
+int Timer::Minutes() {
+  Standard_Real sec, cpu;
+  Standard_Integer minutes, hours;
+  myTimer.Show(sec, minutes, hours, cpu);
+  return minutes;
+}
+
+void Timer::Print(char* label) {
+       Standard_Real seconds, cpu;
+       Standard_Integer minutes, hours;
+       myTimer.Show(seconds, minutes, hours, cpu);
+       if (myWriter)
+       {
+               fprintf(myWriter, "%s took %d minutes %g seconds\n", label, minutes, seconds);
+       }
+       else
+       {
+               cout<<label<<" took "<<minutes<<" minutes, "<<seconds<<" seconds"<<endl;
+       }
+}
\ No newline at end of file
diff --git a/samples/qt/VoxelDemo/src/Viewer.cpp b/samples/qt/VoxelDemo/src/Viewer.cpp
new file mode 100644 (file)
index 0000000..d0304bf
--- /dev/null
@@ -0,0 +1,207 @@
+#include "Viewer.h"
+#include "Timer.h"
+
+#include <QApplication.h>
+#include <QCursor.h>
+#include <QMessagebox.h>
+
+#include <QMouseEvent>
+
+#include <WNT_Window.hxx>
+#include <Graphic3d_WNTGraphicDevice.hxx>
+
+#include <Voxel_Prs.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+
+static Handle(Graphic3d_WNTGraphicDevice) device;
+
+Viewer::Viewer(QWidget* parent):QWidget(parent)
+{
+    if(device.IsNull())
+        device = new Graphic3d_WNTGraphicDevice();
+    
+               Handle(V3d_Viewer) aViewer = new V3d_Viewer(device, TCollection_ExtendedString("Visu3D").ToExtString(), "",
+                                                1000, V3d_XposYnegZpos,
+                                                Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
+                                                true, true, V3d_TEX_NONE);
+    aViewer->Init();
+
+       aViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
+
+    myView = aViewer->CreateView();
+    myIC = new AIS_InteractiveContext(aViewer);
+    myIC->SetDeviationCoefficient(1.e-3);
+
+    int       windowHandle = (int) winId();
+    short     hi, lo;
+
+    lo = (short) windowHandle;
+    hi = (short) (windowHandle >> 16);
+    Handle(WNT_Window) hWnd =
+        new WNT_Window(Handle(Graphic3d_WNTGraphicDevice)::DownCast(aViewer->Device()), (int) hi, (int) lo);
+
+    myView->SetWindow(hWnd);
+    if(!hWnd->IsMapped())
+        hWnd->Map();
+
+    myView->MustBeResized();
+    myView->SetSurfaceDetail(V3d_TEX_NONE);
+    myView->SetTransparency(Standard_True);
+    myView->SetSize(10000.0);
+    myView->SetZSize(10000.0);
+    myView->SetViewMappingDefault();
+
+    myZoom = false;
+    myPan = false;
+    myRotate = false;
+    setMouseTracking(true);
+
+    setMinimumSize(400, 200);
+    
+    myView->ZBufferTriedronSetup();
+    myView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_BLACK, 0.1, V3d_ZBUFFER);
+
+    mySelector.Init(myView);
+
+       setBackgroundRole( QPalette::NoRole );//NoBackground );
+       // set focus policy to threat QContextMenuEvent from keyboard  
+       setFocusPolicy( Qt::StrongFocus );
+       setAttribute( Qt::WA_PaintOnScreen );
+       setAttribute( Qt::WA_NoSystemBackground );
+}
+
+Viewer::~Viewer()
+{
+
+}
+
+void Viewer::paintEvent(QPaintEvent * pEvent)
+{
+    if (!myView.IsNull())
+        myView->Redraw();
+}
+
+
+/*!
+  Get paint engine for the OpenGL viewer. [ virtual public ]
+*/
+QPaintEngine* Viewer::paintEngine() const
+{
+  return 0;
+}
+
+void Viewer::resizeEvent(QResizeEvent * e)
+{
+    if (!myView.IsNull())
+    {
+        myView->MustBeResized();
+    }
+}
+
+void Viewer::mousePressEvent(QMouseEvent * mpEvent)
+{
+    // Memorize start point
+    myStartPnt.setX(mpEvent->x());
+    myStartPnt.setY(mpEvent->y());
+    
+    // Inform IC that the mouse cursor is at the point
+    myIC->MoveTo(myStartPnt.x(), myStartPnt.y(), myView);
+
+    // In case of rotation, define the start rotation point
+    if ((mpEvent->modifiers() & Qt::ControlModifier) && (mpEvent->buttons() & Qt::RightButton))
+    {
+        myView->StartRotation(myStartPnt.x(), myStartPnt.y());
+    }
+
+    // Start degenerate mode
+    setDegenerateMode(true);
+
+    emit mousePressed(mpEvent->modifiers(), mpEvent->x(), mpEvent->y());
+}
+
+void Viewer::mouseMoveEvent(QMouseEvent * mmEvent)
+{
+    QPoint currentPnt(mmEvent->x(), mmEvent->y());
+
+    if (mmEvent->modifiers() & Qt::ControlModifier)
+    {
+        if (mmEvent->buttons() & Qt::LeftButton)
+        {
+            myView->Zoom(myStartPnt.x(), myStartPnt.y(), currentPnt.x(), currentPnt.y());
+            myStartPnt = currentPnt;
+        }
+        else if (mmEvent->buttons() & Qt::MidButton)
+        {
+            myView->Pan(currentPnt.x() - myStartPnt.x(), myStartPnt.y() - currentPnt.y());
+            myStartPnt = currentPnt;
+        }
+        else if (mmEvent->buttons() & Qt::RightButton)
+        {
+            myView->Rotation(currentPnt.x(), currentPnt.y());
+        }
+    }
+    else
+    {
+        myIC->MoveTo(currentPnt.x(), currentPnt.y(), myView);
+    }
+
+    emit mouseMoved(mmEvent->modifiers(), currentPnt.x(), currentPnt.y());
+}
+
+void Viewer::mouseReleaseEvent(QMouseEvent * mrEvent)
+{
+    if(mrEvent->button() == Qt::LeftButton)
+    {
+        if(!myZoom && !myPan && !myRotate)
+        {
+            if(mrEvent->modifiers() & Qt::ShiftModifier)
+                myIC->ShiftSelect();
+            else
+                myIC->Select();
+
+            // Select a voxel
+            int ix = -1, iy = -1, iz = -1;
+            bool detected = mySelector.Detect(mrEvent->x(), mrEvent->y(), ix, iy, iz);
+            if (detected)
+            {
+                cout<<"("<<ix<<", "<<iy<<", "<<iz<<")"<<endl;
+            }
+            if (!myPrs.IsNull())
+                myPrs->Highlight(ix, iy, iz);
+        }
+    }
+    else if(mrEvent->button() == Qt::RightButton)
+    {
+        // Popup menu:
+
+    
+       }
+
+    // Finish degenerate mode
+    setDegenerateMode(false);
+    
+    emit mouseReleased(mrEvent->modifiers(), mrEvent->x(), mrEvent->y());
+}
+
+void Viewer::mouseDoubleClickEvent(QMouseEvent * mdcEvent)
+{
+    emit mouseDoubleClick(mdcEvent->modifiers(), mdcEvent->x(), mdcEvent->y());
+}
+
+void Viewer::setDegenerateMode(const bool on)
+{
+    AIS_ListOfInteractive displayed;
+    myIC->DisplayedObjects(displayed);
+    AIS_ListIteratorOfListOfInteractive itri(displayed);
+    for (; itri.More(); itri.Next())
+    {
+        if (itri.Value()->DynamicType() == STANDARD_TYPE(Voxel_Prs))
+        {
+            Handle(Voxel_Prs) prs = Handle(Voxel_Prs)::DownCast(itri.Value());
+            prs->SetDegenerateMode(on);
+            myView->Redraw();
+            break;
+        }
+    }
+}
diff --git a/samples/qt/VoxelDemo/src/VoxelClient_VisDrawer.cxx b/samples/qt/VoxelDemo/src/VoxelClient_VisDrawer.cxx
new file mode 100644 (file)
index 0000000..e75fbc7
--- /dev/null
@@ -0,0 +1,3373 @@
+// Copyright (c) 1999-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+#include "VoxelClient_VisDrawer.h"
+
+#include <ElSLib.hxx>
+#include <gp_Dir.hxx>
+#include <Geom_Plane.hxx>
+#include <gce_MakePln.hxx>
+#include <Quantity_Color.hxx>
+#include <Aspect_TypeOfLine.hxx>
+#include <Graphic3d_CUserDraw.hxx>
+
+#include <InterfaceGraphic_telem.hxx>
+#include <OpenGl_Element.hxx>
+#include <OpenGl_Callback.hxx>
+#include <OpenGl_NamedStatus.hxx>
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+
+/**************************************************************************/
+
+class VoxelClient_VisDrawer::VisElement : public OpenGl_Element
+{
+public:
+
+  VisElement (Voxel_VisData*);
+  virtual ~VisElement();
+
+  void EvaluateBounds (Graphic3d_CBounds& theMinMax);
+
+  void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
+
+private:
+
+  VoxelClient_VisDrawer* myHandler;
+
+public:
+
+  DEFINE_STANDARD_ALLOC
+
+};
+
+//=======================================================================
+//function : VisElement
+//purpose  : Constructor
+//=======================================================================
+
+VoxelClient_VisDrawer::VisElement::VisElement (Voxel_VisData* theData)
+{
+  myHandler = new VoxelClient_VisDrawer (theData);
+}
+
+//=======================================================================
+//function : ~VisElement
+//purpose  : Destructor
+//=======================================================================
+
+VoxelClient_VisDrawer::VisElement::~VisElement ()
+{
+  delete myHandler;
+}
+
+//=======================================================================
+//function : EvaluateBounds
+//purpose  :
+//=======================================================================
+
+void VoxelClient_VisDrawer::VisElement::EvaluateBounds
+  (Graphic3d_CBounds& theMinMax)
+{
+  myHandler->EvalMinMax (theMinMax);
+}
+
+//=======================================================================
+//function : Render
+//purpose  : display element
+//=======================================================================
+
+void VoxelClient_VisDrawer::VisElement::Render
+  (const Handle (OpenGl_Workspace) &theWorkspace) const
+{
+  const Standard_Boolean aHl = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT);
+  myHandler->Display (aHl);
+}
+
+//=======================================================================
+//function : VisDrawerCallBack
+//purpose  : visdrawer element create callback, adds an element to graphic
+//           driver's structure
+//=======================================================================
+
+static OpenGl_Element* VisDrawerCallBack (const Graphic3d_CUserDraw* theUserDraw)
+{
+  if (theUserDraw == 0)
+    return 0;
+
+  // Retrieve the user structure
+  Voxel_VisData* aUserData = (Voxel_VisData*) (theUserDraw->Data);
+
+  if (aUserData == 0)
+    return 0;
+
+  VoxelClient_VisDrawer::VisElement *aElem = 
+    new VoxelClient_VisDrawer::VisElement (aUserData);
+
+  if (theUserDraw->Bounds != 0)
+    aElem->EvaluateBounds (*(theUserDraw->Bounds));
+
+  return aElem;
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::Init()
+{
+    static Standard_Boolean isInitializeded(Standard_False);
+
+    if (!isInitializeded)
+    {
+        isInitializeded = Standard_True;
+
+        OpenGl_UserDrawCallback& aCallback = UserDrawCallback ();
+        aCallback = VisDrawerCallBack;
+    }
+}
+
+/**************************************************************************/
+VoxelClient_VisDrawer::VoxelClient_VisDrawer(Voxel_VisData * theData):myData(theData)
+{
+
+}
+
+/**************************************************************************/
+VoxelClient_VisDrawer::~VoxelClient_VisDrawer()
+{
+    if (myData)
+    {
+        // Because a pointer to the data is copied, 
+        // it is possible to make an attempt to delete GL lists for
+        // a structure, which is already deleted.
+        // Such a situation may happen on close of the application.
+        // Therefore, this try / catch is used.
+
+        try
+        {
+            Standard_Integer idir;
+
+            // Points
+
+            // BoolDS
+            if (myData->myDisplay.myBoolPointsList > 0)
+            {
+                glDeleteLists(myData->myDisplay.myBoolPointsList, 1);
+                myData->myDisplay.myBoolPointsList = -1;
+            }
+            for (idir = Xminus; idir <= Zplus; idir++)
+            {
+                if (myData->myDisplay.myBoolNearestPointsList[idir] > 0)
+                {
+                    glDeleteLists(myData->myDisplay.myBoolNearestPointsList[idir], 1);
+                    myData->myDisplay.myBoolNearestPointsList[idir] = -1;
+                }
+            }
+
+            // ColorDS
+            if (myData->myDisplay.myColorPointsList > 0)
+            {
+                glDeleteLists(myData->myDisplay.myColorPointsList, 1);
+                myData->myDisplay.myColorPointsList = -1;
+            }
+            for (idir = Xminus; idir <= Zplus; idir++)
+            {
+                if (myData->myDisplay.myColorNearestPointsList[idir] > 0)
+                {
+                    glDeleteLists(myData->myDisplay.myColorNearestPointsList[idir], 1);
+                    myData->myDisplay.myColorNearestPointsList[idir] = -1;
+                }
+            }
+
+            // ROctBoolDS
+            if (myData->myDisplay.myROctBoolPointsList > 0)
+            {
+                glDeleteLists(myData->myDisplay.myROctBoolPointsList, 1);
+                myData->myDisplay.myROctBoolPointsList = -1;
+            }
+            for (idir = Xminus; idir <= Zplus; idir++)
+            {
+                if (myData->myDisplay.myROctBoolNearestPointsList[idir] > 0)
+                {
+                    glDeleteLists(myData->myDisplay.myROctBoolNearestPointsList[idir], 1);
+                    myData->myDisplay.myROctBoolNearestPointsList[idir] = -1;
+                }
+            }
+
+            // Triangulation
+            if (myData->myDisplay.myTriangulationList > 0)
+            {
+                glDeleteLists(myData->myDisplay.myTriangulationList, 1);
+                myData->myDisplay.myTriangulationList = -1;
+            }
+        }
+        catch (...)
+        {
+
+        }
+    }
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::EvalMinMax(Graphic3d_CBounds & theMinMax) const 
+{
+    theMinMax.XMin = FLT_MAX;
+    theMinMax.YMin = FLT_MAX;
+    theMinMax.ZMin = FLT_MAX;
+    theMinMax.XMax = -FLT_MAX;
+    theMinMax.YMax = -FLT_MAX;
+    theMinMax.ZMax = -FLT_MAX;
+    if(!myData)
+        return;
+    if(myData->myBoolVoxels)
+    {
+        if (theMinMax.XMin > myData->myBoolVoxels->GetX())
+               theMinMax.XMin = myData->myBoolVoxels->GetX();
+        if (theMinMax.XMax < myData->myBoolVoxels->GetX() + myData->myBoolVoxels->GetXLen())
+               theMinMax.XMax = myData->myBoolVoxels->GetX() + myData->myBoolVoxels->GetXLen();
+        if (theMinMax.YMin > myData->myBoolVoxels->GetY())
+               theMinMax.YMin = myData->myBoolVoxels->GetY();
+        if (theMinMax.YMax < myData->myBoolVoxels->GetY() + myData->myBoolVoxels->GetYLen())
+               theMinMax.YMax = myData->myBoolVoxels->GetY() + myData->myBoolVoxels->GetYLen();
+        if (theMinMax.ZMin > myData->myBoolVoxels->GetZ())
+               theMinMax.ZMin = myData->myBoolVoxels->GetZ();
+        if (theMinMax.ZMax < myData->myBoolVoxels->GetZ() + myData->myBoolVoxels->GetZLen())
+               theMinMax.ZMax = myData->myBoolVoxels->GetZ() + myData->myBoolVoxels->GetZLen();
+    }
+    if(myData->myColorVoxels)
+    {
+        if (theMinMax.XMin > myData->myColorVoxels->GetX())
+               theMinMax.XMin = myData->myColorVoxels->GetX();
+        if (theMinMax.XMax < myData->myColorVoxels->GetX() + myData->myColorVoxels->GetXLen())
+               theMinMax.XMax = myData->myColorVoxels->GetX() + myData->myColorVoxels->GetXLen();
+        if (theMinMax.YMin > myData->myColorVoxels->GetY())
+               theMinMax.YMin = myData->myColorVoxels->GetY();
+        if (theMinMax.YMax < myData->myColorVoxels->GetY() + myData->myColorVoxels->GetYLen())
+               theMinMax.YMax = myData->myColorVoxels->GetY() + myData->myColorVoxels->GetYLen();
+        if (theMinMax.ZMin > myData->myColorVoxels->GetZ())
+               theMinMax.ZMin = myData->myColorVoxels->GetZ();
+        if (theMinMax.ZMax < myData->myColorVoxels->GetZ() + myData->myColorVoxels->GetZLen())
+               theMinMax.ZMax = myData->myColorVoxels->GetZ() + myData->myColorVoxels->GetZLen();
+    }
+    if(myData->myROctBoolVoxels)
+    {
+        if (theMinMax.XMin > myData->myROctBoolVoxels->GetX())
+               theMinMax.XMin = myData->myROctBoolVoxels->GetX();
+        if (theMinMax.XMax < myData->myROctBoolVoxels->GetX() + myData->myROctBoolVoxels->GetXLen())
+               theMinMax.XMax = myData->myROctBoolVoxels->GetX() + myData->myROctBoolVoxels->GetXLen();
+        if (theMinMax.YMin > myData->myROctBoolVoxels->GetY())
+               theMinMax.YMin = myData->myROctBoolVoxels->GetY();
+        if (theMinMax.YMax < myData->myROctBoolVoxels->GetY() + myData->myROctBoolVoxels->GetYLen())
+               theMinMax.YMax = myData->myROctBoolVoxels->GetY() + myData->myROctBoolVoxels->GetYLen();
+        if (theMinMax.ZMin > myData->myROctBoolVoxels->GetZ())
+               theMinMax.ZMin = myData->myROctBoolVoxels->GetZ();
+        if (theMinMax.ZMax < myData->myROctBoolVoxels->GetZ() + myData->myROctBoolVoxels->GetZLen())
+               theMinMax.ZMax = myData->myROctBoolVoxels->GetZ() + myData->myROctBoolVoxels->GetZLen();
+    }
+    if (!myData->myTriangulation.IsNull())
+    {
+        Standard_Real x, y, z;
+        const TColgp_Array1OfPnt& nodes = myData->myTriangulation->Nodes();
+        Standard_Integer inode = nodes.Lower(), nb_nodes = nodes.Upper();
+        for (; inode <= nb_nodes; inode++)
+        {
+            nodes.Value(inode).Coord(x, y, z);
+            if (theMinMax.XMin > x)
+                   theMinMax.XMin = x;
+            if (theMinMax.XMax < x)
+                   theMinMax.XMax = x;
+            if (theMinMax.YMin > y)
+                   theMinMax.YMin = y;
+            if (theMinMax.YMax < y)
+                   theMinMax.YMax = y;
+            if (theMinMax.ZMin > z)
+                   theMinMax.ZMin = z;
+            if (theMinMax.ZMax < z)
+                   theMinMax.ZMax = z;
+        }
+    }
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::Display(const Standard_Boolean theHighlight)
+{
+    if (!myData)
+        return;
+    if (myData->myBoolVoxels)
+        DisplayVoxels(theHighlight);
+    if (myData->myColorVoxels)
+        DisplayVoxels(theHighlight);
+    if (myData->myROctBoolVoxels)
+        DisplayVoxels(theHighlight);
+    if (!myData->myTriangulation.IsNull())
+        DisplayTriangulation(theHighlight);
+}
+
+// Some static method to define Open GL visual attributes
+// COlor
+static void setColor(const Quantity_Color& color, const Standard_Boolean highlight)
+{
+    static Quantity_Color highlight_color(Quantity_NOC_BLUE1);
+               if(highlight)
+        glColor3f(highlight_color.Red(), highlight_color.Green(), highlight_color.Blue());
+    else
+        glColor3d(color.Red(), color.Green(), color.Blue());
+}
+
+// Type of Line
+static void setTypeOfLine(const Aspect_TypeOfLine type)
+{
+    if(type == Aspect_TOL_SOLID)
+    {
+        glDisable(GL_LINE_STIPPLE);
+    }
+    else
+    {
+        glEnable(GL_LINE_STIPPLE);
+        if(type == Aspect_TOL_DOT)
+            glLineStipple(1, 0xCCCC);
+        else if(type == Aspect_TOL_DASH)
+            glLineStipple(1, 0xFFC0);
+        else if(type == Aspect_TOL_DOTDASH)
+            glLineStipple(1, 0xFF18);
+    }
+}
+
+// Width of Line
+static void setWidthOfLine(const Standard_Integer width)
+{
+    glLineWidth((Standard_ShortReal) width);
+}
+
+// Normal of the view
+static void getNormal(gp_Dir& normal) 
+{
+       Standard_Real x, y, z;
+       GLint viewport[4];
+       GLdouble model_matrix[16], proj_matrix[16];
+
+       glGetDoublev(GL_MODELVIEW_MATRIX,  model_matrix);
+       glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix);
+       glGetIntegerv(GL_VIEWPORT, viewport);
+
+       gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
+       gp_Pnt p1(x, y, z);
+       gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
+       gp_Pnt p2(x, y, z);
+       gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
+       gp_Pnt p3(x, y, z);
+
+       gce_MakePln mkNormal(p1, p2, p3);
+       if (mkNormal.IsDone()) 
+       {
+               const gp_Pln& normal_plane = mkNormal.Value();
+               normal = normal_plane.Axis().Direction();
+       }
+       else
+       {
+               normal = gp::DZ();
+       }
+}
+
+// Normal 2 VoxelDirection converter
+static VoxelDirection getVoxelDirection(const gp_Dir& viewnormal)
+{
+    VoxelDirection vdir;
+       Standard_Real fabsviewnormalx = fabs(viewnormal.X());
+       Standard_Real fabsviewnormaly = fabs(viewnormal.Y());
+       Standard_Real fabsviewnormalz = fabs(viewnormal.Z());
+       if (fabsviewnormalx >= fabsviewnormaly &&
+               fabsviewnormalx >= fabsviewnormalz)
+       {
+               if (viewnormal.X() > 0)
+                       vdir = Xminus;
+               else
+                       vdir = Xplus;
+       }
+       else if (fabsviewnormaly >= fabsviewnormalx &&
+                        fabsviewnormaly >= fabsviewnormalz)
+       {
+               if (viewnormal.Y() > 0)
+                       vdir = Yminus;
+               else
+                       vdir = Yplus;
+       }
+       else if (fabsviewnormalz >= fabsviewnormalx &&
+                        fabsviewnormalz >= fabsviewnormaly)
+       {
+               if (viewnormal.Z() > 0)
+                       vdir = Zminus;
+               else
+                       vdir = Zplus;
+       }
+    return vdir;
+}
+
+// Normal 2 VoxelDirection 3 converter
+static void getVoxel3Directions(const gp_Dir& viewnormal,
+                                VoxelDirection& vdir1,
+                                VoxelDirection& vdir2,
+                                VoxelDirection& vdir3)
+{
+    Standard_Boolean vdir1_set = Standard_False, vdir2_set = Standard_False, vdir3_set = Standard_False;
+
+    // Test X minus
+    Standard_Real dot = viewnormal.Dot(-gp::DX());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Xminus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Xminus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Xminus;
+            vdir3_set = Standard_True;
+        }
+    }
+
+    // Test X plus
+    dot = viewnormal.Dot(gp::DX());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Xplus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Xplus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Xplus;
+            vdir3_set = Standard_True;
+        }
+    }
+
+    // Test Y minus
+    dot = viewnormal.Dot(-gp::DY());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Yminus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Yminus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Yminus;
+            vdir3_set = Standard_True;
+        }
+    }
+
+    // Test Y plus
+    dot = viewnormal.Dot(gp::DY());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Yplus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Yplus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Yplus;
+            vdir3_set = Standard_True;
+        }
+    }
+
+    // Test Z minus
+    dot = viewnormal.Dot(-gp::DZ());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Zminus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Zminus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Zminus;
+            vdir3_set = Standard_True;
+        }
+    }
+
+    // Test Y plus
+    dot = viewnormal.Dot(gp::DZ());
+    if (dot >= 0.0)
+    {
+        if (!vdir1_set)
+        {
+            vdir1 = Zplus;
+            vdir1_set = Standard_True;
+        }
+        else if (!vdir2_set)
+        {
+            vdir2 = Zplus;
+            vdir2_set = Standard_True;
+        }
+        else if (!vdir3_set)
+        {
+            vdir3 = Zplus;
+            vdir3_set = Standard_True;
+        }
+    }
+}
+
+static Standard_Boolean CheckSize(Voxel_DS* voxels, 
+                      const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, 
+                      const Standard_Real xmin, const Standard_Real xmax,
+                      const Standard_Real ymin, const Standard_Real ymax,
+                      const Standard_Real zmin, const Standard_Real zmax,
+                      Standard_Real& xc, Standard_Real& yc, Standard_Real& zc)
+{
+    voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+    if (xc < xmin || xc > xmax)
+        return Standard_False;
+    if (yc < ymin || yc > ymax)
+        return Standard_False;
+    if (zc < zmin || zc > zmax)
+        return Standard_False;
+    return Standard_True;
+}
+
+static Standard_Boolean CheckSize(Voxel_ROctBoolDS* voxels, 
+                      const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, 
+                      const Standard_Integer i, const Standard_Integer j,
+                      const Standard_Real xmin, const Standard_Real xmax,
+                      const Standard_Real ymin, const Standard_Real ymax,
+                      const Standard_Real zmin, const Standard_Real zmax,
+                      Standard_Real& xc, Standard_Real& yc, Standard_Real& zc)
+{
+    if (j == -1)
+        voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+    else
+        voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+    if (xc < xmin || xc > xmax)
+        return Standard_False;
+    if (yc < ymin || yc > ymax)
+        return Standard_False;
+    if (zc < zmin || zc > zmax)
+        return Standard_False;
+    return Standard_True;
+}
+
+static void drawBoolPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
+                           Voxel_BoolDS* voxels,
+                           const Standard_Real xmin, const Standard_Real xmax,
+                           const Standard_Real ymin, const Standard_Real ymax,
+                           const Standard_Real zmin, const Standard_Real zmax)
+{
+       Standard_Real xc, yc, zc;
+       Standard_Integer ix = 0, nbx = voxels->GetNbX();
+       Standard_Integer iy = 0, nby = voxels->GetNbY();
+       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_POINTS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                           voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                               if (value)
+                                               {
+                            if (!check_size)
+                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                       glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                                               }
+                                       }
+                               }
+                       }
+                       break;
+               }
+       }
+    glEnd();
+}
+
+static void drawROctBoolPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
+                               Voxel_ROctBoolDS* voxels,
+                               const Standard_Real xmin, const Standard_Real xmax,
+                               const Standard_Real ymin, const Standard_Real ymax,
+                               const Standard_Real zmin, const Standard_Real zmax)
+{
+       Standard_Real xc, yc, zc;
+       Standard_Integer ix = 0, nbx = voxels->GetNbX();
+       Standard_Integer iy = 0, nby = voxels->GetNbY();
+       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
+    Standard_Integer i, j;
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_POINTS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        switch (voxels->Deepness(ix, iy, iz))
+                        {
+                            case 0:
+                            {
+                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                    continue;
+                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                                                       if (value)
+                                                       {
+                                    if (!check_size)
+                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                               glVertex3d(xc, yc, zc);
+                                    if (nearest)
+                                        break;
+                                                       }
+                                break;
+                            }
+                            case 1:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                                           if (value)
+                                                           {
+                                        if (!check_size)
+                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                                   glVertex3d(xc, yc, zc);
+                                        if (nearest)
+                                            break;
+                                                           }
+                                }
+                                break;
+                            }
+                            case 2:
+                            {
+                                for (i = 0; i < 8; i++)
+                                {
+                                    for (j = 0; j < 8; j++)
+                                    {
+                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                            continue;
+                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                                               if (value)
+                                                               {
+                                            if (!check_size)
+                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                                       glVertex3d(xc, yc, zc);
+                                            if (nearest)
+                                                break;
+                                                               }
+                                    }
+                                }
+                                break;
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+       }
+    glEnd();
+}
+
+
+
+static void drawColorPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
+                            Voxel_ColorDS* voxels, const Handle(Quantity_HArray1OfColor)& hcolors,
+                            const Standard_Byte minvalue, const Standard_Byte maxvalue,
+                            const Standard_Real xmin, const Standard_Real xmax,
+                            const Standard_Real ymin, const Standard_Real ymax,
+                            const Standard_Real zmin, const Standard_Real zmax)
+{
+       Standard_Real xc, yc, zc;
+       Standard_Integer ix = 0, nbx = voxels->GetNbX();
+       Standard_Integer iy = 0, nby = voxels->GetNbY();
+       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
+    Standard_Byte value;
+
+    // Colors
+    const Quantity_Array1OfColor& colors = hcolors->Array1();
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_POINTS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                           value = voxels->Get(ix, iy, iz);
+                           if (value >= minvalue && value <= maxvalue)
+                           {
+                            if (!check_size)
+                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            setColor(colors.Value(value), Standard_False);
+                                   glVertex3d(xc, yc, zc);
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+    }
+    glEnd();
+}
+
+static void drawBoolQuadrangles(Voxel_BoolDS* voxels, const VoxelDirection vdir, 
+                                const gp_Dir& viewnormal, const Standard_Boolean nearest,
+                                const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
+                                const Standard_Real xmin, const Standard_Real xmax,
+                                const Standard_Real ymin, const Standard_Real ymax,
+                                const Standard_Real zmin, const Standard_Real zmax)
+{
+    gp_Vec vc;
+    gp_Pnt pc1, pc2, pc3, pc4;
+    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 1.0;
+    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ();
+
+    // Normal
+    viewnormal.Coord(xn, yn, zn);
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_QUADS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                    }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
+                        if (value)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Display
+                            glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+    }
+    glEnd();
+}
+
+static void drawROctBoolQuadrangles(Voxel_ROctBoolDS* voxels, const VoxelDirection vdir, 
+                                    const gp_Dir& viewnormal, const Standard_Boolean nearest,
+                                    const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
+                                    const Standard_Real xmin, const Standard_Real xmax,
+                                    const Standard_Real ymin, const Standard_Real ymax,
+                                    const Standard_Real zmin, const Standard_Real zmax)
+{
+    gp_Vec vc;
+    gp_Pnt pc1, pc2, pc3, pc4;
+    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 1.0;
+    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ(), i, j, deepness;
+
+    // Normal
+    viewnormal.Coord(xn, yn, zn);
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_QUADS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                    }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        deepness = voxels->Deepness(ix, iy, iz);
+                        for (i = 0; i < 8; i++)
+                        {
+                            for (j = 0; j < 8; j++)
+                            {
+                                if (deepness == 0 && j)
+                                {
+                                    i = 8;
+                                    break;
+                                }
+                                if (deepness == 1 && j)
+                                    break;
+                                if (deepness == 0)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 1)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+                                else if (deepness == 2)
+                                {
+                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                                        continue;
+                                }
+
+                                Standard_Boolean value;
+                                switch (deepness)
+                                {
+                                    case 0:
+                                        value = voxels->Get(ix, iy, iz) == Standard_True;
+                                        break;
+                                    case 1:
+                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
+                                        break;
+                                    case 2:
+                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
+                                        break;
+                                }
+                                
+                                if (value)
+                                {
+                                    // Define translation vector
+                                    if (!check_size)
+                                    {
+                                        switch (deepness)
+                                        {
+                                            case 0:
+                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
+                                                break;
+                                            case 1:
+                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
+                                                break;
+                                            case 2:
+                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
+                                                break;
+                                        }
+                                    }
+                                    vc.SetCoord(xc, yc, zc);
+
+                                    // Translate
+                                    pc1 = p1.Translated(vc);
+                                    pc2 = p2.Translated(vc);
+                                    pc3 = p3.Translated(vc);
+                                    pc4 = p4.Translated(vc);
+
+                                    // Display
+                                    glNormal3d(xn, yn, zn);
+                                    pc1.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc2.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc3.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+                                    pc4.Coord(xc, yc, zc);
+                                    glVertex3d(xc, yc, zc);
+
+                                    if (nearest)
+                                        break;
+                                }
+                            }
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+    }
+    glEnd();
+}
+
+
+
+static void drawColorQuadrangles(Voxel_ColorDS* voxels, const VoxelDirection vdir, 
+                                 const gp_Dir& viewnormal, const Standard_Boolean nearest,
+                                 const Handle(Quantity_HArray1OfColor)& hcolors,
+                                 const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
+                                 const Standard_Byte minvalue, const Standard_Byte maxvalue,
+                                 const Standard_Real xmin, const Standard_Real xmax,
+                                 const Standard_Real ymin, const Standard_Real ymax,
+                                 const Standard_Real zmin, const Standard_Real zmax)
+{
+    gp_Vec vc;
+    gp_Pnt pc1, pc2, pc3, pc4;
+    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 0.0;
+    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ();
+    Standard_Byte value;
+
+    // Normal
+    //viewnormal.Coord(xn, yn, zn);
+    glNormal3d(xn, yn, zn);
+
+    // Colors
+    const Quantity_Array1OfColor& colors = hcolors->Array1();
+
+    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
+                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
+                       zmin <= DBL_MAX && zmax >= DBL_MAX);
+    check_size = !check_size;
+
+    glBegin(GL_QUADS);
+    switch (vdir)
+       {
+               case Xminus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = 0; ix < nbx; ix++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                    }
+                               }
+                       }
+                       break;
+               }
+               case Xplus:
+               {
+                       for (iy = 0; iy < nby; iy++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (ix = nbx - 1; ix >= 0; ix--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = 0; iy < nby; iy++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Yplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iz = 0; iz < nbz; iz++)
+                               {
+                                       for (iy = nby - 1; iy >= 0; iy--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zminus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = 0; iz < nbz; iz++)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+               case Zplus:
+               {
+                       for (ix = 0; ix < nbx; ix++)
+                       {
+                               for (iy = 0; iy < nby; iy++)
+                               {
+                                       for (iz = nbz - 1; iz >= 0; iz--)
+                                       {
+                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
+                            continue;
+                        value = voxels->Get(ix, iy, iz);
+                        if (value >= minvalue && value <= maxvalue)
+                        {
+                            // Define translation vector
+                            if (!check_size)
+                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
+                            vc.SetCoord(xc, yc, zc);
+
+                            // Translate
+                            pc1 = p1.Translated(vc);
+                            pc2 = p2.Translated(vc);
+                            pc3 = p3.Translated(vc);
+                            pc4 = p4.Translated(vc);
+
+                            // Color
+                            setColor(colors.Value(value), Standard_False);
+
+                            // Display
+                            //glNormal3d(xn, yn, zn);
+                            pc1.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc2.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc3.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+                            pc4.Coord(xc, yc, zc);
+                            glVertex3d(xc, yc, zc);
+
+                            if (nearest)
+                                break;
+                        }
+                                       }
+                               }
+                       }
+                       break;
+               }
+    }
+    glEnd();
+}
+
+static void genListIndex(GLint& index)
+{
+    GLint i = 0;
+    while (++i <= INT_MAX)
+    {
+        if (!glIsList(i))
+        {
+            index = i;
+            break;
+        }
+    }
+}
+
+static void setPlaneNormal(const VoxelDirection& dir, 
+                           const Standard_Real dx, const Standard_Real dy, const Standard_Real dz,
+                           gp_Pln& plane, gp_Pnt& p1, gp_Pnt& p2, gp_Pnt& p3, gp_Pnt& p4)
+{
+    gp_Ax3 axes = plane.Position();
+    Standard_Real dx2 = 0.5 * dx, dy2 = 0.5 * dy, dz2 = 0.5 * dz;
+    switch (dir)
+    {
+        case Xminus:
+            p1.SetCoord(-dx2, -dy2, dz2);
+            p2.SetCoord(-dx2, -dy2, -dz2);
+            p3.SetCoord(-dx2, dy2, -dz2);
+            p4.SetCoord(-dx2, dy2, dz2);
+            axes.SetDirection(-gp::DX());
+            break;
+        case Xplus:
+            p1.SetCoord(dx2, -dy2, dz2);
+            p2.SetCoord(dx2, -dy2, -dz2);
+            p3.SetCoord(dx2, dy2, -dz2);
+            p4.SetCoord(dx2, dy2, dz2);
+            axes.SetDirection(gp::DX());
+            break;
+        case Yminus:
+            p1.SetCoord(dx2, -dy2, dz2);
+            p2.SetCoord(dx2, -dy2, -dz2);
+            p3.SetCoord(-dx2, -dy2, -dz2);
+            p4.SetCoord(-dx2, -dy2, dz2);
+            axes.SetDirection(-gp::DY());
+            break;
+        case Yplus:
+            p1.SetCoord(dx2, dy2, dz2);
+            p2.SetCoord(dx2, dy2, -dz2);
+            p3.SetCoord(-dx2, dy2, -dz2);
+            p4.SetCoord(-dx2, dy2, dz2);
+            axes.SetDirection(gp::DY());
+            break;
+        case Zminus:
+            p1.SetCoord(dx2, dy2, -dz2);
+            p2.SetCoord(-dx2, dy2, -dz2);
+            p3.SetCoord(-dx2, -dy2, -dz2);
+            p4.SetCoord(dx2, -dy2, -dz2);
+            axes.SetDirection(-gp::DZ());
+            break;
+        case Zplus:
+            p1.SetCoord(dx2, dy2, dz2);
+            p2.SetCoord(-dx2, dy2, dz2);
+            p3.SetCoord(-dx2, -dy2, dz2);
+            p4.SetCoord(dx2, -dy2, dz2);
+            axes.SetDirection(gp::DZ());
+            break;
+    }
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::DisplayVoxels(const Standard_Boolean theHighlight)
+{
+    if(!myData)
+        return;
+
+    glEnable(GL_DEPTH_TEST);
+
+       // Boolean voxels
+       if (myData->myBoolVoxels)
+    {
+               // Points
+               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
+            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
+               {
+                       glDisable(GL_LIGHTING);
+            if (myData->myDisplay.mySmoothPoints)
+                           glEnable(GL_POINT_SMOOTH);
+            else
+                glDisable(GL_POINT_SMOOTH);
+
+                       // Draw the points of voxels (center points of the voxels)
+                       // starting visualization from the side looking out from the user.
+                       setColor(myData->myDisplay.myColor, theHighlight);
+                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
+
+            // Display
+            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
+        }
+       }
+
+    // Color values
+       if (myData->myColorVoxels)
+    {
+               // Points
+               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
+            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
+               {
+                       glDisable(GL_LIGHTING);
+            if (myData->myDisplay.mySmoothPoints)
+                           glEnable(GL_POINT_SMOOTH);
+            else
+                glDisable(GL_POINT_SMOOTH);
+
+                       // Draw the points of voxels (center points of the voxels)
+                       // starting visualization from the side looking out from the user.
+                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
+
+            // Display
+            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
+        }
+       }
+
+       // Recursive Octree Boolean voxels
+       if (myData->myROctBoolVoxels)
+    {
+               // Points
+               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
+            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
+               {
+                       glDisable(GL_LIGHTING);
+            if (myData->myDisplay.mySmoothPoints)
+                           glEnable(GL_POINT_SMOOTH);
+            else
+                glDisable(GL_POINT_SMOOTH);
+
+                       // Draw the points of voxels (center points of the voxels)
+                       // starting visualization from the side looking out from the user.
+                       setColor(myData->myDisplay.myColor, theHighlight);
+                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
+
+            // Display
+            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
+        }
+       }
+
+    // Shading drawn by boxes
+    if (myData->myDisplay.myDisplayMode == Voxel_VDM_BOXES || 
+        myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTBOXES)
+    {
+               glEnable(GL_LIGHTING);
+        glEnable(GL_COLOR_MATERIAL);
+
+               // Draw quadrangles of voxels looking to the user.
+               setColor(myData->myDisplay.myColor, theHighlight);
+
+        // Display
+        DisplayBoxes(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTBOXES);
+
+        glDisable(GL_COLOR_MATERIAL);
+    }
+
+    // Highlighted voxel
+    HighlightVoxel();
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::DisplayPoints(const Standard_Boolean nearest)
+{
+    //OSD_Timer timer;
+    //timer.Start();
+
+    // Find the side of the cube which normal looks to (or out) the user's eye.
+       gp_Dir viewnormal;
+       getNormal(viewnormal);
+
+    // Range of displayed data
+    Standard_Real xmin = myData->myDisplay.myDisplayedXMin;
+    Standard_Real xmax = myData->myDisplay.myDisplayedXMax;
+    Standard_Real ymin = myData->myDisplay.myDisplayedYMin;
+    Standard_Real ymax = myData->myDisplay.myDisplayedYMax;
+    Standard_Real zmin = myData->myDisplay.myDisplayedZMin;
+    Standard_Real zmax = myData->myDisplay.myDisplayedZMax;
+
+    // Boolean points
+       if (myData->myBoolVoxels)
+    {
+        if (nearest || myData->myDisplay.myDegenerateMode)
+        {
+               VoxelDirection vdir1, vdir2, vdir3;
+            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
+
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                // Clean all allocated GL lists for the case of first call.
+                if (myData->myDisplay.myBoolNearestPointsFirst)
+                {
+                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
+                    {
+                        if (myData->myDisplay.myBoolNearestPointsList[idir] > 0)
+                        {
+                            glDeleteLists(myData->myDisplay.myBoolNearestPointsList[idir], 1);
+                            myData->myDisplay.myBoolNearestPointsList[idir] = -1;
+                        }
+                    }
+                    myData->myDisplay.myBoolNearestPointsFirst = Standard_False;
+                }
+
+                // Generate GL lists if needed.
+                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1] < 0)
+                {
+                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1]);
+                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
+                    drawBoolPoints(vdir1, Standard_True, myData->myBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2] < 0)
+                {
+                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2]);
+                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
+                    drawBoolPoints(vdir2, Standard_True, myData->myBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3] < 0)
+                {
+                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3]);
+                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
+                    drawBoolPoints(vdir3, Standard_True, myData->myBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1]);
+                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2]);
+                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3]);
+            }
+            else
+            {
+                drawBoolPoints(vdir1, Standard_True, myData->myBoolVoxels,
+                               xmin, xmax, ymin, ymax, zmin, zmax);
+                drawBoolPoints(vdir2, Standard_True, myData->myBoolVoxels,
+                               xmin, xmax, ymin, ymax, zmin, zmax);
+                drawBoolPoints(vdir3, Standard_True, myData->myBoolVoxels,
+                               xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+        else
+        {
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                if (myData->myDisplay.myBoolPointsFirst)
+                {
+                    // Delete previous GL list.
+                    if (myData->myDisplay.myBoolPointsList > 0)
+                    {
+                        glDeleteLists(myData->myDisplay.myBoolPointsList, 1);
+                        myData->myDisplay.myBoolPointsList = -1;
+                    }
+
+                    // Generate a new GL list
+                    genListIndex(myData->myDisplay.myBoolPointsList);
+                    glNewList(myData->myDisplay.myBoolPointsList, GL_COMPILE);
+                    VoxelDirection vdir = getVoxelDirection(viewnormal);
+                    drawBoolPoints(vdir, Standard_False, myData->myBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+
+                    // The first call has just been passed...
+                    myData->myDisplay.myBoolPointsFirst = Standard_False;
+                }
+                glCallList(myData->myDisplay.myBoolPointsList);
+            }
+            else
+            {
+                VoxelDirection vdir = getVoxelDirection(viewnormal);
+                drawBoolPoints(vdir, Standard_False, myData->myBoolVoxels,
+                               xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+       }
+
+    // Color points
+       if (myData->myColorVoxels)
+    {
+        if (nearest || myData->myDisplay.myDegenerateMode)
+        {
+               VoxelDirection vdir1, vdir2, vdir3;
+            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
+
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                // Clean all allocated GL lists for the case of first call.
+                if (myData->myDisplay.myColorNearestPointsFirst)
+                {
+                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
+                    {
+                        if (myData->myDisplay.myColorNearestPointsList[idir] > 0)
+                        {
+                            glDeleteLists(myData->myDisplay.myColorNearestPointsList[idir], 1);
+                            myData->myDisplay.myColorNearestPointsList[idir] = -1;
+                        }
+                    }
+                    myData->myDisplay.myColorNearestPointsFirst = Standard_False;
+                }
+
+                // Generate GL lists if needed.
+                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1] < 0)
+                {
+                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1]);
+                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
+                    drawColorPoints(vdir1, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                    xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2] < 0)
+                {
+                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2]);
+                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
+                    drawColorPoints(vdir2, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                    xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3] < 0)
+                {
+                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3]);
+                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
+                    drawColorPoints(vdir3, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                    xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+            
+                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1]);
+                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2]);
+                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3]);
+            }
+            else
+            {
+                drawColorPoints(vdir1, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+                drawColorPoints(vdir2, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+                drawColorPoints(vdir3, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
+                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+        else
+        {
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                if (myData->myDisplay.myColorPointsFirst)
+                {
+                    // Delete previous GL list.
+                    if (myData->myDisplay.myColorPointsList > 0)
+                    {
+                        glDeleteLists(myData->myDisplay.myColorPointsList, 1);
+                        myData->myDisplay.myColorPointsList = -1;
+                    }
+
+                    // Generate a new GL list
+                    genListIndex(myData->myDisplay.myColorPointsList);
+                    glNewList(myData->myDisplay.myColorPointsList, GL_COMPILE);
+                    VoxelDirection vdir = getVoxelDirection(viewnormal);
+                    drawColorPoints(vdir, Standard_False, myData->myColorVoxels, myData->myDisplay.myColors,
+                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                    xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+
+                    // The first call has just been passed...
+                    myData->myDisplay.myColorPointsFirst = Standard_False;
+                }
+                glCallList(myData->myDisplay.myColorPointsList);
+            }
+            else
+            {
+                VoxelDirection vdir = getVoxelDirection(viewnormal);
+                drawColorPoints(vdir, Standard_False, myData->myColorVoxels, myData->myDisplay.myColors,
+                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+       }
+
+    // Recursive Octree Boolean points
+       if (myData->myROctBoolVoxels)
+    {
+        if (nearest || myData->myDisplay.myDegenerateMode)
+        {
+               VoxelDirection vdir1, vdir2, vdir3;
+            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
+
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                // Clean all allocated GL lists for the case of first call.
+                if (myData->myDisplay.myROctBoolNearestPointsFirst)
+                {
+                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
+                    {
+                        if (myData->myDisplay.myROctBoolNearestPointsList[idir] > 0)
+                        {
+                            glDeleteLists(myData->myDisplay.myROctBoolNearestPointsList[idir], 1);
+                            myData->myDisplay.myROctBoolNearestPointsList[idir] = -1;
+                        }
+                    }
+                    myData->myDisplay.myROctBoolNearestPointsFirst = Standard_False;
+                }
+
+                // Generate GL lists if needed.
+                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1] < 0)
+                {
+                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1]);
+                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
+                    drawROctBoolPoints(vdir1, Standard_True, myData->myROctBoolVoxels,
+                                       xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2] < 0)
+                {
+                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2]);
+                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
+                    drawROctBoolPoints(vdir2, Standard_True, myData->myROctBoolVoxels,
+                                       xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3] < 0)
+                {
+                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3]);
+                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
+                    drawROctBoolPoints(vdir3, Standard_True, myData->myROctBoolVoxels,
+                                       xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+                }
+                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1]);
+                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2]);
+                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3]);
+            }
+            else
+            {
+                drawROctBoolPoints(vdir1, Standard_True, myData->myROctBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                drawROctBoolPoints(vdir2, Standard_True, myData->myROctBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+                drawROctBoolPoints(vdir3, Standard_True, myData->myROctBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+        else
+        {
+            if (myData->myDisplay.myUsageOfGLlists)
+            {
+                if (myData->myDisplay.myROctBoolPointsFirst)
+                {
+                    // Delete previous GL list.
+                    if (myData->myDisplay.myROctBoolPointsList > 0)
+                    {
+                        glDeleteLists(myData->myDisplay.myROctBoolPointsList, 1);
+                        myData->myDisplay.myROctBoolPointsList = -1;
+                    }
+
+                    // Generate a new GL list
+                    genListIndex(myData->myDisplay.myROctBoolPointsList);
+                    glNewList(myData->myDisplay.myROctBoolPointsList, GL_COMPILE);
+                    VoxelDirection vdir = getVoxelDirection(viewnormal);
+                    drawROctBoolPoints(vdir, Standard_False, myData->myROctBoolVoxels,
+                                       xmin, xmax, ymin, ymax, zmin, zmax);
+                    glEndList();
+
+                    // The first call has just been passed...
+                    myData->myDisplay.myROctBoolPointsFirst = Standard_False;
+                }
+                glCallList(myData->myDisplay.myROctBoolPointsList);
+            }
+            else
+            {
+                VoxelDirection vdir = getVoxelDirection(viewnormal);
+                drawROctBoolPoints(vdir, Standard_False, myData->myROctBoolVoxels,
+                                   xmin, xmax, ymin, ymax, zmin, zmax);
+            }
+        }
+       }
+
+    //timer.Stop();
+       //Standard_Real seconds, cpu;
+       //Standard_Integer minutes, hours;
+       //timer.Show(seconds, minutes, hours, cpu);
+    //cout<<"DisplayPoints()"<<" took "<<minutes<<" minutes, "<<seconds<<" seconds"<<endl;
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::DisplayBoxes(const Standard_Boolean nearest)
+{
+    // Range of displayed data
+    Standard_Real xmin = myData->myDisplay.myDisplayedXMin;
+    Standard_Real xmax = myData->myDisplay.myDisplayedXMax;
+    Standard_Real ymin = myData->myDisplay.myDisplayedYMin;
+    Standard_Real ymax = myData->myDisplay.myDisplayedYMax;
+    Standard_Real zmin = myData->myDisplay.myDisplayedZMin;
+    Standard_Real zmax = myData->myDisplay.myDisplayedZMax;
+
+    // Find the side of the cube which normal looks to (or out) the user's eye.
+       gp_Dir viewnormal;
+       getNormal(viewnormal);
+
+    // Get three sides of the box looking to the user.
+       VoxelDirection vdir1, vdir2, vdir3;
+    getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
+
+    // Three quadrangles with normals looking to the user
+    gp_Pln plane1(gp::Origin(), viewnormal);
+    gp_Pln plane2(plane1), plane3(plane1);
+
+    // Boolean boxes
+       if (myData->myBoolVoxels &&
+        myData->myBoolVoxels->GetNbX() &&
+        myData->myBoolVoxels->GetNbY() &&
+        myData->myBoolVoxels->GetNbZ())
+    {
+        // Compute size
+        Standard_Real dx = myData->myBoolVoxels->GetXLen() / (Standard_Real) myData->myBoolVoxels->GetNbX();
+        Standard_Real dy = myData->myBoolVoxels->GetYLen() / (Standard_Real) myData->myBoolVoxels->GetNbY();
+        Standard_Real dz = myData->myBoolVoxels->GetZLen() / (Standard_Real) myData->myBoolVoxels->GetNbZ();
+        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
+        dx *= d;
+        dy *= d;
+        dz *= d;
+
+        // Translatethe quadrangles to the side of the voxel
+        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
+        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
+        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
+        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
+
+        // Display
+        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
+        drawBoolQuadrangles(myData->myBoolVoxels, vdir1, plane1.Axis().Direction(), 
+                            skin, p11, p12, p13, p14,
+                            xmin, xmax, ymin, ymax, zmin, zmax);
+        drawBoolQuadrangles(myData->myBoolVoxels, vdir2, plane2.Axis().Direction(), 
+                            skin, p21, p22, p23, p24,
+                            xmin, xmax, ymin, ymax, zmin, zmax);
+        drawBoolQuadrangles(myData->myBoolVoxels, vdir3, plane3.Axis().Direction(), 
+                            skin, p31, p32, p33, p34,
+                            xmin, xmax, ymin, ymax, zmin, zmax);
+    }
+    // Color quadrangles
+       else if (myData->myColorVoxels &&
+             myData->myColorVoxels->GetNbX() &&
+             myData->myColorVoxels->GetNbY() &&
+             myData->myColorVoxels->GetNbZ())
+    {
+        // Compute size
+        Standard_Real dx = myData->myColorVoxels->GetXLen() / (Standard_Real) myData->myColorVoxels->GetNbX();
+        Standard_Real dy = myData->myColorVoxels->GetYLen() / (Standard_Real) myData->myColorVoxels->GetNbY();
+        Standard_Real dz = myData->myColorVoxels->GetZLen() / (Standard_Real) myData->myColorVoxels->GetNbZ();
+        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
+        dx *= d;
+        dy *= d;
+        dz *= d;
+
+        // Translatethe quadrangles to the side of the voxel
+        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
+        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
+        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
+        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
+
+        // Display
+        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
+        drawColorQuadrangles(myData->myColorVoxels, vdir1, plane1.Axis().Direction(), skin, 
+                             myData->myDisplay.myColors, p11, p12, p13, p14,
+                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                             xmin, xmax, ymin, ymax, zmin, zmax);
+        drawColorQuadrangles(myData->myColorVoxels, vdir2, plane2.Axis().Direction(), skin, 
+                             myData->myDisplay.myColors, p21, p22, p23, p24,
+                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                             xmin, xmax, ymin, ymax, zmin, zmax);
+        drawColorQuadrangles(myData->myColorVoxels, vdir3, plane3.Axis().Direction(), skin, 
+                             myData->myDisplay.myColors, p31, p32, p33, p34,
+                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
+                             xmin, xmax, ymin, ymax, zmin, zmax);
+    }
+    // Recursive Octree Boolean boxes
+       else if (myData->myROctBoolVoxels &&
+             myData->myROctBoolVoxels->GetNbX() &&
+             myData->myROctBoolVoxels->GetNbY() &&
+             myData->myROctBoolVoxels->GetNbZ())
+    {
+        // Compute size
+        Standard_Real dx = myData->myROctBoolVoxels->GetXLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbX();
+        Standard_Real dy = myData->myROctBoolVoxels->GetYLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbY();
+        Standard_Real dz = myData->myROctBoolVoxels->GetZLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbZ();
+        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
+        dx *= d;
+        dy *= d;
+        dz *= d;
+
+        // Translatethe quadrangles to the side of the voxel
+        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
+        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
+        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
+        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
+
+        // Display
+        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
+        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir1, plane1.Axis().Direction(), 
+                                skin, p11, p12, p13, p14,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir2, plane2.Axis().Direction(), 
+                                skin, p21, p22, p23, p24,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir3, plane3.Axis().Direction(), 
+                                skin, p31, p32, p33, p34,
+                                xmin, xmax, ymin, ymax, zmin, zmax);
+    }
+}
+
+/**************************************************************************/
+void VoxelClient_VisDrawer::DisplayTriangulation(const Standard_Boolean theHighlight)
+{
+    if(!myData || myData->myTriangulation.IsNull())
+        return;
+
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_LIGHTING);
+
+    const TColgp_Array1OfPnt& nodes = myData->myTriangulation->Nodes();
+    const Poly_Array1OfTriangle& triangles = myData->myTriangulation->Triangles();
+    Standard_Integer itriangle = triangles.Lower(), nb_triangles = triangles.Upper();
+
+    Standard_Boolean compute_normals = Standard_False;
+    if (myData->myNormalsOfNodes.IsNull())
+    {
+        compute_normals = Standard_True;
+        myData->myNormalsOfNodes = new TColgp_HArray1OfDir(itriangle, nb_triangles);
+
+        // Release the GL list
+        if (myData->myDisplay.myTriangulationList > 0)
+        {
+            glDeleteLists(myData->myDisplay.myTriangulationList, 1);
+            myData->myDisplay.myTriangulationList = -1;
+        }
+
+        // Generate a new GL list
+        if (myData->myDisplay.myUsageOfGLlists)
+        {
+            genListIndex(myData->myDisplay.myTriangulationList);
+            glNewList(myData->myDisplay.myTriangulationList, GL_COMPILE);
+        }
+    }
+    TColgp_Array1OfDir& normals = myData->myNormalsOfNodes->ChangeArray1();
+
+    if (!myData->myDisplay.myUsageOfGLlists || compute_normals)
+    {
+
+        glBegin(GL_TRIANGLES);
+
+        Standard_Integer n1, n2, n3;
+        Standard_Real x, y, z;
+        for (; itriangle <= nb_triangles; itriangle++)
+        {
+            const Poly_Triangle& t = triangles.Value(itriangle);
+            t.Get(n1, n2, n3);
+
+            const gp_Pnt& p1 = nodes.Value(n1);
+            const gp_Pnt& p2 = nodes.Value(n2);
+            const gp_Pnt& p3 = nodes.Value(n3);
+
+            // Make the normal:
+            if (compute_normals)
+            {
+                gp_Vec v1(p1, p2), v2(p1, p3);
+                v1.Cross(v2);
+                if (v1.SquareMagnitude() > 1.e-14)
+                    v1.Normalize();
+                else
+                    v1.SetCoord(0.0, 0.0, 1.0);
+                normals.SetValue(itriangle, v1);
+                v1.Coord(x, y, z);
+            }
+            else
+            {
+                normals.Value(itriangle).Coord(x, y, z);
+            }
+            glNormal3d(x, y, z);
+
+            // P1
+            p1.Coord(x, y, z);
+            glVertex3d(x, y, z);
+
+            // P2
+            p2.Coord(x, y, z);
+            glVertex3d(x, y, z);
+
+            // P3
+            p3.Coord(x, y, z);
+            glVertex3d(x, y, z);
+        }
+
+        glEnd();
+
+        if (myData->myDisplay.myUsageOfGLlists)
+            glEndList();
+    }
+
+    if (myData->myDisplay.myUsageOfGLlists)
+        glCallList(myData->myDisplay.myTriangulationList);
+}
+
+void VoxelClient_VisDrawer::HighlightVoxel()
+{
+    if (myData &&
+        myData->myDisplay.myHighlightx >= 0 &&
+        myData->myDisplay.myHighlighty >= 0 &&
+        myData->myDisplay.myHighlightz >= 0)
+    {
+        Standard_Integer nbx, nby, nbz;
+        Standard_Real xlen, ylen, zlen, xc, yc, zc;
+        Voxel_DS* ds = (Voxel_DS*) myData->myBoolVoxels;
+        if (myData->myColorVoxels)
+            ds = (Voxel_DS*) myData->myColorVoxels;
+        if (myData->myROctBoolVoxels)
+            ds = (Voxel_DS*) myData->myROctBoolVoxels;
+        nbx = ds->GetNbX();
+        nby = ds->GetNbY();
+        nbz = ds->GetNbZ();
+        xlen = ds->GetXLen();
+        ylen = ds->GetYLen();
+        zlen = ds->GetZLen();
+        ds->GetCenter(myData->myDisplay.myHighlightx, 
+                      myData->myDisplay.myHighlighty, 
+                      myData->myDisplay.myHighlightz, 
+                      xc, yc, zc);
+
+        Standard_Real half_voxelx = xlen / Standard_Real(nbx) / 2.0;
+        Standard_Real half_voxely = ylen / Standard_Real(nby) / 2.0;
+        Standard_Real half_voxelz = zlen / Standard_Real(nbz) / 2.0;
+        Standard_Real x1 = xc - half_voxelx, y1 = yc - half_voxely, z1 = zc - half_voxelz;
+        Standard_Real x2 = xc + half_voxelx, y2 = yc + half_voxely, z2 = zc + half_voxelz;
+
+        setColor(Quantity_NOC_BLUE1, Standard_True);
+        setTypeOfLine(Aspect_TOL_SOLID);
+        setWidthOfLine(3);
+
+        glBegin(GL_LINES);
+
+        glVertex3d(x1, y1, z1);
+        glVertex3d(x1, y2, z1);
+
+        glVertex3d(x1, y1, z1);
+        glVertex3d(x2, y1, z1);
+
+        glVertex3d(x1, y1, z1);
+        glVertex3d(x1, y1, z2);
+
+        glVertex3d(x1, y2, z1);
+        glVertex3d(x2, y2, z1);
+
+        glVertex3d(x2, y1, z1);
+        glVertex3d(x2, y2, z1);
+
+        glVertex3d(x2, y2, z1);
+        glVertex3d(x2, y2, z2);
+
+        glVertex3d(x1, y1, z2);
+        glVertex3d(x1, y2, z2);
+
+        glVertex3d(x1, y1, z2);
+        glVertex3d(x2, y1, z2);
+
+        glVertex3d(x2, y1, z2);
+        glVertex3d(x2, y2, z2);
+
+        glVertex3d(x2, y2, z2);
+        glVertex3d(x1, y2, z2);
+
+        glVertex3d(x1, y2, z2);
+        glVertex3d(x1, y2, z1);
+
+        glVertex3d(x2, y1, z1);
+        glVertex3d(x2, y1, z2);
+
+        glEnd();
+    }
+}
diff --git a/samples/qt/voxeldemo/OpenGl/OpenGl.vcproj b/samples/qt/voxeldemo/OpenGl/OpenGl.vcproj
deleted file mode 100755 (executable)
index 7bda01b..0000000
+++ /dev/null
@@ -1,643 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="9,00"
-       Name="OpenGl"
-       ProjectGUID="{CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}"
-       RootNamespace="OpenGl"
-       TargetFrameworkVersion="131072"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory=".\Debug"
-                       IntermediateDirectory=".\Debug"
-                       ConfigurationType="2"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               PreprocessorDefinitions="_DEBUG"
-                               MkTypLibCompatible="true"
-                               SuppressStartupBanner="true"
-                               TargetEnvironment="1"
-                               TypeLibraryName=".\Debug/OpenGl.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories="$(CSF_OPT_INC)"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPENGL_EXPORTS;WNT"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="1"
-                               PrecompiledHeaderFile=".\Debug/OpenGl.pch"
-                               AssemblerListingLocation=".\Debug/"
-                               ObjectFile=".\Debug/"
-                               ProgramDataBaseFileName=".\Debug/"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="_DEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib TKernel.lib TKMath.lib TKGeomBase.lib TKV3d.lib TKService.lib TKG3d.lib TKVoxel.lib vfw32.lib odbc32.lib odbccp32.lib gl2ps.lib ftgl_dynamic_MTD.lib"
-                               OutputFile="Debug/VoxelOpenGl.dll"
-                               LinkIncremental="2"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32D)"
-                               GenerateDebugInformation="true"
-                               ProgramDatabaseFile=".\Debug/VoxelOpenGl.pdb"
-                               RandomizedBaseAddress="1"
-                               DataExecutionPrevention="0"
-                               ImportLibrary=".\Debug/VoxelOpenGl.lib"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                               SuppressStartupBanner="true"
-                               OutputFile=".\Debug/OpenGl.bsc"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory=".\Release"
-                       IntermediateDirectory=".\Release"
-                       ConfigurationType="2"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               PreprocessorDefinitions="NDEBUG"
-                               MkTypLibCompatible="true"
-                               SuppressStartupBanner="true"
-                               TargetEnvironment="1"
-                               TypeLibraryName=".\Release/OpenGl.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="2"
-                               InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories="$(CSF_OPT_INC)"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPENGL_EXPORTS;WNT"
-                               StringPooling="true"
-                               RuntimeLibrary="0"
-                               EnableFunctionLevelLinking="true"
-                               PrecompiledHeaderFile=".\Release/OpenGl.pch"
-                               AssemblerListingLocation=".\Release/"
-                               ObjectFile=".\Release/"
-                               ProgramDataBaseFileName=".\Release/"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="NDEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="opengl32.lib glu32.lib TKernel.lib TKMath.lib TKGeomBase.lib TKV3d.lib TKService.lib TKG3d.lib TKVoxel.lib vfw32.lib odbc32.lib odbccp32.lib gl2ps.lib ftgl_dynamic_MTD.lib"
-                               OutputFile="Release/VoxelOpenGl.dll"
-                               LinkIncremental="1"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32)"
-                               ProgramDatabaseFile=".\Release/VoxelOpenGl.pdb"
-                               RandomizedBaseAddress="1"
-                               DataExecutionPrevention="0"
-                               ImportLibrary=".\Release/VoxelOpenGl.lib"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                               SuppressStartupBanner="true"
-                               OutputFile=".\Release/OpenGl.bsc"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="Source Files"
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-                       >
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\glext.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_Context.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_Display.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_GraduatedTrihedron.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_GraphicDriver.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_Trihedron.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_View.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_Window.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\Handle_OpenGl_Workspace.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ArbVBO.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectFace.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectFace.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectLine.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectLine.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectMarker.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectMarker.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectText.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AspectText.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_AVIWriter.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Context.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_CView.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Display.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Display.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Display_1.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Display_2.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Element.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ExtFBO.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_FontMgr.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_FrameBuffer.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_FrameBuffer.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore11.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore12.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore13.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore14.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore15.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GlCore20.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraduatedTrihedron.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_1.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_2.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_3.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_4.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_7.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_703.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_705.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_710.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_713.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_8.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_9.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_Export.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_Layer.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_GraphicDriver_print.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Group.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Group.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ImageBox.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_LayerList.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_LayerList.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Light.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Marker.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Marker.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_MarkerSet.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_MarkerSet.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Matrix.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Matrix.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_NamedStatus.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Polygon.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Polygon.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Polyline.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Polyline.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_PrimitiveArray.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_PrimitiveArray.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_PrinterContext.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_PriorityList.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_PriorityList.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Resource.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Resource.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ResourceCleaner.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ResourceTexture.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_ResourceVBO.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Structure.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Structure.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_telem_util.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_telem_view.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Text.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Text.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_TextParam.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_TextureBox.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Trihedron.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Trihedron.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_View.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_View.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_View_1.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_View_2.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Window.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Window.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace.hxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace_1.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace_2.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace_3.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace_4.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\OpenGl\OpenGl_Workspace_5.cxx"
-                               >
-                       </File>
-                       <File
-                               RelativePath="$(CASROOT)\src\voxelclient\VoxelClient_VisDrawer.cxx"
-                               >
-                       </File>
-               </Filter>
-               
-               <Filter
-                       Name="Resource Files"
-                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-                       >
-               </Filter>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
diff --git a/samples/qt/voxeldemo/VoxelDemo-vc8.sln b/samples/qt/voxeldemo/VoxelDemo-vc8.sln
deleted file mode 100644 (file)
index c3f4ef6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGl", "OpenGl\OpenGl.vcproj", "{CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VoxelDemo", "VoxelDemo.vcproj", "{2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}"
-       ProjectSection(ProjectDependencies) = postProject
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5} = {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}
-       EndProjectSection
-EndProject
-Global
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               Debug|Win32 = Debug|Win32
-               Release|Win32 = Release|Win32
-       EndGlobalSection
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Debug|Win32.ActiveCfg = Debug|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Debug|Win32.Build.0 = Debug|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Release|Win32.ActiveCfg = Release|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Release|Win32.Build.0 = Release|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Debug|Win32.ActiveCfg = Debug|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Debug|Win32.Build.0 = Debug|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Release|Win32.ActiveCfg = Release|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Release|Win32.Build.0 = Release|Win32
-       EndGlobalSection
-       GlobalSection(SolutionProperties) = preSolution
-               HideSolutionNode = FALSE
-       EndGlobalSection
-EndGlobal
diff --git a/samples/qt/voxeldemo/VoxelDemo-vc9.sln b/samples/qt/voxeldemo/VoxelDemo-vc9.sln
deleted file mode 100644 (file)
index c9e690c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenGl", "OpenGl\OpenGl.vcproj", "{CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VoxelDemo", "VoxelDemo.vcproj", "{2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}"
-       ProjectSection(ProjectDependencies) = postProject
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5} = {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}
-       EndProjectSection
-EndProject
-Global
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution
-               Debug|Win32 = Debug|Win32
-               Release|Win32 = Release|Win32
-       EndGlobalSection
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Debug|Win32.ActiveCfg = Debug|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Debug|Win32.Build.0 = Debug|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Release|Win32.ActiveCfg = Release|Win32
-               {CD1C9AFB-8D5D-4A45-ABF5-56DBCED629A5}.Release|Win32.Build.0 = Release|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Debug|Win32.ActiveCfg = Debug|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Debug|Win32.Build.0 = Debug|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Release|Win32.ActiveCfg = Release|Win32
-               {2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}.Release|Win32.Build.0 = Release|Win32
-       EndGlobalSection
-       GlobalSection(SolutionProperties) = preSolution
-               HideSolutionNode = FALSE
-       EndGlobalSection
-EndGlobal
diff --git a/samples/qt/voxeldemo/VoxelDemo.vcproj b/samples/qt/voxeldemo/VoxelDemo.vcproj
deleted file mode 100755 (executable)
index a5ffc00..0000000
+++ /dev/null
@@ -1,438 +0,0 @@
-<?xml version="1.0" encoding="windows-1251"?>
-<VisualStudioProject
-       ProjectType="Visual C++"
-       Version="9,00"
-       Name="VoxelDemo"
-       ProjectGUID="{2739AAB7-4D99-41F6-9A9C-0C9EB34DEA82}"
-       TargetFrameworkVersion="131072"
-       >
-       <Platforms>
-               <Platform
-                       Name="Win32"
-               />
-       </Platforms>
-       <ToolFiles>
-       </ToolFiles>
-       <Configurations>
-               <Configuration
-                       Name="Release|Win32"
-                       OutputDirectory=".\Release"
-                       IntermediateDirectory=".\Release"
-                       ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               TypeLibraryName=".\Release/VoxelDemo.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="2"
-                               InlineFunctionExpansion="1"
-                               AdditionalIncludeDirectories=".\inc,$(CSF_OPT_INC)"
-                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WNT;QT_THREAD_SUPPORT"
-                               StringPooling="true"
-                               RuntimeLibrary="0"
-                               EnableFunctionLevelLinking="true"
-                               PrecompiledHeaderFile=".\Release/VoxelDemo.pch"
-                               AssemblerListingLocation=".\Release/"
-                               ObjectFile=".\Release/"
-                               ProgramDataBaseFileName=".\Release/"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="NDEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="TKV3d.lib TKernel.lib TKBRep.lib TKG3d.lib TKTopAlgo.lib TKMath.lib TKService.lib TKPrim.lib TKVoxel.lib QtCore4.lib QtGui4.lib odbc32.lib odbccp32.lib"
-                               OutputFile=".\Release/VoxelDemo.exe"
-                               LinkIncremental="1"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32)"
-                               ProgramDatabaseFile=".\Release/VoxelDemo.pdb"
-                               SubSystem="1"
-                               RandomizedBaseAddress="1"
-                               DataExecutionPrevention="0"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                               SuppressStartupBanner="true"
-                               OutputFile=".\Release/VoxelDemo.bsc"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-               <Configuration
-                       Name="Debug|Win32"
-                       OutputDirectory=".\Debug"
-                       IntermediateDirectory=".\Debug"
-                       ConfigurationType="1"
-                       InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-                       UseOfMFC="0"
-                       ATLMinimizesCRunTimeLibraryUsage="false"
-                       CharacterSet="2"
-                       >
-                       <Tool
-                               Name="VCPreBuildEventTool"
-                       />
-                       <Tool
-                               Name="VCCustomBuildTool"
-                       />
-                       <Tool
-                               Name="VCXMLDataGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCWebServiceProxyGeneratorTool"
-                       />
-                       <Tool
-                               Name="VCMIDLTool"
-                               TypeLibraryName=".\Debug/VoxelDemo.tlb"
-                               HeaderFileName=""
-                       />
-                       <Tool
-                               Name="VCCLCompilerTool"
-                               Optimization="0"
-                               AdditionalIncludeDirectories=".\inc,$(CSF_OPT_INC)"
-                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WNT;QT_THREAD_SUPPORT;TEST"
-                               MinimalRebuild="true"
-                               BasicRuntimeChecks="3"
-                               RuntimeLibrary="1"
-                               PrecompiledHeaderFile=".\Debug/VoxelDemo.pch"
-                               AssemblerListingLocation=".\Debug/"
-                               ObjectFile=".\Debug/"
-                               ProgramDataBaseFileName=".\Debug/"
-                               WarningLevel="3"
-                               SuppressStartupBanner="true"
-                               DebugInformationFormat="4"
-                       />
-                       <Tool
-                               Name="VCManagedResourceCompilerTool"
-                       />
-                       <Tool
-                               Name="VCResourceCompilerTool"
-                               PreprocessorDefinitions="_DEBUG"
-                               Culture="1033"
-                       />
-                       <Tool
-                               Name="VCPreLinkEventTool"
-                       />
-                       <Tool
-                               Name="VCLinkerTool"
-                               AdditionalDependencies="TKV3d.lib TKernel.lib TKBRep.lib TKG3d.lib TKTopAlgo.lib TKMath.lib TKService.lib TKPrim.lib TKVoxel.lib QtCore4.lib QtGui4.lib odbc32.lib odbccp32.lib"
-                               OutputFile=".\Debug/VoxelDemo.exe"
-                               LinkIncremental="2"
-                               SuppressStartupBanner="true"
-                               AdditionalLibraryDirectories="$(CSF_OPT_LIB32D)"
-                               GenerateManifest="false"
-                               GenerateDebugInformation="true"
-                               ProgramDatabaseFile=".\Debug/VoxelDemo.pdb"
-                               SubSystem="1"
-                               RandomizedBaseAddress="1"
-                               DataExecutionPrevention="0"
-                               TargetMachine="1"
-                       />
-                       <Tool
-                               Name="VCALinkTool"
-                       />
-                       <Tool
-                               Name="VCManifestTool"
-                       />
-                       <Tool
-                               Name="VCXDCMakeTool"
-                       />
-                       <Tool
-                               Name="VCBscMakeTool"
-                               SuppressStartupBanner="true"
-                               OutputFile=".\Debug/VoxelDemo.bsc"
-                       />
-                       <Tool
-                               Name="VCFxCopTool"
-                       />
-                       <Tool
-                               Name="VCAppVerifierTool"
-                       />
-                       <Tool
-                               Name="VCPostBuildEventTool"
-                       />
-               </Configuration>
-       </Configurations>
-       <References>
-       </References>
-       <Files>
-               <Filter
-                       Name="Source Files"
-                       Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-                       >
-                       <File
-                               RelativePath="src\Application.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="src\ConversionThread.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="src\Main.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="src\Timer.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="src\Viewer.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-               </Filter>
-               <Filter
-                       Name="Header Files"
-                       Filter="h;hpp;hxx;hm;inl"
-                       >
-                       <File
-                               RelativePath="inc\Application.h"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                               Description="Moc&apos;ing $(InputName).h ..."
-                                               CommandLine="moc.exe $(InputDir)$(InputName).h -o .\moc\moc_$(InputName).cxx&#x0D;&#x0A;"
-                                               Outputs=".\moc\moc_$(InputName).cxx"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                               Description="Moc&apos;ing $(InputName).h ..."
-                                               CommandLine="moc.exe $(InputDir)$(InputName).h -o .\moc\moc_$(InputName).cxx&#x0D;&#x0A;"
-                                               Outputs="moc\moc_$(InputName).cxx"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="inc\ConversionThread.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="inc\Timer.h"
-                               >
-                       </File>
-                       <File
-                               RelativePath="inc\Viewer.h"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                               Description="Moc&apos;ing $(InputName).h ..."
-                                               CommandLine="moc.exe $(InputDir)$(InputName).h -o .\moc\moc_$(InputName).cxx&#x0D;&#x0A;"
-                                               Outputs=".\moc\moc_$(InputName).cxx"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCustomBuildTool"
-                                               Description="Moc&apos;ing $(InputName).h ..."
-                                               CommandLine="moc.exe $(InputDir)$(InputName).h -o .\moc\moc_$(InputName).cxx&#x0D;&#x0A;"
-                                               Outputs=".\moc\moc_$(InputName).cxx"
-                                       />
-                               </FileConfiguration>
-                       </File>
-               </Filter>
-               <Filter
-                       Name="Moc files"
-                       Filter="cxx"
-                       >
-                       <File
-                               RelativePath="moc\moc_Application.cxx"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="moc\moc_Viewer.cxx"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
-               </Filter>
-               <Filter
-                       Name="Resource Files"
-                       Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-                       >
-               </Filter>
-       </Files>
-       <Globals>
-       </Globals>
-</VisualStudioProject>
diff --git a/samples/qt/voxeldemo/env.bat b/samples/qt/voxeldemo/env.bat
deleted file mode 100755 (executable)
index b07d529..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-@ECHO OFF
-
-IF not "%CASDEB%" EQU "" (
-SET BIN_DIR=Debug
-) ELSE (
-SET BIN_DIR=Release
-)
-
-SET PATH=%~dp0%BIN_DIR%;%PATH%
-
-SET CSF_GraphicShr=OpenGl\%BIN_DIR%\VoxelOpenGl.dll
-
-SET PATH=%~dp0OpenGl\%BIN_DIR%;%PATH%
-
-SET CSF_TEX_FONT=2
-SET MMGT_REENTRANT=1
diff --git a/samples/qt/voxeldemo/inc/Application.h b/samples/qt/voxeldemo/inc/Application.h
deleted file mode 100755 (executable)
index 59e63ea..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#ifndef APPLICATION_H
-#define APPLICATION_H
-
-#include <qmainwindow.h>
-#include <AIS_Shape.hxx>
-#include <Voxel_Prs.hxx>
-#include <Voxel_BoolDS.hxx>
-#include <Voxel_ColorDS.hxx>
-#include "Viewer.h"
-
-class Application: public QMainWindow
-{
-    Q_OBJECT
-
-public:
-    Application();
-    ~Application();
-
-protected:
-    void closeEvent( QCloseEvent* );
-
-private slots:
-    void box();
-    void cylinder();
-    void torus();
-    void sphere();
-    void choose();
-    void load( const QString & );
-    void load( const TopoDS_Shape & );
-    void save();
-    void open();
-
-    void testBoolDS();
-    void testColorDS();
-    void testFloatDS();
-    void testOctBoolDS();
-    void testROctBoolDS();
-
-    void testFuseBoolDS();
-    void testFuseColorDS();
-    void testFuseFloatDS();
-    void testCutBoolDS();
-    void testCutColorDS();
-    void testCutFloatDS();
-    
-    void convert2bool();
-    void convert2color();
-    void convert(const int );
-
-    void setNbX();
-    void setNbY();
-    void setNbZ();
-
-    void setScanSide();
-
-    void setVolumicBoolValue();
-    void setVolumicColorValue();
-
-    void setQuadrangleSize();
-    void setPointSize();
-
-    void setColorMinValue();
-    void setColorMaxValue();
-
-    void setUsageOfGLlists();
-    
-    void setDisplayedXMin();
-    void setDisplayedXMax();
-    void setDisplayedYMin();
-    void setDisplayedYMax();
-    void setDisplayedZMin();
-    void setDisplayedZMax();
-
-    void displayPoints();
-    void displayNearestPoints();
-    void displayBoxes();
-    void displayNearestBoxes();
-
-    void displayColorScale();
-    
-    void displayWaves();
-    void displayCut();
-    void displayCollisions();
-
-    void about();
-
-private:
-    void display(Voxel_VoxelDisplayMode );
-    void initPrs();
-
-       Viewer* myViewer;
-       Handle(AIS_Shape) myShape;
-       Handle(Voxel_Prs) myVoxels;
-       Voxel_BoolDS* myBoolVoxels;
-       Voxel_ColorDS* myColorVoxels;
-       int myNbX;
-       int myNbY;
-       int myNbZ;
-    unsigned char myScanSide;
-    bool myVolumicBoolValue;
-    unsigned char myVolumicColorValue;
-    int myQuadrangleSize;
-    int myPointSize;
-    unsigned char myColorMinValue;
-    unsigned char myColorMaxValue;
-    double myDisplayedXMin;
-    double myDisplayedXMax;
-    double myDisplayedYMin;
-    double myDisplayedYMax;
-    double myDisplayedZMin;
-    double myDisplayedZMax;
-};
-
-#endif // APPLICATION_H
diff --git a/samples/qt/voxeldemo/inc/ConversionThread.h b/samples/qt/voxeldemo/inc/ConversionThread.h
deleted file mode 100755 (executable)
index 7e66a94..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _CONVERSIONTHREAD_H_
-#define _CONVERSIONTHREAD_H_
-
-#include <QThread.h>
-//#include <Voxel_Converter.hxx>
-#include <Voxel_FastConverter.hxx>
-
-class ConversionThread : public QThread
-{
-
-public:
-
-    ConversionThread();
-    ~ConversionThread();
-
-//    void setConverter(Voxel_Converter*     converter);
-    void setConverter(Voxel_FastConverter* converter);
-
-    void setVolumicValue(const int value);
-    void setScanSide(const int side);
-    void setThreadIndex(const int ithread);
-
-    int* getProgress();
-
-protected:
-
-    void run();
-
-private:
-
-//    Voxel_Converter*     myConverter;
-    Voxel_FastConverter* myFastConverter;
-
-    int myVolumicValue;
-    int myScanSide;
-    int myThreadIndex;
-    int myProgress;
-};
-
-#endif // _CONVERSIONTHREAD_H_
\ No newline at end of file
diff --git a/samples/qt/voxeldemo/inc/Timer.h b/samples/qt/voxeldemo/inc/Timer.h
deleted file mode 100755 (executable)
index 338d7dc..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Timer.h: interface for the Timer class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_)
-#define AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include <OSD_Timer.hxx>
-
-class Timer  
-{
-public:
-       Standard_EXPORT Timer();
-       Standard_EXPORT Timer(const char* filename);
-       Standard_EXPORT ~Timer();
-       Standard_EXPORT void Start();
-       Standard_EXPORT void Stop();
-       Standard_EXPORT void Continue();
-       Standard_EXPORT void Reset();
-  Standard_EXPORT float Seconds();
-  Standard_EXPORT int Minutes();
-       Standard_EXPORT void Print(char* label);
-
-private:
-       OSD_Timer myTimer;
-       FILE* myWriter;
-};
-
-#endif // !defined(AFX_TIMER_H__528FB454_797E_11D7_9B1B_000103C0F1F9__INCLUDED_)
diff --git a/samples/qt/voxeldemo/inc/Viewer.h b/samples/qt/voxeldemo/inc/Viewer.h
deleted file mode 100755 (executable)
index ee57227..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _VIEWER_H_
-#define _VIEWER_H_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#include <QWidget.h>
-
-#include <AIS_InteractiveContext.hxx>
-#include <V3d_View.hxx>
-
-#include <Voxel_Prs.hxx>
-#include <Voxel_Selector.hxx>
-
-class Viewer : public QWidget 
-{
-       
-       Q_OBJECT
-
-public:
-
-       Viewer(QWidget* parent);
-       virtual ~Viewer();
-
-       Handle(AIS_InteractiveContext) getIC() const { return myIC; }
-       Handle(V3d_View) getView() const { return myView; }
-    Voxel_Selector& getSelector() { return mySelector; }
-    void setPrs(const Handle(Voxel_Prs)& prs) { myPrs = prs; }
-       virtual QPaintEngine*          paintEngine() const;
-
-signals:
-       
-       void mousePressed(Qt::KeyboardModifiers,int,int);
-       void mouseMoved(Qt::KeyboardModifiers,int,int);
-       void mouseReleased(Qt::KeyboardModifiers,int,int);
-       void mouseDoubleClick(Qt::KeyboardModifiers,int,int);
-
-protected:
-       virtual void paintEvent(QPaintEvent* pEvent);
-       virtual void resizeEvent(QResizeEvent* rsEvent);
-       virtual void mousePressEvent(QMouseEvent* mpEvent);
-       virtual void mouseMoveEvent(QMouseEvent* mmEvent);
-       virtual void mouseReleaseEvent(QMouseEvent* mrEvent);
-       virtual void mouseDoubleClickEvent(QMouseEvent* mdcEvent);
-
-private:
-       Handle(AIS_InteractiveContext) myIC;
-       Handle(V3d_View)               myView;
-
-       bool myRotate;
-       bool myZoom;
-       bool myPan;
-
-       QPoint myStartPnt;
-
-    void setDegenerateMode(const bool );
-
-    Voxel_Selector mySelector;
-    Handle(Voxel_Prs) myPrs;
-};
-
-#endif // _VIEWER_H_
diff --git a/samples/qt/voxeldemo/msvc.bat b/samples/qt/voxeldemo/msvc.bat
deleted file mode 100644 (file)
index f0e56be..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-call ../../../env.bat %1 %2 %3
-call %~dp0env.bat
-if not ["%CASDEB%"] == [""] call ../../../msvc.bat %VCVER% win%ARCH% %CASDEB% VoxelDemo-%VCVER%.sln
-if ["%CASDEB%"] == [""] call ../../../msvc.bat %VCVER% win%ARCH% "" VoxelDemo-%VCVER%.sln
\ No newline at end of file
diff --git a/samples/qt/voxeldemo/run.bat b/samples/qt/voxeldemo/run.bat
deleted file mode 100644 (file)
index d6571cc..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-call ../../../env.bat %1 %2 %3
-
-call %~dp0env.bat
-
-if not exist "%BIN_DIR%\VoxelDemo.exe" goto ERR_EXE
-
-echo Starting VoxelDemo .....
-start /D "%BIN_DIR%" VoxelDemo.exe
-
-goto END
-
-:ERR_EXE
-echo Executable %BIN_DIR%\VoxelDemo.exe not found."
-echo Probably you didn't compile the application.
-pause
-goto END
-
-:END
\ No newline at end of file
diff --git a/samples/qt/voxeldemo/src/Application.cpp b/samples/qt/voxeldemo/src/Application.cpp
deleted file mode 100755 (executable)
index c4379b0..0000000
+++ /dev/null
@@ -1,2366 +0,0 @@
-#include "Application.h"
-#include "ConversionThread.h"
-#include "Timer.h"
-
-#include <QPixmap.h>
-#include <QToolButton.h>
-#include <QWhatsThis.h>
-#include <QMenu.h>
-#include <QMenuBar.h>
-#include <QStatusBar.h>
-#include <QApplication.h>
-#include <QFileDialog.h>
-#include <QMessageBox.h>
-#include <QInputDialog.h>
-#include <QCloseEvent>
-
-#include <Voxel_BoolDS.hxx>
-#include <Voxel_ColorDS.hxx>
-#include <Voxel_FloatDS.hxx>
-#include <Voxel_OctBoolDS.hxx>
-#include <Voxel_ROctBoolDS.hxx>
-#include <Voxel_BooleanOperation.hxx>
-#include <Voxel_CollisionDetection.hxx>
-#include <Voxel_FastConverter.hxx>
-#include <Voxel_Writer.hxx>
-#include <Voxel_Reader.hxx>
-#include <VoxelClient_VisDrawer.h>
-
-#include <BRepTools.hxx>
-#include <BRepBndLib.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepPrimAPI_MakeTorus.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <Aspect_ColorScale.hxx>
-
-#include <Windows.h>
-
-Application::Application()
-    : QMainWindow( 0 )
-{
-    // File
-    QMenu * file = menuBar()->addMenu( "&File" );
-
-    QAction* a;
-    // Box
-    a = new QAction("Box", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(box()));
-    file->addAction(a);
-    // Cylinder
-    a = new QAction("Cylinder", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(cylinder()));
-    file->addAction(a);
-    // Torus
-    a = new QAction("Torus", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(torus()));
-    file->addAction(a);
-    // Sphere
-    a = new QAction("Sphere", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(sphere()));
-    file->addAction(a);
-    // Load shape...
-    a = new QAction("Load shape...", this);
-    a->setShortcut(tr("Ctrl+O"));
-    connect(a, SIGNAL(triggered()), this, SLOT(choose()));
-    file->addAction(a);
-
-    file->addSeparator();
-
-    // Open
-    a = new QAction("Open", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(open()));
-    file->addAction(a);
-
-    // Save
-    a = new QAction("Save", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(save()));
-    file->addAction(a);
-
-    file->addSeparator();
-
-    // Quit
-    a = new QAction("&Quit", this);
-    a->setShortcut(tr("Ctrl+Q"));
-    connect(a, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
-    file->addAction(a);
-
-    menuBar()->addSeparator();
-
-
-#ifdef TEST
-    QMenu * test = menuBar()->addMenu( "Test" );
-
-    a = new QAction("Test boolean", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testBoolDS()));
-    test->addAction(a);
-
-    a = new QAction("Test color", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testColorDS()));
-    test->addAction(a);
-
-    a = new QAction("Test float", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testFloatDS()));
-    test->addAction(a);
-
-    a = new QAction("Test boolean / 8", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testOctBoolDS()));
-    test->addAction(a);
-
-    a = new QAction("Test boolean / 8 / 8..", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testROctBoolDS()));
-    test->addAction(a);
-
-    test->addSeparator();
-
-    a = new QAction("Test fusion of booleans", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testFuseBoolDS()));
-    test->addAction(a);
-
-    a = new QAction("Test fusion of colors", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testFuseColorDS()));
-    test->addAction(a);
-
-    a = new QAction("Test fusion of floating-points", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testFuseFloatDS()));
-    test->addAction(a);
-
-    a = new QAction("Test cutting of booleans", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testCutBoolDS()));
-    test->addAction(a);
-
-    a = new QAction("Test cutting of booleans", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testCutColorDS()));
-    test->addAction(a);
-
-    a = new QAction("Test cutting of floating-points", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(testCutFloatDS()));
-    test->addAction(a);
-
-#endif // TEST
-
-    QMenu * converter = menuBar()->addMenu( "Converter" );
-
-#ifdef TEST
-    
-    a = new QAction("Number of splits along X", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setNbX()));
-    converter->addAction(a);
-
-    a = new QAction("Number of splits along Y", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setNbY()));
-    converter->addAction(a);
-
-    a = new QAction("Number of splits along Z", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setNbZ()));
-    converter->addAction(a);
-
-    converter->addSeparator();
-
-    a = new QAction("Side of scanning", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setScanSide()));
-    converter->addAction(a);
-
-    converter->addSeparator();
-
-    a = new QAction("Volumic value of 1bit voxels", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setVolumicBoolValue()));
-    converter->addAction(a);
-    
-    a = new QAction("Volumic value of 4bit voxels", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setVolumicColorValue()));
-    converter->addAction(a);
-
-    converter->addSeparator();
-
-#endif // TEST
-
-    a = new QAction("Convert to 1bit voxels", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(convert2bool()));
-    converter->addAction(a);
-
-    a = new QAction("Convert to 4bit voxels", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(convert2color()));
-    converter->addAction(a);
-
-    QMenu * vis = menuBar()->addMenu( "&Visualization" );
-
-    a = new QAction("Points", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayPoints()));
-    vis->addAction(a);
-
-#ifdef TEST
-    
-    a = new QAction("Nearest points", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayNearestPoints()));
-    vis->addAction(a);
-
-#endif // TEST
-
-    a = new QAction("Boxes", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayBoxes()));
-    vis->addAction(a);
-
-#ifdef TEST
-
-    a = new QAction("Nearest boxes", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayNearestBoxes()));
-    vis->addAction(a);
-
-#endif // TEST
-    
-    vis->addSeparator();
-
-    a = new QAction("Point size", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setPointSize()));
-    vis->addAction(a);
-    
-    a = new QAction("Quadrangle size (%)", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setQuadrangleSize()));
-    vis->addAction(a);
-
-    vis->addSeparator();
-
-    a = new QAction("Color min value", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setColorMinValue()));
-    vis->addAction(a);
-
-    a = new QAction("Color max value", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setColorMaxValue()));
-    vis->addAction(a);
-
-#ifdef TEST
-
-    vis->addSeparator();
-
-    a = new QAction("Use GL lists", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setUsageOfGLlists()));
-    vis->addAction(a);
-
-#endif // TEST
-
-    vis->addSeparator();
-
-    a = new QAction("Displayed X min", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedXMin()));
-    vis->addAction(a);
-
-    a = new QAction("Displayed X max", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedXMax()));
-    vis->addAction(a);
-
-    a = new QAction("Displayed Y min", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedYMin()));
-    vis->addAction(a);
-
-    a = new QAction("Displayed Y max", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedYMax()));
-    vis->addAction(a);
-
-    a = new QAction("Displayed Z min", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedZMin()));
-    vis->addAction(a);
-
-    a = new QAction("Displayed Z max", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(setDisplayedZMax()));
-    vis->addAction(a);
-
-
-    QMenu * demo = menuBar()->addMenu( "Demo" );
-
-    a = new QAction("Waves", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayWaves()));
-    demo->addAction(a);
-
-    a = new QAction("Cut", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayCut()));
-    demo->addAction(a);
-
-    a = new QAction("Collisions", this);
-    connect(a, SIGNAL(triggered()), this, SLOT(displayCollisions()));
-    demo->addAction(a);
-
-
-    QMenu * help = menuBar()->addMenu( "Help" );
-
-    a = new QAction("About", this);
-    a->setShortcut(tr("F1"));
-    connect(a, SIGNAL(triggered()), this, SLOT(about()));
-    help->addAction(a);
-
-
-    myViewer = new Viewer( this );
-    myViewer->setFocus();
-    setCentralWidget( myViewer );
-    statusBar()->showMessage( "Ready", 2000 );
-
-       myNbX = 100;
-       myNbY = 100;
-       myNbZ = 100;
-
-    myScanSide = 7;
-
-    myVolumicBoolValue = false;
-    myVolumicColorValue = 0;
-
-    myQuadrangleSize = 40;
-    
-    myColorMinValue = 1;
-    myColorMaxValue = 15;
-
-       myBoolVoxels = 0;
-       myColorVoxels = 0;
-
-    myDisplayedXMin = -DBL_MAX;
-    myDisplayedXMax =  DBL_MAX;
-    myDisplayedYMin = -DBL_MAX;
-    myDisplayedYMax =  DBL_MAX;
-    myDisplayedZMin = -DBL_MAX;
-    myDisplayedZMax =  DBL_MAX;
-
-       VoxelClient_VisDrawer::Init();
-
-    resize( 450, 600 );
-}
-
-Application::~Application()
-{
-       if (myBoolVoxels)
-               delete myBoolVoxels;
-       if (myColorVoxels)
-               delete myColorVoxels;
-}
-
-void Application::choose()
-{
-    QString fn = QFileDialog::getOpenFileName( this, QString::null, QString::null, "*.brep");
-    if ( !fn.isEmpty() )
-               load( fn );
-    else
-               statusBar()->showMessage( "Loading aborted", 2000 );
-}
-
-void Application::load( const QString &fileName )
-{
-    QFile f( fileName );
-    if ( !f.open( QIODevice::ReadOnly ) )
-               return;
-
-    // Read shape
-       TopoDS_Shape S;
-       BRep_Builder B;
-       if (!BRepTools::Read(S, (char*) fileName.constData(), B))
-               statusBar()->showMessage( "Loading failed", 2000 );
-    
-    load(S);
-}
-
-void Application::open()
-{
-    QString fn = QFileDialog::getOpenFileName( this, QString::null, QString::null, "*.vx");
-    if ( fn.isEmpty() || !QFile::exists(fn) )
-    {
-               statusBar()->showMessage( "Open aborted", 2000 );
-        return;
-    }
-
-    Timer timer;
-    timer.Start();
-
-    // Read the voxels
-    Voxel_Reader reader;
-    if (!reader.Read((char*)fn.constData()))
-    {
-               statusBar()->showMessage( "Open failed... sorry", 2000 );
-        return;
-    }
-
-    timer.Stop();
-    timer.Print("Open");
-
-    // Release current voxels
-    if (myBoolVoxels)
-    {
-        delete myBoolVoxels;
-        myBoolVoxels = 0;
-    }
-    if (myColorVoxels)
-    {
-        delete myColorVoxels;
-        myColorVoxels = 0;
-    }
-
-    // Take the voxels
-    if (reader.IsBoolVoxels())
-    {
-        myBoolVoxels = (Voxel_BoolDS*) reader.GetBoolVoxels();
-        myViewer->getSelector().SetVoxels(*myBoolVoxels);
-    }
-    else if (reader.IsColorVoxels())
-    {
-        myColorVoxels = (Voxel_ColorDS*) reader.GetColorVoxels();
-        myViewer->getSelector().SetVoxels(*myColorVoxels);
-    }
-    
-    // Display the voxels
-    myViewer->getIC()->EraseAll(false, false);
-    Voxel_DS* ds = myBoolVoxels;
-    if (!ds)
-        ds = myColorVoxels;
-    if (ds)
-    {
-        myDisplayedXMin = ds->GetX() - 10.0 * Precision::Confusion();
-        myDisplayedXMax = ds->GetX() + ds->GetXLen() + 10.0 * Precision::Confusion();
-        myDisplayedYMin = ds->GetY() - 10.0 * Precision::Confusion();
-        myDisplayedYMax = ds->GetY() + ds->GetYLen() + 10.0 * Precision::Confusion();
-        myDisplayedZMin = ds->GetZ() - 10.0 * Precision::Confusion();
-        myDisplayedZMax = ds->GetZ() + ds->GetZLen() + 10.0 * Precision::Confusion();
-    }
-
-    // Init visual data
-    initPrs();
-
-    // Set voxels and display
-    Handle(Poly_Triangulation) empty;
-    myVoxels->SetBoolVoxels(myBoolVoxels);
-       myVoxels->SetColorVoxels(myColorVoxels);
-    myVoxels->SetTriangulation(empty);
-    if (myViewer->getIC()->IsDisplayed(myVoxels))
-        myViewer->getIC()->Redisplay(myVoxels, false);
-    else
-           myViewer->getIC()->Display(myVoxels, false);
-   
-    // Color scale
-    if (myColorVoxels)
-        displayColorScale();
-    else
-        myViewer->getView()->ColorScaleErase();
-
-       myViewer->getView()->FitAll();
-
-    statusBar()->showMessage( "Ready.", 2000 );
-}
-
-void Application::save()
-{
-    QString fn = QFileDialog::getSaveFileName( this, QString::null, QString::null, "*.vx");
-    if ( fn.isEmpty() )
-    {
-               statusBar()->showMessage( "Storage aborted", 2000 );
-        return;
-    }
-    if (fn.indexOf(".vx", -1, Qt::CaseInsensitive) == -1)
-        fn += ".vx";
-
-    Timer timer;
-    timer.Start();
-
-    // Write the voxels
-    Voxel_Writer writer;
-    writer.SetFormat(Voxel_VFF_BINARY);
-    if (myBoolVoxels)
-        writer.SetVoxels(*myBoolVoxels);
-    else if (myColorVoxels)
-        writer.SetVoxels(*myColorVoxels);
-    else
-    {
-               statusBar()->showMessage( "Nothing to store", 2000 );
-        return;
-    }
-    if (!writer.Write((char*)fn.constData()))
-    {
-               statusBar()->showMessage( "Storage failed... sorry", 2000 );
-        return;
-    }
-
-    timer.Stop();
-    timer.Print("Save");
-
-    statusBar()->showMessage( "Saved.", 2000 );
-}
-
-void Application::closeEvent( QCloseEvent* ce )
-{
-    ce->accept();
-}
-
-void Application::about()
-{
-    QMessageBox::about( this, "Voxel demo-application",
-                       "This example demonstrates simple usage of "
-                       "voxel models of Open CASCADE.");
-}
-
-void Application::testBoolDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. BoolDS:
-
-       timer.Start();
-
-       Voxel_BoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds.Set(ix, iy, iz, false);
-                               else
-                                       ds.Set(ix, iy, iz, true);
-                       }
-               }
-       }
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               bool value = ds.Get(ix, iy, iz) == Standard_True;
-                               if (ix & 0x01)
-                               {
-                                       if (value != false)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                                       if (value != true)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("BoolDS");
-}
-
-void Application::testColorDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. ColorDS:
-
-       timer.Start();
-
-       Voxel_ColorDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                if (ix & 0x01)
-                           ds.Set(ix, iy, iz, 8);
-                else
-                    ds.Set(ix, iy, iz, 7);
-                       }
-               }
-       }
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               unsigned char value = ds.Get(ix, iy, iz);
-                if (ix & 0x01)
-                {
-                                   if (value != 8)
-                                           cout<<"Wrong value!"<<endl;
-                }
-                else
-                {
-                                   if (value != 7)
-                                           cout<<"Wrong value!"<<endl;
-                }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("ColorDS");
-}
-
-void Application::testFloatDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. FloatDS:
-
-       timer.Start();
-
-       Voxel_FloatDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                if (ix & 0x01)
-                           ds.Set(ix, iy, iz, 8.8f);
-                else
-                    ds.Set(ix, iy, iz, 7.7f);
-                       }
-               }
-       }
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               float value = ds.Get(ix, iy, iz);
-                if (ix & 0x01)
-                {
-                                   if (value != 8.8f)
-                                           cout<<"Wrong value!"<<endl;
-                }
-                else
-                {
-                                   if (value != 7.7f)
-                                           cout<<"Wrong value!"<<endl;
-                }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("FloatDS");
-}
-
-void Application::testOctBoolDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 30, nby = 30, nbz = 30;
-
-
-       // 1. OctBoolDS:
-
-       timer.Start();
-
-       Voxel_OctBoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                {
-                                       ds.Set(ix, iy, iz, true);
-                }
-                               else
-                {
-                    for (int i = 0; i < 8; i++)
-                    {
-                        if (i & 0x01)
-                                               ds.Set(ix, iy, iz, i, true);
-                        else
-                            ds.Set(ix, iy, iz, i, false);
-                    }
-                }
-                       }
-               }
-       }
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                               {
-                               bool value = ds.Get(ix, iy, iz) == Standard_True;
-                                       if (value != true)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                    for (int i = 0; i < 8; i++)
-                    {
-                        if (i & 0x01)
-                        {
-                                       bool value = ds.Get(ix, iy, iz, i) == Standard_True;
-                                               if (value != true)
-                                                       cout<<"Wrong value!"<<endl;
-                        }
-                        else
-                        {
-                                       bool value = ds.Get(ix, iy, iz, i) == Standard_True;
-                                               if (value != false)
-                                                       cout<<"Wrong value!"<<endl;
-                        }
-                    }
-                               }
-                       }
-               }
-       }
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                               {
-                    for (int i = 0; i < 8; i++)
-                    {
-                        ds.Set(ix, iy, iz, i, true);
-                    }
-                               }
-                else
-                {
-                    for (int i = 0; i < 8; i++)
-                    {
-                        ds.Set(ix, iy, iz, i, false);
-                    }
-                }
-                       }
-               }
-       }
-
-    ds.OptimizeMemory();
-
-       timer.Stop();
-       timer.Print("OctBoolDS");
-}
-
-void Application::testROctBoolDS()
-{
-       Timer timer;
-       int ix, iy, iz, i, j;
-       int nbx = 30, nby = 30, nbz = 30;
-
-       // 1. ROctBoolDS:
-
-       timer.Start();
-
-       Voxel_ROctBoolDS ds(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-    for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                ds.Set(ix, iy, iz, true);
-                       }
-               }
-       }
-
-    for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                for (i = 0; i < 8; i++)
-                {
-                    for (j = 0; j < 8; j++)
-                    {
-                        ds.Set(ix, iy, iz, i, j, true);
-                    }
-                }
-                       }
-               }
-       }
-
-    ds.OptimizeMemory();
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                if (ds.Deepness(ix, iy, iz) == 0)
-                {
-                    bool value = ds.Get(ix, iy, iz);
-                    if (value != true)
-                        cout<<"Wrong value..."<<endl;
-                }
-                if (ds.Deepness(ix, iy, iz) == 1)
-                {
-                    for (i = 0; i < 8; i++)
-                    {
-                        bool value = ds.Get(ix, iy, iz, i);
-                        if (value != true)
-                            cout<<"Wrong value..."<<endl;
-                    }
-                }
-                if (ds.Deepness(ix, iy, iz) == 2)
-                {
-                    for (i = 0; i < 8; i++)
-                    {
-                        for (j = 0; j < 8; j++)
-                        {
-                            bool value = ds.Get(ix, iy, iz, i, j);
-                            if (value != true)
-                                cout<<"Wrong value..."<<endl;
-                        }
-                    }
-                }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("ROctBoolDS");
-
-
-    // Test converter
-    TopoDS_Shape S = BRepPrimAPI_MakeSphere(100.0);
-
-    timer.Start();
-
-    int progress = 0;
-    Voxel_ROctBoolDS* ds2 = new Voxel_ROctBoolDS;
-    Voxel_FastConverter converter(S, *ds2, 0.1, myNbX, myNbY, myNbZ, 1);
-    converter.Convert(progress);
-    ds2->OptimizeMemory();
-
-       timer.Stop();
-       timer.Print("ROctBoolDS::converter");
-
-
-    // Display 
-    myViewer->getIC()->EraseAll(false, false);
-    initPrs();
-    myVoxels->SetBoolVoxels(0);
-       myVoxels->SetColorVoxels(0);
-    Handle(Poly_Triangulation) empty;
-    myVoxels->SetTriangulation(empty);
-    myVoxels->SetROctBoolVoxels(ds2);
-    myViewer->getIC()->Display(myVoxels, false);
-    myViewer->getView()->ColorScaleErase();
-       myViewer->getView()->FitAll();
-    myViewer->getSelector().SetVoxels(*ds2);
-}
-
-void Application::testFuseBoolDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two BoolDS:
-
-       timer.Start();
-
-       Voxel_BoolDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_BoolDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, false);
-                               else
-                                       ds2.Set(ix, iy, iz, true);
-                       }
-               }
-       }
-
-    // 2. Fuse them
-
-    Voxel_BooleanOperation fuser;
-    if (!fuser.Fuse(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               bool value = ds1.Get(ix, iy, iz) == Standard_True;
-                               if (ix & 0x01)
-                               {
-                                       if (value != false)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                                       if (value != true)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Fusion of BoolDS");
-}
-
-void Application::testFuseColorDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two ColorDS:
-
-       timer.Start();
-
-       Voxel_ColorDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_ColorDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               ds1.Set(ix, iy, iz, 11);
-                       }
-               }
-       }
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, 3);
-                               else
-                                       ds2.Set(ix, iy, iz, 5);
-                       }
-               }
-       }
-
-    // 2. Fuse them
-
-    Voxel_BooleanOperation fuser;
-    if (!fuser.Fuse(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               unsigned char value = ds1.Get(ix, iy, iz);
-                               if (ix & 0x01)
-                               {
-                                       if (value != 14)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                                       if (value != 15)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Fusion of ColorDS");
-}
-
-void Application::testFuseFloatDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two FloatDS:
-
-       timer.Start();
-
-       Voxel_FloatDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_FloatDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               ds1.Set(ix, iy, iz, 11.1f);
-                       }
-               }
-       }
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, 3.3f);
-                               else
-                                       ds2.Set(ix, iy, iz, 5.5f);
-                       }
-               }
-       }
-
-    // 2. Fuse them
-
-    Voxel_BooleanOperation fuser;
-    if (!fuser.Fuse(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               float value = ds1.Get(ix, iy, iz);
-                               if (ix & 0x01)
-                               {
-                    if (fabs(value - 14.4f) > 0.001)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                    if (fabs(value - 16.6f) > 0.001)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Fusion of FloatDS");
-}
-
-void Application::testCutBoolDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two BoolDS:
-
-       timer.Start();
-
-       Voxel_BoolDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_BoolDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               ds1.Set(ix, iy, iz, true);
-                       }
-               }
-       }
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, false);
-                               else
-                                       ds2.Set(ix, iy, iz, true);
-                       }
-               }
-       }
-
-    // 2. Cut them
-
-    Voxel_BooleanOperation cutter;
-    if (!cutter.Cut(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               bool value = ds1.Get(ix, iy, iz) == Standard_True;
-                               if (ix & 0x01)
-                               {
-                                       if (value != true)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                                       if (value != false)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Cut of BoolDS");
-}
-
-void Application::testCutColorDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two ColorDS:
-
-       timer.Start();
-
-       Voxel_ColorDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_ColorDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               ds1.Set(ix, iy, iz, 11);
-                       }
-               }
-       }
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, 3);
-                               else
-                                       ds2.Set(ix, iy, iz, 5);
-                       }
-               }
-       }
-
-    // 2. Cut them
-
-    Voxel_BooleanOperation cutter;
-    if (!cutter.Cut(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               unsigned char value = ds1.Get(ix, iy, iz);
-                               if (ix & 0x01)
-                               {
-                                       if (value != 8)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                                       if (value != 6)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Cut of ColorDS");
-}
-
-void Application::testCutFloatDS()
-{
-       Timer timer;
-       int ix, iy, iz;
-       int nbx = 100, nby = 100, nbz = 100;
-
-
-       // 1. Set two FloatDS:
-
-       timer.Start();
-
-       Voxel_FloatDS ds1(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-       Voxel_FloatDS ds2(0, 0, 0, 1, 1, 1, nbx, nby, nbz);
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               ds1.Set(ix, iy, iz, 11.1f);
-                       }
-               }
-       }
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               if (ix & 0x01)
-                                       ds2.Set(ix, iy, iz, 3.3f);
-                               else
-                                       ds2.Set(ix, iy, iz, 5.5f);
-                       }
-               }
-       }
-
-    // 2. Cut them
-
-    Voxel_BooleanOperation cutter;
-    if (!cutter.Cut(ds1, ds2))
-        cout<<"The operation failed..."<<endl;
-
-    // 3. Check result
-
-       for (ix = 0; ix < nbx; ix++)
-       {
-               for (iy = 0; iy < nby; iy++)
-               {
-                       for (iz = 0; iz < nbz; iz++)
-                       {
-                               float value = ds1.Get(ix, iy, iz);
-                               if (ix & 0x01)
-                               {
-                    if (fabs(value - 7.8f) > 0.001)
-                                       cout<<"Wrong value!"<<endl;
-                               }
-                               else
-                               {
-                    if (fabs(value - 5.6f) > 0.001)
-                                               cout<<"Wrong value!"<<endl;
-                               }
-                       }
-               }
-       }
-
-       timer.Stop();
-       timer.Print("Cut of FloatDS");
-}
-
-void Application::convert2bool()
-{
-    convert(0);
-}
-
-void Application::convert2color()
-{
-    convert(1);
-}
-
-void Application::convert(const int ivoxel)
-{
-       TopoDS_Shape S;
-       if (!myShape.IsNull())
-               S = myShape->Shape();
-    if (S.IsNull())
-       {
-               QMessageBox::warning( this, "Voxel demo-application", "No shape for conversion!");
-               return;
-       }
-
-    switch (ivoxel)
-    {
-        case 0:
-        {
-               if (!myBoolVoxels)
-                       myBoolVoxels = new Voxel_BoolDS;
-            if (myColorVoxels)
-            {
-                delete myColorVoxels;
-                myColorVoxels = 0;
-            }
-            break;
-        }
-        case 1:
-        {
-               if (!myColorVoxels)
-                       myColorVoxels = new Voxel_ColorDS;
-            if (myBoolVoxels)
-            {
-                delete myBoolVoxels;
-                myBoolVoxels = 0;
-            }
-            break;
-        }
-    }
-
-    switch (ivoxel)
-    {
-        case 0:
-        {
-            Timer timer;
-            timer.Start();
-
-            /*
-            int progress;
-            Voxel_Converter converter(S, *myBoolVoxels, myNbX, myNbY, myNbZ);
-               if (!converter.Convert(progress, myVolumicBoolValue, myScanSide))
-               {
-                       QMessageBox::warning( this, "Voxel demo-application", "Conversion failed...");
-                       return;
-               }
-            */
-
-            /*
-            Voxel_Converter converter(S, *myBoolVoxels, myNbX, myNbY, myNbZ, 2);
-            ConversionThread thread1, thread2;
-            
-            thread1.setConverter(&converter);
-            thread2.setConverter(&converter);
-
-            thread1.setVolumicValue(myVolumicBoolValue);
-            thread2.setVolumicValue(myVolumicBoolValue);
-
-            thread1.setScanSide(myScanSide);
-            thread2.setScanSide(myScanSide);
-
-            thread1.setThreadIndex(1);
-            thread2.setThreadIndex(2);
-
-            thread1.start();
-            thread2.start();
-
-            while (thread1.running() || thread2.running())
-            {
-                ::Sleep(100);
-            }
-            */
-
-            /*
-            int progress;
-            Voxel_FastConverter converter(S, *myBoolVoxels, 0.1, myNbX, myNbY, myNbZ, 1);
-            converter.Convert(progress, 1);
-            //if (myVolumicBoolValue)
-            //    converter.FillInVolume(myVolumicBoolValue);
-            */
-
-            Voxel_FastConverter converter(S, *myBoolVoxels, 0.1, myNbX, myNbY, myNbZ, 2);
-            ConversionThread thread1, thread2;
-            
-            thread1.setConverter(&converter);
-            thread2.setConverter(&converter);
-
-            thread1.setThreadIndex(1);
-            thread2.setThreadIndex(2);
-
-            thread1.start();
-            thread2.start();
-
-            while (thread1.isRunning() || thread2.isRunning())
-            {
-                ::Sleep(100);
-            }
-
-            timer.Print("Converter");
-
-            myViewer->getSelector().SetVoxels(*myBoolVoxels);
-            break;
-        }
-        case 1:
-        {
-
-            Timer timer;
-            timer.Start();
-
-            /*
-            int progress;
-            Voxel_Converter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ);
-               if (!converter.Convert(progress, myVolumicColorValue, myScanSide))
-               {
-                       QMessageBox::warning( this, "Voxel demo-application", "Conversion failed...");
-                       return;
-               }
-            */
-
-            /*
-            Voxel_Converter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ, 2);
-            ConversionThread thread1, thread2;
-            
-            thread1.setConverter(&converter);
-            thread2.setConverter(&converter);
-
-            thread1.setVolumicValue(myVolumicColorValue);
-            thread2.setVolumicValue(myVolumicColorValue);
-
-            thread1.setScanSide(myScanSide);
-            thread2.setScanSide(myScanSide);
-
-            thread1.setThreadIndex(1);
-            thread2.setThreadIndex(2);
-
-            thread1.start();
-            thread2.start();
-
-            while (thread1.running() || thread2.running())
-            {
-                ::Sleep(100);
-            }
-            */
-
-            /*
-            int progress;
-            Voxel_FastConverter converter(S, *myColorVoxels, myNbX, myNbY, myNbZ, 1);
-            converter.Convert(progress, 1);
-            if (myVolumicColorValue)
-                converter.FillInVolume(myVolumicColorValue);
-            */
-
-            Voxel_FastConverter converter(S, *myColorVoxels, 0.1, myNbX, myNbY, myNbZ, 2);
-            ConversionThread thread1, thread2;
-            
-            thread1.setConverter(&converter);
-            thread2.setConverter(&converter);
-
-            thread1.setThreadIndex(1);
-            thread2.setThreadIndex(2);
-
-            thread1.start();
-            thread2.start();
-
-            while (thread1.isRunning() || thread2.isRunning())
-            {
-                ::Sleep(100);
-            }
-
-            timer.Print("Converter");
-
-
-            // Set color for demonstration
-            double maxd = 
-                fabs(myColorVoxels->GetX()) > fabs(myColorVoxels->GetY()) ? 
-                fabs(myColorVoxels->GetX()) : fabs(myColorVoxels->GetY());
-            maxd = maxd > fabs(myColorVoxels->GetZ()) ? maxd : fabs(myColorVoxels->GetZ());
-            maxd = maxd > fabs(myColorVoxels->GetX() + myColorVoxels->GetXLen()) ?
-                maxd : fabs(myColorVoxels->GetX() + myColorVoxels->GetXLen());
-            maxd = maxd > fabs(myColorVoxels->GetY() + myColorVoxels->GetYLen()) ?
-                maxd : fabs(myColorVoxels->GetY() + myColorVoxels->GetYLen());
-            maxd = maxd > fabs(myColorVoxels->GetZ() + myColorVoxels->GetZLen()) ?
-                maxd : fabs(myColorVoxels->GetZ() + myColorVoxels->GetZLen());
-            for (int ix = 0; ix < myNbX; ix++)
-            {
-                for (int iy = 0; iy < myNbY; iy++)
-                {
-                    for (int iz = 0; iz < myNbZ; iz++)
-                    {
-                        unsigned char value = myColorVoxels->Get(ix, iy, iz);
-                        if (value)
-                        {
-                            double xc, yc, zc, xd, yd, zd;
-                            myColorVoxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            xd = fabs(xc);
-                            yd = fabs(yc);
-                            zd = fabs(zc);
-                            double mind = xd < yd ? xd : yd;
-                            mind = zd < mind ? zd : mind;
-                            value = unsigned char(15.0 * (maxd - mind) / maxd);
-                            if (value <= 0)
-                                value = 1;
-                            myColorVoxels->Set(ix, iy, iz, value);
-                        }
-                    }
-                }
-            }
-
-            myViewer->getSelector().SetVoxels(*myColorVoxels);
-            break;
-        }
-    }
-
-    myViewer->getIC()->EraseAll(false, false);
-
-    Voxel_DS* ds = myBoolVoxels;
-    if (!ds)
-        ds = myColorVoxels;
-    if (ds)
-    {
-        myDisplayedXMin = ds->GetX() - 10.0 * Precision::Confusion();
-        myDisplayedXMax = ds->GetX() + ds->GetXLen() + 10.0 * Precision::Confusion();
-        myDisplayedYMin = ds->GetY() - 10.0 * Precision::Confusion();
-        myDisplayedYMax = ds->GetY() + ds->GetYLen() + 10.0 * Precision::Confusion();
-        myDisplayedZMin = ds->GetZ() - 10.0 * Precision::Confusion();
-        myDisplayedZMax = ds->GetZ() + ds->GetZLen() + 10.0 * Precision::Confusion();
-    }
-
-    // Init visual data
-    initPrs();
-
-    // Set voxels and display
-    Handle(Poly_Triangulation) empty;
-    myVoxels->SetBoolVoxels(myBoolVoxels);
-       myVoxels->SetColorVoxels(myColorVoxels);
-    myVoxels->SetTriangulation(empty);
-    if (myViewer->getIC()->IsDisplayed(myVoxels))
-        myViewer->getIC()->Redisplay(myVoxels, false);
-    else
-           myViewer->getIC()->Display(myVoxels, false);
-    
-    // Color scale
-    if (myColorVoxels)
-        displayColorScale();
-    else
-        myViewer->getView()->ColorScaleErase();
-
-       myViewer->getView()->FitAll();
-}
-
-void Application::setNbX()
-{
-       bool ok;
-       myNbX = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbX,
-                                                                                                                1, 100000, 1, &ok);
-}
-
-void Application::setNbY()
-{
-       bool ok;
-       myNbY = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbY,
-                                                                                                                1, 100000, 1, &ok);
-}
-
-void Application::setNbZ()
-{
-       bool ok;
-       myNbZ = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Number of splits in X-direction:", myNbZ,
-                                                                                                                1, 100000, 1, &ok);
-}
-
-void Application::setColorMinValue()
-{
-       bool ok;
-       myColorMinValue = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Minimum value for color [0 .. 15]:", myColorMinValue,
-                                                                0, 15, 1, &ok);
-    if (!myVoxels.IsNull())
-        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
-}
-
-void Application::setColorMaxValue()
-{
-       bool ok;
-       myColorMaxValue = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Maximum value for color [0 .. 15]:", myColorMaxValue,
-                                                                0, 15, 1, &ok);
-    if (!myVoxels.IsNull())
-        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
-}
-
-void Application::setUsageOfGLlists()
-{
-    int res = QMessageBox::question( this, "Voxel demo-application", "Press Yes to use GL lists and No not to use them.", QMessageBox::Yes, QMessageBox::No);
-    if (!myVoxels.IsNull())
-        myVoxels->SetUsageOfGLlists(res == QMessageBox::Yes);
-}
-
-void Application::setDisplayedXMin()
-{
-       myDisplayedXMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum X value:", myDisplayedXMin);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setDisplayedXMax()
-{
-       myDisplayedXMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum X value:", myDisplayedXMax);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setDisplayedYMin()
-{
-       myDisplayedYMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum Y value:", myDisplayedYMin);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setDisplayedYMax()
-{
-       myDisplayedYMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum Y value:", myDisplayedYMax);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setDisplayedZMin()
-{
-       myDisplayedZMin = QInputDialog::getDouble(this, "Voxel demo-application", "Minimum Z value:", myDisplayedZMin);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setDisplayedZMax()
-{
-       myDisplayedZMax = QInputDialog::getDouble(this, "Voxel demo-application", "Maximum Z value:", myDisplayedZMax);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetSizeRange(myDisplayedXMin, myDisplayedXMax,
-                               myDisplayedYMin, myDisplayedYMax,
-                               myDisplayedZMin, myDisplayedZMax);
-    }
-}
-
-void Application::setScanSide()
-{
-       myScanSide = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Side of scanning (1: +X side, 2: +Y side, 3: +Z side, 4: +X & +Y sides, .. 7: +X, +Y,& +Z sides):", 
-                                 myScanSide, 1, 7, 1);
-}
-
-void Application::setVolumicBoolValue()
-{
-       myVolumicBoolValue = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Volumic value on voxelization [0 .. 1]:", 
-                                 myVolumicBoolValue, 0, 1, 1);
-}
-
-void Application::setVolumicColorValue()
-{
-       myVolumicColorValue = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Volumic value on voxelization [0 .. 15]:", 
-                                 myVolumicColorValue, 0, 15, 1);
-}
-
-void Application::setQuadrangleSize()
-{
-       myQuadrangleSize = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Size of quadrangles (0% .. 100%):", 
-                                 myQuadrangleSize, 1, 100, 10);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetQuadrangleSize(myQuadrangleSize);
-    }
-}
-
-void Application::setPointSize()
-{
-       myPointSize = 
-               QInputDialog::getInteger(this, "Voxel demo-application", "Size of points (1 .. 10):", 
-                                 myPointSize, 1, 10, 1);
-    if (!myVoxels.IsNull())
-    {
-        myVoxels->SetPointSize(myPointSize);
-    }
-}
-
-void Application::display(Voxel_VoxelDisplayMode mode)
-{
-    if (myVoxels.IsNull() || !myViewer->getIC()->IsDisplayed(myVoxels))
-    {
-               QMessageBox::warning( this, "Voxel demo-application", "Voxels are not displayed");
-               return;
-       }
-
-    myVoxels->SetDisplayMode(mode);
-
-    if (myColorVoxels)
-        displayColorScale();
-    else
-        myViewer->getView()->ColorScaleErase();
-
-    myViewer->getIC()->Redisplay(myVoxels, true);
-}
-
-void Application::displayPoints()
-{
-    display(Voxel_VDM_POINTS);
-}
-
-void Application::displayNearestPoints()
-{
-    display(Voxel_VDM_NEARESTPOINTS);
-}
-
-void Application::displayBoxes()
-{
-    display(Voxel_VDM_BOXES);
-}
-
-void Application::displayNearestBoxes()
-{
-    display(Voxel_VDM_NEARESTBOXES);
-}
-
-void Application::displayColorScale()
-{
-       Handle(Aspect_ColorScale) color_scale = myViewer->getView()->ColorScale();
-       if (!color_scale.IsNull())
-       {
-        int nb_colors = 1<<4 /* 4 bits */;
-        color_scale->SetRange(0, nb_colors - 1);
-        color_scale->SetNumberOfIntervals(nb_colors);
-               color_scale->SetPosition(0.01, 0.5 - 0.01);
-               color_scale->SetSize(0.5 - 0.01, 0.5 - 0.01);
-       }
-    myViewer->getView()->ColorScaleDisplay();
-}
-
-void Application::displayWaves()
-{
-    myViewer->getIC()->EraseAll(false, false);
-
-    // Make voxels
-    if (myBoolVoxels)
-    {
-        delete myBoolVoxels;
-        myBoolVoxels = 0;
-    }
-    if (myColorVoxels)
-        delete myColorVoxels;
-
-    int nbx = 500, nby = 50, nbz = 50;
-    double xlen = 100.0, ylen = 100.0, zlen = 20.0;
-    double dx = xlen / (double) nbx, dy = ylen / (double) nby, dz = zlen / (double) nbz;
-    myColorVoxels = new Voxel_ColorDS(0.0, 0.0, 0.0, xlen, ylen, zlen, nbx, nby, nbz);
-
-    // Initial state - no colors
-    int ix, iy, iz;
-    for (ix = 0; ix < nbx; ix++)
-    {
-        for (iy = 0; iy < nby; iy++)
-        {
-            for (iz = 0; iz < nbz; iz++)
-            {
-                myColorVoxels->Set(ix, iy, iz, 0);
-            }
-        }
-    }
-
-    // Init visual data
-    initPrs();
-    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
-    myVoxels->SetUsageOfGLlists(false);
-       myVoxels->SetBoolVoxels(myBoolVoxels);
-       myVoxels->SetColorVoxels(myColorVoxels);
-    if (myViewer->getIC()->IsDisplayed(myVoxels))
-        myViewer->getIC()->Redisplay(myVoxels, false);
-    else
-           myViewer->getIC()->Display(myVoxels, false);
-    myViewer->getView()->FitAll();
-
-    // Prepare arrays of values
-    // X&Z values
-    int i = 0, di = 5 /* nb waves */;
-    int* zvalues = new int[nbx];
-    unsigned char* xvalues = new unsigned char[nbx];
-    for (ix = 0; ix < nbx; ix++, i += di)
-    {
-        if (i > nbx || i < 0)
-        {
-            di *= -1;
-            i += di;
-        }
-        double rad = -M_PI / 2.0 + double(i) / (double) nbx * M_PI;
-        double c = cos(rad);
-        xvalues[ix] = 15.0 * c;
-        if (xvalues[ix] == 0)
-            xvalues[ix] = 1;
-        zvalues[ix] = (nbz - 2) * c;
-    }
-
-    // Make waves
-    unsigned char value = 0;
-    for (i = 0; i <= 100; i++)
-    {
-        for (ix = 0; ix < nbx; ix++)
-        {
-            int ixi = ix + i;
-            if (ixi >= nbx)
-                ixi -= nbx;
-            for (iz = 0; iz < nbz; iz++)
-            {
-                value = 0;
-                if (iz < zvalues[ixi])
-                    value = xvalues[ixi];
-                for (iy = 0; iy < nby; iy++)
-                {
-                    myColorVoxels->Set(ix, iy, iz, value);
-                }
-            }
-        }
-        myViewer->getIC()->Redisplay(myVoxels, true);
-        qApp->processEvents();
-    }
-
-    delete[] xvalues;
-    delete[] zvalues;
-}
-
-void Application::initPrs()
-{
-       if (myVoxels.IsNull())
-    {
-               myVoxels = new Voxel_Prs;
-        myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
-        myVoxels->SetColor(Quantity_NOC_WHITE);
-        myVoxels->SetPointSize(1.0);
-        myVoxels->SetSmoothPoints(false);
-        myVoxels->SetQuadrangleSize(myQuadrangleSize);
-        myVoxels->SetColorRange(myColorMinValue, myColorMaxValue);
-        // Colors of ColorDS
-        int nb_colors = 16 /* 4 bits */;
-        Handle(Quantity_HArray1OfColor) colors = new Quantity_HArray1OfColor(0, nb_colors - 1);
-        for (int icolor = 0; icolor < nb_colors; icolor++)
-        {
-            Quantity_Color color;
-            Aspect_ColorScale::FindColor(icolor, 0, nb_colors - 1, nb_colors, color);
-            colors->SetValue(icolor, color);
-        }
-        myVoxels->SetColors(colors);
-        myViewer->setPrs(myVoxels);
-    }
-    else
-    {
-        myViewer->getIC()->RecomputePrsOnly(myVoxels, false);
-    }
-}
-
-void Application::box()
-{
-    gp_Ax2 axes(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1));
-    TopoDS_Shape S = BRepPrimAPI_MakeBox(axes, 100, 100, 100);
-    load(S);
-}
-
-void Application::cylinder()
-{
-    TopoDS_Shape S = BRepPrimAPI_MakeCylinder(50, 100);
-    load(S);
-}
-
-void Application::torus()
-{
-    TopoDS_Shape S = BRepPrimAPI_MakeTorus(100, 20);
-    load(S);
-}
-
-void Application::sphere()
-{
-    TopoDS_Shape S = BRepPrimAPI_MakeSphere(100);
-    load(S);
-}
-
-void Application::load(const TopoDS_Shape& S)
-{
-       myViewer->getIC()->EraseAll(false, false);
-
-    // Delete voxels of previous shape.
-    if (myBoolVoxels)
-    {
-        delete myBoolVoxels;
-        myBoolVoxels = 0;
-    }
-    if (myColorVoxels)
-    {
-        delete myColorVoxels;
-        myColorVoxels = 0;
-    }
-    
-    // Set view size
-    Bnd_Box box;
-    double xmin, ymin, zmin, xmax, ymax, zmax, length = 0;
-    BRepBndLib::Add(S, box);
-    box.Get(xmin, ymin, zmin, xmax, ymax, zmax);
-    length = xmax - xmin > ymax - ymin ? xmax - xmin : ymax - ymin;
-    length = length > zmax - zmin ? length : zmax - zmin;
-    length *= 2.0;
-    myViewer->getView()->SetSize(length);
-    myViewer->getView()->SetZSize(length);
-
-    // Display shape
-       if (myShape.IsNull())
-       {
-               myShape = new AIS_Shape(S);
-               myShape->SetDisplayMode(1);
-        myShape->UnsetSelectionMode();
-       }
-       else
-       {
-               myShape->Set(S);
-        myViewer->getIC()->RecomputePrsOnly(myShape, false);
-       }
-    if (myViewer->getIC()->IsDisplayed(myShape))
-        myViewer->getIC()->Redisplay(myShape, false);
-    else
-           myViewer->getIC()->Display(myShape, false);
-       myViewer->getView()->FitAll();
-}
-
-void Application::displayCut()
-{
-    myViewer->getIC()->EraseAll(false, false);
-
-    // Make a sphere with a lot of toruses, 
-    // cut the toruses from the sphere.
-    TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(100.0);
-    TopoDS_Shape torus1 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt( 80,   0, 20), gp::DZ()), 30, 10);
-    TopoDS_Shape torus2 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(  0,  80, 20), gp::DZ()), 30, 10);
-    TopoDS_Shape torus3 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(-80,   0, 20), gp::DZ()), 30, 10);
-    TopoDS_Shape torus4 = BRepPrimAPI_MakeTorus(gp_Ax2(gp_Pnt(  0, -80, 20), gp::DZ()), 30, 10);
-
-    // Compute bounding box of the shapes
-    Bnd_Box box;
-    BRepBndLib::Add(sphere, box);
-    BRepBndLib::Add(torus1, box);
-    BRepBndLib::Add(torus2, box);
-    BRepBndLib::Add(torus3, box);
-    BRepBndLib::Add(torus4, box);
-
-    // Nullify voxels
-    if (myColorVoxels)
-    {
-        delete myColorVoxels;
-        myColorVoxels = 0;
-    }
-    if (myBoolVoxels)
-    {
-        delete myBoolVoxels;
-        myBoolVoxels = 0;
-    }
-
-    Timer timer;
-    timer.Start();
-
-    // Create a cube of voxels
-    int nbx = 100, nby = 100, nbz = 100;
-    double xmin, ymin, zmin, xmax, ymax, zmax;
-    box.Get(xmin, ymin, zmin, xmax, ymax, zmax);
-    myColorVoxels = new Voxel_ColorDS(xmin, ymin, zmin, 
-                                      xmax - xmin, ymax - ymin, zmax - zmin,
-                                      nbx, nby, nbz);
-    Voxel_ColorDS vtorus(xmin, ymin, zmin, 
-                         xmax - xmin, ymax - ymin, zmax - zmin,
-                         nbx, nby, nbz);
-
-    // Make a cube of voxels for the sphere.
-    int progress;
-    Voxel_FastConverter converter(sphere, *myColorVoxels, 0.1, nbx, nby, nbz);
-    converter.Convert(progress);
-    converter.FillInVolume(15);
-   
-    // Torus 1
-    Voxel_FastConverter converter1(torus1, vtorus, 0.1, nbx, nby, nbz);
-    converter1.Convert(progress);
-    converter1.FillInVolume(3);
-   
-    // Torus 2
-    Voxel_FastConverter converter2(torus2, vtorus, 0.1, nbx, nby, nbz);
-    converter2.Convert(progress);
-    converter2.FillInVolume(7);
-   
-    // Torus 3
-    Voxel_FastConverter converter3(torus3, vtorus, 0.1, nbx, nby, nbz);
-    converter3.Convert(progress);
-    converter3.FillInVolume(10);
-   
-    // Torus 4
-    Voxel_FastConverter converter4(torus4, vtorus, 0.1, nbx, nby, nbz);
-    converter4.Convert(progress);
-    converter4.FillInVolume(12);
-
-    // Cut
-    Voxel_BooleanOperation cutter;
-    cutter.Cut(*myColorVoxels, vtorus);
-
-    // Remove volumic voxels
-    converter.FillInVolume(0);
-
-    timer.Stop();
-    timer.Print("Cut");
-
-    // Display
-    initPrs();
-    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
-    myVoxels->SetUsageOfGLlists(true);
-       myVoxels->SetBoolVoxels(myBoolVoxels);
-       myVoxels->SetColorVoxels(myColorVoxels);
-    if (myViewer->getIC()->IsDisplayed(myVoxels))
-        myViewer->getIC()->Redisplay(myVoxels, false);
-    else
-           myViewer->getIC()->Display(myVoxels, false);
-    myViewer->getView()->FitAll();
-}
-
-void Application::displayCollisions()
-{
-    myViewer->getIC()->EraseAll(false, false);
-
-    // Make a big box with a lot of small spheres inside.
-    double x = 0.0, y = 0.0, z = 0.0, xlen = 100.0, ylen = 100.0, zlen = 100.0, r = 10.0;
-    gp_Pnt P1(x, y, z); // center point of moving sphere (S1).
-    TopoDS_Shape B   = BRepPrimAPI_MakeBox(gp_Pnt(x-r, y-r, z-r), gp_Pnt(xlen+r, ylen+r, zlen+r));
-    TopoDS_Shape S1  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       z),       gp::DZ()), r / 2.0);
-    TopoDS_Shape S2  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       z),       gp::DZ()), r);
-    TopoDS_Shape S3  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       z),       gp::DZ()), r);
-    TopoDS_Shape S4  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., z),       gp::DZ()), r);
-    TopoDS_Shape S5  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., z),       gp::DZ()), r);
-    TopoDS_Shape S6  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., z),       gp::DZ()), r);
-    TopoDS_Shape S7  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    z),       gp::DZ()), r);
-    TopoDS_Shape S8  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    z),       gp::DZ()), r);
-    TopoDS_Shape S9  = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    z),       gp::DZ()), r);
-    TopoDS_Shape S10 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S11 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S12 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S13 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S14 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S15 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S16 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S17 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S18 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    zlen/2.), gp::DZ()), r);
-    TopoDS_Shape S19 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       y,       zlen),    gp::DZ()), r);
-    TopoDS_Shape S20 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., y,       zlen),    gp::DZ()), r);
-    TopoDS_Shape S21 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    y,       zlen),    gp::DZ()), r);
-    TopoDS_Shape S22 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen/2., zlen),    gp::DZ()), r);
-    TopoDS_Shape S23 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen/2., zlen),    gp::DZ()), r);
-    TopoDS_Shape S24 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen/2., zlen),    gp::DZ()), r);
-    TopoDS_Shape S25 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(x,       ylen,    zlen),    gp::DZ()), r);
-    TopoDS_Shape S26 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen/2., ylen,    zlen),    gp::DZ()), r);
-    TopoDS_Shape S27 = BRepPrimAPI_MakeSphere(gp_Ax2(gp_Pnt(xlen,    ylen,    zlen),    gp::DZ()), r);
-
-    // Planes of the big box
-    gp_Ax2 xminusPlane(gp_Pnt(x,    y,    z),    gp::DX());
-    gp_Ax2 xplusPlane (gp_Pnt(xlen, y,    z),    gp::DX());
-    gp_Ax2 yminusPlane(gp_Pnt(x,    y,    z),    gp::DY());
-    gp_Ax2 yplusPlane (gp_Pnt(x,    ylen, z),    gp::DY());
-    gp_Ax2 zminusPlane(gp_Pnt(x,    y,    z),    gp::DZ());
-    gp_Ax2 zplusPlane (gp_Pnt(x,    y,    zlen), gp::DZ());
-
-    // Nullify voxels
-    if (myColorVoxels)
-    {
-        delete myColorVoxels;
-        myColorVoxels = 0;
-    }
-    if (myBoolVoxels)
-    {
-        delete myBoolVoxels;
-        myBoolVoxels = 0;
-    }
-
-    // Prepare visualization
-    initPrs();
-    myVoxels->SetDisplayMode(Voxel_VDM_POINTS);
-    myVoxels->SetColor(Quantity_NOC_RED);
-    myVoxels->SetPointSize(4);
-    myVoxels->SetSmoothPoints(false);
-    myVoxels->SetUsageOfGLlists(false);
-       myVoxels->SetColorVoxels(myColorVoxels);
-
-    // Display all shapes
-    double transparency = 0.9;
-    Handle(AIS_Shape) aisB   = new AIS_Shape(B);
-    Handle(AIS_Shape) aisS1  = new AIS_Shape(S1);
-    Handle(AIS_Shape) aisS2  = new AIS_Shape(S2);
-    Handle(AIS_Shape) aisS3  = new AIS_Shape(S3);
-    Handle(AIS_Shape) aisS4  = new AIS_Shape(S4);
-    Handle(AIS_Shape) aisS5  = new AIS_Shape(S5);
-    Handle(AIS_Shape) aisS6  = new AIS_Shape(S6);
-    Handle(AIS_Shape) aisS7  = new AIS_Shape(S7);
-    Handle(AIS_Shape) aisS8  = new AIS_Shape(S8);
-    Handle(AIS_Shape) aisS9  = new AIS_Shape(S9);
-    Handle(AIS_Shape) aisS10 = new AIS_Shape(S10);
-    Handle(AIS_Shape) aisS11 = new AIS_Shape(S11);
-    Handle(AIS_Shape) aisS12 = new AIS_Shape(S12);
-    Handle(AIS_Shape) aisS13 = new AIS_Shape(S13);
-    Handle(AIS_Shape) aisS14 = new AIS_Shape(S14);
-    Handle(AIS_Shape) aisS15 = new AIS_Shape(S15);
-    Handle(AIS_Shape) aisS16 = new AIS_Shape(S16);
-    Handle(AIS_Shape) aisS17 = new AIS_Shape(S17);
-    Handle(AIS_Shape) aisS18 = new AIS_Shape(S18);
-    Handle(AIS_Shape) aisS19 = new AIS_Shape(S19);
-    Handle(AIS_Shape) aisS20 = new AIS_Shape(S20);
-    Handle(AIS_Shape) aisS21 = new AIS_Shape(S21);
-    Handle(AIS_Shape) aisS22 = new AIS_Shape(S22);
-    Handle(AIS_Shape) aisS23 = new AIS_Shape(S23);
-    Handle(AIS_Shape) aisS24 = new AIS_Shape(S24);
-    Handle(AIS_Shape) aisS25 = new AIS_Shape(S25);
-    Handle(AIS_Shape) aisS26 = new AIS_Shape(S26);
-    Handle(AIS_Shape) aisS27 = new AIS_Shape(S27);
-    aisS1-> SetDisplayMode(1);
-    aisS2-> SetDisplayMode(1);
-    aisS3-> SetDisplayMode(1);
-    aisS4-> SetDisplayMode(1);
-    aisS5-> SetDisplayMode(1);
-    aisS6-> SetDisplayMode(1);
-    aisS7-> SetDisplayMode(1);
-    aisS8-> SetDisplayMode(1);
-    aisS9-> SetDisplayMode(1);
-    aisS10->SetDisplayMode(1);
-    aisS11->SetDisplayMode(1);
-    aisS12->SetDisplayMode(1);
-    aisS13->SetDisplayMode(1);
-    aisS14->SetDisplayMode(1);
-    aisS15->SetDisplayMode(1);
-    aisS16->SetDisplayMode(1);
-    aisS17->SetDisplayMode(1);
-    aisS18->SetDisplayMode(1);
-    aisS19->SetDisplayMode(1);
-    aisS20->SetDisplayMode(1);
-    aisS21->SetDisplayMode(1);
-    aisS22->SetDisplayMode(1);
-    aisS23->SetDisplayMode(1);
-    aisS24->SetDisplayMode(1);
-    aisS25->SetDisplayMode(1);
-    aisS26->SetDisplayMode(1);
-    aisS27->SetDisplayMode(1);
-    aisB->  UnsetSelectionMode();
-    aisS1-> UnsetSelectionMode();
-    aisS2-> UnsetSelectionMode();
-    aisS3-> UnsetSelectionMode();
-    aisS4-> UnsetSelectionMode();
-    aisS5-> UnsetSelectionMode();
-    aisS6-> UnsetSelectionMode();
-    aisS7-> UnsetSelectionMode();
-    aisS8-> UnsetSelectionMode();
-    aisS9-> UnsetSelectionMode();
-    aisS10->UnsetSelectionMode();
-    aisS11->UnsetSelectionMode();
-    aisS12->UnsetSelectionMode();
-    aisS13->UnsetSelectionMode();
-    aisS14->UnsetSelectionMode();
-    aisS15->UnsetSelectionMode();
-    aisS16->UnsetSelectionMode();
-    aisS17->UnsetSelectionMode();
-    aisS18->UnsetSelectionMode();
-    aisS19->UnsetSelectionMode();
-    aisS20->UnsetSelectionMode();
-    aisS21->UnsetSelectionMode();
-    aisS22->UnsetSelectionMode();
-    aisS23->UnsetSelectionMode();
-    aisS24->UnsetSelectionMode();
-    aisS25->UnsetSelectionMode();
-    aisS26->UnsetSelectionMode();
-    aisS27->UnsetSelectionMode();
-    aisS1-> SetTransparency(2.0 * transparency / 3.0);
-    aisS2-> SetTransparency(transparency);
-    aisS3-> SetTransparency(transparency);
-    aisS4-> SetTransparency(transparency);
-    aisS5-> SetTransparency(transparency);
-    aisS6-> SetTransparency(transparency);
-    aisS7-> SetTransparency(transparency);
-    aisS8-> SetTransparency(transparency);
-    aisS9-> SetTransparency(transparency);
-    aisS10->SetTransparency(transparency);
-    aisS11->SetTransparency(transparency);
-    aisS12->SetTransparency(transparency);
-    aisS13->SetTransparency(transparency);
-    aisS14->SetTransparency(transparency);
-    aisS15->SetTransparency(transparency);
-    aisS16->SetTransparency(transparency);
-    aisS17->SetTransparency(transparency);
-    aisS18->SetTransparency(transparency);
-    aisS19->SetTransparency(transparency);
-    aisS20->SetTransparency(transparency);
-    aisS21->SetTransparency(transparency);
-    aisS22->SetTransparency(transparency);
-    aisS23->SetTransparency(transparency);
-    aisS24->SetTransparency(transparency);
-    aisS25->SetTransparency(transparency);
-    aisS26->SetTransparency(transparency);
-    aisS27->SetTransparency(transparency);
-    myViewer->getIC()->Display(aisB, false);
-    myViewer->getIC()->Display(aisS1, false);
-    myViewer->getIC()->Display(aisS2, false);
-    myViewer->getIC()->Display(aisS3, false);
-    myViewer->getIC()->Display(aisS4, false);
-    myViewer->getIC()->Display(aisS5, false);
-    myViewer->getIC()->Display(aisS6, false);
-    myViewer->getIC()->Display(aisS7, false);
-    myViewer->getIC()->Display(aisS8, false);
-    myViewer->getIC()->Display(aisS9, false);
-    myViewer->getIC()->Display(aisS10, false);
-    myViewer->getIC()->Display(aisS11, false);
-    myViewer->getIC()->Display(aisS12, false);
-    myViewer->getIC()->Display(aisS13, false);
-    myViewer->getIC()->Display(aisS14, false);
-    myViewer->getIC()->Display(aisS15, false);
-    myViewer->getIC()->Display(aisS16, false);
-    myViewer->getIC()->Display(aisS17, false);
-    myViewer->getIC()->Display(aisS18, false);
-    myViewer->getIC()->Display(aisS19, false);
-    myViewer->getIC()->Display(aisS20, false);
-    myViewer->getIC()->Display(aisS21, false);
-    myViewer->getIC()->Display(aisS22, false);
-    myViewer->getIC()->Display(aisS23, false);
-    myViewer->getIC()->Display(aisS24, false);
-    myViewer->getIC()->Display(aisS25, false);
-    myViewer->getIC()->Display(aisS26, false);
-    myViewer->getIC()->Display(aisS27, false);
-
-    // Prepare computer of collisions
-    double deflection = 0.1;
-    int nbx = 100, nby = 100, nbz = 100;
-    
-    Voxel_CollisionDetection coldet(deflection, nbx, nby, nbz);
-    coldet.SetUsageOfVolume(false);
-    coldet.KeepCollisions(false);
-    coldet.AddShape(S1);
-    coldet.AddShape(S2);
-    coldet.AddShape(S3);
-    coldet.AddShape(S4);
-    coldet.AddShape(S5);
-    coldet.AddShape(S6);
-    coldet.AddShape(S7);
-    coldet.AddShape(S8);
-    coldet.AddShape(S9);
-    coldet.AddShape(S10);
-    coldet.AddShape(S11);
-    coldet.AddShape(S12);
-    coldet.AddShape(S13);
-    coldet.AddShape(S14);
-    coldet.AddShape(S15);
-    coldet.AddShape(S16);
-    coldet.AddShape(S17);
-    coldet.AddShape(S18);
-    coldet.AddShape(S19);
-    coldet.AddShape(S20);
-    coldet.AddShape(S21);
-    coldet.AddShape(S22);
-    coldet.AddShape(S23);
-    coldet.AddShape(S24);
-    coldet.AddShape(S25);
-    coldet.AddShape(S26);
-    coldet.AddShape(S27);
-    //coldet.AddShape(BRepPrimAPI_MakeBox(gp_Pnt(x, y, z), gp_Pnt(xlen, ylen, zlen)));
-    
-    Bnd_Box box;
-    BRepBndLib::Add(B, box);
-    coldet.SetBoundaryBox(box);
-
-    coldet.Voxelize();
-
-    // Move one of the spheres inside the box
-    // and compute collisions
-    gp_Trsf trsf;
-    gp_Vec vmove(1, 0.5, 0.25);
-
-    int imove = 0, nb_moves = 900;
-    while (imove < nb_moves)
-    {
-        // Move
-        trsf.SetTranslation(vmove);
-        TopLoc_Location loc(trsf);
-        S1.Move(loc);
-        P1.Translate(vmove);
-        
-        // Check whether S1 is inside the big box
-        // Detect the plane S1 touches to.
-        if (P1.X() < x)
-            vmove.Mirror(xminusPlane);
-        else if (P1.X() > xlen)
-            vmove.Mirror(xplusPlane);
-        else if (P1.Y() < y)
-            vmove.Mirror(yminusPlane);
-        else if (P1.Y() > ylen)
-            vmove.Mirror(yplusPlane);
-        else if (P1.Z() < z)
-            vmove.Mirror(zminusPlane);
-        else if (P1.Z() > zlen)
-            vmove.Mirror(zplusPlane);
-
-        // Compute collisions
-        coldet.ReplaceShape(1, S1);
-        coldet.Voxelize(1); // only the first sphere (S1)
-        coldet.Compute();
-        myBoolVoxels = &((Voxel_BoolDS&) coldet.GetCollisions());
-
-        // Redisplay S1
-        aisS1->Set(S1);
-        myViewer->getIC()->Redisplay(aisS1, false);
-
-        // Display the collisions
-        myVoxels->SetBoolVoxels(myBoolVoxels);
-        if (myViewer->getIC()->IsDisplayed(myVoxels))
-            myViewer->getIC()->Redisplay(myVoxels, true);
-        else
-        {
-               myViewer->getIC()->Display(myVoxels, false);
-            myViewer->getView()->FitAll();
-        }
-
-        imove++;
-        qApp->processEvents();
-    }
-
-    // Copy the result of collision detection
-    int ix, iy, iz;
-    myBoolVoxels = new Voxel_BoolDS(coldet.GetCollisions().GetX(), 
-                                    coldet.GetCollisions().GetY(), 
-                                    coldet.GetCollisions().GetZ(), 
-                                    coldet.GetCollisions().GetXLen(), 
-                                    coldet.GetCollisions().GetYLen(), 
-                                    coldet.GetCollisions().GetZLen(), 
-                                    nbx, nby, nbz);
-    for (ix = 0; ix < nbx; ix++)
-    {
-        for (iy = 0; iy < nby; iy++)
-        {
-            for (iz = 0; iz < nbz; iz++)
-            {
-                if (coldet.GetCollisions().Get(ix, iy, iz))
-                    myBoolVoxels->Set(ix, iy, iz, Standard_True);
-            }
-        }
-    }
-    myVoxels->SetBoolVoxels(myBoolVoxels);
-}
\ No newline at end of file
diff --git a/samples/qt/voxeldemo/src/ConversionThread.cpp b/samples/qt/voxeldemo/src/ConversionThread.cpp
deleted file mode 100755 (executable)
index 6fee824..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "ConversionThread.h"
-
-ConversionThread::ConversionThread():QThread(),
-/*myConverter(0),*/myFastConverter(0),
-myVolumicValue(0),myScanSide(1),
-myThreadIndex(1)
-{
-
-}
-
-ConversionThread::~ConversionThread()
-{
-
-}
-
-/*
-void ConversionThread::setConverter(Voxel_Converter* converter)
-{
-    myConverter = converter;
-    myFastConverter = 0;
-}
-*/
-
-void ConversionThread::setConverter(Voxel_FastConverter* converter)
-{
-    myFastConverter = converter;
-    //myConverter = 0;
-}
-
-void ConversionThread::setVolumicValue(const int value)
-{
-    myVolumicValue = value;
-}
-
-void ConversionThread::setScanSide(const int side)
-{
-    myScanSide = side;
-}
-
-void ConversionThread::setThreadIndex(const int ithread)
-{
-    myThreadIndex = ithread;
-}
-
-int* ConversionThread::getProgress()
-{
-    return &myProgress;
-}
-
-void ConversionThread::run()
-{
-    if (/*!myConverter && */!myFastConverter)
-        return;
-    //if (myConverter)
-    //    myConverter->Convert(myProgress, myVolumicValue, myScanSide, myThreadIndex);
-    //else
-        myFastConverter->Convert(myProgress, myThreadIndex);
-}
diff --git a/samples/qt/voxeldemo/src/Main.cpp b/samples/qt/voxeldemo/src/Main.cpp
deleted file mode 100755 (executable)
index e5f9175..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <qapplication.h>
-#include "application.h"
-
-int main( int argc, char ** argv ) 
-{
-    QApplication a( argc, argv );
-
-    Application *w = new Application();
-    w->setWindowTitle( "Voxel demo-application" );
-    w->show();
-    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
-    return a.exec();
-}
diff --git a/samples/qt/voxeldemo/src/Timer.cpp b/samples/qt/voxeldemo/src/Timer.cpp
deleted file mode 100755 (executable)
index d8a3f3e..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// Timer.cpp: implementation of the Timer class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "Timer.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-Timer::Timer():myWriter(0) {}
-
-Timer::Timer(const char* filename)
-{
-       myWriter = fopen(filename, "a");
-}
-
-Timer::~Timer()
-{
-       if (myWriter)
-               fclose(myWriter);
-}
-
-void Timer::Start() {
-       myTimer.Reset();
-       myTimer.Start();
-}
-
-void Timer::Stop() {
-       myTimer.Stop();
-}
-
-void Timer::Continue() {
-       myTimer.Start();
-}
-
-void Timer::Reset() {
-       myTimer.Reset();
-}
-
-float Timer::Seconds() {
-  Standard_Real sec, cpu;
-  Standard_Integer minutes, hours;
-  myTimer.Show(sec, minutes, hours, cpu);
-  return (float) sec;
-}
-
-int Timer::Minutes() {
-  Standard_Real sec, cpu;
-  Standard_Integer minutes, hours;
-  myTimer.Show(sec, minutes, hours, cpu);
-  return minutes;
-}
-
-void Timer::Print(char* label) {
-       Standard_Real seconds, cpu;
-       Standard_Integer minutes, hours;
-       myTimer.Show(seconds, minutes, hours, cpu);
-       if (myWriter)
-       {
-               fprintf(myWriter, "%s took %d minutes %g seconds\n", label, minutes, seconds);
-       }
-       else
-       {
-               cout<<label<<" took "<<minutes<<" minutes, "<<seconds<<" seconds"<<endl;
-       }
-}
\ No newline at end of file
diff --git a/samples/qt/voxeldemo/src/Viewer.cpp b/samples/qt/voxeldemo/src/Viewer.cpp
deleted file mode 100755 (executable)
index d0304bf..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-#include "Viewer.h"
-#include "Timer.h"
-
-#include <QApplication.h>
-#include <QCursor.h>
-#include <QMessagebox.h>
-
-#include <QMouseEvent>
-
-#include <WNT_Window.hxx>
-#include <Graphic3d_WNTGraphicDevice.hxx>
-
-#include <Voxel_Prs.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-
-static Handle(Graphic3d_WNTGraphicDevice) device;
-
-Viewer::Viewer(QWidget* parent):QWidget(parent)
-{
-    if(device.IsNull())
-        device = new Graphic3d_WNTGraphicDevice();
-    
-               Handle(V3d_Viewer) aViewer = new V3d_Viewer(device, TCollection_ExtendedString("Visu3D").ToExtString(), "",
-                                                1000, V3d_XposYnegZpos,
-                                                Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT,
-                                                true, true, V3d_TEX_NONE);
-    aViewer->Init();
-
-       aViewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK);
-
-    myView = aViewer->CreateView();
-    myIC = new AIS_InteractiveContext(aViewer);
-    myIC->SetDeviationCoefficient(1.e-3);
-
-    int       windowHandle = (int) winId();
-    short     hi, lo;
-
-    lo = (short) windowHandle;
-    hi = (short) (windowHandle >> 16);
-    Handle(WNT_Window) hWnd =
-        new WNT_Window(Handle(Graphic3d_WNTGraphicDevice)::DownCast(aViewer->Device()), (int) hi, (int) lo);
-
-    myView->SetWindow(hWnd);
-    if(!hWnd->IsMapped())
-        hWnd->Map();
-
-    myView->MustBeResized();
-    myView->SetSurfaceDetail(V3d_TEX_NONE);
-    myView->SetTransparency(Standard_True);
-    myView->SetSize(10000.0);
-    myView->SetZSize(10000.0);
-    myView->SetViewMappingDefault();
-
-    myZoom = false;
-    myPan = false;
-    myRotate = false;
-    setMouseTracking(true);
-
-    setMinimumSize(400, 200);
-    
-    myView->ZBufferTriedronSetup();
-    myView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_BLACK, 0.1, V3d_ZBUFFER);
-
-    mySelector.Init(myView);
-
-       setBackgroundRole( QPalette::NoRole );//NoBackground );
-       // set focus policy to threat QContextMenuEvent from keyboard  
-       setFocusPolicy( Qt::StrongFocus );
-       setAttribute( Qt::WA_PaintOnScreen );
-       setAttribute( Qt::WA_NoSystemBackground );
-}
-
-Viewer::~Viewer()
-{
-
-}
-
-void Viewer::paintEvent(QPaintEvent * pEvent)
-{
-    if (!myView.IsNull())
-        myView->Redraw();
-}
-
-
-/*!
-  Get paint engine for the OpenGL viewer. [ virtual public ]
-*/
-QPaintEngine* Viewer::paintEngine() const
-{
-  return 0;
-}
-
-void Viewer::resizeEvent(QResizeEvent * e)
-{
-    if (!myView.IsNull())
-    {
-        myView->MustBeResized();
-    }
-}
-
-void Viewer::mousePressEvent(QMouseEvent * mpEvent)
-{
-    // Memorize start point
-    myStartPnt.setX(mpEvent->x());
-    myStartPnt.setY(mpEvent->y());
-    
-    // Inform IC that the mouse cursor is at the point
-    myIC->MoveTo(myStartPnt.x(), myStartPnt.y(), myView);
-
-    // In case of rotation, define the start rotation point
-    if ((mpEvent->modifiers() & Qt::ControlModifier) && (mpEvent->buttons() & Qt::RightButton))
-    {
-        myView->StartRotation(myStartPnt.x(), myStartPnt.y());
-    }
-
-    // Start degenerate mode
-    setDegenerateMode(true);
-
-    emit mousePressed(mpEvent->modifiers(), mpEvent->x(), mpEvent->y());
-}
-
-void Viewer::mouseMoveEvent(QMouseEvent * mmEvent)
-{
-    QPoint currentPnt(mmEvent->x(), mmEvent->y());
-
-    if (mmEvent->modifiers() & Qt::ControlModifier)
-    {
-        if (mmEvent->buttons() & Qt::LeftButton)
-        {
-            myView->Zoom(myStartPnt.x(), myStartPnt.y(), currentPnt.x(), currentPnt.y());
-            myStartPnt = currentPnt;
-        }
-        else if (mmEvent->buttons() & Qt::MidButton)
-        {
-            myView->Pan(currentPnt.x() - myStartPnt.x(), myStartPnt.y() - currentPnt.y());
-            myStartPnt = currentPnt;
-        }
-        else if (mmEvent->buttons() & Qt::RightButton)
-        {
-            myView->Rotation(currentPnt.x(), currentPnt.y());
-        }
-    }
-    else
-    {
-        myIC->MoveTo(currentPnt.x(), currentPnt.y(), myView);
-    }
-
-    emit mouseMoved(mmEvent->modifiers(), currentPnt.x(), currentPnt.y());
-}
-
-void Viewer::mouseReleaseEvent(QMouseEvent * mrEvent)
-{
-    if(mrEvent->button() == Qt::LeftButton)
-    {
-        if(!myZoom && !myPan && !myRotate)
-        {
-            if(mrEvent->modifiers() & Qt::ShiftModifier)
-                myIC->ShiftSelect();
-            else
-                myIC->Select();
-
-            // Select a voxel
-            int ix = -1, iy = -1, iz = -1;
-            bool detected = mySelector.Detect(mrEvent->x(), mrEvent->y(), ix, iy, iz);
-            if (detected)
-            {
-                cout<<"("<<ix<<", "<<iy<<", "<<iz<<")"<<endl;
-            }
-            if (!myPrs.IsNull())
-                myPrs->Highlight(ix, iy, iz);
-        }
-    }
-    else if(mrEvent->button() == Qt::RightButton)
-    {
-        // Popup menu:
-
-    
-       }
-
-    // Finish degenerate mode
-    setDegenerateMode(false);
-    
-    emit mouseReleased(mrEvent->modifiers(), mrEvent->x(), mrEvent->y());
-}
-
-void Viewer::mouseDoubleClickEvent(QMouseEvent * mdcEvent)
-{
-    emit mouseDoubleClick(mdcEvent->modifiers(), mdcEvent->x(), mdcEvent->y());
-}
-
-void Viewer::setDegenerateMode(const bool on)
-{
-    AIS_ListOfInteractive displayed;
-    myIC->DisplayedObjects(displayed);
-    AIS_ListIteratorOfListOfInteractive itri(displayed);
-    for (; itri.More(); itri.Next())
-    {
-        if (itri.Value()->DynamicType() == STANDARD_TYPE(Voxel_Prs))
-        {
-            Handle(Voxel_Prs) prs = Handle(Voxel_Prs)::DownCast(itri.Value());
-            prs->SetDegenerateMode(on);
-            myView->Redraw();
-            break;
-        }
-    }
-}
index db96db53359d9e9442d6ab06fb472d4ba0abc1b0..a34ff23b5c78b348dd4ccb87ecd3bbd48f669e55 100755 (executable)
@@ -35,7 +35,6 @@ proc Visualization:ressources { } {
     return [list \
           [list both r FontMFT {}] \
           [list both r Textures {}] \
-          [list both n VoxelClient {}] \
            ]
 }
 ;#
diff --git a/src/VoxelClient/FILES b/src/VoxelClient/FILES
deleted file mode 100755 (executable)
index 4ad113e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-VoxelClient_VisDrawer.h
-VoxelClient_VisDrawer.cxx
diff --git a/src/VoxelClient/VoxelClient_VisDrawer.cxx b/src/VoxelClient/VoxelClient_VisDrawer.cxx
deleted file mode 100755 (executable)
index 88497ec..0000000
+++ /dev/null
@@ -1,3376 +0,0 @@
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-#include "VoxelClient_VisDrawer.h"
-
-#include <ElSLib.hxx>
-#include <gp_Dir.hxx>
-#include <Geom_Plane.hxx>
-#include <gce_MakePln.hxx>
-#include <Quantity_Color.hxx>
-#include <Aspect_TypeOfLine.hxx>
-#include <Graphic3d_CUserDraw.hxx>
-
-#include <InterfaceGraphic_telem.hxx>
-#include <OpenGl_Element.hxx>
-#include <OpenGl_GraphicDriver.hxx>
-#include <OpenGl_NamedStatus.hxx>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-/**************************************************************************/
-
-class VoxelClient_VisDrawer::VisElement : public OpenGl_Element
-{
-public:
-
-  VisElement (Voxel_VisData*);
-  virtual ~VisElement();
-
-  void EvaluateBounds (Graphic3d_CBounds& theMinMax);
-
-  void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
-
-  virtual void Release (const Handle(OpenGl_Context)& theContext)
-  {
-    //
-  }
-
-private:
-
-  VoxelClient_VisDrawer* myHandler;
-
-public:
-
-  DEFINE_STANDARD_ALLOC
-
-};
-
-//=======================================================================
-//function : VisElement
-//purpose  : Constructor
-//=======================================================================
-
-VoxelClient_VisDrawer::VisElement::VisElement (Voxel_VisData* theData)
-{
-  myHandler = new VoxelClient_VisDrawer (theData);
-}
-
-//=======================================================================
-//function : ~VisElement
-//purpose  : Destructor
-//=======================================================================
-
-VoxelClient_VisDrawer::VisElement::~VisElement ()
-{
-  delete myHandler;
-}
-
-//=======================================================================
-//function : EvaluateBounds
-//purpose  :
-//=======================================================================
-
-void VoxelClient_VisDrawer::VisElement::EvaluateBounds
-  (Graphic3d_CBounds& theMinMax)
-{
-  myHandler->EvalMinMax (theMinMax);
-}
-
-//=======================================================================
-//function : Render
-//purpose  : display element
-//=======================================================================
-
-void VoxelClient_VisDrawer::VisElement::Render
-  (const Handle (OpenGl_Workspace) &theWorkspace) const
-{
-  const Standard_Boolean aHl = (theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT);
-  myHandler->Display (aHl);
-}
-
-//=======================================================================
-//function : VisDrawerCallBack
-//purpose  : visdrawer element create callback, adds an element to graphic
-//           driver's structure
-//=======================================================================
-
-static OpenGl_Element* VisDrawerCallBack (const Graphic3d_CUserDraw* theUserDraw)
-{
-  if (theUserDraw == 0)
-    return 0;
-
-  // Retrieve the user structure
-  Voxel_VisData* aUserData = (Voxel_VisData*) (theUserDraw->Data);
-
-  if (aUserData == 0)
-    return 0;
-
-  VoxelClient_VisDrawer::VisElement *aElem = 
-    new VoxelClient_VisDrawer::VisElement (aUserData);
-
-  if (theUserDraw->Bounds != 0)
-    aElem->EvaluateBounds (*(theUserDraw->Bounds));
-
-  return aElem;
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::Init (Handle(OpenGl_GraphicDriver)& theDriver)
-{
-    static Standard_Boolean isInitializeded(Standard_False);
-
-    if (!isInitializeded)
-    {
-        isInitializeded = Standard_True;
-        theDriver->UserDrawCallback() = VisDrawerCallBack;
-    }
-}
-
-/**************************************************************************/
-VoxelClient_VisDrawer::VoxelClient_VisDrawer(Voxel_VisData * theData):myData(theData)
-{
-
-}
-
-/**************************************************************************/
-VoxelClient_VisDrawer::~VoxelClient_VisDrawer()
-{
-    if (myData)
-    {
-        // Because a pointer to the data is copied, 
-        // it is possible to make an attempt to delete GL lists for
-        // a structure, which is already deleted.
-        // Such a situation may happen on close of the application.
-        // Therefore, this try / catch is used.
-
-        try
-        {
-            Standard_Integer idir;
-
-            // Points
-
-            // BoolDS
-            if (myData->myDisplay.myBoolPointsList > 0)
-            {
-                glDeleteLists(myData->myDisplay.myBoolPointsList, 1);
-                myData->myDisplay.myBoolPointsList = -1;
-            }
-            for (idir = Xminus; idir <= Zplus; idir++)
-            {
-                if (myData->myDisplay.myBoolNearestPointsList[idir] > 0)
-                {
-                    glDeleteLists(myData->myDisplay.myBoolNearestPointsList[idir], 1);
-                    myData->myDisplay.myBoolNearestPointsList[idir] = -1;
-                }
-            }
-
-            // ColorDS
-            if (myData->myDisplay.myColorPointsList > 0)
-            {
-                glDeleteLists(myData->myDisplay.myColorPointsList, 1);
-                myData->myDisplay.myColorPointsList = -1;
-            }
-            for (idir = Xminus; idir <= Zplus; idir++)
-            {
-                if (myData->myDisplay.myColorNearestPointsList[idir] > 0)
-                {
-                    glDeleteLists(myData->myDisplay.myColorNearestPointsList[idir], 1);
-                    myData->myDisplay.myColorNearestPointsList[idir] = -1;
-                }
-            }
-
-            // ROctBoolDS
-            if (myData->myDisplay.myROctBoolPointsList > 0)
-            {
-                glDeleteLists(myData->myDisplay.myROctBoolPointsList, 1);
-                myData->myDisplay.myROctBoolPointsList = -1;
-            }
-            for (idir = Xminus; idir <= Zplus; idir++)
-            {
-                if (myData->myDisplay.myROctBoolNearestPointsList[idir] > 0)
-                {
-                    glDeleteLists(myData->myDisplay.myROctBoolNearestPointsList[idir], 1);
-                    myData->myDisplay.myROctBoolNearestPointsList[idir] = -1;
-                }
-            }
-
-            // Triangulation
-            if (myData->myDisplay.myTriangulationList > 0)
-            {
-                glDeleteLists(myData->myDisplay.myTriangulationList, 1);
-                myData->myDisplay.myTriangulationList = -1;
-            }
-        }
-        catch (...)
-        {
-
-        }
-    }
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::EvalMinMax(Graphic3d_CBounds & theMinMax) const 
-{
-    theMinMax.XMin = FLT_MAX;
-    theMinMax.YMin = FLT_MAX;
-    theMinMax.ZMin = FLT_MAX;
-    theMinMax.XMax = -FLT_MAX;
-    theMinMax.YMax = -FLT_MAX;
-    theMinMax.ZMax = -FLT_MAX;
-    if(!myData)
-        return;
-    if(myData->myBoolVoxels)
-    {
-        if (theMinMax.XMin > myData->myBoolVoxels->GetX())
-               theMinMax.XMin = myData->myBoolVoxels->GetX();
-        if (theMinMax.XMax < myData->myBoolVoxels->GetX() + myData->myBoolVoxels->GetXLen())
-               theMinMax.XMax = myData->myBoolVoxels->GetX() + myData->myBoolVoxels->GetXLen();
-        if (theMinMax.YMin > myData->myBoolVoxels->GetY())
-               theMinMax.YMin = myData->myBoolVoxels->GetY();
-        if (theMinMax.YMax < myData->myBoolVoxels->GetY() + myData->myBoolVoxels->GetYLen())
-               theMinMax.YMax = myData->myBoolVoxels->GetY() + myData->myBoolVoxels->GetYLen();
-        if (theMinMax.ZMin > myData->myBoolVoxels->GetZ())
-               theMinMax.ZMin = myData->myBoolVoxels->GetZ();
-        if (theMinMax.ZMax < myData->myBoolVoxels->GetZ() + myData->myBoolVoxels->GetZLen())
-               theMinMax.ZMax = myData->myBoolVoxels->GetZ() + myData->myBoolVoxels->GetZLen();
-    }
-    if(myData->myColorVoxels)
-    {
-        if (theMinMax.XMin > myData->myColorVoxels->GetX())
-               theMinMax.XMin = myData->myColorVoxels->GetX();
-        if (theMinMax.XMax < myData->myColorVoxels->GetX() + myData->myColorVoxels->GetXLen())
-               theMinMax.XMax = myData->myColorVoxels->GetX() + myData->myColorVoxels->GetXLen();
-        if (theMinMax.YMin > myData->myColorVoxels->GetY())
-               theMinMax.YMin = myData->myColorVoxels->GetY();
-        if (theMinMax.YMax < myData->myColorVoxels->GetY() + myData->myColorVoxels->GetYLen())
-               theMinMax.YMax = myData->myColorVoxels->GetY() + myData->myColorVoxels->GetYLen();
-        if (theMinMax.ZMin > myData->myColorVoxels->GetZ())
-               theMinMax.ZMin = myData->myColorVoxels->GetZ();
-        if (theMinMax.ZMax < myData->myColorVoxels->GetZ() + myData->myColorVoxels->GetZLen())
-               theMinMax.ZMax = myData->myColorVoxels->GetZ() + myData->myColorVoxels->GetZLen();
-    }
-    if(myData->myROctBoolVoxels)
-    {
-        if (theMinMax.XMin > myData->myROctBoolVoxels->GetX())
-               theMinMax.XMin = myData->myROctBoolVoxels->GetX();
-        if (theMinMax.XMax < myData->myROctBoolVoxels->GetX() + myData->myROctBoolVoxels->GetXLen())
-               theMinMax.XMax = myData->myROctBoolVoxels->GetX() + myData->myROctBoolVoxels->GetXLen();
-        if (theMinMax.YMin > myData->myROctBoolVoxels->GetY())
-               theMinMax.YMin = myData->myROctBoolVoxels->GetY();
-        if (theMinMax.YMax < myData->myROctBoolVoxels->GetY() + myData->myROctBoolVoxels->GetYLen())
-               theMinMax.YMax = myData->myROctBoolVoxels->GetY() + myData->myROctBoolVoxels->GetYLen();
-        if (theMinMax.ZMin > myData->myROctBoolVoxels->GetZ())
-               theMinMax.ZMin = myData->myROctBoolVoxels->GetZ();
-        if (theMinMax.ZMax < myData->myROctBoolVoxels->GetZ() + myData->myROctBoolVoxels->GetZLen())
-               theMinMax.ZMax = myData->myROctBoolVoxels->GetZ() + myData->myROctBoolVoxels->GetZLen();
-    }
-    if (!myData->myTriangulation.IsNull())
-    {
-        Standard_Real x, y, z;
-        const TColgp_Array1OfPnt& nodes = myData->myTriangulation->Nodes();
-        Standard_Integer inode = nodes.Lower(), nb_nodes = nodes.Upper();
-        for (; inode <= nb_nodes; inode++)
-        {
-            nodes.Value(inode).Coord(x, y, z);
-            if (theMinMax.XMin > x)
-                   theMinMax.XMin = x;
-            if (theMinMax.XMax < x)
-                   theMinMax.XMax = x;
-            if (theMinMax.YMin > y)
-                   theMinMax.YMin = y;
-            if (theMinMax.YMax < y)
-                   theMinMax.YMax = y;
-            if (theMinMax.ZMin > z)
-                   theMinMax.ZMin = z;
-            if (theMinMax.ZMax < z)
-                   theMinMax.ZMax = z;
-        }
-    }
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::Display(const Standard_Boolean theHighlight)
-{
-    if (!myData)
-        return;
-    if (myData->myBoolVoxels)
-        DisplayVoxels(theHighlight);
-    if (myData->myColorVoxels)
-        DisplayVoxels(theHighlight);
-    if (myData->myROctBoolVoxels)
-        DisplayVoxels(theHighlight);
-    if (!myData->myTriangulation.IsNull())
-        DisplayTriangulation(theHighlight);
-}
-
-// Some static method to define Open GL visual attributes
-// COlor
-static void setColor(const Quantity_Color& color, const Standard_Boolean highlight)
-{
-    static Quantity_Color highlight_color(Quantity_NOC_BLUE1);
-               if(highlight)
-        glColor3f(highlight_color.Red(), highlight_color.Green(), highlight_color.Blue());
-    else
-        glColor3d(color.Red(), color.Green(), color.Blue());
-}
-
-// Type of Line
-static void setTypeOfLine(const Aspect_TypeOfLine type)
-{
-    if(type == Aspect_TOL_SOLID)
-    {
-        glDisable(GL_LINE_STIPPLE);
-    }
-    else
-    {
-        glEnable(GL_LINE_STIPPLE);
-        if(type == Aspect_TOL_DOT)
-            glLineStipple(1, 0xCCCC);
-        else if(type == Aspect_TOL_DASH)
-            glLineStipple(1, 0xFFC0);
-        else if(type == Aspect_TOL_DOTDASH)
-            glLineStipple(1, 0xFF18);
-    }
-}
-
-// Width of Line
-static void setWidthOfLine(const Standard_Integer width)
-{
-    glLineWidth((Standard_ShortReal) width);
-}
-
-// Normal of the view
-static void getNormal(gp_Dir& normal) 
-{
-       Standard_Real x, y, z;
-       GLint viewport[4];
-       GLdouble model_matrix[16], proj_matrix[16];
-
-       glGetDoublev(GL_MODELVIEW_MATRIX,  model_matrix);
-       glGetDoublev(GL_PROJECTION_MATRIX, proj_matrix);
-       glGetIntegerv(GL_VIEWPORT, viewport);
-
-       gluUnProject(viewport[0], viewport[1], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
-       gp_Pnt p1(x, y, z);
-       gluUnProject(viewport[0] + viewport[2], viewport[1], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
-       gp_Pnt p2(x, y, z);
-       gluUnProject(viewport[0], viewport[1] + viewport[3], 0., model_matrix, proj_matrix, viewport, &x, &y, &z);
-       gp_Pnt p3(x, y, z);
-
-       gce_MakePln mkNormal(p1, p2, p3);
-       if (mkNormal.IsDone()) 
-       {
-               const gp_Pln& normal_plane = mkNormal.Value();
-               normal = normal_plane.Axis().Direction();
-       }
-       else
-       {
-               normal = gp::DZ();
-       }
-}
-
-// Normal 2 VoxelDirection converter
-static VoxelDirection getVoxelDirection(const gp_Dir& viewnormal)
-{
-    VoxelDirection vdir;
-       Standard_Real fabsviewnormalx = fabs(viewnormal.X());
-       Standard_Real fabsviewnormaly = fabs(viewnormal.Y());
-       Standard_Real fabsviewnormalz = fabs(viewnormal.Z());
-       if (fabsviewnormalx >= fabsviewnormaly &&
-               fabsviewnormalx >= fabsviewnormalz)
-       {
-               if (viewnormal.X() > 0)
-                       vdir = Xminus;
-               else
-                       vdir = Xplus;
-       }
-       else if (fabsviewnormaly >= fabsviewnormalx &&
-                        fabsviewnormaly >= fabsviewnormalz)
-       {
-               if (viewnormal.Y() > 0)
-                       vdir = Yminus;
-               else
-                       vdir = Yplus;
-       }
-       else if (fabsviewnormalz >= fabsviewnormalx &&
-                        fabsviewnormalz >= fabsviewnormaly)
-       {
-               if (viewnormal.Z() > 0)
-                       vdir = Zminus;
-               else
-                       vdir = Zplus;
-       }
-    return vdir;
-}
-
-// Normal 2 VoxelDirection 3 converter
-static void getVoxel3Directions(const gp_Dir& viewnormal,
-                                VoxelDirection& vdir1,
-                                VoxelDirection& vdir2,
-                                VoxelDirection& vdir3)
-{
-    Standard_Boolean vdir1_set = Standard_False, vdir2_set = Standard_False, vdir3_set = Standard_False;
-
-    // Test X minus
-    Standard_Real dot = viewnormal.Dot(-gp::DX());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Xminus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Xminus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Xminus;
-            vdir3_set = Standard_True;
-        }
-    }
-
-    // Test X plus
-    dot = viewnormal.Dot(gp::DX());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Xplus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Xplus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Xplus;
-            vdir3_set = Standard_True;
-        }
-    }
-
-    // Test Y minus
-    dot = viewnormal.Dot(-gp::DY());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Yminus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Yminus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Yminus;
-            vdir3_set = Standard_True;
-        }
-    }
-
-    // Test Y plus
-    dot = viewnormal.Dot(gp::DY());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Yplus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Yplus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Yplus;
-            vdir3_set = Standard_True;
-        }
-    }
-
-    // Test Z minus
-    dot = viewnormal.Dot(-gp::DZ());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Zminus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Zminus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Zminus;
-            vdir3_set = Standard_True;
-        }
-    }
-
-    // Test Y plus
-    dot = viewnormal.Dot(gp::DZ());
-    if (dot >= 0.0)
-    {
-        if (!vdir1_set)
-        {
-            vdir1 = Zplus;
-            vdir1_set = Standard_True;
-        }
-        else if (!vdir2_set)
-        {
-            vdir2 = Zplus;
-            vdir2_set = Standard_True;
-        }
-        else if (!vdir3_set)
-        {
-            vdir3 = Zplus;
-            vdir3_set = Standard_True;
-        }
-    }
-}
-
-static Standard_Boolean CheckSize(Voxel_DS* voxels, 
-                      const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, 
-                      const Standard_Real xmin, const Standard_Real xmax,
-                      const Standard_Real ymin, const Standard_Real ymax,
-                      const Standard_Real zmin, const Standard_Real zmax,
-                      Standard_Real& xc, Standard_Real& yc, Standard_Real& zc)
-{
-    voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-    if (xc < xmin || xc > xmax)
-        return Standard_False;
-    if (yc < ymin || yc > ymax)
-        return Standard_False;
-    if (zc < zmin || zc > zmax)
-        return Standard_False;
-    return Standard_True;
-}
-
-static Standard_Boolean CheckSize(Voxel_ROctBoolDS* voxels, 
-                      const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz, 
-                      const Standard_Integer i, const Standard_Integer j,
-                      const Standard_Real xmin, const Standard_Real xmax,
-                      const Standard_Real ymin, const Standard_Real ymax,
-                      const Standard_Real zmin, const Standard_Real zmax,
-                      Standard_Real& xc, Standard_Real& yc, Standard_Real& zc)
-{
-    if (j == -1)
-        voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-    else
-        voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-    if (xc < xmin || xc > xmax)
-        return Standard_False;
-    if (yc < ymin || yc > ymax)
-        return Standard_False;
-    if (zc < zmin || zc > zmax)
-        return Standard_False;
-    return Standard_True;
-}
-
-static void drawBoolPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
-                           Voxel_BoolDS* voxels,
-                           const Standard_Real xmin, const Standard_Real xmax,
-                           const Standard_Real ymin, const Standard_Real ymax,
-                           const Standard_Real zmin, const Standard_Real zmax)
-{
-       Standard_Real xc, yc, zc;
-       Standard_Integer ix = 0, nbx = voxels->GetNbX();
-       Standard_Integer iy = 0, nby = voxels->GetNbY();
-       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_POINTS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                           voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                                               Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                               if (value)
-                                               {
-                            if (!check_size)
-                                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                       glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                                               }
-                                       }
-                               }
-                       }
-                       break;
-               }
-       }
-    glEnd();
-}
-
-static void drawROctBoolPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
-                               Voxel_ROctBoolDS* voxels,
-                               const Standard_Real xmin, const Standard_Real xmax,
-                               const Standard_Real ymin, const Standard_Real ymax,
-                               const Standard_Real zmin, const Standard_Real zmax)
-{
-       Standard_Real xc, yc, zc;
-       Standard_Integer ix = 0, nbx = voxels->GetNbX();
-       Standard_Integer iy = 0, nby = voxels->GetNbY();
-       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
-    Standard_Integer i, j;
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_POINTS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        switch (voxels->Deepness(ix, iy, iz))
-                        {
-                            case 0:
-                            {
-                                if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                    continue;
-                                                       Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                                                       if (value)
-                                                       {
-                                    if (!check_size)
-                                                                   ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                               glVertex3d(xc, yc, zc);
-                                    if (nearest)
-                                        break;
-                                                       }
-                                break;
-                            }
-                            case 1:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                                           Standard_Boolean value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                                           if (value)
-                                                           {
-                                        if (!check_size)
-                                                                       voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                                   glVertex3d(xc, yc, zc);
-                                        if (nearest)
-                                            break;
-                                                           }
-                                }
-                                break;
-                            }
-                            case 2:
-                            {
-                                for (i = 0; i < 8; i++)
-                                {
-                                    for (j = 0; j < 8; j++)
-                                    {
-                                        if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                            continue;
-                                                               Standard_Boolean value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                                               if (value)
-                                                               {
-                                            if (!check_size)
-                                                                           voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                                       glVertex3d(xc, yc, zc);
-                                            if (nearest)
-                                                break;
-                                                               }
-                                    }
-                                }
-                                break;
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-       }
-    glEnd();
-}
-
-
-
-static void drawColorPoints(const VoxelDirection vdir, const Standard_Boolean nearest,
-                            Voxel_ColorDS* voxels, const Handle(Quantity_HArray1OfColor)& hcolors,
-                            const Standard_Byte minvalue, const Standard_Byte maxvalue,
-                            const Standard_Real xmin, const Standard_Real xmax,
-                            const Standard_Real ymin, const Standard_Real ymax,
-                            const Standard_Real zmin, const Standard_Real zmax)
-{
-       Standard_Real xc, yc, zc;
-       Standard_Integer ix = 0, nbx = voxels->GetNbX();
-       Standard_Integer iy = 0, nby = voxels->GetNbY();
-       Standard_Integer iz = 0, nbz = voxels->GetNbZ();
-    Standard_Byte value;
-
-    // Colors
-    const Quantity_Array1OfColor& colors = hcolors->Array1();
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_POINTS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                           value = voxels->Get(ix, iy, iz);
-                           if (value >= minvalue && value <= maxvalue)
-                           {
-                            if (!check_size)
-                                       voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            setColor(colors.Value(value), Standard_False);
-                                   glVertex3d(xc, yc, zc);
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-    }
-    glEnd();
-}
-
-static void drawBoolQuadrangles(Voxel_BoolDS* voxels, const VoxelDirection vdir, 
-                                const gp_Dir& viewnormal, const Standard_Boolean nearest,
-                                const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
-                                const Standard_Real xmin, const Standard_Real xmax,
-                                const Standard_Real ymin, const Standard_Real ymax,
-                                const Standard_Real zmin, const Standard_Real zmax)
-{
-    gp_Vec vc;
-    gp_Pnt pc1, pc2, pc3, pc4;
-    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 1.0;
-    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ();
-
-    // Normal
-    viewnormal.Coord(xn, yn, zn);
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_QUADS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                    }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        Standard_Boolean value = voxels->Get(ix, iy, iz) == Standard_True;
-                        if (value)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Display
-                            glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-    }
-    glEnd();
-}
-
-static void drawROctBoolQuadrangles(Voxel_ROctBoolDS* voxels, const VoxelDirection vdir, 
-                                    const gp_Dir& viewnormal, const Standard_Boolean nearest,
-                                    const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
-                                    const Standard_Real xmin, const Standard_Real xmax,
-                                    const Standard_Real ymin, const Standard_Real ymax,
-                                    const Standard_Real zmin, const Standard_Real zmax)
-{
-    gp_Vec vc;
-    gp_Pnt pc1, pc2, pc3, pc4;
-    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 1.0;
-    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ(), i, j, deepness;
-
-    // Normal
-    viewnormal.Coord(xn, yn, zn);
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_QUADS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                    }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        deepness = voxels->Deepness(ix, iy, iz);
-                        for (i = 0; i < 8; i++)
-                        {
-                            for (j = 0; j < 8; j++)
-                            {
-                                if (deepness == 0 && j)
-                                {
-                                    i = 8;
-                                    break;
-                                }
-                                if (deepness == 1 && j)
-                                    break;
-                                if (deepness == 0)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 1)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, -1, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-                                else if (deepness == 2)
-                                {
-                                    if (check_size && !CheckSize(voxels, ix, iy, iz, i, j, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                                        continue;
-                                }
-
-                                Standard_Boolean value;
-                                switch (deepness)
-                                {
-                                    case 0:
-                                        value = voxels->Get(ix, iy, iz) == Standard_True;
-                                        break;
-                                    case 1:
-                                        value = voxels->Get(ix, iy, iz, i) == Standard_True;
-                                        break;
-                                    case 2:
-                                        value = voxels->Get(ix, iy, iz, i, j) == Standard_True;
-                                        break;
-                                }
-                                
-                                if (value)
-                                {
-                                    // Define translation vector
-                                    if (!check_size)
-                                    {
-                                        switch (deepness)
-                                        {
-                                            case 0:
-                                                ((Voxel_DS*)voxels)->GetCenter(ix, iy, iz, xc, yc, zc);
-                                                break;
-                                            case 1:
-                                                voxels->GetCenter(ix, iy, iz, i, xc, yc, zc);
-                                                break;
-                                            case 2:
-                                                voxels->GetCenter(ix, iy, iz, i, j, xc, yc, zc);
-                                                break;
-                                        }
-                                    }
-                                    vc.SetCoord(xc, yc, zc);
-
-                                    // Translate
-                                    pc1 = p1.Translated(vc);
-                                    pc2 = p2.Translated(vc);
-                                    pc3 = p3.Translated(vc);
-                                    pc4 = p4.Translated(vc);
-
-                                    // Display
-                                    glNormal3d(xn, yn, zn);
-                                    pc1.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc2.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc3.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-                                    pc4.Coord(xc, yc, zc);
-                                    glVertex3d(xc, yc, zc);
-
-                                    if (nearest)
-                                        break;
-                                }
-                            }
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-    }
-    glEnd();
-}
-
-
-
-static void drawColorQuadrangles(Voxel_ColorDS* voxels, const VoxelDirection vdir, 
-                                 const gp_Dir& viewnormal, const Standard_Boolean nearest,
-                                 const Handle(Quantity_HArray1OfColor)& hcolors,
-                                 const gp_Pnt& p1, const gp_Pnt& p2, const gp_Pnt& p3, const gp_Pnt& p4,
-                                 const Standard_Byte minvalue, const Standard_Byte maxvalue,
-                                 const Standard_Real xmin, const Standard_Real xmax,
-                                 const Standard_Real ymin, const Standard_Real ymax,
-                                 const Standard_Real zmin, const Standard_Real zmax)
-{
-    gp_Vec vc;
-    gp_Pnt pc1, pc2, pc3, pc4;
-    Standard_Real xc, yc, zc, xn = 0.0, yn = 0.0, zn = 0.0;
-    Standard_Integer ix, iy, iz, nbx = voxels->GetNbX(), nby = voxels->GetNbY(), nbz = voxels->GetNbZ();
-    Standard_Byte value;
-
-    // Normal
-    //viewnormal.Coord(xn, yn, zn);
-    glNormal3d(xn, yn, zn);
-
-    // Colors
-    const Quantity_Array1OfColor& colors = hcolors->Array1();
-
-    Standard_Boolean check_size = (xmin <= DBL_MAX && xmax >= DBL_MAX &&
-                       ymin <= DBL_MAX && ymax >= DBL_MAX &&
-                       zmin <= DBL_MAX && zmax >= DBL_MAX);
-    check_size = !check_size;
-
-    glBegin(GL_QUADS);
-    switch (vdir)
-       {
-               case Xminus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = 0; ix < nbx; ix++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                    }
-                               }
-                       }
-                       break;
-               }
-               case Xplus:
-               {
-                       for (iy = 0; iy < nby; iy++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (ix = nbx - 1; ix >= 0; ix--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = 0; iy < nby; iy++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Yplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iz = 0; iz < nbz; iz++)
-                               {
-                                       for (iy = nby - 1; iy >= 0; iy--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zminus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = 0; iz < nbz; iz++)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-               case Zplus:
-               {
-                       for (ix = 0; ix < nbx; ix++)
-                       {
-                               for (iy = 0; iy < nby; iy++)
-                               {
-                                       for (iz = nbz - 1; iz >= 0; iz--)
-                                       {
-                        if (check_size && !CheckSize(voxels, ix, iy, iz, xmin, xmax, ymin, ymax, zmin, zmax, xc, yc, zc))
-                            continue;
-                        value = voxels->Get(ix, iy, iz);
-                        if (value >= minvalue && value <= maxvalue)
-                        {
-                            // Define translation vector
-                            if (!check_size)
-                                voxels->GetCenter(ix, iy, iz, xc, yc, zc);
-                            vc.SetCoord(xc, yc, zc);
-
-                            // Translate
-                            pc1 = p1.Translated(vc);
-                            pc2 = p2.Translated(vc);
-                            pc3 = p3.Translated(vc);
-                            pc4 = p4.Translated(vc);
-
-                            // Color
-                            setColor(colors.Value(value), Standard_False);
-
-                            // Display
-                            //glNormal3d(xn, yn, zn);
-                            pc1.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc2.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc3.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-                            pc4.Coord(xc, yc, zc);
-                            glVertex3d(xc, yc, zc);
-
-                            if (nearest)
-                                break;
-                        }
-                                       }
-                               }
-                       }
-                       break;
-               }
-    }
-    glEnd();
-}
-
-static void genListIndex(GLint& index)
-{
-    GLint i = 0;
-    while (++i <= INT_MAX)
-    {
-        if (!glIsList(i))
-        {
-            index = i;
-            break;
-        }
-    }
-}
-
-static void setPlaneNormal(const VoxelDirection& dir, 
-                           const Standard_Real dx, const Standard_Real dy, const Standard_Real dz,
-                           gp_Pln& plane, gp_Pnt& p1, gp_Pnt& p2, gp_Pnt& p3, gp_Pnt& p4)
-{
-    gp_Ax3 axes = plane.Position();
-    Standard_Real dx2 = 0.5 * dx, dy2 = 0.5 * dy, dz2 = 0.5 * dz;
-    switch (dir)
-    {
-        case Xminus:
-            p1.SetCoord(-dx2, -dy2, dz2);
-            p2.SetCoord(-dx2, -dy2, -dz2);
-            p3.SetCoord(-dx2, dy2, -dz2);
-            p4.SetCoord(-dx2, dy2, dz2);
-            axes.SetDirection(-gp::DX());
-            break;
-        case Xplus:
-            p1.SetCoord(dx2, -dy2, dz2);
-            p2.SetCoord(dx2, -dy2, -dz2);
-            p3.SetCoord(dx2, dy2, -dz2);
-            p4.SetCoord(dx2, dy2, dz2);
-            axes.SetDirection(gp::DX());
-            break;
-        case Yminus:
-            p1.SetCoord(dx2, -dy2, dz2);
-            p2.SetCoord(dx2, -dy2, -dz2);
-            p3.SetCoord(-dx2, -dy2, -dz2);
-            p4.SetCoord(-dx2, -dy2, dz2);
-            axes.SetDirection(-gp::DY());
-            break;
-        case Yplus:
-            p1.SetCoord(dx2, dy2, dz2);
-            p2.SetCoord(dx2, dy2, -dz2);
-            p3.SetCoord(-dx2, dy2, -dz2);
-            p4.SetCoord(-dx2, dy2, dz2);
-            axes.SetDirection(gp::DY());
-            break;
-        case Zminus:
-            p1.SetCoord(dx2, dy2, -dz2);
-            p2.SetCoord(-dx2, dy2, -dz2);
-            p3.SetCoord(-dx2, -dy2, -dz2);
-            p4.SetCoord(dx2, -dy2, -dz2);
-            axes.SetDirection(-gp::DZ());
-            break;
-        case Zplus:
-            p1.SetCoord(dx2, dy2, dz2);
-            p2.SetCoord(-dx2, dy2, dz2);
-            p3.SetCoord(-dx2, -dy2, dz2);
-            p4.SetCoord(dx2, -dy2, dz2);
-            axes.SetDirection(gp::DZ());
-            break;
-    }
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::DisplayVoxels(const Standard_Boolean theHighlight)
-{
-    if(!myData)
-        return;
-
-    glEnable(GL_DEPTH_TEST);
-
-       // Boolean voxels
-       if (myData->myBoolVoxels)
-    {
-               // Points
-               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
-            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
-               {
-                       glDisable(GL_LIGHTING);
-            if (myData->myDisplay.mySmoothPoints)
-                           glEnable(GL_POINT_SMOOTH);
-            else
-                glDisable(GL_POINT_SMOOTH);
-
-                       // Draw the points of voxels (center points of the voxels)
-                       // starting visualization from the side looking out from the user.
-                       setColor(myData->myDisplay.myColor, theHighlight);
-                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
-
-            // Display
-            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
-        }
-       }
-
-    // Color values
-       if (myData->myColorVoxels)
-    {
-               // Points
-               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
-            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
-               {
-                       glDisable(GL_LIGHTING);
-            if (myData->myDisplay.mySmoothPoints)
-                           glEnable(GL_POINT_SMOOTH);
-            else
-                glDisable(GL_POINT_SMOOTH);
-
-                       // Draw the points of voxels (center points of the voxels)
-                       // starting visualization from the side looking out from the user.
-                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
-
-            // Display
-            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
-        }
-       }
-
-       // Recursive Octree Boolean voxels
-       if (myData->myROctBoolVoxels)
-    {
-               // Points
-               if (myData->myDisplay.myDisplayMode == Voxel_VDM_POINTS ||
-            myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS)
-               {
-                       glDisable(GL_LIGHTING);
-            if (myData->myDisplay.mySmoothPoints)
-                           glEnable(GL_POINT_SMOOTH);
-            else
-                glDisable(GL_POINT_SMOOTH);
-
-                       // Draw the points of voxels (center points of the voxels)
-                       // starting visualization from the side looking out from the user.
-                       setColor(myData->myDisplay.myColor, theHighlight);
-                       glPointSize((Standard_ShortReal) myData->myDisplay.myPointSize);
-
-            // Display
-            DisplayPoints(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTPOINTS);
-        }
-       }
-
-    // Shading drawn by boxes
-    if (myData->myDisplay.myDisplayMode == Voxel_VDM_BOXES || 
-        myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTBOXES)
-    {
-               glEnable(GL_LIGHTING);
-        glEnable(GL_COLOR_MATERIAL);
-
-               // Draw quadrangles of voxels looking to the user.
-               setColor(myData->myDisplay.myColor, theHighlight);
-
-        // Display
-        DisplayBoxes(myData->myDisplay.myDisplayMode == Voxel_VDM_NEARESTBOXES);
-
-        glDisable(GL_COLOR_MATERIAL);
-    }
-
-    // Highlighted voxel
-    HighlightVoxel();
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::DisplayPoints(const Standard_Boolean nearest)
-{
-    //OSD_Timer timer;
-    //timer.Start();
-
-    // Find the side of the cube which normal looks to (or out) the user's eye.
-       gp_Dir viewnormal;
-       getNormal(viewnormal);
-
-    // Range of displayed data
-    Standard_Real xmin = myData->myDisplay.myDisplayedXMin;
-    Standard_Real xmax = myData->myDisplay.myDisplayedXMax;
-    Standard_Real ymin = myData->myDisplay.myDisplayedYMin;
-    Standard_Real ymax = myData->myDisplay.myDisplayedYMax;
-    Standard_Real zmin = myData->myDisplay.myDisplayedZMin;
-    Standard_Real zmax = myData->myDisplay.myDisplayedZMax;
-
-    // Boolean points
-       if (myData->myBoolVoxels)
-    {
-        if (nearest || myData->myDisplay.myDegenerateMode)
-        {
-               VoxelDirection vdir1, vdir2, vdir3;
-            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
-
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                // Clean all allocated GL lists for the case of first call.
-                if (myData->myDisplay.myBoolNearestPointsFirst)
-                {
-                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
-                    {
-                        if (myData->myDisplay.myBoolNearestPointsList[idir] > 0)
-                        {
-                            glDeleteLists(myData->myDisplay.myBoolNearestPointsList[idir], 1);
-                            myData->myDisplay.myBoolNearestPointsList[idir] = -1;
-                        }
-                    }
-                    myData->myDisplay.myBoolNearestPointsFirst = Standard_False;
-                }
-
-                // Generate GL lists if needed.
-                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1] < 0)
-                {
-                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1]);
-                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
-                    drawBoolPoints(vdir1, Standard_True, myData->myBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2] < 0)
-                {
-                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2]);
-                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
-                    drawBoolPoints(vdir2, Standard_True, myData->myBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3] < 0)
-                {
-                    genListIndex(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3]);
-                    glNewList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
-                    drawBoolPoints(vdir3, Standard_True, myData->myBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir1]);
-                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir2]);
-                glCallList(myData->myDisplay.myBoolNearestPointsList[(Standard_Integer) vdir3]);
-            }
-            else
-            {
-                drawBoolPoints(vdir1, Standard_True, myData->myBoolVoxels,
-                               xmin, xmax, ymin, ymax, zmin, zmax);
-                drawBoolPoints(vdir2, Standard_True, myData->myBoolVoxels,
-                               xmin, xmax, ymin, ymax, zmin, zmax);
-                drawBoolPoints(vdir3, Standard_True, myData->myBoolVoxels,
-                               xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-        else
-        {
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                if (myData->myDisplay.myBoolPointsFirst)
-                {
-                    // Delete previous GL list.
-                    if (myData->myDisplay.myBoolPointsList > 0)
-                    {
-                        glDeleteLists(myData->myDisplay.myBoolPointsList, 1);
-                        myData->myDisplay.myBoolPointsList = -1;
-                    }
-
-                    // Generate a new GL list
-                    genListIndex(myData->myDisplay.myBoolPointsList);
-                    glNewList(myData->myDisplay.myBoolPointsList, GL_COMPILE);
-                    VoxelDirection vdir = getVoxelDirection(viewnormal);
-                    drawBoolPoints(vdir, Standard_False, myData->myBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-
-                    // The first call has just been passed...
-                    myData->myDisplay.myBoolPointsFirst = Standard_False;
-                }
-                glCallList(myData->myDisplay.myBoolPointsList);
-            }
-            else
-            {
-                VoxelDirection vdir = getVoxelDirection(viewnormal);
-                drawBoolPoints(vdir, Standard_False, myData->myBoolVoxels,
-                               xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-       }
-
-    // Color points
-       if (myData->myColorVoxels)
-    {
-        if (nearest || myData->myDisplay.myDegenerateMode)
-        {
-               VoxelDirection vdir1, vdir2, vdir3;
-            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
-
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                // Clean all allocated GL lists for the case of first call.
-                if (myData->myDisplay.myColorNearestPointsFirst)
-                {
-                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
-                    {
-                        if (myData->myDisplay.myColorNearestPointsList[idir] > 0)
-                        {
-                            glDeleteLists(myData->myDisplay.myColorNearestPointsList[idir], 1);
-                            myData->myDisplay.myColorNearestPointsList[idir] = -1;
-                        }
-                    }
-                    myData->myDisplay.myColorNearestPointsFirst = Standard_False;
-                }
-
-                // Generate GL lists if needed.
-                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1] < 0)
-                {
-                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1]);
-                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
-                    drawColorPoints(vdir1, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                    xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2] < 0)
-                {
-                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2]);
-                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
-                    drawColorPoints(vdir2, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                    xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3] < 0)
-                {
-                    genListIndex(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3]);
-                    glNewList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
-                    drawColorPoints(vdir3, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                    xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-            
-                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir1]);
-                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir2]);
-                glCallList(myData->myDisplay.myColorNearestPointsList[(Standard_Integer) vdir3]);
-            }
-            else
-            {
-                drawColorPoints(vdir1, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-                drawColorPoints(vdir2, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-                drawColorPoints(vdir3, Standard_True, myData->myColorVoxels, myData->myDisplay.myColors,
-                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-        else
-        {
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                if (myData->myDisplay.myColorPointsFirst)
-                {
-                    // Delete previous GL list.
-                    if (myData->myDisplay.myColorPointsList > 0)
-                    {
-                        glDeleteLists(myData->myDisplay.myColorPointsList, 1);
-                        myData->myDisplay.myColorPointsList = -1;
-                    }
-
-                    // Generate a new GL list
-                    genListIndex(myData->myDisplay.myColorPointsList);
-                    glNewList(myData->myDisplay.myColorPointsList, GL_COMPILE);
-                    VoxelDirection vdir = getVoxelDirection(viewnormal);
-                    drawColorPoints(vdir, Standard_False, myData->myColorVoxels, myData->myDisplay.myColors,
-                                    myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                    xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-
-                    // The first call has just been passed...
-                    myData->myDisplay.myColorPointsFirst = Standard_False;
-                }
-                glCallList(myData->myDisplay.myColorPointsList);
-            }
-            else
-            {
-                VoxelDirection vdir = getVoxelDirection(viewnormal);
-                drawColorPoints(vdir, Standard_False, myData->myColorVoxels, myData->myDisplay.myColors,
-                                myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-       }
-
-    // Recursive Octree Boolean points
-       if (myData->myROctBoolVoxels)
-    {
-        if (nearest || myData->myDisplay.myDegenerateMode)
-        {
-               VoxelDirection vdir1, vdir2, vdir3;
-            getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
-
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                // Clean all allocated GL lists for the case of first call.
-                if (myData->myDisplay.myROctBoolNearestPointsFirst)
-                {
-                    for (Standard_Integer idir = Xminus; idir <= Zplus; idir++)
-                    {
-                        if (myData->myDisplay.myROctBoolNearestPointsList[idir] > 0)
-                        {
-                            glDeleteLists(myData->myDisplay.myROctBoolNearestPointsList[idir], 1);
-                            myData->myDisplay.myROctBoolNearestPointsList[idir] = -1;
-                        }
-                    }
-                    myData->myDisplay.myROctBoolNearestPointsFirst = Standard_False;
-                }
-
-                // Generate GL lists if needed.
-                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1] < 0)
-                {
-                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1]);
-                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1], GL_COMPILE);
-                    drawROctBoolPoints(vdir1, Standard_True, myData->myROctBoolVoxels,
-                                       xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2] < 0)
-                {
-                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2]);
-                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2], GL_COMPILE);
-                    drawROctBoolPoints(vdir2, Standard_True, myData->myROctBoolVoxels,
-                                       xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                if (myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3] < 0)
-                {
-                    genListIndex(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3]);
-                    glNewList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3], GL_COMPILE);
-                    drawROctBoolPoints(vdir3, Standard_True, myData->myROctBoolVoxels,
-                                       xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-                }
-                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir1]);
-                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir2]);
-                glCallList(myData->myDisplay.myROctBoolNearestPointsList[(Standard_Integer) vdir3]);
-            }
-            else
-            {
-                drawROctBoolPoints(vdir1, Standard_True, myData->myROctBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                drawROctBoolPoints(vdir2, Standard_True, myData->myROctBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-                drawROctBoolPoints(vdir3, Standard_True, myData->myROctBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-        else
-        {
-            if (myData->myDisplay.myUsageOfGLlists)
-            {
-                if (myData->myDisplay.myROctBoolPointsFirst)
-                {
-                    // Delete previous GL list.
-                    if (myData->myDisplay.myROctBoolPointsList > 0)
-                    {
-                        glDeleteLists(myData->myDisplay.myROctBoolPointsList, 1);
-                        myData->myDisplay.myROctBoolPointsList = -1;
-                    }
-
-                    // Generate a new GL list
-                    genListIndex(myData->myDisplay.myROctBoolPointsList);
-                    glNewList(myData->myDisplay.myROctBoolPointsList, GL_COMPILE);
-                    VoxelDirection vdir = getVoxelDirection(viewnormal);
-                    drawROctBoolPoints(vdir, Standard_False, myData->myROctBoolVoxels,
-                                       xmin, xmax, ymin, ymax, zmin, zmax);
-                    glEndList();
-
-                    // The first call has just been passed...
-                    myData->myDisplay.myROctBoolPointsFirst = Standard_False;
-                }
-                glCallList(myData->myDisplay.myROctBoolPointsList);
-            }
-            else
-            {
-                VoxelDirection vdir = getVoxelDirection(viewnormal);
-                drawROctBoolPoints(vdir, Standard_False, myData->myROctBoolVoxels,
-                                   xmin, xmax, ymin, ymax, zmin, zmax);
-            }
-        }
-       }
-
-    //timer.Stop();
-       //Standard_Real seconds, cpu;
-       //Standard_Integer minutes, hours;
-       //timer.Show(seconds, minutes, hours, cpu);
-    //cout<<"DisplayPoints()"<<" took "<<minutes<<" minutes, "<<seconds<<" seconds"<<endl;
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::DisplayBoxes(const Standard_Boolean nearest)
-{
-    // Range of displayed data
-    Standard_Real xmin = myData->myDisplay.myDisplayedXMin;
-    Standard_Real xmax = myData->myDisplay.myDisplayedXMax;
-    Standard_Real ymin = myData->myDisplay.myDisplayedYMin;
-    Standard_Real ymax = myData->myDisplay.myDisplayedYMax;
-    Standard_Real zmin = myData->myDisplay.myDisplayedZMin;
-    Standard_Real zmax = myData->myDisplay.myDisplayedZMax;
-
-    // Find the side of the cube which normal looks to (or out) the user's eye.
-       gp_Dir viewnormal;
-       getNormal(viewnormal);
-
-    // Get three sides of the box looking to the user.
-       VoxelDirection vdir1, vdir2, vdir3;
-    getVoxel3Directions(viewnormal, vdir1, vdir2, vdir3);
-
-    // Three quadrangles with normals looking to the user
-    gp_Pln plane1(gp::Origin(), viewnormal);
-    gp_Pln plane2(plane1), plane3(plane1);
-
-    // Boolean boxes
-       if (myData->myBoolVoxels &&
-        myData->myBoolVoxels->GetNbX() &&
-        myData->myBoolVoxels->GetNbY() &&
-        myData->myBoolVoxels->GetNbZ())
-    {
-        // Compute size
-        Standard_Real dx = myData->myBoolVoxels->GetXLen() / (Standard_Real) myData->myBoolVoxels->GetNbX();
-        Standard_Real dy = myData->myBoolVoxels->GetYLen() / (Standard_Real) myData->myBoolVoxels->GetNbY();
-        Standard_Real dz = myData->myBoolVoxels->GetZLen() / (Standard_Real) myData->myBoolVoxels->GetNbZ();
-        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
-        dx *= d;
-        dy *= d;
-        dz *= d;
-
-        // Translatethe quadrangles to the side of the voxel
-        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
-        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
-        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
-        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
-
-        // Display
-        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
-        drawBoolQuadrangles(myData->myBoolVoxels, vdir1, plane1.Axis().Direction(), 
-                            skin, p11, p12, p13, p14,
-                            xmin, xmax, ymin, ymax, zmin, zmax);
-        drawBoolQuadrangles(myData->myBoolVoxels, vdir2, plane2.Axis().Direction(), 
-                            skin, p21, p22, p23, p24,
-                            xmin, xmax, ymin, ymax, zmin, zmax);
-        drawBoolQuadrangles(myData->myBoolVoxels, vdir3, plane3.Axis().Direction(), 
-                            skin, p31, p32, p33, p34,
-                            xmin, xmax, ymin, ymax, zmin, zmax);
-    }
-    // Color quadrangles
-       else if (myData->myColorVoxels &&
-             myData->myColorVoxels->GetNbX() &&
-             myData->myColorVoxels->GetNbY() &&
-             myData->myColorVoxels->GetNbZ())
-    {
-        // Compute size
-        Standard_Real dx = myData->myColorVoxels->GetXLen() / (Standard_Real) myData->myColorVoxels->GetNbX();
-        Standard_Real dy = myData->myColorVoxels->GetYLen() / (Standard_Real) myData->myColorVoxels->GetNbY();
-        Standard_Real dz = myData->myColorVoxels->GetZLen() / (Standard_Real) myData->myColorVoxels->GetNbZ();
-        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
-        dx *= d;
-        dy *= d;
-        dz *= d;
-
-        // Translatethe quadrangles to the side of the voxel
-        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
-        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
-        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
-        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
-
-        // Display
-        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
-        drawColorQuadrangles(myData->myColorVoxels, vdir1, plane1.Axis().Direction(), skin, 
-                             myData->myDisplay.myColors, p11, p12, p13, p14,
-                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                             xmin, xmax, ymin, ymax, zmin, zmax);
-        drawColorQuadrangles(myData->myColorVoxels, vdir2, plane2.Axis().Direction(), skin, 
-                             myData->myDisplay.myColors, p21, p22, p23, p24,
-                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                             xmin, xmax, ymin, ymax, zmin, zmax);
-        drawColorQuadrangles(myData->myColorVoxels, vdir3, plane3.Axis().Direction(), skin, 
-                             myData->myDisplay.myColors, p31, p32, p33, p34,
-                             myData->myDisplay.myColorMinValue, myData->myDisplay.myColorMaxValue,
-                             xmin, xmax, ymin, ymax, zmin, zmax);
-    }
-    // Recursive Octree Boolean boxes
-       else if (myData->myROctBoolVoxels &&
-             myData->myROctBoolVoxels->GetNbX() &&
-             myData->myROctBoolVoxels->GetNbY() &&
-             myData->myROctBoolVoxels->GetNbZ())
-    {
-        // Compute size
-        Standard_Real dx = myData->myROctBoolVoxels->GetXLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbX();
-        Standard_Real dy = myData->myROctBoolVoxels->GetYLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbY();
-        Standard_Real dz = myData->myROctBoolVoxels->GetZLen() / (Standard_Real) myData->myROctBoolVoxels->GetNbZ();
-        Standard_Real d  = 0.01 * (Standard_Real) myData->myDisplay.myQuadrangleSize;
-        dx *= d;
-        dy *= d;
-        dz *= d;
-
-        // Translatethe quadrangles to the side of the voxel
-        gp_Pnt p11, p12, p13, p14, p21, p22, p23, p24, p31, p32, p33, p34;
-        setPlaneNormal(vdir1, dx, dy, dz, plane1, p11, p12, p13, p14);
-        setPlaneNormal(vdir2, dx, dy, dz, plane2, p21, p22, p23, p24);
-        setPlaneNormal(vdir3, dx, dy, dz, plane3, p31, p32, p33, p34);
-
-        // Display
-        Standard_Boolean skin = nearest || myData->myDisplay.myDegenerateMode;
-        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir1, plane1.Axis().Direction(), 
-                                skin, p11, p12, p13, p14,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir2, plane2.Axis().Direction(), 
-                                skin, p21, p22, p23, p24,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-        drawROctBoolQuadrangles(myData->myROctBoolVoxels, vdir3, plane3.Axis().Direction(), 
-                                skin, p31, p32, p33, p34,
-                                xmin, xmax, ymin, ymax, zmin, zmax);
-    }
-}
-
-/**************************************************************************/
-void VoxelClient_VisDrawer::DisplayTriangulation(const Standard_Boolean theHighlight)
-{
-    if(!myData || myData->myTriangulation.IsNull())
-        return;
-
-    glEnable(GL_DEPTH_TEST);
-    glEnable(GL_LIGHTING);
-
-    const TColgp_Array1OfPnt& nodes = myData->myTriangulation->Nodes();
-    const Poly_Array1OfTriangle& triangles = myData->myTriangulation->Triangles();
-    Standard_Integer itriangle = triangles.Lower(), nb_triangles = triangles.Upper();
-
-    Standard_Boolean compute_normals = Standard_False;
-    if (myData->myNormalsOfNodes.IsNull())
-    {
-        compute_normals = Standard_True;
-        myData->myNormalsOfNodes = new TColgp_HArray1OfDir(itriangle, nb_triangles);
-
-        // Release the GL list
-        if (myData->myDisplay.myTriangulationList > 0)
-        {
-            glDeleteLists(myData->myDisplay.myTriangulationList, 1);
-            myData->myDisplay.myTriangulationList = -1;
-        }
-
-        // Generate a new GL list
-        if (myData->myDisplay.myUsageOfGLlists)
-        {
-            genListIndex(myData->myDisplay.myTriangulationList);
-            glNewList(myData->myDisplay.myTriangulationList, GL_COMPILE);
-        }
-    }
-    TColgp_Array1OfDir& normals = myData->myNormalsOfNodes->ChangeArray1();
-
-    if (!myData->myDisplay.myUsageOfGLlists || compute_normals)
-    {
-
-        glBegin(GL_TRIANGLES);
-
-        Standard_Integer n1, n2, n3;
-        Standard_Real x, y, z;
-        for (; itriangle <= nb_triangles; itriangle++)
-        {
-            const Poly_Triangle& t = triangles.Value(itriangle);
-            t.Get(n1, n2, n3);
-
-            const gp_Pnt& p1 = nodes.Value(n1);
-            const gp_Pnt& p2 = nodes.Value(n2);
-            const gp_Pnt& p3 = nodes.Value(n3);
-
-            // Make the normal:
-            if (compute_normals)
-            {
-                gp_Vec v1(p1, p2), v2(p1, p3);
-                v1.Cross(v2);
-                if (v1.SquareMagnitude() > 1.e-14)
-                    v1.Normalize();
-                else
-                    v1.SetCoord(0.0, 0.0, 1.0);
-                normals.SetValue(itriangle, v1);
-                v1.Coord(x, y, z);
-            }
-            else
-            {
-                normals.Value(itriangle).Coord(x, y, z);
-            }
-            glNormal3d(x, y, z);
-
-            // P1
-            p1.Coord(x, y, z);
-            glVertex3d(x, y, z);
-
-            // P2
-            p2.Coord(x, y, z);
-            glVertex3d(x, y, z);
-
-            // P3
-            p3.Coord(x, y, z);
-            glVertex3d(x, y, z);
-        }
-
-        glEnd();
-
-        if (myData->myDisplay.myUsageOfGLlists)
-            glEndList();
-    }
-
-    if (myData->myDisplay.myUsageOfGLlists)
-        glCallList(myData->myDisplay.myTriangulationList);
-}
-
-void VoxelClient_VisDrawer::HighlightVoxel()
-{
-    if (myData &&
-        myData->myDisplay.myHighlightx >= 0 &&
-        myData->myDisplay.myHighlighty >= 0 &&
-        myData->myDisplay.myHighlightz >= 0)
-    {
-        Standard_Integer nbx, nby, nbz;
-        Standard_Real xlen, ylen, zlen, xc, yc, zc;
-        Voxel_DS* ds = (Voxel_DS*) myData->myBoolVoxels;
-        if (myData->myColorVoxels)
-            ds = (Voxel_DS*) myData->myColorVoxels;
-        if (myData->myROctBoolVoxels)
-            ds = (Voxel_DS*) myData->myROctBoolVoxels;
-        nbx = ds->GetNbX();
-        nby = ds->GetNbY();
-        nbz = ds->GetNbZ();
-        xlen = ds->GetXLen();
-        ylen = ds->GetYLen();
-        zlen = ds->GetZLen();
-        ds->GetCenter(myData->myDisplay.myHighlightx, 
-                      myData->myDisplay.myHighlighty, 
-                      myData->myDisplay.myHighlightz, 
-                      xc, yc, zc);
-
-        Standard_Real half_voxelx = xlen / Standard_Real(nbx) / 2.0;
-        Standard_Real half_voxely = ylen / Standard_Real(nby) / 2.0;
-        Standard_Real half_voxelz = zlen / Standard_Real(nbz) / 2.0;
-        Standard_Real x1 = xc - half_voxelx, y1 = yc - half_voxely, z1 = zc - half_voxelz;
-        Standard_Real x2 = xc + half_voxelx, y2 = yc + half_voxely, z2 = zc + half_voxelz;
-
-        setColor(Quantity_NOC_BLUE1, Standard_True);
-        setTypeOfLine(Aspect_TOL_SOLID);
-        setWidthOfLine(3);
-
-        glBegin(GL_LINES);
-
-        glVertex3d(x1, y1, z1);
-        glVertex3d(x1, y2, z1);
-
-        glVertex3d(x1, y1, z1);
-        glVertex3d(x2, y1, z1);
-
-        glVertex3d(x1, y1, z1);
-        glVertex3d(x1, y1, z2);
-
-        glVertex3d(x1, y2, z1);
-        glVertex3d(x2, y2, z1);
-
-        glVertex3d(x2, y1, z1);
-        glVertex3d(x2, y2, z1);
-
-        glVertex3d(x2, y2, z1);
-        glVertex3d(x2, y2, z2);
-
-        glVertex3d(x1, y1, z2);
-        glVertex3d(x1, y2, z2);
-
-        glVertex3d(x1, y1, z2);
-        glVertex3d(x2, y1, z2);
-
-        glVertex3d(x2, y1, z2);
-        glVertex3d(x2, y2, z2);
-
-        glVertex3d(x2, y2, z2);
-        glVertex3d(x1, y2, z2);
-
-        glVertex3d(x1, y2, z2);
-        glVertex3d(x1, y2, z1);
-
-        glVertex3d(x2, y1, z1);
-        glVertex3d(x2, y1, z2);
-
-        glEnd();
-    }
-}
diff --git a/src/VoxelClient/VoxelClient_VisDrawer.h b/src/VoxelClient/VoxelClient_VisDrawer.h
deleted file mode 100755 (executable)
index a36cca9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Copyright (c) 1999-2012 OPEN CASCADE SAS
-
- The content of this file is subject to the Open CASCADE Technology Public
- License Version 6.5 (the "License"). You may not use the content of this file
- except in compliance with the License. Please obtain a copy of the License
- at http://www.opencascade.org and read it completely before using this file.
-
- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-
- The Original Code and all software distributed under the License is
- distributed on an "AS IS" basis, without warranty of any kind, and the
- Initial Developer hereby disclaims all such warranties, including without
- limitation, any warranties of merchantability, fitness for a particular
- purpose or non-infringement. Please see the License for the specific terms
- and conditions governing the rights and limitations under the License.
-
-*/
-
-#ifndef _VOXEL_VISDRAWER_H_
-#define _VOXEL_VISDRAWER_H_
-
-#include "Voxel_VisData.h"
-#include <Graphic3d_CBounds.hxx>
-
-class Handle(OpenGl_GraphicDriver);
-
-class VoxelClient_VisDrawer
-{
-public:
-
-  class VisElement;
-
-public:
-
-  Standard_EXPORT static void Init (Handle(OpenGl_GraphicDriver)& theDriver);
-
-       Standard_EXPORT VoxelClient_VisDrawer(Voxel_VisData* theData);
-       Standard_EXPORT virtual ~VoxelClient_VisDrawer();
-
-       Standard_EXPORT void EvalMinMax(Graphic3d_CBounds& theMinMax) const;
-       Standard_EXPORT void Display(const Standard_Boolean theHighlight);
-
-private:
-    
-       Standard_EXPORT void DisplayVoxels(const Standard_Boolean theHighlight);
-       Standard_EXPORT void DisplayPoints(const Standard_Boolean nearest);
-       Standard_EXPORT void DisplayBoxes(const Standard_Boolean nearest);
-    Standard_EXPORT void HighlightVoxel();
-       
-    Standard_EXPORT void DisplayTriangulation(const Standard_Boolean theHighlight);
-
-       Voxel_VisData* myData;
-};
-
-#endif // _VOXEL_VISDRAWER_H_