1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
oan
cb2e41f927 Exact intersection of discrete segments 2019-11-04 22:04:04 +03:00
2768 changed files with 138535 additions and 71534 deletions

View File

@@ -3,7 +3,6 @@ StdResource
SHMessage
Textures
Shaders
XRResources
XSMessage
XSTEPResource
XmlOcafResource

View File

@@ -1,4 +1,4 @@
TModelingData TKShapeView TKMessageModel TKMessageView
TModelingData TKShapeView
TVisualization TKView TKVInspector
TApplicationFramework TKTreeModel TKTInspectorAPI TKDFBrowser
TTool TKTInspector TKToolsDraw TInspectorEXE

View File

@@ -108,7 +108,6 @@ n BRepMesh
n BRepMeshData
n BRepOffset
n BRepOffsetAPI
n BRepPreviewAPI
n BRepPrim
n BRepPrimAPI
n BRepProj
@@ -202,7 +201,6 @@ n InterfaceGraphic
n AIS
n Aspect
n DsgPrs
n PrsDim
n Graphic3d
n Image
n Media
@@ -216,13 +214,13 @@ n SelectBasics
n SelectMgr
n StdPrs
n StdSelect
n TColQuantity
n V3d
n WNT
n Xw
n Cocoa
r Textures
r Shaders
r XRResources
t TKMeshVS
t TKOpenGl
t TKD3DHost
@@ -445,23 +443,3 @@ t TKRWMesh
n RWGltf
n RWMesh
n RWObj
n DFBrowser
n DFBrowserPane
n DFBrowserPaneXDE
n ShapeView
n TInspector
n TInspectorAPI
x TInspectorEXE
t TKDFBrowser
t TKShapeView
t TKTInspector
t TKTInspectorAPI
t TKToolsDraw
t TKTreeModel
t TKView
t TKVInspector
n ToolsDraw
n TreeModel
n View
n ViewControl
n VInspector

View File

@@ -130,9 +130,7 @@ elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
if (APPLE)
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
elseif(NOT WIN32)
# CLang for Windows (at least CLang 8.0 distributed with VS 2019)
# does not support option "-std=c++0x"
else()
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)

View File

@@ -7,8 +7,7 @@ if (NOT DEFINED ${3RDPARTY_QT_DIR} AND ${3RDPARTY_QT_DIR} STREQUAL "")
FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" Qt 3RDPARTY_QT_DIR_NAME)
if (NOT DEFINED ${3RDPARTY_QT_DIR_NAME} AND ${3RDPARTY_QT_DIR_NAME} STREQUAL "")
set (3RDPARTY_QT_DIR "" CACHE PATH "The directory containing qt")
message (FATAL_ERROR "Could not find used third-party product: 3RDPARTY_QT_DIR")
message (FATAL_ERROR "... Qt root directory was not found")
endif()
# Combine directory name with absolute path and show in GUI
@@ -32,10 +31,4 @@ if (NOT ${Qt5_FOUND})
#message (STATUS "Qt4 cmake configuration")
else()
#message (STATUS "Qt5 cmake configuration")
endif()
if (3RDPARTY_QT_DIR OR EXISTS "${3RDPARTY_QT_DIR}")
list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_QT_DIR}/bin")
else()
list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_QT_DLL_DIR)
endif()
endif()

View File

@@ -82,11 +82,6 @@ if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Micr
lappend ::SYS_VC_LIST "vc142-uwp"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
lappend ::SYS_VC_LIST "vclang"
lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
}
# detect installed Visual Studio instances from global environment
if { [info exists ::env(VS140COMNTOOLS)] } {
@@ -187,9 +182,6 @@ proc wokdep:gui:UpdateList {} {
if { "$::HAVE_FFMPEG" == "true" } {
wokdep:SearchFFmpeg anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_OPENVR" == "true" } {
wokdep:SearchOpenVR anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::HAVE_TBB" == "true" } {
wokdep:SearchTBB anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -201,11 +193,7 @@ proc wokdep:gui:UpdateList {} {
}
if { "$::HAVE_ZLIB" == "true" } {
set aCheckLib "z"
if { "$::tcl_platform(platform)" == "windows" } {
set aCheckLib "zlib"
}
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "zlib" "zlib.h" "$aCheckLib" {"zlib"}
wokdep:SearchStandardLibrary anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs "zlib" "zlib.h" "zlib" {"zlib"}
}
if { "$::HAVE_LIBLZMA" == "true" } {
set aCheckLib "lzma"
@@ -226,14 +214,9 @@ proc wokdep:gui:UpdateList {} {
wokdep:SearchRapidJson anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if {"$::BUILD_Inspector" == "true" } {
set ::CHECK_QT "true"
if { "$::CHECK_QT4" == "true" } {
wokdep:SearchQt4 anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::CHECK_QT" == "true" } {
wokdep:SearchQt anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
if { "$::CHECK_JDK" == "true" } {
wokdep:SearchJDK anIncErrs anLib32Errs anLib64Errs anBin32Errs anBin64Errs
}
@@ -475,8 +458,6 @@ checkbutton .myFrame.myChecks.myFImageCheck -offvalue "false" -onvalue "true
ttk::label .myFrame.myChecks.myFImageLbl -text "Use FreeImage"
checkbutton .myFrame.myChecks.myTbbCheck -offvalue "false" -onvalue "true" -variable HAVE_TBB -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myTbbLbl -text "Use Intel TBB"
checkbutton .myFrame.myChecks.myOpenVrCheck -offvalue "false" -onvalue "true" -variable HAVE_OPENVR -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myOpenVrLbl -text "Use OpenVR"
if { "$::tcl_platform(os)" != "Darwin" } {
checkbutton .myFrame.myChecks.myGlesCheck -offvalue "false" -onvalue "true" -variable HAVE_GLES2 -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myGlesLbl -text "Use OpenGL ES"
@@ -504,16 +485,11 @@ ttk::label .myFrame.myChecks.myLzmaLbl -text "Use liblzma"
checkbutton .myFrame.myChecks.myE57Check -offvalue "false" -onvalue "true" -variable HAVE_E57 -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myE57Lbl -text "Use E57"
checkbutton .myFrame.myChecks.myQtCheck -offvalue "false" -onvalue "true" -variable CHECK_QT -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myQtLbl -text "Search Qt"
checkbutton .myFrame.myChecks.myQt4Check -offvalue "false" -onvalue "true" -variable CHECK_QT4 -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myQt4Lbl -text "Search Qt4"
checkbutton .myFrame.myChecks.myJDKCheck -offvalue "false" -onvalue "true" -variable CHECK_JDK -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myJDKLbl -text "Search JDK"
if { "$::tcl_platform(platform)" == "windows" } {
checkbutton .myFrame.myChecks.myInspectorBuild -offvalue "false" -onvalue "true" -variable BUILD_Inspector -command wokdep:gui:UpdateList
ttk::label .myFrame.myChecks.myInspectorLbl -text "Build Inspector"
}
# Additional headers search paths
ttk::label .myFrame.myIncLbl -text "Additional headers search paths:" -padding {5 5 80 5}
scrollbar .myFrame.myIncScrl -command ".myFrame.myIncList yview"
@@ -617,8 +593,8 @@ if { "$::tcl_platform(os)" != "Darwin" } {
grid .myFrame.myChecks.myZLibCheck -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myZLibLbl -row $aCheckRowIter -column 7 -sticky w
grid .myFrame.myChecks.myQtCheck -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myQtLbl -row $aCheckRowIter -column 13 -sticky w
grid .myFrame.myChecks.myQt4Check -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myQt4Lbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myFFmpegCheck -row $aCheckRowIter -column 0 -sticky e
@@ -640,16 +616,9 @@ grid .myFrame.myChecks.myJDKLbl -row $aCheckRowIter -column 13 -sticky w
incr aCheckRowIter
grid .myFrame.myChecks.myRapidJsonCheck -row $aCheckRowIter -column 0 -sticky e
grid .myFrame.myChecks.myRapidJsonLbl -row $aCheckRowIter -column 1 -sticky w
grid .myFrame.myChecks.myOpenVrCheck -row $aCheckRowIter -column 4 -sticky e
grid .myFrame.myChecks.myOpenVrLbl -row $aCheckRowIter -column 5 -sticky w
grid .myFrame.myChecks.myE57Check -row $aCheckRowIter -column 6 -sticky e
grid .myFrame.myChecks.myE57Lbl -row $aCheckRowIter -column 7 -sticky w
if { "$::tcl_platform(platform)" == "windows" } {
grid .myFrame.myChecks.myInspectorBuild -row $aCheckRowIter -column 12 -sticky e
grid .myFrame.myChecks.myInspectorLbl -row $aCheckRowIter -column 13 -sticky w
}
incr aCheckRowIter
# Additional headers search paths

View File

@@ -68,7 +68,7 @@ if { [info exists ::env(SHORTCUT_HEADERS)] } {
}
# fetch environment variables (e.g. set by custom.sh or custom.bat) and set them as tcl variables with the same name
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENVR HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo BUILD_Inspector}
set THE_ENV_VARIABLES {HAVE_FREEIMAGE HAVE_FFMPEG HAVE_TBB HAVE_GLES2 HAVE_D3D HAVE_VTK HAVE_ZLIB HAVE_LIBLZMA HAVE_E57 HAVE_RAPIDJSON HAVE_OPENCL CHECK_QT4 CHECK_JDK MACOSX_USE_GLX HAVE_RelWithDebInfo}
foreach anEnvIter $THE_ENV_VARIABLES {
set ${anEnvIter} "false"
if { [info exists ::env(${anEnvIter})] } {
@@ -241,11 +241,7 @@ proc wokdep:Preferred {theList theCmpl theArch} {
# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
if { [regexp {^vclang} $theCmpl] } {
set aCmpl vc14
} else {
set aCmpl $theCmpl
}
set aCmpl $theCmpl
}
set aShortList {}
@@ -625,59 +621,6 @@ proc wokdep:SearchFFmpeg {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBi
return "$isFound"
}
# Search OpenVR SDK placement
proc wokdep:SearchOpenVR {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
upvar $theErrInc anErrInc
upvar $theErrLib32 anErrLib32
upvar $theErrLib64 anErrLib64
upvar $theErrBin32 anErrBin32
upvar $theErrBin64 anErrBin64
set isFound "true"
set anOpenVrHPath [wokdep:SearchHeader "openvr.h"]
if { "$anOpenVrHPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$::ARCH" ]
if { "$aPath" != "" && [file exists "$aPath/include/openvr.h"] } {
lappend ::CSF_OPT_INC "$aPath/include"
} elseif { "$aPath" != "" && [file exists "$aPath/headers/openvr.h"] } {
lappend ::CSF_OPT_INC "$aPath/headers"
} else {
lappend anErrInc "Error: 'openvr.h' not found (OpenVR)"
set isFound "false"
}
}
set aPlatform "unknown"
if { "$::tcl_platform(platform)" == "windows" } {
set aPlatform "win"
} elseif { "$::tcl_platform(os)" == "Darwin" } {
set aPlatform "osx"
} elseif { "$::tcl_platform(os)" == "Linux" } {
set aPlatform "linux"
}
foreach anArchIter {64 32} {
set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter"]
if { "$anOpenVrLibPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{openvr}*] "$::VCVER" "$anArchIter" ]
set anOpenVrLibPath [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib/${aPlatform}${anArchIter}"]
set anOpenVrLibPath2 [wokdep:SearchLib "openvr_api" "$anArchIter" "$aPath/lib"]
if { "$anOpenVrLibPath" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/${aPlatform}${anArchIter}"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/${aPlatform}${anArchIter}"
} elseif { "$anOpenVrLibPath2" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
} else {
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}openvr_api.${::SYS_LIB_SUFFIX}' not found (OpenVR)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}
}
return "$isFound"
}
# Search TBB library placement
proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
upvar $theErrInc anErrInc
@@ -688,11 +631,7 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
# keep only two first digits in "vc141"
if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
if { [regexp {^vclang} ${::VCVER}] } {
set aVcLib vc14
} else {
set aVcLib ${::VCVER}
}
set aVcLib ${::VCVER}
}
set isFound "true"
@@ -1075,8 +1014,8 @@ proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
return "$isFound"
}
# Search Qt libraries placement
proc wokdep:SearchQt {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
# Search Qt4 libraries placement
proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
upvar $theErrInc anErrInc
upvar $theErrLib32 anErrLib32
upvar $theErrLib64 anErrLib64
@@ -1084,46 +1023,53 @@ proc wokdep:SearchQt {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64}
upvar $theErrBin64 anErrBin64
set isFound "true"
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt}*] "$::VCVER" "$::ARCH" ]
set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qguiapplication.h"]
set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
if { "$aQMsgBoxHPath" == "" } {
if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qguiapplication.h"] } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
lappend ::CSF_OPT_INC "$aPath/include"
lappend ::CSF_OPT_INC "$aPath/include/Qt"
lappend ::CSF_OPT_INC "$aPath/include/QtGui"
lappend ::CSF_OPT_INC "$aPath/include/QtCore"
lappend ::CSF_OPT_INC "$aPath/include/QtWidgets"
lappend ::CSF_OPT_INC "$aPath/include/QtXml"
} else {
lappend anErrInc "Error: 'QtGui/qguiapplication.h' not found"
if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
lappend ::CSF_OPT_INC "/usr/include/qt4"
lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
} else {
lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
set isFound "false"
}
}
}
set aQtGuiLibName "QtGui"
if { "$::tcl_platform(platform)" == "windows" } {
set aQtGuiLibName "Qt5Gui"
set aQtGuiLibName "QtGui4"
}
foreach anArchIter {64 32} {
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
if { "$aQMsgBoxLibPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
if { "$aQMsgBoxLibPath" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
} else {
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt)"
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}
if { "$::tcl_platform(platform)" == "windows" } {
set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter"]
set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
if { "$aQMsgBoxDllPath" == "" } {
set aQMsgBoxDllPath [wokdep:SearchBin "${aQtGuiLibName}.dll" "$anArchIter" "$aPath/bin"]
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
if { "$aQMsgBoxDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
} else {
lappend anErrBin$anArchIter "Error: '${aQtGuiLibName}.dll' not found (Qt)"
lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,6 @@ set "HAVE_D3D=false"
set "HAVE_ZLIB=false"
set "HAVE_LIBLZMA=false"
set "HAVE_RAPIDJSON=false"
set "HAVE_OPENVR=false"
set "HAVE_E57=false"
set "CSF_OPT_INC="
set "CSF_OPT_LIB32="
@@ -78,9 +77,6 @@ if "%VCVER:~-4%" == "-uwp" (
set VCLIB=%VCLIB%-uwp
set VCPROP=Universal
)
if "%VCFMT%" == "vclang" (
set VCLIB=vc14
)
rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
rem ----- Parsing of Visual Studio platform -----
@@ -110,10 +106,6 @@ if not "%DevEnvDir%" == "" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "DevEnvDir=%%i\Common7\IDE\"
)
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
@@ -126,7 +118,6 @@ if not "%DevEnvDir%" == "" (
echo vc14 = VS 2015
echo vc141 = VS 2017
echo vc142 = VS 2019
echo vclang = VS 2019 with ClangCL toolset
exit /B
)
@@ -156,11 +147,6 @@ if /I "%VCFMT%" == "vc9" (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=v142"
) else if /I "%VCFMT%" == "vclang" (
for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
)
set "VCPlatformToolSet=ClangCL"
) else if /I "%VCFMT%" == "gcc" (
rem MinGW
) else (
@@ -190,7 +176,6 @@ if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DH
if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
if ["%HAVE_RAPIDJSON%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_RAPIDJSON" & set "CSF_DEFINES=HAVE_RAPIDJSON;%CSF_DEFINES%"
if ["%HAVE_OPENVR%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENVR" & set "CSF_DEFINES=HAVE_OPENVR;%CSF_DEFINES%"
if ["%HAVE_E57%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_E57" & set "CSF_DEFINES=HAVE_E57;%CSF_DEFINES%"
rem Eliminate VS warning

View File

@@ -16,7 +16,6 @@ export HAVE_GLES2="false";
export HAVE_ZLIB="false";
export HAVE_LIBLZMA="false";
export HAVE_RAPIDJSON="false";
export HAVE_OPENVR="false";
export HAVE_E57="false";
export MACOSX_USE_GLX="false";
export CSF_OPT_INC=""
@@ -107,7 +106,6 @@ if [ "$HAVE_VTK" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -D
if [ "$HAVE_ZLIB" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_ZLIB"; fi
if [ "$HAVE_LIBLZMA" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_LIBLZMA"; fi
if [ "$HAVE_RAPIDJSON" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_RAPIDJSON"; fi
if [ "$HAVE_OPENVR" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_OPENVR"; fi
if [ "$HAVE_E57" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DHAVE_E57"; fi
# Option to compile OCCT with X11 libs on Mac OS X
if [ "$MACOSX_USE_GLX" == "true" ]; then export CSF_OPT_CMPL="${CSF_OPT_CMPL} -DMACOSX_USE_GLX"; fi

View File

@@ -159,7 +159,7 @@
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
<OutputFile>.\..\..\..\win32\__VCVER__\bind\__TKNAM__.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
@@ -255,7 +255,7 @@
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
<OutputFile>.\..\..\..\win64\__VCVER__\bind\__TKNAM__.dll</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

View File

@@ -149,7 +149,7 @@
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win32\__VCVER__\libd;$(CSF_OPT_LIB32D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -238,7 +238,7 @@
<PreprocessorDefinitions>_DEBUG;$(CSF_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>__TKDEP_DEBUG__</AdditionalDependencies>
<AdditionalDependencies>__TKDEP__</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<AdditionalLibraryDirectories>..\..\..\win64\__VCVER__\libd;$(CSF_OPT_LIB64D);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -64,7 +64,7 @@ Then makefiles will appear in the build folder (e.g. <i> D:/occt/build-android <
Alternatively one may specify the values without a toolchain file:
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=21 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
> cmake -G "MinGW Makefiles" -DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_NDK=D:/DevTools/android-ndk-r13b -DCMAKE_ANDROID_STL_TYPE=gnustl_shared -DCMAKE_SYSTEM_VERSION=15 -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_MAKE_PROGRAM=D:/DevTools/MinGW/bin/mingw32-make.exe -D3RDPARTY_DIR=D:/occt-3rdparty D:/occt
@figure{/dev_guides/building/android/images/android_image006.png}

View File

@@ -150,8 +150,7 @@ Steps to prepare dump of the object into json:
1. Create method <b>DumpJson</b>. The method should accept the output stream and the depth for the fields dump.
Depth, equal to zero means that only fields of this class should be dumped. Default value -1 means that whole tree of dump will be built recursively calling dump of all fields.
2. Put into the first row of the method <b>OCCT_DUMP_CLASS_BEGIN</b> or <b>OCCT_DUMP_TRANSIENT_CLASS_BEGIN</b> (for Standard_Transient objects).
This macro appends class name into output stream.
2. Put into the first row of the method <b>OCCT_DUMP_CLASS_BEGIN</b>. This macro creates a local variable, that will open Json structure on start, and close on exit from this method.
3. Add several macro to store field values.
@@ -369,53 +368,3 @@ Each counter has its name shown when the collected statistics are printed.
In DRAW, use command *dperf* to print all performance statistics.
Note that performance counters are not thread-safe.
@section occt_debug_sanitizers Use of compiler sanitizers
GCC and Clang compilers provide options for instrumenting the code with the tools intended for detection of run-time errors, called sanitizers.
This section provides some hints for using sanitizers for detecting possible errors in OCCT code.
@subsection occt_debug_sanitizers_linux Linux
Example of configuration steps for Ubuntu:
1. In CMake configuration:
- Use up-to-date version of the GCC or CLang compiler; make sure that if CMAKE_CXX_COMPILER is set to C++ compiler (e.g. "clang++-6.0") and CMAKE_C_COMPILER is set to C compiler (e.g. "clang-6.0")
- Ensure that CMAKE_LINKER is set to the C++ linker bundled with compiler (e.g. clang++-6.0); this is important to avoid linking problems
- For building with Address sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls"
- For building with Undefined Behavior sanitizer, set CMAKE_CXX_FLAGS and CMAKE_C_FLAGS to "-fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"
- Set CMAKE_BUILD_TYPE to RelWithDebInfo to get more informative stack traces on errors
2. Build as usual (make)
Be prepared that it works much slower than normal build and consumes more disk space.
3. Before running executable, make sure that "llvm-symbolizer" is in PATH; this is necessary to get human-readable stack traces. The tool must have exactly that name.
If it is installed in common folder (/usr/bin or similar) with different name, one option is to create a symlink, for instance:
> sudo ln -s /usr/bin/llvm-symbolizer-6.0 /usr/bin/llvm-symbolizer
Alternatively, add directory where actual llvm-symbolizer is located (such as /usr/lib/llvm-6.0/bin) to the PATH variable.
4. Set environment variable to disable memory leaks detection (they seem to be reported for every global variable at exit, not much useful):
> export ASAN_OPTIONS=detect_leaks=0
5. Set environment variable CSF_CPULIMIT_FACTOR to reasonably large number to increase the time limits for program execution (used by OCCT tests) to compensate the performance penalty introduced by sanitizers:
> export CSF_CPULIMIT_FACTOR=20
6. When using UBSan, set environment variable UBSAN_OPTIONS to get stack traces:
> export UBSAN_OPTIONS=print_stacktrace=1
7. Run DRAW and perform tests as usual, keeping in mind that running with sanitizer is much heavier than normal build:
> ./draw.sh relwithdeb <br>
> Draw[]> testgrid -parallel 0
Note that when running tests under sanitizers, behavior may be different.
Known problems (as of CLang 6.0) are:
- Software signals (access violation etc.) are not handled
- Heap memory usage always reports zero
@subsection occt_debug_sanitizers_windows Windows
Though CLang toolset is available in Visual Studio 2015 and newer, sanitizer do not seem to be available out of the box (last tested with VS 2019 16.2.3).

View File

@@ -1888,94 +1888,3 @@ Unexpected const-ness of Aspect_Window::DoResize() method has been removed, so t
@subsection upgrade_750_rename Renaming of types
Enumeration BRepOffset_Type is renamed to ChFiDS_TypeOfConcavity.
@subsection upgrade_750_tkv3d TKV3d/TKService toolkits changes
The following changes could be highlighted while porting:
* *Prs3d::GetDeflection()* has been moved to *StdPrs_ToolTriangulatedShape::GetDeflection()*.
* *Prs3d_ShapeTool* has been moved to *StdPrs_ShapeTool*.
* *StdSelect_ViewerSelector3d* has been moved to *SelectMgr_ViewerSelector3d*.
* *Font_BRepFont* has been moved to *StdPrs_BRepFont*.
* Visualization classes now use *TopLoc_Datum3D* (from *TKMath*) instead of *Geom_Transformation* (from *TKG3d*) as smart pointer to *gp_Trsf*.
This is rather an internal change, but some applications might need to be updated.
@subsection upgrade_750_hlrangle Prs3d_Drawer deviation angle
Properties Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::HLRDeviationCoefficient() have been removed from classes *Prs3d_Drawer*, *AIS_Shape* and *AIS_InteractiveContext*.
Prs3d_Drawer::DeviationAngle() should be now used instead of Prs3d_Drawer::HLRAngle() and Prs3d_Drawer::DeviationCoefficient() instead of Prs3d_Drawer::HLRDeviationCoefficient().
The default value of Prs3d_Drawer::DeviationAngle() property has been changed from 12 to 20 degrees to match removed Prs3d_Drawer::HLRAngle(), previously used as input for triangulation algorithm.
@subsection upgrade_750_hlrprs Changes in HLR presentation API
Methods computing HLR presentation within *PrsMgr_PresentableObject::Compute()* have been renamed to *PrsMgr_PresentableObject::computeHLR()*
and now accept *Graphic3d_Camera* object instead of removed *Prs3d_Projector*.
@subsection upgrade_750_dimensions Dimension and Relation presentations moved from AIS to PrsDim
Presentation classes displaying Dimensions and Relations have been moved from *AIS* package to *PrsDim*.
Corresponding classes should be renamed in application code (like *AIS_LengthDimension* -> *PrsDim_LengthDimension*).
@subsection upgrade_750_sensitiveEntity Select3D_SensitiveEntity interface change
The method Select3D_SensitiveEntity::NbSubElements() has been changed to be constant. Select3D_SensitiveEntity subclasses at application level should be updated accordingly.
@subsection upgrade_750_Booleans Changes in Boolean operations algorithm
* TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional:
~~~~
void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS,
TopTools_ListOfShape& theLS,
TopTools_MapOfShape* theMap = NULL);
~~~~
@subsection upgrade_750_Adaptor2d_OffsetCurve Offset direction change
Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating values and derivatives of offset curve is unified for offset direction used in class Geom2d_OffsetCurve: now offset direction points to outer ("right") side of base curve instead of the previously used inner ("left") side. Old usage of class in any application should be changed something like that:
Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
@subsection upgrade_750_message_messenger Message_Messenger interface change
Operators << with left argument *Handle(Message_Messenger)*, used to output messages with
a stream-like interface, have been removed.
This functionality is provided now by separate class *Message_Messenger::StreamBuffer*.
That class contains a stringstream buffer which can be filled using standard stream
operators. The string is sent to a messenger on destruction of the buffer object,
call of its method Flush(), or using operator << with one of ostream manipulators
(*std::endl, std::flush, std::ends*). Manipulator *Message_EndLine* has been removed,
*std::endl* should be used instead.
New methods *SendFail(), SendAlarm(), SendWarning(), SendInfo()*, and *SendTrace()* are
provided in both *Message_Messenger* class and as static functions in *Message* package
(short-cuts to default messenger), returning buffer object for the output of
corresponding type of the message.
The code that used operator << for messenger, should be ported as follows.
Before the change:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger << "Value = " << anInteger << Message_EndLine;
~~~~~
After the change, single-line variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
theMessenger->SendInfo() << "Value = " << anInteger << std::endl;
~~~~~
After the change, extended variant:
~~~~~
Handle(Message_Messenger) theMessenger = ...;
Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo();
aSender << "Array: [ ";
for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; }
aSender << "]" << std::endl; // aSender can be used further for other messages
~~~~~
@subsection upgrade_750_message_printer Message_Printer interface change
Previously, sub-classes of *Message_Printer* have to provide a triplet of *Message_Printer::Send()* methods accepting different string representations: TCollection_AsciiString, TCollection_ExtendedString and Standard_CString.
*Message_Printer* interface has been changed, so that sub-classes now have to implement only single method *Message_Printer::send()* accepting TCollection_AsciiString argument and having no Endl flag, which has been removed.
Old three Message_Printer::Send() methods remain defined virtual with unused last argument and redirecting to new send() method by default.

View File

@@ -210,7 +210,7 @@ for which OCCT is certified to work.
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br> GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| Android | NDK r10, GNU gcc 4.8 or newer |

View File

@@ -406,47 +406,6 @@ if(!Interface_Static::SetIVal(;read.step.shape.aspect;,1))
~~~~~
Default value is 1 (ON).
<h4>read.step.constructivegeom.relationship:</h4>
Boolean flag regulating translation of "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entities that define
position of constructive geometry entities contained in "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" with respect to the
main representation of the shape (product).
By default, the flag is set to 0 (OFF) so these entities are not translated.
Set this flag to 1 (ON) if you need to translate constructive geometry entities associated with the parts:
~~~~~
if (!Interface_Static::SetIVal("read.step.constructivegeom.relationship", 1)) { .. error .. }
~~~~~
The "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" entity is translated into compound of two unlimited planar faces,
whose location is result of translation of corresponding "AXIS_PLACEMENT" entity.
Note that appropriate interpretation of the translated data should be done after translation.
The result of translation can be obtained either for the "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entity,
of for each of the two "AXIS2_PLACEMENT_3D" entities referenced by it. as follows:
~~~~~
STEPControl_Reader aReader;
... // translate file and parse STEP model to find relevant axis entity
Handle(StepGeom_Axis2Placement3d) aSTEPAxis = ...;
Handle(Transfer_Binder) aBinder = aReader->WS()->TransferReader()->TransientProcess()->Find(aSTEPAxis);
Handle(TransferBRep_ShapeBinder) aShBinder = Handle(TransferBRep_ShapeBinder)::DownCast(aBinder);
if (! aShBinder.IsNull())
{
TopoDS_Face aFace = TopoDS::Face (aShBinder->Result());
if (! aFace.IsNull())
{
Handle(Geom_Plane) aSurf = Handle(Geom_Plane)::DownCast (BRep_Tool::Surface (aFace));
if (! aSurf.IsNull())
{
gp_Ax3 anAxis = aSurf->Placement();
... // use the axis placement data
}
}
}
~~~~~
@subsubsection occt_step_2_3_4 Performing the STEP file translation
Perform the translation according to what you want to translate. You can choose either root entities (all or selected by the number of root), or select any entity by its number in the STEP file. There is a limited set of types of entities that can be used as starting entities for translation. Only the following entities are recognized as transferable:

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#3D3ACF"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#DDDDDD"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#3D3ACF"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#DDDDDD"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#DDDDDD"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#3D3ACF"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#3D3ACF"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,27 +0,0 @@
<svg width="188" height="90" viewBox="0 0 188 90" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="188" height="90" fill="white"/>
<rect x="6.5" y="6.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 8V16H13V26H21V16H26V8H8Z" fill="#DDDDDD"/>
<path d="M42 15H41V16V25H35V9H51V15H42Z" fill="#DDDDDD" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 18V8H63V18H60V26H80V18H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="34.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 36V44H13V54H21V44H26V36H8Z" fill="#DDDDDD"/>
<path d="M42 43H41V44V53H35V37H51V43H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 46V36H63V46H60V54H80V46H71Z" fill="#DDDDDD"/>
<rect x="6.5" y="62.5" width="75" height="21" stroke="#7C97DE"/>
<path d="M8 64V72H13V82H21V72H26V64H8Z" fill="#3D3ACF"/>
<path d="M42 71H41V72V81H35V65H51V71H42Z" fill="#3D3ACF" stroke="#5BD6B8" stroke-width="2"/>
<path d="M71 74V64H63V74H60V82H80V74H71Z" fill="#3D3ACF"/>
<path d="M93 10L100 17L93 24V20H84V14H93V10Z" fill="#7C97DE"/>
<path d="M93 38L100 45L93 52V48H84V42H93V38Z" fill="#7C97DE"/>
<path d="M93 66L100 73L93 80V76H84V70H93V66Z" fill="#7C97DE"/>
<path d="M108 8V16H113V26H121V16H126V8H108Z" fill="#DDDDDD"/>
<path d="M108 36V44H113V54H121V44H126V36H108Z" fill="#DDDDDD"/>
<path d="M108 64V72H113V82H121V72H126V64H108Z" fill="#DDDDDD"/>
<path d="M152 8H134V26H142V16H152V8Z" fill="#3D3ACF"/>
<path d="M152 36H134V54H142V44H152V36Z" fill="#DDDDDD"/>
<path d="M152 64H134V82H142V72H152V64Z" fill="#3D3ACF"/>
<path d="M171 18V8H163V18H160V26H180V18H171Z" fill="#DDDDDD"/>
<path d="M171 46V36H163V46H160V54H180V46H171Z" fill="#DDDDDD"/>
<path d="M171 74V64H163V74H160V82H180V74H171Z" fill="#DDDDDD"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -830,8 +830,10 @@ myContext->MoveTo (thePixelX, thePixelY, myView, true);
Dynamic detection and selection are put into effect in a straightforward way. There are only a few conventions and functions to be familiar with:
* *AIS_InteractiveContext::MoveTo* -- passes mouse position to Interactive Context selectors.
* *AIS_InteractiveContext::SelectDetected* -- stores what has been detected at the last *MoveTo*. Changes the previously selected object. Depending on the selection scheme, the selection is enriched, replaced or other.
* *AIS_InteractiveContext::SelectPoint/SelectRectangle/SelectPolygon* -- Applies selection to point, rectangular or surrounding area. Changes the previously selected object. Depending on the selection scheme, the selection is enriched, replaced or other.
* *AIS_InteractiveContext::Select* -- stores what has been detected at the last *MoveTo*. Replaces the previously selected object. Empties the stack if nothing has been detected at the last move.
* *AIS_InteractiveContext::ShiftSelect* -- if the object detected at the last move was not already selected, it is added to the list of the selected objects. If not, it is withdrawn. Nothing happens if you click on an empty area.
* *AIS_InteractiveContext::Select* -- selects everything found in the surrounding area.
* *AIS_InteractiveContext::ShiftSelect* -- selects what was not previously in the list of selected, deselects those already present.
Highlighting of detected and selected entities is automatically managed by the Interactive Context. The Highlight colors are those dealt with above. You can nonetheless disconnect this automatic mode if you want to manage this part yourself:
~~~~~
@@ -868,17 +870,6 @@ for (myAISCtx->InitSelected(); myAISCtx->MoreSelected(); myAISCtx->NextSelected(
}
~~~~~
@subsubsection occt_visu_3_4_7 Selection schemes
Select* methods of AIS_InteractiveContext accept some selection scheme as parameter. The table below describes available selection schemes.
| Type | Reaction on click | | Type | Reaction on click |
| :----- | :----- | :----- | :----- | :----- |
| AIS_SelectionScheme_Replace | @figure{visualization_selection_scheme_replace.svg, ""} | | AIS_SelectionScheme_XOR | @figure{visualization_selection_scheme_XOR.svg, ""} |
| AIS_SelectionScheme_Add | @figure{visualization_selection_scheme_add.svg, ""} | | AIS_SelectionScheme_Clear | @figure{visualization_selection_scheme_clear.svg, ""} |
| AIS_SelectionScheme_Remove | @figure{visualization_selection_scheme_remove.svg, ""} | | AIS_SelectionScheme_ReplaceExtra | @figure{visualization_selection_scheme_replaceExtra.svg, ""} |
@subsection occt_visu_3_5 Standard Interactive Object Classes
Interactive Objects are selectable and viewable objects connecting graphic representation and the underlying reference geometry.
@@ -971,26 +962,26 @@ This command can also draw a sphere surface or a volume with a large amount of p
The **Relation** is made up of constraints on one or more interactive shapes and the corresponding reference geometry. For example, you might want to constrain two edges in a parallel relation. This constraint is considered as an object in its own right, and is shown as a sensitive primitive. This takes the graphic form of a perpendicular arrow marked with the || symbol and lying between the two edges.
The following relations are provided by *PrsDim*:
* *PrsDim_ConcentricRelation*
* *PrsDim_FixRelation*
* *PrsDim_IdenticRelation*
* *PrsDim_ParallelRelation*
* *PrsDim_PerpendicularRelation*
* *PrsDim_Relation*
* *PrsDim_SymmetricRelation*
* *PrsDim_TangentRelation*
The following relations are provided by *AIS*:
* *AIS_ConcentricRelation*
* *AIS_FixRelation*
* *AIS_IdenticRelation*
* *AIS_ParallelRelation*
* *AIS_PerpendicularRelation*
* *AIS_Relation*
* *AIS_SymmetricRelation*
* *AIS_TangentRelation*
The list of relations is not exhaustive.
@subsubsection occt_visu_3_5_4 Dimensions
* *PrsDim_AngleDimension*
* *PrsDim_Chamf3dDimension*
* *PrsDim_DiameterDimension*
* *PrsDim_DimensionOwner*
* *PrsDim_LengthDimension*
* *PrsDim_OffsetDimension*
* *PrsDim_RadiusDimension*
* *AIS_AngleDimension*
* *AIS_Chamf3dDimension*
* *AIS_DiameterDimension*
* *AIS_DimensionOwner*
* *AIS_LengthDimension*
* *AIS_OffsetDimension*
* *AIS_RadiusDimension*
@subsubsection occt_visu_3_5_5 MeshVS_Mesh
@@ -1419,7 +1410,7 @@ aView->Update();
@subsubsection occt_visu_4_4_5 Perspective Projection
**Field of view (FOVy)** -- defines the field of camera view by y axis in degrees (45° is default).
**Field of view (FOVy)** -- defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
@figure{camera_perspective.png,"Perspective frustum",420}
@@ -1441,7 +1432,7 @@ There are two types of IOD:
* _Graphic3d_Camera::IODType_Absolute_ : Intraocular distance is defined as an absolute value.
* _Graphic3d_Camera::IODType_Relative_ : Intraocular distance is defined relative to the camera focal length (as its coefficient).
**Field of view (FOV)** -- defines the field of camera view by y axis in degrees (45° is default).
**Field of view (FOV)** -- defines the field of camera view by y axis in degrees (45<EFBFBD> is default).
**ZFocus** -- defines the distance to the point of stereographic focus.

View File

@@ -245,10 +245,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView());
myAISContext()->UpdateCurrentViewer();
myAISContext()->Select (theX1, theY1, theX2, theY2, myView(), Standard_True);
}
}
@@ -259,8 +256,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectDetected();
myAISContext()->UpdateCurrentViewer();
myAISContext()->Select (Standard_True);
}
}
@@ -282,11 +278,7 @@ public:
{
if ((!myAISContext().IsNull()) && (!myView().IsNull()))
{
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView(),
AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
myAISContext()->ShiftSelect (theX1, theY1, theX2, theY2, myView(), Standard_True);
}
}
@@ -297,8 +289,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectDetected (AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
myAISContext()->ShiftSelect (Standard_True);
}
}

View File

@@ -262,10 +262,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView());
myAISContext()->UpdateCurrentViewer();
myAISContext()->Select (theX1, theY1, theX2, theY2, myView(), Standard_True);
}
}
@@ -276,8 +273,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectDetected();
myAISContext()->UpdateCurrentViewer();
myAISContext()->Select (Standard_True);
}
}
@@ -299,11 +295,7 @@ public:
{
if (!myAISContext().IsNull() && !myView().IsNull())
{
myAISContext()->SelectRectangle (Graphic3d_Vec2i (theX1, theY1),
Graphic3d_Vec2i (theX2, theY2),
myView(),
AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
myAISContext()->ShiftSelect (theX1, theY1, theX2, theY2, myView(), Standard_True);
}
}
@@ -314,8 +306,7 @@ public:
{
if (!myAISContext().IsNull())
{
myAISContext()->SelectDetected (AIS_SelectionScheme_XOR);
myAISContext()->UpdateCurrentViewer();
myAISContext()->ShiftSelect (Standard_True);
}
}

View File

@@ -24,7 +24,7 @@
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <OpenGl_GraphicDriver.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <Prs3d.hxx>
#include <Prs3d_Drawer.hxx>
#include <STEPControl_Reader.hxx>
#include <STEPCAFControl_Reader.hxx>
@@ -257,12 +257,12 @@ bool OcctViewer::ImportSTEP(std::string theFilename)
}
Handle(Prs3d_Drawer) aDrawer = myContext->DefaultDrawer();
Standard_Real aDeflection = StdPrs_ToolTriangulatedShape::GetDeflection (aCompound, aDrawer);
Standard_Real aDeflection = Prs3d::GetDeflection (aCompound, aDrawer);
if (!BRepTools::Triangulation (aCompound, aDeflection))
{
BRepMesh_IncrementalMesh anAlgo;
anAlgo.ChangeParameters().Deflection = aDeflection;
anAlgo.ChangeParameters().Angle = aDrawer->DeviationAngle();
anAlgo.ChangeParameters().Angle = aDrawer->HLRAngle();
anAlgo.ChangeParameters().InParallel = Standard_True;
anAlgo.SetShape (aCompound);
anAlgo.Perform();

View File

@@ -48,11 +48,27 @@ OcctJni_MsgPrinter::~OcctJni_MsgPrinter()
}
// =======================================================================
// function : send
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity) const
void OcctJni_MsgPrinter::Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
const TCollection_AsciiString aStr (theString);
OcctJni_MsgPrinter::Send (aStr, theGravity, theToPutEndl);
}
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity < myTraceLevel)
{
@@ -69,3 +85,17 @@ void OcctJni_MsgPrinter::send (const TCollection_AsciiString& theString,
myJEnv->CallObjectMethod (myJObj, myJMet, aJStr);
myJEnv->DeleteLocalRef (aJStr);
}
// =======================================================================
// function : Send
// purpose :
// =======================================================================
void OcctJni_MsgPrinter::Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const
{
if (theGravity >= myTraceLevel)
{
OcctJni_MsgPrinter::Send (TCollection_AsciiString (theString), theGravity, theToPutEndl);
}
}

View File

@@ -30,11 +30,20 @@ public:
//! Destructor.
~OcctJni_MsgPrinter();
protected:
//! Redirection to TCollection_AsciiString method
virtual void Send (const TCollection_ExtendedString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Redirection to TCollection_AsciiString method
virtual void Send (const Standard_CString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
//! Main printing method
virtual void send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity) const;
virtual void Send (const TCollection_AsciiString& theString,
const Message_Gravity theGravity,
const Standard_Boolean theToPutEndl) const;
private:

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="All"
SccProjectName=""
SccLocalPath=""
Keyword="MakeFileProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="10"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/All.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="10"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/All.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,431 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Approx"
SccProjectName=""
SccLocalPath=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../Debug"
IntermediateDirectory=".\../Debug/objd"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;WNT"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Debug/objd/Approx.pch"
AssemblerListingLocation=".\../Debug/objd/"
ObjectFile=".\../Debug/objd/"
ProgramDataBaseFileName=".\../Debug/objd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBO.lib TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib"
OutputFile=".\../Debug/Approx.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/Approx.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/Approx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\../Release"
IntermediateDirectory=".\../Release/obj"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WNT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Release/obj/Approx.pch"
AssemblerListingLocation=".\../Release/obj/"
ObjectFile=".\../Release/obj/"
ProgramDataBaseFileName=".\../Release/obj/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBO.lib TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib"
OutputFile=".\../Release/Approx.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\../Release/Approx.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Release/Approx.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="Approx_Presentation.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="Approx_Presentation.h">
</File>
</Filter>
<Filter
Name="Common"
Filter="">
<File
RelativePath="..\env.bat">
</File>
<File
RelativePath="..\readme.txt">
</File>
<File
RelativePath="..\run.bat">
</File>
<File
RelativePath="..\vc.bat">
</File>
<Filter
Name="Source Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\MainFrm.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.h">
</File>
<File
RelativePath="..\Common\WNT\MainFrm.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.h">
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.h">
</File>
<File
RelativePath="..\Common\WNT\resource.h">
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.h">
</File>
<File
RelativePath="..\Common\WNT\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="..\Common\WNT\res\OCCDemo.ico">
</File>
<File
RelativePath="..\Common\WNT\res\OCCDemo.rc2">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar.bmp">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar1.bmp">
</File>
</Filter>
</Filter>
<File
RelativePath="..\Common\WNT\res\occ_logo.bmp">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,603 @@
// Approx_Presentation.cpp: implementation of the Approx_Presentation class.
// Approximation of curves and surfaces from points.
////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Approx_Presentation.h"
#include <GeomAPI_PointsToBSpline.hxx>
#include <GeomAPI_PointsToBSplineSurface.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <gp_Pnt.hxx>
#ifdef WNT
#define EOL "\r\n"
#else
#define EOL "\n"
#endif
#define SCALE 100
// Initialization of global variable with an instance of this class
OCCDemo_Presentation* OCCDemo_Presentation::Current = new Approx_Presentation;
// Initialization of array of samples
const Approx_Presentation::PSampleFuncType Approx_Presentation::SampleFuncs[] =
{
&Approx_Presentation::sample1,
&Approx_Presentation::sample2,
&Approx_Presentation::sample3,
&Approx_Presentation::sample4
};
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Approx_Presentation::Approx_Presentation()
{
myIndex = 0;
myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
setName ("Approximation of curves and surfaces.");
}
//////////////////////////////////////////////////////////////////////
// Sample execution
//////////////////////////////////////////////////////////////////////
void Approx_Presentation::DoSample()
{
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbSamples)
(this->*SampleFuncs[myIndex])();
}
//////////////////////////////////////////////////////////////////////
// Sample functions
//////////////////////////////////////////////////////////////////////
//================================================================
//defining the data of BSpline curves and surfaces:
static Standard_Real Tol [] =
{
0.5*SCALE,
0.7*SCALE,
0.4*SCALE,
1*SCALE
};
static Standard_Integer DegMin [] =
{
2,3,5,7
};
static Standard_Integer DegMax [] =
{
7,9,10,12
};
static GeomAbs_Shape Continuity [] =
{
GeomAbs_C2, GeomAbs_C1, GeomAbs_C2, GeomAbs_C3
};
//================================================================
// Function : Comment
// Purpose :
//================================================================
static TCollection_AsciiString Comment(Standard_Real Step,
Standard_Integer Upper,
Standard_Integer DegMin,
Standard_Integer DegMax,
Standard_Integer Indicator,
Standard_Real Tol)
{
TCollection_AsciiString aText;
aText = (
"/////////////////////////////////////////////////////////////////" EOL
"// Approximation of surface." EOL
"// Building a BSpline surface which approximates a set of points." EOL
"/////////////////////////////////////////////////////////////////" EOL EOL
"// creating a set of points:" EOL
);
aText += "Standard_Real Step = ";
aText += TCollection_AsciiString(Step);
aText += ";" EOL;
aText += "Standard_Integer Upper = ";
aText += TCollection_AsciiString(Upper);
aText += ";" EOL EOL;
aText += (
" //a set of X and Y coordinates:" EOL
" Standard_Real aXStep = Step , aYStep = Step ;" EOL
" Standard_Real aX0 = -300, aY0 = -200;" EOL
" //Z coordinates:" EOL
" TColStd_Array2OfReal aZPoints( 1, Upper , 1, Upper );" EOL EOL
"// initializing array of Z coordinates:" EOL
"// aZPoints(1,1) = -2;" EOL
"// aZPoints(1,2) = 3;" EOL
"// ..." EOL EOL
"//creating a approximate BSpline surface:" EOL
);
aText += "Parameters of surface:" EOL ;
aText += "DegMin = ";
aText += TCollection_AsciiString(DegMin);
aText += ";" EOL;
aText += "DegMax = ";
aText += TCollection_AsciiString(DegMax);
aText += ";" EOL;
aText += "Continuity = " ;
if( Indicator == 2 )
aText += "GeomAbs_C1";
if( Indicator == 3 )
aText += "GeomAbs_C2";
if( Indicator == 4 )
aText += "GeomAbs_C3";
aText += ";" EOL;
aText += "Tolerance = ";
aText += TCollection_AsciiString(Tol/SCALE);
aText += ";" EOL EOL ;
aText += (
"GeomAPI_PointsToBSplineSurface aPTBS;" EOL
"aPTBS.Init(aZPoints,aX0,aXStep,aY0,aYStep," EOL
" DegMin,DegMax,Continuity,Tolerance);" EOL
"Handle(Geom_BSplineSurface) aSurface = aPTBS.Surface();" EOL EOL EOL
);
return aText;
}
//================================================================
// Function : Approx_Presentation::CreateBSplineSurface
// Purpose :
//================================================================
Handle(Geom_BSplineSurface) Approx_Presentation::CreateBSplineSurface(TColStd_Array2OfReal& aZPoints,
Standard_Real theXStep,
Standard_Real theYStep,
Standard_Integer Count)
{
Standard_Real aX0 = -300, aY0 = -200;
GeomAPI_PointsToBSplineSurface aPTBS;
aPTBS.Init(aZPoints,aX0,theXStep,aY0,theYStep,
DegMin[Count],DegMax[Count],Continuity[Count],Tol[Count]);
Handle(Geom_BSplineSurface) aSurface = aPTBS.Surface();
return aSurface;
}
//================================================================
// Function : Approx_Presentation::DrawModifyBSplineSurface
// Purpose :
//================================================================
Standard_Boolean Approx_Presentation::DrawModifyBSplineSurface(TColStd_Array2OfReal& aZPoints,
Standard_Real theXStep,
Standard_Real theYStep,
Standard_Integer theIndexX,
Standard_Integer theIndexY,
Standard_Real theDeflection,
Handle(AIS_InteractiveObject)& aMovePnt,
Handle(AIS_InteractiveObject)& aObj,
Standard_Integer Count)
{
Handle(AIS_InteractiveObject) auxObj;
Standard_Real aX0 = -300, aY0 = -200;
Standard_Real aLastZ = aZPoints(theIndexX,theIndexY);
aZPoints(theIndexX,theIndexY) += 100*theDeflection;
Standard_Real aCurrentX = aX0 + theXStep*(theIndexX-1),
aCurrentY = aY0 + theYStep*(theIndexY-1);
getAISContext()->Erase(aMovePnt);
aMovePnt = drawPoint(gp_Pnt(aCurrentX,aCurrentY,aZPoints(theIndexX,theIndexY)));
if(WAIT_A_LITTLE) return Standard_False;
GeomAPI_PointsToBSplineSurface aPTBS;
aPTBS.Init(aZPoints,aX0,theXStep,aY0,theYStep,
DegMin[Count],DegMax[Count],Continuity[Count],Tol[Count]);
aZPoints(theIndexX,theIndexY) = aLastZ;
Handle(Geom_BSplineSurface) aSurface = aPTBS.Surface();
auxObj = drawSurface(aSurface);
getAISContext()->Erase(aObj);
aObj = auxObj;
if(WAIT_A_SECOND) return Standard_False;
return Standard_True;
}
//================================================================
// Function : Approx_Presentation::sample1
// Purpose :
//================================================================
void Approx_Presentation::sample1()
{
Standard_Integer Count = 0;
TCollection_AsciiString aText = (
"//////////////////////////////////////////////////////////////" EOL
"// Approximation of curve." EOL
"// Building a BSpline curve which approximates a set of points." EOL
"//////////////////////////////////////////////////////////////" EOL EOL
"// creating a set of points to approximate," EOL
"// nPoint is the number of points:" EOL
"Standard_Integer nPoint = 20;" EOL
"TColgp_Array1OfPnt aCurvePoint (1, nPoint);" EOL EOL
"// initializing this array of points:" EOL
"// aCurvePoint(1,1) = gp_Pnt(-6,1,0);" EOL
"// aCurvePoint(1,2) = gp_Pnt(-5,1.5,0);" EOL
"// ..." EOL EOL
"//creating an empty approximation algorithm:" EOL
"GeomAPI_PointsToBSpline aPTB;" EOL EOL
"//creating a approximate BSpline curve:" EOL
);
aText += "//parameters of curve:" EOL ;
aText += "DegMin = ";
aText += TCollection_AsciiString(DegMin[Count]);
aText += ";" EOL;
aText += "DegMax = ";
aText += TCollection_AsciiString(DegMax[Count]);
aText += ";" EOL;
aText += "Continuity = GeomAbs_C2" ;
aText += ";" EOL;
aText += "Tolerance = ";
aText += TCollection_AsciiString(Tol[Count]/SCALE);
aText += ";" EOL EOL ;
aText += (
"aPTB.Init(aCurvePoint,DegMin,DegMax,Continuity,Tolerance);" EOL
"Handle(Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
);
setResultTitle("Creating approximations of curves");
setResultText(aText.ToCString());
getAISContext()->EraseAll();
Standard_Real aCoords[][3] = {
{-6,1,0},{-5,1.5,0},{-4,2,0},{-3.5,3,0},{-3,2.7,0},{-2,2.5,0},{-1.5,1,0},{-1,0.5,0},
{0,0,0},{1,0.3,0},{2,1,0},{3,1.5,0},{4,2.3,0},{5,2.7,0},{5.5,3.2,0},{6,2.5,0},
{7,2,0},{7.5,1,0},{8,0,0},{8.5,-1,0}
};
Standard_Integer nPoint = sizeof(aCoords)/(sizeof(Standard_Real)*3);
TColgp_Array1OfPnt aCurvePoint (1, nPoint);
GeomAPI_PointsToBSpline aPTB;
Handle(AIS_InteractiveObject) aIndexPnt [2],aObj;
Standard_Integer aIndex[2] = {9,13};
Standard_Real aDeflection[2] = {-1.5,2};
for (Standard_Integer i=0; i < nPoint; i++)
{
aCurvePoint(i+1) = gp_Pnt (aCoords[i][0]*SCALE-100, aCoords[i][1]*SCALE-100, aCoords[i][2]*SCALE);
if( i+1 == aIndex[0])
aIndexPnt[0] = drawPoint(aCurvePoint(aIndex[0]));
if( i+1 == aIndex[1])
aIndexPnt[1] = drawPoint(aCurvePoint(aIndex[1]));
if( i+1 != aIndex[0] && i+1 != aIndex[1])
drawPoint(aCurvePoint(i+1));
}
if(WAIT_A_LITTLE) return;
aPTB.Init(aCurvePoint,DegMin[Count],DegMax[Count],Continuity[Count],Tol[Count]);
Handle(Geom_BSplineCurve) aCurve = aPTB.Curve();
aObj = drawCurve(aCurve);
for( i = 0 ; i < 2 ; i++)
{
if (WAIT_A_SECOND) return;
getAISContext()->Erase(aIndexPnt[i]);
aCurvePoint(aIndex[i]) = gp_Pnt(aCurvePoint(aIndex[i]).X()-SCALE*aDeflection[i],
aCurvePoint(aIndex[i]).Y()+SCALE*aDeflection[i],
aCurvePoint(aIndex[i]).Z());
aIndexPnt[i] = drawPoint(aCurvePoint(aIndex[i]));
aPTB.Init(aCurvePoint,DegMin[Count],DegMax[Count],Continuity[Count],Tol[Count]);
aCurve = aPTB.Curve();
if (WAIT_A_LITTLE) return;
getAISContext()->Erase(aObj);
aObj = drawCurve(aCurve);
}
}
//================================================================
// Function : Approx_Presentation::sample2
// Purpose :
//================================================================
void Approx_Presentation::sample2()
{
setResultTitle("Creating approximations of surfaces");
Standard_Integer Count = 1;
Standard_Real aZCoords [] =
{
{-1},{0},{0},{1},{0},{-1},{-1},{0},{0},{-1.5},{-2.5},{0},{1},{-2},{-3},{0}
};
Standard_Real aXStep = 175, aYStep = 175;
Standard_Real aX0 = -300, aY0 = -200;
Standard_Integer anUpper = 4;
TColStd_Array2OfReal aZPoints(1,anUpper,1,anUpper);
Standard_Integer aIndexX[] = { 4, 3, 2, 2, 1 };
Standard_Integer aIndexY[] = { 4, 3, 2, 3, 4 };
Standard_Real aDeflection[] = { 1.5, 2.5, 1.5, 1.5, -1 };
Standard_Integer aNumOfIndexPnt = sizeof(aIndexX)/sizeof(Standard_Integer);
TColgp_Array2OfPnt aPnt(1,4,1,4);
Handle(AIS_InteractiveObject) aShowPnt[4][4],aObj,aMovePnt;
Standard_Integer aColLength = aZPoints.ColLength();
Standard_Integer aRowLength = aZPoints.RowLength();
Standard_Integer aIndex = -1;
for(Standard_Integer i = 0 ; i < aRowLength ; i++)
{
for(Standard_Integer j = 0; j < aColLength ; j++)
{
aIndex++;
aZPoints(i+1,j+1) = aZCoords[aIndex];
}
}
Standard_Real auxY0,auxX0 = aX0 - aXStep;
for( i = 0 ; i < aColLength ; i++)
{
auxX0 += aXStep;
auxY0 = aY0 - aYStep;
for(Standard_Integer j = 0 ; j < aRowLength ; j++)
{
aZPoints(i+1,j+1) *=SCALE;
auxY0 += aYStep;
aPnt(i+1,j+1) = gp_Pnt (auxX0,auxY0,aZPoints(i+1,j+1));
aShowPnt[i][j] = drawPoint(aPnt(i+1,j+1));
}
}
if(WAIT_A_LITTLE) return ;
TCollection_AsciiString aText;
aText = Comment(aXStep,anUpper,DegMin[Count],DegMax[Count],Count+1,Tol[Count]);
setResultText(aText.ToCString());
Handle(Geom_BSplineSurface) aSurface = CreateBSplineSurface(aZPoints,aXStep,aYStep,Count);
aObj = drawSurface(aSurface);
Standard_Boolean aBool;
if(WAIT_A_LITTLE) return ;
for( i = 0 ; i < aNumOfIndexPnt ; i++)
{
aMovePnt = aShowPnt[aIndexX[i]-1][aIndexY[i]-1];
aBool = DrawModifyBSplineSurface(aZPoints,aXStep,aYStep,aIndexX[i],aIndexY[i],
aDeflection[i],aMovePnt,aObj,Count);
if(!aBool) return;
if( i < aNumOfIndexPnt - 1)
{
drawPoint(aPnt(aIndexX[i],aIndexY[i]));
getAISContext()->Erase(aMovePnt);
}
}
}
//================================================================
// Function : Approx_Presentation::sample3
// Purpose :
//================================================================
void Approx_Presentation::sample3()
{
setResultTitle("Creating approximations of surfaces");
Standard_Integer Count = 2;
Standard_Real aZCoords [] =
{
{-3},{-2.3},{-3},{-0.5},{-1},{-1},{-1},{-1},{0},{0},{0},{0},{1},{-1},{-1},{0}
};
Standard_Integer anUpper = 4;
TColStd_Array2OfReal aZPoints(1,anUpper,1,anUpper);
Standard_Integer aIndexX[] = {1, 2, 3, 4};
Standard_Integer aIndexY[] = {1, 2, 3, 4};
Standard_Real aDeflection[] = {1.5, 2, 1, 1.5};
Standard_Integer aNumOfIndexPnt = sizeof(aIndexX)/sizeof(Standard_Integer);
TColgp_Array2OfPnt aPnt(1,4,1,4);
Handle(AIS_InteractiveObject) aShowPnt[4][4],aObj,aMovePnt;
Standard_Integer aColLength = aZPoints.ColLength();
Standard_Integer aRowLength = aZPoints.RowLength();
Standard_Integer aIndex = -1;
for(Standard_Integer i = 0 ; i < aRowLength ; i++)
{
for(Standard_Integer j = 0; j < aColLength ; j++)
{
aIndex++;
aZPoints(i+1,j+1) = aZCoords[aIndex];
}
}
Standard_Real aXStep = 175, aYStep = 175;
Standard_Real aX0 = -300, aY0 = -200;
Standard_Real auxY0,auxX0 = aX0 - aXStep;
for( i = 0 ; i < aColLength ; i++)
{
auxX0 += aXStep;
auxY0 = aY0 - aYStep;
for(Standard_Integer j = 0 ; j < aRowLength ; j++)
{
aZPoints(i+1,j+1) *=SCALE;
auxY0 += aYStep;
aPnt(i+1,j+1) = gp_Pnt (auxX0,auxY0,aZPoints(i+1,j+1));
aShowPnt[i][j] = drawPoint(aPnt(i+1,j+1));
}
}
if(WAIT_A_LITTLE) return ;
TCollection_AsciiString aText;
aText += Comment(aXStep,anUpper,DegMin[Count],DegMax[Count],Count+1,Tol[Count]);
setResultText(aText.ToCString());
Handle(Geom_BSplineSurface) aSurface = CreateBSplineSurface(aZPoints,aXStep,aYStep,Count);
aObj = drawSurface(aSurface);
Standard_Boolean aBool;
if(WAIT_A_LITTLE) return ;
for( i = 0 ; i < aNumOfIndexPnt ; i++)
{
aMovePnt = aShowPnt[aIndexX[i]-1][aIndexY[i]-1];
aBool = DrawModifyBSplineSurface(aZPoints,aXStep,aYStep,aIndexX[i],aIndexY[i],
aDeflection[i],aMovePnt,aObj,Count);
if(!aBool) return;
if( i < aNumOfIndexPnt - 1)
{
drawPoint(aPnt(aIndexX[i],aIndexY[i]));
getAISContext()->Erase(aMovePnt);
}
}
}
//================================================================
// Function : Approx_Presentation::sample4
// Purpose :
//================================================================
void Approx_Presentation::sample4()
{
setResultTitle("Creating approximations of surfaces");
Standard_Integer Count = 3;
Standard_Real aZCoords [] =
{
{-1.5},{0.5},{1},{0.5},{-1.5},{0},{-0.5},{0},{-0.5},{0},{1},{-0.5},{0},{-0.5},{1},{0},{-0.5},
{0},{-0.5},{0},{-1.5},{0.5},{1},{0.5},{-1.5}
};
Standard_Integer anUpper = 5;
TColStd_Array2OfReal aZPoints(1,anUpper,1,anUpper);
Standard_Integer aIndexX[] = { 1, 3, 5 };
Standard_Integer aIndexY[] = { 3, 3, 3 };
Standard_Real aDeflection[] = {-2, 1, -2 };
Standard_Integer aNumOfIndexPnt = sizeof(aIndexX)/sizeof(Standard_Integer);
TColgp_Array2OfPnt aPnt(1,5,1,5);
Handle(AIS_InteractiveObject) aShowPnt[5][5],aObj,aMovePnt;
Standard_Integer aColLength = aZPoints.ColLength();
Standard_Integer aRowLength = aZPoints.RowLength();
Standard_Integer aIndex = -1;
for(Standard_Integer i = 0 ; i < aRowLength ; i++)
{
for(Standard_Integer j = 0; j < aColLength ; j++)
{
aIndex++;
aZPoints(i+1,j+1) = aZCoords[aIndex];
}
}
Standard_Real aXStep = 140, aYStep = 140;
Standard_Real aX0 = -300, aY0 = -200;
Standard_Real auxY0,auxX0 = aX0 - aXStep;
for( i = 0 ; i < aColLength ; i++)
{
auxX0 += aXStep;
auxY0 = aY0 - aYStep;
for(Standard_Integer j = 0 ; j < aRowLength ; j++)
{
aZPoints(i+1,j+1) *=SCALE;
auxY0 += aYStep;
aPnt(i+1,j+1) = gp_Pnt (auxX0,auxY0,aZPoints(i+1,j+1));
aShowPnt[i][j] = drawPoint(aPnt(i+1,j+1));
}
}
if(WAIT_A_LITTLE) return ;
TCollection_AsciiString aText;
aText += Comment(aXStep,anUpper,DegMin[Count],DegMax[Count],Count+1,Tol[Count]);
setResultText(aText.ToCString());
Handle(Geom_BSplineSurface) aSurface = CreateBSplineSurface(aZPoints,aXStep,aYStep,Count);
aObj = drawSurface(aSurface);
Standard_Boolean aBool;
if(WAIT_A_LITTLE) return ;
for( i = 0 ; i < aNumOfIndexPnt ; i++)
{
aMovePnt = aShowPnt[aIndexX[i]-1][aIndexY[i]-1];
aBool = DrawModifyBSplineSurface(aZPoints,aXStep,aYStep,aIndexX[i],aIndexY[i],
aDeflection[i],aMovePnt,aObj,Count);
if(!aBool) return;
if( i < aNumOfIndexPnt - 1)
{
drawPoint(aPnt(aIndexX[i],aIndexY[i]));
getAISContext()->Erase(aMovePnt);
}
}
}

View File

@@ -0,0 +1,50 @@
// Approx_Presentation.h: interface for the Approx_Presentation class.
// Presentation class: Approximation of curves and surfaces.
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_Approx_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_Approx_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <OCCDemo_Presentation.h>
#include <Geom_BSplineSurface.hxx>
class Approx_Presentation : public OCCDemo_Presentation
{
public:
// Construction
Approx_Presentation();
public:
// Iteration on samples
virtual void DoSample();
// one phase of iterations
private:
// Sample functions
void sample1();
void sample2();
void sample3();
void sample4();
Standard_Boolean DrawModifyBSplineSurface(TColStd_Array2OfReal& ,
Standard_Real ,Standard_Real ,
Standard_Integer ,Standard_Integer ,
Standard_Real,Handle(AIS_InteractiveObject)&,
Handle(AIS_InteractiveObject)&,
Standard_Integer);
Handle(Geom_BSplineSurface) CreateBSplineSurface(TColStd_Array2OfReal& ,
Standard_Real ,Standard_Real,
Standard_Integer);
private:
// Array of pointers to sample functions
typedef void (Approx_Presentation::*PSampleFuncType)();
static const PSampleFuncType SampleFuncs[];
};
#endif // !defined(AFX_Approx_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,428 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Chamfers"
SccProjectName=""
SccLocalPath=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\../Release"
IntermediateDirectory=".\../Release/obj"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;WNT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Release/obj/Chamfers.pch"
AssemblerListingLocation=".\../Release/obj/"
ObjectFile=".\../Release/obj/"
ProgramDataBaseFileName=".\../Release/obj/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib TKBO.lib"
OutputFile=".\../Release/Chamfers.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\../Release/Chamfers.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Release/Chamfers.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../Debug"
IntermediateDirectory=".\../Debug/objd"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WNT"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Debug/objd/Chamfers.pch"
AssemblerListingLocation=".\../Debug/objd/"
ObjectFile=".\../Debug/objd/"
ProgramDataBaseFileName=".\../Debug/objd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBO.lib TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib"
OutputFile=".\../Debug/Chamfers.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/Chamfers.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/Chamfers.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="Chamfers_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="Chamfers_Presentation.h">
</File>
</Filter>
<Filter
Name="Common"
Filter="">
<File
RelativePath="..\env.bat">
</File>
<File
RelativePath="..\readme.txt">
</File>
<File
RelativePath="..\run.bat">
</File>
<File
RelativePath="..\vc.bat">
</File>
<Filter
Name="Source Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\MainFrm.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\StdAfx.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.h">
</File>
<File
RelativePath="..\Common\WNT\MainFrm.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.h">
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.h">
</File>
<File
RelativePath="..\Common\WNT\resource.h">
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.h">
</File>
<File
RelativePath="..\Common\WNT\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="..\Common\WNT\res\OCCDemo.ico">
</File>
<File
RelativePath="..\Common\WNT\res\OCCDemo.rc2">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar.bmp">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar1.bmp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,781 @@
// Chamfers_Presentation.cpp: implementation of the Chamfers_Presentation class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Chamfers_Presentation.h"
#ifdef WNT
#pragma warning (disable : 4786)
#endif
#include <TopoDS_Edge.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAlgo_Fuse.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS.hxx>
#include <TopOpeBRepBuild_HBuilder.hxx>
#include <Precision.hxx>
#ifdef WNT
#define EOL "\r\n"
#else
#define EOL "\n"
#endif
#define BOX_SIDE_LEN 500
// Initialization of global variable with an instance of this class
OCCDemo_Presentation* OCCDemo_Presentation::Current = new Chamfers_Presentation;
// Initialization of array of samples
const Chamfers_Presentation::PSampleFuncType Chamfers_Presentation::SampleFuncs[] =
{
&Chamfers_Presentation::sampleBoxChamfer,
&Chamfers_Presentation::sampleBoxCylChamfer,
&Chamfers_Presentation::sampleBoxCylAngChamfer,
&Chamfers_Presentation::sampleBoxFillet,
&Chamfers_Presentation::sampleBoxCylFillet,
&Chamfers_Presentation::sampleBoxCylAngFillet
};
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Chamfers_Presentation::Chamfers_Presentation()
{
myIndex = 0;
myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
setName ("Chamfers and Fillets");
}
//////////////////////////////////////////////////////////////////////
// Sample execution
//////////////////////////////////////////////////////////////////////
void Chamfers_Presentation::DoSample()
{
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbSamples)
(this->*SampleFuncs[myIndex])();
}
//////////////////////////////////////////////////////////////////////
// Sample functions
//////////////////////////////////////////////////////////////////////
//================================================================
// Function : createDiverseChamferOnBox
// Purpose : makes chamfers of different size on 3 converging edges
// of the given box using given distances d1, d2, d3;
// outputs its own source code into result dialog
//================================================================
Standard_Boolean Chamfers_Presentation::createDiverseChamferOnBox(
TopoDS_Solid& aBox,
Standard_Real d1, // chamfer on edge 1
Standard_Real d2, // chamfer on edge 2
Standard_Real d3, // chamfer on edge 3
Handle(AIS_InteractiveObject)& thePrevShape)// for smoth drawing
// we display the new shape first, then erase the previous one
{
// initializing a class that builds chamfer
BRepFilletAPI_MakeChamfer aMakeChamfer(aBox);
// a map of "edge-to-list of faces". Key = edge, value = list of 2 faces
// of the box that "touch" the edge
TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;
// filling the map with edges and faces of the box
TopExp::MapShapesAndAncestors(aBox, TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);
// array of indexes of edges to be chamfered
int aEdgeInd[] = {6, 2, 10, 12, 5};
// creating chamfer on one of an edge of the top face, using d1
if (d1 > Precision::Confusion())
{
TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[0]));
TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());
aMakeChamfer.Add(d1, d1, anEdge, aFace);
}
// creating chamfer on the other 3 edges of the top face, using d2
if (d2 > Precision::Confusion())
{
for (Standard_Integer i = 1; i <= 3; i++)
{
TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[i]));
TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());
aMakeChamfer.Add(d2, d2, anEdge, aFace);
}
}
// creating chamfer on a vertical edge of box, using d3
if (d3 > Precision::Confusion())
{
TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[4]));
TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());
aMakeChamfer.Add(d3, d3, anEdge, aFace);
}
aMakeChamfer.Build();
if (aMakeChamfer.IsDone())
{
Handle(AIS_InteractiveObject) aNewShape = new AIS_Shape(aMakeChamfer.Shape());
getAISContext()->Erase(thePrevShape, Standard_False);
thePrevShape = aNewShape;
getAISContext()->Display(aNewShape);
}
TCollection_AsciiString aText;
aText = aText +
" // creating a box and centering it on the screen" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);" EOL EOL
" // initializing a class that builds chamfer" EOL
" BRepFilletAPI_MakeChamfer aMakeChamfer(aBox);" EOL EOL
" // a map of \"edge-to-list of faces\". Key = edge, value = list of 2 faces " EOL
" // of the box that \"touch\" the edge" EOL
" TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;" EOL
" // filling the map with edges and faces of the box" EOL
" TopExp::MapShapesAndAncestors(aBox, TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);" EOL
"" EOL
" Standard_Real d1 = "+TCollection_AsciiString(d1)+";" EOL
" Standard_Real d2 = "+TCollection_AsciiString(d2)+";" EOL
" Standard_Real d3 = "+TCollection_AsciiString(d3)+";" EOL
"" EOL
" // array of indexes of edges to be chamfered" EOL
" int aEdgeInd[] = {6, 2, 10, 12, 5};" EOL
"" EOL
" // creating chamfer on one of an edge of the top face, using d1" EOL
" if (d1 > Precision::Confusion())" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[0]));" EOL
" TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());" EOL
" aMakeChamfer.Add(d1, d1, anEdge, aFace);" EOL
" }" EOL
"" EOL
" // creating chamfer on the other 3 edges of the top face, using d2" EOL
" if (d2 > Precision::Confusion())" EOL
" {" EOL
" for (Standard_Integer i = 1; i <= 3; i++)" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[i]));" EOL
" TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());" EOL
" aMakeChamfer.Add(d2, d2, anEdge, aFace);" EOL
" }" EOL
" }" EOL
"" EOL
" // creating chamfer on a vertical edge of box, using d3" EOL
" if (d3 > Precision::Confusion())" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[4]));" EOL
" TopoDS_Face aFace = TopoDS::Face(aMapOfEdgeToFaces.FindFromKey(anEdge).First());" EOL
" aMakeChamfer.Add(d3, d3, anEdge, aFace);" EOL
" }" EOL
" " EOL
" aMakeChamfer.Build();" EOL
" if (aMakeChamfer.IsDone())" EOL
" TopoDS_Shape aChamferedShape = aMakeChamfer.Shape();" EOL;
setResultText(aText.ToCString());
return WAIT_A_SECOND;
}
//================================================================
// Function : createChamferOnBox
// Purpose : makes chamfers on edges of the top face of the given box
// using given distances theDistA and theDistB, outputs its own
// source code into result dialog
//================================================================
Standard_Boolean Chamfers_Presentation::createChamferOnBox(
TopoDS_Solid& aBox,
Standard_Real theDistA, // distance along first face
Standard_Real theDistB, // distance along second face
Handle(AIS_InteractiveObject)& thePrevShape)// for smoth drawing
// we display the new shape first, then erase the previous one
{
// initializing a class that builds chamfer
BRepFilletAPI_MakeChamfer aMakeChamfer(aBox);
// a map of "edge-to-list of faces". Key = edge, value = list of 2 faces
// of the box that "touch" the edge
TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;
// filling the map with edges and faces of the box
TopExp::MapShapesAndAncestors(aBox, TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);
// array of indexes of edges to be chamfered
int aEdgeInd[] = {2, 6, 10, 12};
// building chamfers
for (int i = 0; i <= sizeof(aEdgeInd)/sizeof(int)-1; i++)
//for (int i = 1; i <= 12; i++) // uncomment to iterate through ALL edges of the box
{
TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[i]));
//TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(i));
// uncomment to iterate through ALL edges of the box
const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);
TopoDS_Face aFace = TopoDS::Face(aFaces.First());
aMakeChamfer.Add(theDistA, theDistB, anEdge, aFace);
}
aMakeChamfer.Build();
if (aMakeChamfer.IsDone())
{
Handle(AIS_InteractiveObject) aNewShape = new AIS_Shape(aMakeChamfer.Shape());
getAISContext()->Erase(thePrevShape, Standard_False);
getAISContext()->Display(aNewShape, Standard_True);
thePrevShape = aNewShape;
}
TCollection_AsciiString aText;
aText = aText +
" // creating a box and centering it on the screen" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);" EOL EOL
" // initializing a class that builds chamfer" EOL
" BRepFilletAPI_MakeChamfer aMakeChamfer(aBox);" EOL EOL
" // a map of \"edge-to-list of faces\". Key = edge, value = list of 2 faces " EOL
" // of the box that \"touch\" the edge" EOL
" TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;" EOL
" // filling the map with edges and faces of the box" EOL
" TopExp::MapShapesAndAncestors(aBox, TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);" EOL
"" EOL
" Standard_Real aDistA = "+TCollection_AsciiString(theDistA)+";" EOL
" Standard_Real aDistB = "+TCollection_AsciiString(theDistB)+";" EOL
"" EOL
" // array of indexes of edges to be chamfered" EOL
" int aEdgeInd[] = {2, 6, 10, 12};" EOL EOL
" // building chamfers" EOL
" for (int i = 0; i <= sizeof(aEdgeInd)/sizeof(int)-1; i++)" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdgeToFaces.FindKey(aEdgeInd[i]));" EOL
" const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);" EOL
" TopoDS_Face aFace = TopoDS::Face(aFaces.First());" EOL
" // creating a chamfer with lengths aDistA, aDistB" EOL
" aMakeChamfer.Add(aDistA, aDistB, anEdge, aFace);" EOL
" }" EOL EOL
" aMakeChamfer.Build();" EOL
" if (aMakeChamfer.IsDone())" EOL
" TopoDS_Shape aChamferedShape = aMakeChamfer.Shape();" EOL;
setResultText(aText.ToCString());
return WAIT_A_SECOND;
}
//================================================================
// Function : createFilletOnBox
// Purpose : creates a box with side=10, makes fillets on some of its edges
// using given value of radius and shape of fillet, outputs its own
// source code into theText parameter
//================================================================
Standard_Boolean Chamfers_Presentation::createFilletOnBox(
TopoDS_Solid& aBox,
Standard_Real theRad, // radius of fillet
ChFi3d_FilletShape theFShape, // shape of fillet
Handle(AIS_InteractiveObject)& thePrevObj) // to erase
// the previous shape
{
// initializing a class that builds fillet
// second parameter is a shape of fillet:
// enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };
BRepFilletAPI_MakeFillet aMakeFillet(aBox, theFShape);
// a map of edges
TopTools_IndexedMapOfShape aMapOfEdges;
// filling the map with edges of the box
TopExp::MapShapes(aBox, TopAbs_EDGE, aMapOfEdges);
// array of indexes of edges to be chamfered
int aEdgeInd[] = {2, 6, 10, 12};
// adding edges that will have fillet
for (int i = 0; i <= sizeof(aEdgeInd)/sizeof(int)-1; i++)
{
TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdges(aEdgeInd[i]));
aMakeFillet.Add(theRad, anEdge);
}
aMakeFillet.Build();
if (aMakeFillet.IsDone())
{
Handle(AIS_InteractiveObject) aNewShape = new AIS_Shape(aMakeFillet.Shape());
getAISContext()->Erase(thePrevObj, Standard_False);
getAISContext()->Display(aNewShape, Standard_True);
thePrevObj = aNewShape;
}
// calculating the string corresponding to theFShape
TCollection_AsciiString aFShapeStr;
aFShapeStr = ((theFShape==ChFi3d_Rational)? "ChFi3d_Rational":
((theFShape==ChFi3d_QuasiAngular)? "ChFi3d_QuasiAngular":
"ChFi3d_Polynomial"));
TCollection_AsciiString aText;
aText = aText +
" // creating a box and centering it on the screen" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);" EOL
" " EOL
" // initializing a class that builds fillet" EOL
" // second parameter is a shape of fillet:" EOL
" // enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };" EOL
" BRepFilletAPI_MakeFillet aMakeFillet(aBox, "+aFShapeStr+");" EOL
" " EOL
" // a map of edges" EOL
" TopTools_IndexedMapOfShape aMapOfEdges;" EOL
" // filling the map with edges of the box" EOL
" TopExp::MapShapes(aBox, TopAbs_EDGE, aMapOfEdges);" EOL EOL
" // array of indexes of edges to be chamfered" EOL
" int aEdgeInd[] = {2, 6, 10, 12};" EOL EOL
" // adding edges that will have fillet" EOL
" Standard_Real r = "+TCollection_AsciiString(theRad)+";" EOL
" for (int i = 0; i <= sizeof(aEdgeInd)/sizeof(int)-1; i++)" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(aMapOfEdges(aEdgeInd[i]));" EOL
" aMakeFillet.Add(r, anEdge);" EOL
" }" EOL
" aMakeFillet.Build();" EOL
" if (aMakeFillet.IsDone())" EOL
" TopoDS_Shape aShapeWithFillet = aMakeFillet.Shape();" EOL;
setResultText(aText.ToCString());
return WAIT_A_SECOND;
}
// ===============================================================
// CHAMFER CASES
// ===============================================================
//================================================================
// Function : Chamfers_Presentation::sampleBoxChamfer1,2,3
// Purpose :
//================================================================
void Chamfers_Presentation::sampleBoxChamfer()
{
setResultTitle("Creating Chamfer");
TCollection_AsciiString aText;
aText = aText +
" // creating a box and centering it on the screen" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);" EOL;
setResultText(aText.ToCString());
// show initial shape
Standard_Real a = BOX_SIDE_LEN;
TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);
Handle(AIS_InteractiveObject) aPrevShape = new AIS_Shape(aBox);
getAISContext()->Display(aPrevShape, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// show several chamfers
if (createChamferOnBox(aBox, a/10, a/10, aPrevShape)) return;
if (createChamferOnBox(aBox, a/24, a/10, aPrevShape)) return;
if (createChamferOnBox(aBox, a/10, a/10, aPrevShape)) return;
if (createChamferOnBox(aBox, a/10, a/24, aPrevShape)) return;
if (createChamferOnBox(aBox, a/10, a/10, aPrevShape)) return;
if (createDiverseChamferOnBox(aBox, a/6, a/10, 0, aPrevShape)) return;
if (createDiverseChamferOnBox(aBox, a/6, a/10, a/24, aPrevShape)) return;
}
//================================================================
// Function : Chamfers_Presentation::sampleBoxCylChamfer
// Purpose : creates a more complecated chamfer on a shape created
// by fusing box and cylinder
//================================================================
void Chamfers_Presentation::sampleBoxCylChamfer()
{
setResultTitle("Creating Chamfer");
TCollection_AsciiString aText;
aText = aText +
" // creating a shape, a result of fusing of a box and cylinder" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" Standard_Real b = a/2;" EOL
" BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);" EOL
" BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), a/4, a);" EOL
" BRepAlgoAPI_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());" EOL
" aFuser.Build();" EOL EOL
" // initializing a class that builds chamfer" EOL
" BRepFilletAPI_MakeChamfer aMakeChamfer(aFuser.Shape());" EOL EOL
" // a map of \"edge-to-list of faces\". Key = edge, value = list of 2 faces " EOL
" // of the box that \"touch\" the edge" EOL
" TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;" EOL
" // filling the map with edges and faces of the box" EOL
" TopExp::MapShapesAndAncestors(aFuser.Shape(), TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);" EOL EOL
" // retrieving list of edges to build a chamfer on - edges of " EOL
" // intersection of the cylinder and the box" EOL
" const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();" EOL
" TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);" EOL
"" EOL
" // creating fillet on edge intersection edges" EOL
" Standard_Real d = a/20;" EOL
" for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(anIntersectionEdgesIt.Value());" EOL
" if (!aMapOfEdgeToFaces.Contains(anEdge)) continue;" EOL
" const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);" EOL
" TopoDS_Face aFace = TopoDS::Face(aFaces.First());" EOL
" aMakeChamfer.Add(d, d, anEdge, aFace);" EOL
" }" EOL
" " EOL
" aMakeChamfer.Build();" EOL
" if (aMakeChamfer.IsDone())" EOL
" TopoDS_Shape aChamferedShape = aMakeChamfer.Shape();" EOL;
setResultText(aText.ToCString());
// creating a shape, a result of fusing of a box and cylinder
Standard_Real a = BOX_SIDE_LEN;
Standard_Real b = a/2;
BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);
BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), a/4, a);
BRepAlgo_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());
aFuser.Build();
Handle(AIS_InteractiveObject) aPrevObj = new AIS_Shape(aFuser.Shape());
getAISContext()->Display(aPrevObj, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// initializing a class that builds chamfer
BRepFilletAPI_MakeChamfer aMakeChamfer(aFuser.Shape());
// a map of "edge-to-list of faces". Key = edge, value = list of 2 faces
// of the box that "touch" the edge
TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;
// filling the map with edges and faces of the box
TopExp::MapShapesAndAncestors(aFuser.Shape(), TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);
// retrieving list of edges to build a chamfer on - edges of
// intersection of the cylinder and the box
const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();
TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);
// creating fillet on edge intersection edges
Standard_Real d = a/20;
for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(anIntersectionEdgesIt.Value());
if (!aMapOfEdgeToFaces.Contains(anEdge)) continue;
const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);
TopoDS_Face aFace = TopoDS::Face(aFaces.First());
aMakeChamfer.Add(d, d, anEdge, aFace);
}
aMakeChamfer.Build();
if (aMakeChamfer.IsDone())
{
getAISContext()->Erase(aPrevObj, Standard_False);
getAISContext()->Display(new AIS_Shape(aMakeChamfer.Shape()));
//aPrevObj = aNewShape;// uncomment if further thePrevObj is used
}
}
//================================================================
// Function : Chamfers_Presentation::sampleBoxCylAngChamfer
// Purpose : creates a more complecated chamfer on a shape created
// by fusing box and cylinder
//================================================================
void Chamfers_Presentation::sampleBoxCylAngChamfer()
{
setResultTitle("Creating Chamfer");
TCollection_AsciiString aText;
aText = aText +
" // creating a shape, a result of fusing of a box and cylinder" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" Standard_Real b = a/2;" EOL
" BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);" EOL
" BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,-0.4,0.6)), a/4, a);" EOL
" BRepAlgoAPI_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());" EOL
" aFuser.Build();" EOL EOL
" // initializing a class that builds chamfer" EOL
" BRepFilletAPI_MakeChamfer aMakeChamfer(aFuser.Shape());" EOL EOL
" // a map of \"edge-to-list of faces\". Key = edge, value = list of 2 faces " EOL
" // of the box that \"touch\" the edge" EOL
" TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;" EOL
" // filling the map with edges and faces of the box" EOL
" TopExp::MapShapesAndAncestors(aFuser.Shape(), TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);" EOL EOL
" // retrieving list of edges to build a chamfer on - edges of " EOL
" // intersection of the cylinder and the box" EOL
" const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();" EOL
" TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);" EOL EOL
" // creating chamfer on intersection edges" EOL
" Standard_Real d = a/20;" EOL
" for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())" EOL
" {" EOL
" TopoDS_Edge anEdge = TopoDS::Edge(anIntersectionEdgesIt.Value());" EOL
" if (!aMapOfEdgeToFaces.Contains(anEdge)) continue;" EOL
" const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);" EOL
" TopoDS_Face aFace = TopoDS::Face(aFaces.First());" EOL
" aMakeChamfer.Add(d, d, anEdge, aFace);" EOL
" }" EOL EOL
" aMakeChamfer.Build();" EOL
" if (aMakeChamfer.IsDone())" EOL
" TopoDS_Shape aChamferedShape = aMakeChamfer.Shape();" EOL;
setResultText(aText.ToCString());
// creating a shape, a result of fusing of a box and cylinder
Standard_Real a = BOX_SIDE_LEN;
Standard_Real b = a/2;
BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);
BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,-0.4,0.6)), a/4, a);
BRepAlgo_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());
aFuser.Build();
Handle(AIS_InteractiveObject) aPrevObj = new AIS_Shape(aFuser.Shape());
getAISContext()->Display(aPrevObj, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// initializing a class that builds chamfer
BRepFilletAPI_MakeChamfer aMakeChamfer(aFuser.Shape());
// a map of "edge-to-list of faces". Key = edge, value = list of 2 faces
// of the box that "touch" the edge
TopTools_IndexedDataMapOfShapeListOfShape aMapOfEdgeToFaces;
// filling the map with edges and faces of the box
TopExp::MapShapesAndAncestors(aFuser.Shape(), TopAbs_EDGE, TopAbs_FACE, aMapOfEdgeToFaces);
// retrieving list of edges to build a chamfer on - edges of
// intersection of the cylinder and the box
const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();
TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);
// creating fillet on edge intersection edges
Standard_Real d = a/20;
for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(anIntersectionEdgesIt.Value());
if (!aMapOfEdgeToFaces.Contains(anEdge)) continue;
const TopTools_ListOfShape& aFaces = aMapOfEdgeToFaces.FindFromKey(anEdge);
TopoDS_Face aFace = TopoDS::Face(aFaces.First());
aMakeChamfer.Add(d, d, anEdge, aFace);
}
aMakeChamfer.Build();
if (aMakeChamfer.IsDone())
{
getAISContext()->Erase(aPrevObj, Standard_False);
getAISContext()->Display(new AIS_Shape(aMakeChamfer.Shape()));
//thePrevShape = aNewShape;// uncomment if further thePrevObj is used
}
}
// ===============================================================
// FILLET CASES
// ===============================================================
//================================================================
// Function : Chamfers_Presentation::sampleBoxFillet1,2,3
// Purpose :
//================================================================
void Chamfers_Presentation::sampleBoxFillet()
{
setResultTitle("Creating Fillet");
TCollection_AsciiString aText;
aText = aText +
" // creating a box and centering it on the screen" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);" EOL;
setResultText(aText.ToCString());
// show initial shape
Standard_Real a = BOX_SIDE_LEN;
TopoDS_Solid aBox = BRepPrimAPI_MakeBox(gp_Pnt(-a/2, -a/2, -a/2), a, a, a);
Handle(AIS_InteractiveObject) aPrevObj = new AIS_Shape(aBox);
getAISContext()->Display(aPrevObj, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// show several fillets
if (createFilletOnBox(aBox, a/10, ChFi3d_Polynomial, aPrevObj)) return;
if (createFilletOnBox(aBox, a/5, ChFi3d_QuasiAngular, aPrevObj)) return;
if (createFilletOnBox(aBox, a/3.3, ChFi3d_Rational, aPrevObj)) return;
}
//================================================================
// Function : Chamfers_Presentation::sampleBoxCylFillet
// Purpose : creates a more complecated chamfer on a shape created
// by fusing box and cylinder
//================================================================
void Chamfers_Presentation::sampleBoxCylFillet()
{
setResultTitle("Creating Fillet");
TCollection_AsciiString aText;
aText = aText +
" // creating a shape - result of fusing a box and a cylinder" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" Standard_Real b = a/2;" EOL
" BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);" EOL
" BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), a/4, a);" EOL
" BRepAlgoAPI_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());" EOL
" aFuser.Build();" EOL EOL
" // initializing a class that builds fillet" EOL
" // second parameter is a shape of fillet:" EOL
" // enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };" EOL
" BRepFilletAPI_MakeFillet aMakeFillet(aFuser.Shape(), ChFi3d_Rational);" EOL EOL
" // retrieving list of edges to build a chamfer on - edges of " EOL
" // intersection of the cylinder and the box" EOL
" const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();" EOL
" TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);" EOL EOL
" // creating fillet on edge intersection edges" EOL
" Standard_Real d = a/10;" EOL
" for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())" EOL
" aMakeFillet.Add(d, TopoDS::Edge(anIntersectionEdgesIt.Value()));" EOL
"" EOL
" aMakeFillet.Build();" EOL EOL
" if (aMakeFillet.IsDone())" EOL
" TopoDS_Shape aShapeWithFillet = aMakeFillet.Shape();" EOL;
setResultText(aText.ToCString());
// creating a shape, a result of fusing of a box and cylinder
Standard_Real a = BOX_SIDE_LEN;
Standard_Real b = a/2;
BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);
BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), a/4, a);
BRepAlgo_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());
aFuser.Build();
Handle(AIS_InteractiveObject) aPrevObj = new AIS_Shape(aFuser.Shape());
getAISContext()->Display(aPrevObj, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// initializing a class that builds fillet
// second parameter is a shape of fillet:
// enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };
BRepFilletAPI_MakeFillet aMakeFillet(aFuser.Shape(), ChFi3d_Rational);
// retrieving list of edges to build a chamfer on - edges of
// intersection of the cylinder and the box
const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();
TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);
// creating fillet on edge intersection edges
Standard_Real d = a/10;
for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())
aMakeFillet.Add(d, TopoDS::Edge(anIntersectionEdgesIt.Value()));
aMakeFillet.Build();
if (aMakeFillet.IsDone())
{
getAISContext()->Erase(aPrevObj, Standard_False);
//aPrevObj = new AIS_Shape(aMakeFillet.Shape());// uncomment if aPrevObj is used further
getAISContext()->Display(new AIS_Shape(aMakeFillet.Shape()));
}
}
//================================================================
// Function : Chamfers_Presentation::sampleBoxCylAngFillet
// Purpose : creates a fillet on a more complecated shape created
// by fusing box and cylinder
//================================================================
void Chamfers_Presentation::sampleBoxCylAngFillet()
{
setResultTitle("Creating Fillet");
TCollection_AsciiString aText;
aText = aText +
" // creating a shape - result of fusing a box and a cylinder" EOL
" Standard_Real a = "+TCollection_AsciiString(BOX_SIDE_LEN)+";" EOL
" Standard_Real b = a/2;" EOL
" BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);" EOL
" BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,-0.4,0.6)), a/4, a);" EOL
" BRepAlgoAPI_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());" EOL
" aFuser.Build();" EOL EOL
" // initializing a class that builds fillet" EOL
" // second parameter is a shape of fillet:" EOL
" // enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };" EOL
" BRepFilletAPI_MakeFillet aMakeFillet(aFuser.Shape(), ChFi3d_Rational);" EOL EOL
" // retrieving list of edges to build a chamfer on - edges of " EOL
" // intersection of the cylinder and the box" EOL
" const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();" EOL
" TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);" EOL EOL
" // creating fillet on intersection edges" EOL
" Standard_Real d = a/10;" EOL
" for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())" EOL
" aMakeFillet.Add(d, TopoDS::Edge(anIntersectionEdgesIt.Value()));" EOL
" aMakeFillet.Build();" EOL EOL
" if (aMakeFillet.IsDone())" EOL
" TopoDS_Shape aShapeWithFillet = aMakeFillet.Shape();" EOL;
setResultText(aText.ToCString());
// creating a shape, a result of fusing of a box and cylinder
Standard_Real a = BOX_SIDE_LEN;
Standard_Real b = a/2;
BRepPrimAPI_MakeBox aBoxMaker (gp_Pnt(-b, -b, -b), a, a, a);
BRepPrimAPI_MakeCylinder aCylMaker(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,-0.4,0.6)), a/4, a);
BRepAlgo_Fuse aFuser(aBoxMaker.Solid(), aCylMaker.Solid());
aFuser.Build();
Handle(AIS_InteractiveObject) aPrevObj = new AIS_Shape(aFuser.Shape());
getAISContext()->Display(aPrevObj, Standard_False);
COCCDemoDoc::Fit();
if (WAIT_A_SECOND) return;
// initializing a class that builds fillet
// second parameter is a shape of fillet:
// enum ChFi3d_FilletShape { ChFi3d_Rational, ChFi3d_QuasiAngular, ChFi3d_Polynomial };
BRepFilletAPI_MakeFillet aMakeFillet(aFuser.Shape(), ChFi3d_Rational);
// retrieving list of edges to build a chamfer on - edges of
// intersection of the cylinder and the box
const TopTools_ListOfShape& aEdgesOfIntersection = aFuser.Builder()->Section();
TopTools_ListIteratorOfListOfShape anIntersectionEdgesIt(aEdgesOfIntersection);
// creating fillet on edge intersection edges
Standard_Real d = a/10;
for (; anIntersectionEdgesIt.More(); anIntersectionEdgesIt.Next())
aMakeFillet.Add(d, TopoDS::Edge(anIntersectionEdgesIt.Value()));
aMakeFillet.Build();
if (aMakeFillet.IsDone())
{
getAISContext()->Erase(aPrevObj, Standard_False);
//aPrevObj = new AIS_Shape(aMakeFillet.Shape());// uncomment if aPrevObj is used further
getAISContext()->Display(new AIS_Shape(aMakeFillet.Shape()));
}
}

View File

@@ -0,0 +1,57 @@
// Chamfers_Presentation.h: interface for the Chamfers_Presentation class.
// Presentation class: Example on chamfers and fillets
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_Chamfers_PRESENTATION_H)
#define AFX_Chamfers_PRESENTATION_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <OCCDemo_Presentation.h>
#include <ChFi3d_FilletShape.hxx>
class AIS_InteractiveObject;
class TopoDS_Solid;
class Chamfers_Presentation : public OCCDemo_Presentation
{
public:
// Construction
Chamfers_Presentation();
public:
// Iteration on samples
virtual void DoSample();
// one phase of iterations
private:
Standard_Boolean createChamferOnBox(
TopoDS_Solid&, Standard_Real, Standard_Real,
Handle(AIS_InteractiveObject)&);
Standard_Boolean createDiverseChamferOnBox(
TopoDS_Solid&, Standard_Real, Standard_Real,
Standard_Real, Handle(AIS_InteractiveObject)&);
Standard_Boolean createFilletOnBox(
TopoDS_Solid&, Standard_Real, ChFi3d_FilletShape,
Handle(AIS_InteractiveObject)&);
// Sample functions
void sampleBoxChamfer();
void sampleBoxFillet();
void sampleBoxCylChamfer();
void sampleBoxCylAngChamfer();
void sampleBoxCylFillet();
void sampleBoxCylAngFillet();
private:
// Array of pointers to sample functions
typedef void (Chamfers_Presentation::*PSampleFuncType)();
static const PSampleFuncType SampleFuncs[];
};
#endif // !defined(AFX_Chamfers_PRESENTATION_H)

View File

@@ -0,0 +1,77 @@
// ISession_Curve.cpp: implementation of the ISession_Curve class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ISession_Curve.h"
#include <Prs3d_LineAspect.hxx>
#include <StdPrs_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
//
// Foreach ancestors, we add a IMPLEMENT_STANDARD_SUPERTYPE and
// a IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_ENTRY macro.
// We must respect the order: from the direct ancestor class
// to the base class.
//
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ISession_Curve::ISession_Curve(const Handle(Geom_Curve)& aCurve)
:AIS_InteractiveObject(),myCurve(aCurve)
{
}
ISession_Curve::~ISession_Curve()
{
}
void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer /*aMode*/)
{
GeomAdaptor_Curve anAdaptorCurve(myCurve);
if (hasOwnColor)
myDrawer->LineAspect()->SetColor (myDrawer->Color());
myDrawer->Link()->SetDiscretisation(100);
myDrawer->Link()->SetMaximalParameterValue(500);
StdPrs_Curve::Add (aPresentation, anAdaptorCurve, myDrawer);
}
void ISession_Curve::Compute(const Handle(Prs3d_Projector)& aProjector,
const Handle(Prs3d_Presentation)& aPresentation)
{
}
void ISession_Curve::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
const Standard_Integer aMode)
{
}

View File

@@ -0,0 +1,33 @@
// ISession_Curve.h: interface for the ISession_Curve class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)
#define AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <Standard_Macro.hxx>
#include <Standard_DefineHandle.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Geom_Curve.hxx>
DEFINE_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject)
class ISession_Curve : public AIS_InteractiveObject
{
public:
ISession_Curve(const Handle(Geom_Curve)& aCurve);
virtual ~ISession_Curve();
DEFINE_STANDARD_RTTIEXT(ISession_Curve,AIS_InteractiveObject)
private:
Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,const Handle(Prs3d_Presentation)& aPresentation,const Standard_Integer aMode = 0) ;
Standard_EXPORT virtual void Compute(const Handle(Prs3d_Projector)& aProjector,const Handle(Prs3d_Presentation)& aPresentation) ;
void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,const Standard_Integer aMode) ;
Handle(Geom_Curve) myCurve;
};
#endif // !defined(AFX_ISESSION_CURVE_H__F981CB93_A3CC_11D1_8DA3_0800369C8A03__INCLUDED_)

View File

@@ -0,0 +1,314 @@
// OCCDemo_Presentation.cpp: implementation of the OCCDemo_Presentation class.
// This is a base class for all presentations
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "OCCDemo_Presentation.h"
#include "OCCDemoView.h"
#include "ISession_Curve.h"
#include <AIS_InteractiveObject.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Quantity_Color.hxx>
#include <AIS_Shape.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <Precision.hxx>
#include <Geom_Line.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Prs_Drawer.hxx>
#include <Prs3d_ArrowAspect.hxx>
#include <AIS_Point.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <GeomAPI.hxx>
#include <gp_Pln.hxx>
#include <Geom_OffsetCurve.hxx>
#define MAX_PARAM 1000 // if a surface parameter is infinite, it is assingned
// this value in order to display the "infinit" object in the viewer.
Standard_Boolean OCCDemo_Presentation::WaitForInput (unsigned long aMilliSeconds)
{
//::WaitForSingleObject(::CreateEvent (NULL, FALSE, FALSE, NULL), aMilliSeconds);
if (::MsgWaitForMultipleObjects(0, NULL, FALSE, aMilliSeconds,
QS_KEY | QS_MOUSEBUTTON) != WAIT_TIMEOUT)
{
MSG msg;
if (::PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if (msg.message == WM_KEYUP)
{
::PeekMessage (&msg, NULL, 0, 0, PM_REMOVE);
return WaitForInput (aMilliSeconds);
}
else
return Standard_True;
}
}
return Standard_False;
}
//================================================================
// Function : fixParam
// Purpose : assings a finite value to theParam if it intinite
// (equal to +- Precision::Infinite())
//================================================================
static Standard_Boolean fixParam(Standard_Real& theParam)
{
Standard_Boolean aResult = Standard_False;
if (Precision::IsNegativeInfinite(theParam))
{
theParam = -MAX_PARAM;
aResult = Standard_True;
}
if (Precision::IsPositiveInfinite(theParam))
{
theParam = MAX_PARAM;
aResult = Standard_True;
}
return aResult;
}
//================================================================
// Function : DrawSurface
// Purpose : displays a given geometric surface in 3d viewer
// (creates a finite face and displays it)
//================================================================
Handle(AIS_InteractiveObject) OCCDemo_Presentation::drawSurface
(const Handle(Geom_Surface)& theSurface,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Standard_Real u1, u2, v1, v2;
theSurface->Bounds(u1,u2,v1,v2);
fixParam(u1);
fixParam(u2);
fixParam(v1);
fixParam(v2);
Handle(AIS_Shape) aGraphicSurface =
new AIS_Shape(BRepBuilderAPI_MakeFace (theSurface, u1, u2, v1, v2));
getAISContext()->SetMaterial(aGraphicSurface, Graphic3d_NOM_PLASTIC, toDisplay);
getAISContext()->SetColor(aGraphicSurface, theColor, toDisplay);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicSurface, Standard_False);
COCCDemoDoc::Fit();
}
else
getAISContext()->Display (aGraphicSurface);
}
return aGraphicSurface;
}
//================================================================
// Function : DrawCurve
// Purpose : displays a given curve 3d
//================================================================
Handle(AIS_InteractiveObject) OCCDemo_Presentation::drawCurve
(const Handle(Geom_Curve)& theCurve,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve (theCurve);
getAISContext()->SetColor (aGraphicCurve, theColor, toDisplay);
aGraphicCurve->Attributes()->Link()->SetLineArrowDraw(Standard_False);
if (toDisplay){
if (FitMode){
getAISContext()->Display (aGraphicCurve, Standard_False);
COCCDemoDoc::Fit();
}
else
getAISContext()->Display (aGraphicCurve);
}
return aGraphicCurve;
}
//================================================================
// Function : DrawCurve
// Purpose : displays a given curve 2d
//================================================================
Handle(AIS_InteractiveObject) OCCDemo_Presentation::drawCurve
(const Handle(Geom2d_Curve)& theCurve,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay,
const gp_Ax2& aPosition)
{
// create 3D curve in plane
Handle(Geom_Curve) aCurve3d;
if (theCurve->IsKind(STANDARD_TYPE(Geom2d_OffsetCurve)))
{
Handle(Geom2d_OffsetCurve) aOffCurve =
Handle(Geom2d_OffsetCurve)::DownCast(theCurve);
Handle(Geom_Curve) aBasCurve3d =
GeomAPI::To3d (aOffCurve->BasisCurve(), gp_Pln(aPosition));
Standard_Real aDist = aOffCurve->Offset();
aCurve3d = new Geom_OffsetCurve (aBasCurve3d, aDist, aPosition.Direction());
}
else
{
aCurve3d = GeomAPI::To3d (theCurve, gp_Pln(aPosition));
}
return drawCurve (aCurve3d, theColor, toDisplay);
}
//================================================================
// Function : drawPoint
// Purpose : displays a given point
//================================================================
Handle(AIS_Point) OCCDemo_Presentation::drawPoint
(const gp_Pnt& aPnt,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle(AIS_Point) aGraphicPoint = new AIS_Point (new Geom_CartesianPoint(aPnt));
getAISContext()->SetColor (aGraphicPoint, theColor, toDisplay);
if (toDisplay) {
getAISContext()->Display (aGraphicPoint);
//COCCDemoDoc::Fit();
}
return aGraphicPoint;
}
//================================================================
// Function : drawVector
// Purpose : displays a given vector in 3d viewer
// (segment of line starting at thePnt with the arrow at the end,
// the length of segment is the length of the vector)
//================================================================
Handle(AIS_InteractiveObject) OCCDemo_Presentation::drawVector
(const gp_Pnt& thePnt,
const gp_Vec& theVec,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Standard_Real aLength = theVec.Magnitude();
if (aLength < Precision::Confusion())
return Handle(AIS_InteractiveObject)();
Handle(Geom_Curve) aCurve = new Geom_Line (thePnt, theVec);
aCurve = new Geom_TrimmedCurve (aCurve, 0, aLength);
Handle(ISession_Curve) aGraphicCurve = new ISession_Curve (aCurve);
getAISContext()->SetColor (aGraphicCurve, theColor, toDisplay);
Handle(Prs3d_Drawer) aDrawer = aGraphicCurve->Attributes()->Link();
aDrawer->SetLineArrowDraw(Standard_True);
aDrawer->ArrowAspect()->SetLength(aLength/10);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicCurve, Standard_False);
COCCDemoDoc::Fit();
}
else
getAISContext()->Display (aGraphicCurve);
}
return aGraphicCurve;
}
Handle(AIS_Shape) OCCDemo_Presentation::drawShape
(const TopoDS_Shape& theShape,const Quantity_Color& theColor,
const Standard_Boolean toDisplay)
{
Handle(AIS_Shape) aGraphicShape = new AIS_Shape(theShape);
getAISContext()->SetMaterial(aGraphicShape, Graphic3d_NOM_PLASTIC, toDisplay);
getAISContext()->SetColor (aGraphicShape, theColor, toDisplay);
if (toDisplay){
if (FitMode){
getAISContext()->Display (aGraphicShape, Standard_False);
COCCDemoDoc::Fit();
}
else
getAISContext()->Display (aGraphicShape);
}
return aGraphicShape;
}
Handle(AIS_Shape) OCCDemo_Presentation::drawShape
(const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial,
const Standard_Boolean toDisplay)
{
Handle(AIS_Shape) aGraphicShape = new AIS_Shape(theShape);
getAISContext()->SetMaterial(aGraphicShape, theMaterial, toDisplay);
if (toDisplay) {
if (FitMode){
getAISContext()->Display (aGraphicShape, Standard_False);
COCCDemoDoc::Fit();
}
else
getAISContext()->Display (aGraphicShape);
}
return aGraphicShape;
}
void OCCDemo_Presentation::GetViewCenter(Standard_Real& Xc, Standard_Real& Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::SetViewCenter(Standard_Real Xc, Standard_Real Yc)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewCenter(Xc,Yc);
}
void OCCDemo_Presentation::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->GetViewEye(X,Y,Z);
}
void OCCDemo_Presentation::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewEye(X,Y,Z);
}
Standard_Real OCCDemo_Presentation::GetViewScale()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
return pView->GetViewScale();
}
void OCCDemo_Presentation::SetViewScale(Standard_Real Coef)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->SetViewScale(Coef);
}
void OCCDemo_Presentation::ResetView()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->Reset();
}

View File

@@ -0,0 +1,132 @@
// OCCDemo_Presentation.h: interface for the OCCDemo_Presentation class.
// This is a base class for all presentations
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WAIT_A_LITTLE WaitForInput(500)
#define WAIT_A_SECOND WaitForInput(1000)
#include <OCCDemoDoc.h>
class AIS_InteractiveObject;
class Geom_Surface;
class Geom_Curve;
class Geom2d_Curve;
class Quantity_Color;
class OCCDemo_Presentation
{
public:
// Construction
OCCDemo_Presentation() : myIndex(0), myNbSamples(0), FitMode(false){}
virtual ~OCCDemo_Presentation() {}
public:
static OCCDemo_Presentation* Current;
// this pointer must be initialized when realize a derivable class;
// it is used by application to access to a presentation class instance
void SetDocument (COCCDemoDoc* theDoc) {myDoc = theDoc;}
// document must be set by the user of this class before first use of iterations
public:
// Titling
const CString& GetName() const {return myName;}
public:
// Iteration on samples
void FirstSample() {myIndex=0;}
void LastSample() {myIndex=myNbSamples-1;}
Standard_Boolean AtFirstSample() const {return myIndex <= 0;}
Standard_Boolean AtLastSample() const {return myIndex >= myNbSamples-1;}
void NextSample() {myIndex++;}
void PrevSample() {myIndex--;}
virtual void DoSample() = 0;
static void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
static void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
static void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
static void SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z);
static Standard_Real GetViewScale();
static void SetViewScale(Standard_Real Coef);
static void ResetView();
// place one-time initialization code in this function
virtual void Init() {}
protected:
// Methods to call from a derivable class
void setName (const char* theName) {myName = CString(theName);}
Handle(AIS_InteractiveContext) getAISContext() const {return myDoc->GetAISContext();}
Handle(V3d_Viewer) getViewer() const {return myDoc->GetViewer();}
void setResultTitle (const char* theTitle) {myDoc->GetResultDialog()->SetTitle(theTitle);}
void setResultText (const char* theText) {myDoc->GetResultDialog()->SetText(theText);}
Standard_CString GetDataDir() {return myDoc->GetDataDir();}
Standard_Boolean WaitForInput (unsigned long aMilliSeconds);
// Waits for a user input or a period of time has been elapsed
Handle(AIS_InteractiveObject) drawSurface (const Handle(Geom_Surface)& theSurface,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_LEMONCHIFFON3),
const Standard_Boolean toDisplay = Standard_True);
// creates a finite face based on the given geometric surface
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom_Curve)& theCurve,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
const Standard_Boolean toDisplay = Standard_True);
// creates an ISession_Curve based on the given geometric curve
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_InteractiveObject) drawCurve (const Handle(Geom2d_Curve)& theCurve,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_RED),
const Standard_Boolean toDisplay = Standard_True,
const gp_Ax2& aPosition = gp::XOY());
// converts a given curve to 3d using aPosition and calls the previous method
Handle(AIS_Point) drawPoint (const gp_Pnt& thePnt,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_GREEN),
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given point
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_InteractiveObject) drawVector (const gp_Pnt& thePnt,
const gp_Vec& theVec,
const Quantity_Color& theColor = Quantity_Color(Quantity_NOC_YELLOW),
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given vector
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Quantity_Color& theColor,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape
// with material PLASTIC and a given color
// and displays it in the viewer if toDisplay = Standard_True
Handle(AIS_Shape) drawShape (const TopoDS_Shape& theShape,
const Graphic3d_NameOfMaterial theMaterial = Graphic3d_NOM_BRASS,
const Standard_Boolean toDisplay = Standard_True);
// creates a presentation of the given shape with the given material
// (color is default for a given material)
// and displays it in the viewer if toDisplay = Standard_True
protected:
// Fields to use in a derivable class
BOOL FitMode;
int myIndex;
int myNbSamples;
private:
COCCDemoDoc* myDoc;
CString myName;
};
#endif // !defined(AFX_OCCDEMO_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,112 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "OCCDemo.h"
#include "MainFrm.h"
#include "OCCDemoDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR // status line indicator
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
/* | CBRS_GRIPPER */| CBRS_TOOLTIPS | CBRS_FLYBY) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndToolBar1.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS | CBRS_FLYBY) ||
!m_wndToolBar1.LoadToolBar(IDR_TOOLBAR1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
//EnableDocking(CBRS_ALIGN_ANY);
//DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

View File

@@ -0,0 +1,59 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__57A6A22C_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_MAINFRM_H__57A6A22C_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CToolBar m_wndToolBar1;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__57A6A22C_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,201 @@
// OCCDemo.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "OCCDemo.h"
#include "MainFrm.h"
#include "OCCDemoDoc.h"
#include "OCCDemoView.h"
#include <Standard_Version.hxx>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COCCDemoApp
BEGIN_MESSAGE_MAP(COCCDemoApp, CWinApp)
//{{AFX_MSG_MAP(COCCDemoApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
//}}AFX_MSG_MAP
// Standard file based document commands
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COCCDemoApp construction
COCCDemoApp::COCCDemoApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
try
{
myGraphicDevice = new Graphic3d_WNTGraphicDevice;
}
catch(Standard_Failure)
{
AfxMessageBox("Fatal Error During Graphic Initialisation");
}
}
/////////////////////////////////////////////////////////////////////////////
// The one and only COCCDemoApp object
COCCDemoApp theApp;
/////////////////////////////////////////////////////////////////////////////
// COCCDemoApp initialization
BOOL COCCDemoApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COCCDemoDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(COCCDemoView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// Create result dialog
AfxInitRichEdit();
CMainFrame* cFrame = (CMainFrame*) GetMainWnd();
COCCDemoDoc* aDoc = (COCCDemoDoc*) cFrame->GetActiveDocument();
// pass cFrame->GetDesktopWindow() as parent to have an independent dialog
// pass cFrame as parent to have the result dialog always above the main window
if (!aDoc->GetResultDialog()->Create(CResultDialog::IDD, cFrame->GetDesktopWindow()))
TRACE0("Failed to create result dialog\n");
aDoc->GetResultDialog()->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);
aDoc->GetResultDialog()->ShowWindow(SW_HIDE);
aDoc->GetResultDialog()->Initialize();
// resize the result dialog, so no clipping occures when user
// resizes the dialog manually
// position the result dialog to the left bottom corner of the view
CRect aDlgRect, aViewRect;
aDoc->GetResultDialog()->GetWindowRect(&aDlgRect);
cFrame->GetActiveView()->GetWindowRect(&aViewRect);
int x = aViewRect.left;
int y = aViewRect.bottom - aDlgRect.Size().cy;
int cx = aDlgRect.Size().cx+1;
int cy = aDlgRect.Size().cy+1;
aDoc->GetResultDialog()->SetWindowPos(NULL, x, y, cx, cy, SWP_NOREDRAW | SWP_NOZORDER);
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
m_pMainWnd->SetFocus();
aDoc->Start();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
BOOL OnInitDialog();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BOOL CAboutDlg::OnInitDialog(){
CWnd* TitleWnd = GetDlgItem(IDC_ABOUTBOX_TITLE);
CString TitleString;
TitleWnd->GetWindowText(TitleString);
CString OCC_Version = OCC_VERSION_STRING;
TitleString = TitleString + OCC_Version;
TitleWnd->SetWindowText(TitleString);
CenterWindow();
return TRUE;
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void COCCDemoApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// COCCDemoApp message handlers

View File

@@ -0,0 +1,55 @@
// OCCDemo.h : main header file for the OCCDEMO application
//
#if !defined(AFX_OCCDEMO_H__57A6A228_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_OCCDEMO_H__57A6A228_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// COCCDemoApp:
// See OCCDemo.cpp for the implementation of this class
//
class COCCDemoApp : public CWinApp
{
public:
COCCDemoApp();
Handle(Graphic3d_WNTGraphicDevice) GetGraphicDevice() const
{ return myGraphicDevice; } ;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COCCDemoApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(COCCDemoApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle(Graphic3d_WNTGraphicDevice) myGraphicDevice;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OCCDEMO_H__57A6A228_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,380 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\OCCDemo.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\OCCDemo.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_OCC_LOGO BITMAP DISCARDABLE "res\\occ_logo.bmp"
IDR_MAINFRAME BITMAP MOVEABLE PURE "res\\Toolbar.bmp"
IDR_TOOLBAR1 BITMAP DISCARDABLE "res\\Toolbar1.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_MAINFRAME TOOLBAR DISCARDABLE 20, 20
BEGIN
BUTTON ID_BUTTONStart
BUTTON ID_BUTTONPrev
BUTTON ID_BUTTONRepeat
BUTTON ID_BUTTONNext
BUTTON ID_BUTTONEnd
SEPARATOR
BUTTON ID_BUTTONShowResult
BUTTON ID_DUMP_VIEW
END
IDR_TOOLBAR1 TOOLBAR DISCARDABLE 20, 20
BEGIN
BUTTON ID_BUTTONZoomAll
BUTTON ID_BUTTONZoomWin
BUTTON ID_BUTTONZoomProg
SEPARATOR
BUTTON ID_BUTTONPan
BUTTON ID_BUTTONPanGlo
SEPARATOR
BUTTON ID_BUTTONFront
BUTTON ID_BUTTONTop
BUTTON ID_BUTTONLeft
BUTTON ID_BUTTONBack
BUTTON ID_BUTTONRight
BUTTON ID_BUTTONBottom
BUTTON ID_BUTTONAxo
SEPARATOR
BUTTON ID_BUTTONRot
BUTTON ID_BUTTONReset
SEPARATOR
BUTTON ID_BUTTONWire
BUTTON ID_BUTTONShade
BUTTON ID_BUTTONHlrOn
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME MENU PRELOAD DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Reset", ID_FILE_NEW
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_APP_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About OCCDemo...", ID_APP_ABOUT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
"A", ID_BUTTONAxo, VIRTKEY, CONTROL, NOINVERT
"B", ID_BUTTONBack, VIRTKEY, CONTROL, NOINVERT
"F", ID_BUTTONZoomAll, VIRTKEY, NOINVERT
"F", ID_BUTTONFront, VIRTKEY, CONTROL, NOINVERT
"H", ID_BUTTONHlrOn, VIRTKEY, SHIFT, NOINVERT
"L", ID_BUTTONLeft, VIRTKEY, CONTROL, NOINVERT
"M", ID_BUTTONBottom, VIRTKEY, CONTROL, NOINVERT
"R", ID_BUTTONReset, VIRTKEY, NOINVERT
"R", ID_BUTTONRight, VIRTKEY, CONTROL, NOINVERT
"S", ID_BUTTONShade, VIRTKEY, SHIFT, NOINVERT
"T", ID_BUTTONTop, VIRTKEY, CONTROL, NOINVERT
VK_END, ID_BUTTONEnd, VIRTKEY, NOINVERT
VK_F11, ID_BUTTONShowResult, VIRTKEY, NOINVERT
VK_F12, ID_DUMP_VIEW, VIRTKEY, NOINVERT
VK_HOME, ID_BUTTONStart, VIRTKEY, NOINVERT
VK_NEXT, ID_BUTTONNext, VIRTKEY, NOINVERT
VK_PRIOR, ID_BUTTONPrev, VIRTKEY, NOINVERT
VK_SPACE, ID_BUTTONRepeat, VIRTKEY, NOINVERT
"W", ID_BUTTONWire, VIRTKEY, SHIFT, NOINVERT
"X", ID_APP_EXIT, VIRTKEY, CONTROL, NOINVERT
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOGEX 34, 22, 201, 161
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "About"
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "OCCDemo, Open CASCADE ",IDC_ABOUTBOX_TITLE,3,8,195,8
CTEXT "Copyright (C) 2008, Open CASCADE Company",IDC_STATIC,28,
99,147,8,SS_CENTERIMAGE
DEFPUSHBUTTON "OK",IDOK,55,135,88,14,WS_GROUP
CTEXT "http://www.opencascade.com",IDC_STATIC,50,115,98,8,
SS_CENTERIMAGE
CONTROL 1300,IDC_STATIC,"Static",SS_BITMAP,36,27,129,62,
WS_EX_CLIENTEDGE
END
IDD_ResultDialog DIALOG DISCARDABLE 0, 0, 244, 231
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "Result Dialog"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_RICHEDIT_ResultDialog,"RICHEDIT",ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_NOHIDESEL |
ES_READONLY | WS_BORDER | WS_VSCROLL | WS_HSCROLL |
WS_TABSTOP,0,7,243,192
PUSHBUTTON "Copy selection",IDC_CopySelectionToClipboard,0,206,60,
18
PUSHBUTTON "Copy all",IDC_CopyAllToClipboard,65,206,60,18
PUSHBUTTON "Close",IDCANCEL,183,206,60,18
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Open CASCADE Demonstration Application\0"
VALUE "CompanyName", "Open CASCADE, France\0"
VALUE "FileDescription", "OCCDemo MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "OCCDemo\0"
VALUE "LegalCopyright", "Copyright (C) 2001, Open CASCADE Company\0"
VALUE "LegalTrademarks", "Open CASCADE\0"
VALUE "OriginalFilename", "OCCDemo.EXE\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "OCCDemo Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ResultDialog, DIALOG
BEGIN
RIGHTMARGIN, 243
TOPMARGIN, 7
BOTTOMMARGIN, 224
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
IDR_MAINFRAME "OCCDemo\n\nOCCDem\n\n\nOCCDemo.Document\nOCCDem Document"
END
STRINGTABLE PRELOAD DISCARDABLE
BEGIN
AFX_IDS_APP_TITLE "OCCDemo"
AFX_IDS_IDLEMESSAGE "Ready"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_FILE_NEW "Start demo a new\nReset"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_APP_ABOUT "Display program information, version number and copyright\nAbout"
ID_APP_EXIT "Quit the application\nExit"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCSIZE "Change the window size"
AFX_IDS_SCMOVE "Change the window position"
AFX_IDS_SCMINIMIZE "Reduce the window to an icon"
AFX_IDS_SCMAXIMIZE "Enlarge the window to full size"
AFX_IDS_SCNEXTWINDOW "Switch to the next document window"
AFX_IDS_SCPREVWINDOW "Switch to the previous document window"
AFX_IDS_SCCLOSE "Close the active window"
END
STRINGTABLE DISCARDABLE
BEGIN
AFX_IDS_SCRESTORE "Restore the window to normal size"
AFX_IDS_SCTASKLIST "Activate Task List"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_BUTTONZoomAll "Press to zoom the application objects in the view\nFitAll (F)"
ID_BUTTONZoomWin "Press and drag MB1 to select a zoom window\nZoom Window"
ID_BUTTONZoomProg "Press and drag MB1 to zoom\nDynamic Zooming"
ID_BUTTONPan "Press and drag MB1 to pan\nDynamic Panning"
ID_BUTTONPanGlo "Press and select a new view center t\nGlobal Panning"
ID_BUTTONFront "Press to select a front View\nFront (Ctrl+F)"
ID_BUTTONLeft "Press to select a left View\nLeft (Ctrl+L)"
ID_BUTTONTop "Press to select a top View\nTop (Ctrl+T)"
ID_BUTTONBack "Press to select a back View\nBack (Ctrl+B)"
ID_BUTTONRight "Press to select a right View\nRight (Ctrl+R)"
ID_BUTTONBottom "Press to select a bottom View\nBottom (Ctrl+M)"
ID_BUTTONAxo "Press to select axonometric View\nAxo (Ctrl+A)"
ID_BUTTONRot "Press and drag MB1 to rotate\nDynamic Rotation"
ID_BUTTONReset "Press to reset view\nReset (R)"
ID_BUTTONWire "Press to switch to wireframe mode\nWireframe mode (Shift+W)"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_BUTTONShade "Press to switch to shading mode\nShading mode (Shift+S)"
ID_BUTTONHlrOn "Press to switch to HLR mode\nHLR mode (Shift+H)"
END
STRINGTABLE DISCARDABLE
BEGIN
ID_BUTTONStart "Press to go to the first sample\nFirst sample (Home)"
ID_BUTTONNext "Press to go to the next sample\nNext sample (PgDn)"
ID_BUTTONShowResult "Press to toggle show of source code on/off\nSource code (F11)"
ID_DUMP_VIEW "Save current frame into a GIF file\nExport view to GIF (F12)"
ID_BUTTONEnd "Press to go to the last sample\nLast sample (End)"
ID_BUTTONPrev "Press to go to the previous sample\nPrevious sample (PgUp)"
ID_BUTTONRepeat "Press to repeat the current sample\nRepeat sample (Space)"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\OCCDemo.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,273 @@
// OCCDemoDoc.cpp : implementation of the COCCDemoDoc class
//
#include "stdafx.h"
#include "OCCDemo.h"
#include "OCCDemoDoc.h"
#include "OCCDemo_Presentation.h"
#include "OCCDemoView.h"
#include <Standard_ErrorHandler.hxx>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COCCDemoDoc
IMPLEMENT_DYNCREATE(COCCDemoDoc, CDocument)
BEGIN_MESSAGE_MAP(COCCDemoDoc, CDocument)
//{{AFX_MSG_MAP(COCCDemoDoc)
ON_COMMAND(ID_BUTTONNext, OnBUTTONNext)
ON_COMMAND(ID_BUTTONStart, OnBUTTONStart)
ON_COMMAND(ID_BUTTONRepeat, OnBUTTONRepeat)
ON_COMMAND(ID_BUTTONPrev, OnBUTTONPrev)
ON_COMMAND(ID_BUTTONEnd, OnBUTTONEnd)
ON_UPDATE_COMMAND_UI(ID_BUTTONNext, OnUpdateBUTTONNext)
ON_UPDATE_COMMAND_UI(ID_BUTTONPrev, OnUpdateBUTTONPrev)
ON_COMMAND(ID_FILE_NEW, OnFileNew)
ON_COMMAND(ID_BUTTONShowResult, OnBUTTONShowResult)
ON_UPDATE_COMMAND_UI(ID_BUTTONShowResult, OnUpdateBUTTONShowResult)
ON_COMMAND(ID_DUMP_VIEW, OnDumpView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COCCDemoDoc construction/destruction
COCCDemoDoc::COCCDemoDoc()
{
// TODO: add one-time construction code here
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice();
myViewer = new V3d_Viewer(theGraphicDevice);
myViewer->SetDefaultLights();
myViewer->SetLightOn();
myViewer->SetDefaultBackgroundColor(Quantity_TOC_RGB, 0.,0.,0.);
myAISContext = new AIS_InteractiveContext(myViewer);
myShowResult = FALSE;
myPresentation = OCCDemo_Presentation::Current;
myPresentation->SetDocument(this);
CFile aFile;
if (!aFile.Open("Data\\points.dat", CFile::modeRead)){
strcpy(myDataDir, "..\\Data");
}
else
strcpy(myDataDir, "Data");
strcpy(myLastPath, ".");
}
COCCDemoDoc::~COCCDemoDoc()
{
}
BOOL COCCDemoDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
SetTitle(myPresentation->GetName());
myAISContext->EraseAll(Standard_False);
myAISContext->SetDisplayMode(AIS_Shaded);
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
COCCDemoView* pView = (COCCDemoView*) GetNextView(pos);
pView->Reset();
}
return TRUE;
}
void COCCDemoDoc::Start()
{
myPresentation->Init();
OnBUTTONStart();
}
/////////////////////////////////////////////////////////////////////////////
// COCCDemoDoc serialization
void COCCDemoDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{}// TODO: add storing code here
else
{}// TODO: add loading code here
}
/////////////////////////////////////////////////////////////////////////////
// COCCDemoDoc diagnostics
#ifdef _DEBUG
void COCCDemoDoc::AssertValid() const
{
CDocument::AssertValid();
}
void COCCDemoDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// COCCDemoDoc commands
void COCCDemoDoc::OnFileNew()
{
OnNewDocument();
Start();
}
void COCCDemoDoc::InitViewButtons()
{
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
COCCDemoView* pView = (COCCDemoView*) GetNextView(pos);
pView->InitButtons();
}
}
void COCCDemoDoc::DoSample()
{
InitViewButtons();
HCURSOR hOldCursor = ::GetCursor();
HCURSOR hNewCursor = AfxGetApp()->LoadStandardCursor(IDC_APPSTARTING);
SetCursor(hNewCursor);
{
try
{
myPresentation->DoSample();
}
catch (Standard_Failure)
{
Standard_SStream ostr;
ostr<<Standard_Failure::Caught()<<"\n\0";
AfxMessageBox (GetSString(ostr));
}
}
SetCursor(hOldCursor);
}
void COCCDemoDoc::OnBUTTONStart()
{
myAISContext->EraseAll(Standard_False);
myPresentation->FirstSample();
DoSample();
}
void COCCDemoDoc::OnBUTTONEnd()
{
myAISContext->EraseAll(Standard_False);
myPresentation->LastSample();
DoSample();
}
void COCCDemoDoc::OnBUTTONRepeat()
{
DoSample();
}
void COCCDemoDoc::OnBUTTONNext()
{
if (!myPresentation->AtLastSample())
{
myPresentation->NextSample();
DoSample();
}
}
void COCCDemoDoc::OnBUTTONPrev()
{
if (!myPresentation->AtFirstSample())
{
myPresentation->PrevSample();
DoSample();
}
}
void COCCDemoDoc::OnUpdateBUTTONNext(CCmdUI* pCmdUI)
{
pCmdUI->Enable (!myPresentation->AtLastSample());
}
void COCCDemoDoc::OnUpdateBUTTONPrev(CCmdUI* pCmdUI)
{
pCmdUI->Enable (!myPresentation->AtFirstSample());
}
void COCCDemoDoc::OnBUTTONShowResult()
{
myShowResult = !myShowResult;
if (myShowResult)
myCResultDialog.ShowWindow(SW_SHOWNORMAL);
else
myCResultDialog.ShowWindow(SW_HIDE);
}
void COCCDemoDoc::OnUpdateBUTTONShowResult(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myShowResult);
}
void COCCDemoDoc::OnDumpView()
{
// save current directory and restore it on exit
char aCurPath[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, aCurPath);
::SetCurrentDirectory(myLastPath);
CFileDialog *aDlg = new CFileDialog(false, "gif", "OCCView.gif",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "GIF Files (*.gif)|*.gif||", NULL);
int result = aDlg->DoModal();
if ( result == IDOK)
{
CString aFileName = aDlg->GetFileName();
delete aDlg;
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
COCCDemoView* pView = (COCCDemoView*) GetNextView(pos);
pView->UpdateWindow();
}
myViewer->InitActiveViews();
Handle(V3d_View) aView = myViewer->ActiveView();
char aStrFileName[MAX_PATH];
strcpy(aStrFileName, aFileName);
aView->Dump(aStrFileName);
}
else
delete aDlg;
::GetCurrentDirectory(MAX_PATH, myLastPath);
::SetCurrentDirectory(aCurPath);
}
void COCCDemoDoc::Fit()
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
COCCDemoView *pView = (COCCDemoView *) pChild->GetActiveView();
pView->FitAll();
}

View File

@@ -0,0 +1,88 @@
// OCCDemoDoc.h : interface of the COCCDemoDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_OCCDEMODOC_H__57A6A22E_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_OCCDEMODOC_H__57A6A22E_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ResultDialog.h"
class OCCDemo_Presentation;
class COCCDemoDoc : public CDocument
{
public:
Handle(V3d_Viewer) GetViewer() const { return myViewer; };
Handle(AIS_InteractiveContext) GetAISContext() const { return myAISContext; };
CResultDialog* GetResultDialog () {return &myCResultDialog;}
Standard_CString GetDataDir() {return myDataDir;}
protected: // create from serialization only
COCCDemoDoc();
DECLARE_DYNCREATE(COCCDemoDoc)
// Attributes
public:
BOOL& IsShowResult() {return myShowResult;}
// Operations
public:
void Start();
static void Fit();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COCCDemoDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~COCCDemoDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
void InitViewButtons();
void DoSample();
// Generated message map functions
protected:
//{{AFX_MSG(COCCDemoDoc)
afx_msg void OnBUTTONNext();
afx_msg void OnBUTTONStart();
afx_msg void OnBUTTONRepeat();
afx_msg void OnBUTTONPrev();
afx_msg void OnBUTTONEnd();
afx_msg void OnUpdateBUTTONNext(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPrev(CCmdUI* pCmdUI);
afx_msg void OnFileNew();
afx_msg void OnBUTTONShowResult();
afx_msg void OnUpdateBUTTONShowResult(CCmdUI* pCmdUI);
afx_msg void OnDumpView();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
Handle(V3d_Viewer) myViewer;
Handle(AIS_InteractiveContext) myAISContext;
OCCDemo_Presentation *myPresentation;
CResultDialog myCResultDialog;
BOOL myShowResult;
char myDataDir[8]; // for "..\Data\0"
char myLastPath[MAX_PATH]; // directory of lastly saved file in DumpView()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OCCDEMODOC_H__57A6A22E_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,583 @@
// OCCDemoView.cpp : implementation of the COCCDemoView class
//
#include "stdafx.h"
#include "MainFrm.h"
#include "OCCDemo.h"
#include "OCCDemoDoc.h"
#include "OCCDemoView.h"
#include <Graphic3d_GraphicDriver.hxx>
#define ValZWMin 1
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COCCDemoView
IMPLEMENT_DYNCREATE(COCCDemoView, CView)
BEGIN_MESSAGE_MAP(COCCDemoView, CView)
//{{AFX_MSG_MAP(COCCDemoView)
ON_COMMAND(ID_BUTTONAxo, OnBUTTONAxo)
ON_COMMAND(ID_BUTTONBack, OnBUTTONBack)
ON_COMMAND(ID_BUTTONBottom, OnBUTTONBottom)
ON_COMMAND(ID_BUTTONFront, OnBUTTONFront)
ON_COMMAND(ID_BUTTONHlrOn, OnBUTTONHlrOn)
ON_COMMAND(ID_BUTTONLeft, OnBUTTONLeft)
ON_COMMAND(ID_BUTTONPan, OnBUTTONPan)
ON_COMMAND(ID_BUTTONPanGlo, OnBUTTONPanGlo)
ON_COMMAND(ID_BUTTONReset, OnBUTTONReset)
ON_COMMAND(ID_BUTTONRight, OnBUTTONRight)
ON_COMMAND(ID_BUTTONRot, OnBUTTONRot)
ON_COMMAND(ID_BUTTONTop, OnBUTTONTop)
ON_COMMAND(ID_BUTTONZoomAll, OnBUTTONZoomAll)
ON_WM_SIZE()
ON_COMMAND(ID_BUTTONZoomProg, OnBUTTONZoomProg)
ON_COMMAND(ID_BUTTONZoomWin, OnBUTTONZoomWin)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_UPDATE_COMMAND_UI(ID_BUTTONPanGlo, OnUpdateBUTTONPanGlo)
ON_UPDATE_COMMAND_UI(ID_BUTTONPan, OnUpdateBUTTONPan)
ON_UPDATE_COMMAND_UI(ID_BUTTONZoomProg, OnUpdateBUTTONZoomProg)
ON_UPDATE_COMMAND_UI(ID_BUTTONZoomWin, OnUpdateBUTTONZoomWin)
ON_UPDATE_COMMAND_UI(ID_BUTTONRot, OnUpdateBUTTONRot)
ON_COMMAND(ID_BUTTONWire, OnBUTTONWire)
ON_COMMAND(ID_BUTTONShade, OnBUTTONShade)
ON_UPDATE_COMMAND_UI(ID_BUTTONHlrOn, OnUpdateBUTTONHlrOn)
ON_UPDATE_COMMAND_UI(ID_BUTTONShade, OnUpdateBUTTONShade)
ON_UPDATE_COMMAND_UI(ID_BUTTONWire, OnUpdateBUTTONWire)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COCCDemoView construction/destruction
COCCDemoView::COCCDemoView()
{
myXmin=0;
myYmin=0;
myXmax=0;
myYmax=0;
myCurZoom=0;
myCurrentMode = CurAction3d_Nothing;
myVisMode = VIS_SHADE;
m_Pen = NULL;
myGraphicDriver = Handle(Graphic3d_GraphicDriver)::DownCast(
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice()->GraphicDriver() );
}
COCCDemoView::~COCCDemoView()
{
if (!myView.IsNull())
myView->Remove();
if (m_Pen)
delete m_Pen;
}
BOOL COCCDemoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// COCCDemoView drawing
void COCCDemoView::OnInitialUpdate()
{
CView::OnInitialUpdate();
myView = GetDocument()->GetViewer()->CreateView();
Handle(Graphic3d_WNTGraphicDevice) theGraphicDevice =
((COCCDemoApp*)AfxGetApp())->GetGraphicDevice();
Handle(WNT_Window) aWNTWindow = new WNT_Window(theGraphicDevice,GetSafeHwnd ());
myView->SetWindow(aWNTWindow);
if (!aWNTWindow->IsMapped()) aWNTWindow->Map();
myCurrentMode = CurAction3d_Nothing;
myVisMode = VIS_SHADE;
RedrawVisMode();
}
void COCCDemoView::OnDraw(CDC* pDC)
{
COCCDemoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
myView->Redraw();
}
/////////////////////////////////////////////////////////////////////////////
// COCCDemoView diagnostics
#ifdef _DEBUG
void COCCDemoView::AssertValid() const
{
CView::AssertValid();
}
void COCCDemoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
COCCDemoDoc* COCCDemoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COCCDemoDoc)));
return (COCCDemoDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// COCCDemoView message handlers
void COCCDemoView::OnSize(UINT nType, int cx, int cy)
{
if (!myView.IsNull())
myView->MustBeResized();
}
void COCCDemoView::OnBUTTONBack()
{
myView->SetProj(V3d_Ypos);
}
void COCCDemoView::OnBUTTONFront()
{
myView->SetProj(V3d_Yneg);
}
void COCCDemoView::OnBUTTONBottom()
{
myView->SetProj(V3d_Zneg);
}
void COCCDemoView::OnBUTTONTop()
{
myView->SetProj(V3d_Zpos);
}
void COCCDemoView::OnBUTTONLeft()
{
myView->SetProj(V3d_Xneg);
}
void COCCDemoView::OnBUTTONRight()
{
myView->SetProj(V3d_Xpos);
}
void COCCDemoView::OnBUTTONAxo()
{
myView->SetProj(V3d_XposYnegZpos);
}
void COCCDemoView::OnBUTTONPan()
{
myCurrentMode = CurAction3d_DynamicPanning;
}
void COCCDemoView::OnBUTTONPanGlo()
{
// save the current zoom value
myCurZoom = myView->Scale();
// Do a Global Zoom
myView->FitAll();
// Set the mode
myCurrentMode = CurAction3d_GlobalPanning;
}
void COCCDemoView::OnBUTTONReset()
{
myView->Reset();
}
void COCCDemoView::OnBUTTONRot()
{
myCurrentMode = CurAction3d_DynamicRotation;
}
void COCCDemoView::OnBUTTONZoomAll()
{
myView->FitAll();
myView->ZFitAll();
}
void COCCDemoView::OnBUTTONZoomProg()
{
myCurrentMode = CurAction3d_DynamicZooming;
}
void COCCDemoView::OnBUTTONZoomWin()
{
myCurrentMode = CurAction3d_WindowZooming;
}
void COCCDemoView::OnLButtonDown(UINT nFlags, CPoint point)
{
// save the current mouse coordinate in min
myXmin=point.x; myYmin=point.y;
myXmax=point.x; myYmax=point.y;
if ( ! (nFlags & MK_CONTROL) )
{
if (myCurrentMode == CurAction3d_DynamicRotation)
{
myView->SetComputedMode(Standard_False);
myView->StartRotation(point.x,point.y);
}
}
}
void COCCDemoView::OnLButtonUp(UINT nFlags, CPoint point)
{
if ( !(nFlags & MK_CONTROL) )
{
switch (myCurrentMode)
{
case CurAction3d_Nothing :
myXmax=point.x;
myYmax=point.y;
break;
case CurAction3d_DynamicZooming :
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_WindowZooming :
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False);
myXmax=point.x;
myYmax=point.y;
if ((abs(myXmin-myXmax)>ValZWMin) || (abs(myYmin-myYmax)>ValZWMin))
// Test if the zoom window is greater than a minimale window.
{
// Do the zoom window between Pmin and Pmax
myView->WindowFitAll(myXmin,myYmin,myXmax,myYmax);
}
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_DynamicPanning :
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_GlobalPanning :
myView->Place(point.x,point.y,myCurZoom);
myCurrentMode = CurAction3d_Nothing;
break;
case CurAction3d_DynamicRotation :
if (myVisMode == VIS_HLR)
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
myView->SetComputedMode(Standard_True);
myView->Redraw();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
myCurrentMode = CurAction3d_Nothing;
break;
} //switch (myCurrentMode)
}
}
void COCCDemoView::OnRButtonDown(UINT nFlags, CPoint point)
{
if ( nFlags & MK_CONTROL )
{
myView->SetComputedMode(Standard_False);
myView->StartRotation(point.x,point.y);
}
}
void COCCDemoView::OnRButtonUp(UINT nFlags, CPoint point)
{
if (myVisMode == VIS_HLR)
{
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
myView->SetComputedMode(Standard_True);
myView->Redraw();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
}
}
void COCCDemoView::OnMouseMove(UINT nFlags, CPoint point)
{
// ============================ LEFT BUTTON =======================
if ( nFlags & MK_LBUTTON)
{
if ( nFlags & MK_CONTROL )
{
// move with MB1 and Control : on the dynamic zooming
// Do the zoom in function of mouse's coordinates
myView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in max
myXmax = point.x;
myYmax = point.y;
}
else // if ( Ctrl )
{
switch (myCurrentMode)
{
case CurAction3d_Nothing :
myXmax = point.x;
myYmax = point.y;
break;
case CurAction3d_DynamicZooming :
myView->Zoom(myXmax,myYmax,point.x,point.y);
// save the current mouse coordinate in max;
myXmax=point.x;
myYmax=point.y;
break;
case CurAction3d_WindowZooming :
myXmax = point.x; myYmax = point.y;
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_False,LongDash);
DrawRectangle(myXmin,myYmin,myXmax,myYmax,Standard_True,LongDash);
break;
case CurAction3d_DynamicPanning :
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
break;
case CurAction3d_GlobalPanning : // nothing
break;
case CurAction3d_DynamicRotation :
myView->Rotation(point.x,point.y);
myView->Redraw();
break;
}
}
}
// ============================ MIDDLE BUTTON =======================
else if ( nFlags & MK_MBUTTON)
{
if ( nFlags & MK_CONTROL )
{
myView->Pan(point.x-myXmax,myYmax-point.y); // Realize the panning
myXmax = point.x; myYmax = point.y;
}
}
// ============================ RIGHT BUTTON =======================
else if ( nFlags & MK_RBUTTON)
{
if ( nFlags & MK_CONTROL )
{
myView->Rotation(point.x,point.y);
}
}
// ============================ NO BUTTON =======================
else
{
myXmax = point.x;
myYmax = point.y;
}
}
void COCCDemoView::OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myCurrentMode == CurAction3d_GlobalPanning);
pCmdUI->Enable (myCurrentMode != CurAction3d_GlobalPanning);
}
void COCCDemoView::OnUpdateBUTTONPan(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicPanning);
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicPanning );
}
void COCCDemoView::OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicZooming );
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicZooming);
}
void COCCDemoView::OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myCurrentMode == CurAction3d_WindowZooming);
pCmdUI->Enable (myCurrentMode != CurAction3d_WindowZooming);
}
void COCCDemoView::OnUpdateBUTTONRot(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myCurrentMode == CurAction3d_DynamicRotation);
pCmdUI->Enable (myCurrentMode != CurAction3d_DynamicRotation);
}
void COCCDemoView::DrawRectangle(const Standard_Integer MinX,
const Standard_Integer MinY,
const Standard_Integer MaxX,
const Standard_Integer MaxY,
const Standard_Boolean Draw,
const LineStyle aLineStyle)
{
static int m_DrawMode;
if (!m_Pen && aLineStyle ==Solid )
{
m_Pen = new CPen(PS_SOLID, 1, RGB(0,0,0)); m_DrawMode = R2_MERGEPENNOT;
}
else if (!m_Pen && aLineStyle ==Dot )
{
m_Pen = new CPen(PS_DOT, 1, RGB(0,0,0)); m_DrawMode = R2_XORPEN;
}
else if (!m_Pen && aLineStyle == ShortDash)
{
m_Pen = new CPen(PS_DASH, 1, RGB(255,0,0)); m_DrawMode = R2_XORPEN;
}
else if (!m_Pen && aLineStyle == LongDash)
{
m_Pen = new CPen(PS_DASH, 1, RGB(0,0,0)); m_DrawMode = R2_NOTXORPEN;
}
else if (aLineStyle == Default)
{
m_Pen = NULL; m_DrawMode = R2_MERGEPENNOT;
}
CPen* aOldPen;
CClientDC clientDC(this);
if (m_Pen)
aOldPen = clientDC.SelectObject(m_Pen);
clientDC.SetROP2(m_DrawMode);
static Standard_Integer StoredMinX, StoredMaxX, StoredMinY, StoredMaxY;
static Standard_Boolean m_IsVisible = Standard_False;
if ( m_IsVisible && !Draw) // move or up : erase at the old position
{
clientDC.MoveTo(StoredMinX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMaxY);
clientDC.LineTo(StoredMaxX,StoredMaxY);
clientDC.LineTo(StoredMaxX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMinY);
m_IsVisible = false;
}
StoredMinX = min ( MinX, MaxX );
StoredMinY = min ( MinY, MaxY );
StoredMaxX = max ( MinX, MaxX );
StoredMaxY = max ( MinY, MaxY);
if (Draw) // move : draw
{
clientDC.MoveTo(StoredMinX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMaxY);
clientDC.LineTo(StoredMaxX,StoredMaxY);
clientDC.LineTo(StoredMaxX,StoredMinY); clientDC.LineTo(StoredMinX,StoredMinY);
m_IsVisible = true;
}
if (m_Pen)
clientDC.SelectObject(aOldPen);
}
void COCCDemoView::InitButtons()
{
myXmin=0;
myYmin=0;
myXmax=0;
myYmax=0;
myCurZoom=0;
myCurrentMode = CurAction3d_Nothing;
}
void COCCDemoView::Reset()
{
InitButtons();
myVisMode = VIS_SHADE;
if (!myView.IsNull())
{
RedrawVisMode();
myView->Reset();
}
}
void COCCDemoView::RedrawVisMode()
{
switch (myVisMode)
{
case VIS_WIREFRAME:
GetDocument()->GetAISContext()->SetDisplayMode(AIS_WireFrame);
myView->SetComputedMode (Standard_False);
myView->Redraw();
break;
case VIS_SHADE:
GetDocument()->GetAISContext()->SetDisplayMode(AIS_Shaded);
myView->SetComputedMode (Standard_False);
myView->Redraw();
break;
case VIS_HLR:
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
myView->SetComputedMode (Standard_True);
myView->Redraw();
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
GetDocument()->GetAISContext()->SetDisplayMode(AIS_WireFrame);
break;
}
}
void COCCDemoView::OnBUTTONWire()
{
myVisMode = VIS_WIREFRAME;
RedrawVisMode();
}
void COCCDemoView::OnBUTTONShade()
{
myVisMode = VIS_SHADE;
RedrawVisMode();
}
void COCCDemoView::OnBUTTONHlrOn()
{
myVisMode = VIS_HLR;
RedrawVisMode();
}
void COCCDemoView::OnUpdateBUTTONWire(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myVisMode == VIS_WIREFRAME);
pCmdUI->Enable (myVisMode != VIS_WIREFRAME);
}
void COCCDemoView::OnUpdateBUTTONShade(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myVisMode == VIS_SHADE);
pCmdUI->Enable (myVisMode != VIS_SHADE);
}
void COCCDemoView::OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck (myVisMode == VIS_HLR);
pCmdUI->Enable (myVisMode != VIS_HLR);
}
void COCCDemoView::GetViewCenter(Standard_Real& Xc, Standard_Real& Yc)
{
myView->Center(Xc,Yc);
}
void COCCDemoView::SetViewCenter(Standard_Real Xc, Standard_Real Yc)
{
myView->SetCenter(Xc,Yc);
}
void COCCDemoView::GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z)
{
myView->Eye(X,Y,Z);
}
void COCCDemoView::SetViewEye(Standard_Real X, Standard_Real Y, Standard_Real Z)
{
myView->SetEye(X,Y,Z);
}
Standard_Real COCCDemoView::GetViewScale()
{
return myView->Scale();
}
void COCCDemoView::SetViewScale(Standard_Real Coef)
{
myView->SetScale(Coef);
}

View File

@@ -0,0 +1,138 @@
// OCCDemoView.h : interface of the COCCDemoView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
enum View3D_CurrentAction {
CurAction3d_Nothing,
CurAction3d_DynamicZooming,
CurAction3d_WindowZooming,
CurAction3d_DynamicPanning,
CurAction3d_GlobalPanning,
CurAction3d_DynamicRotation
};
class COCCDemoView : public CView
{
protected: // create from serialization only
COCCDemoView();
DECLARE_DYNCREATE(COCCDemoView)
// Attributes
public:
COCCDemoDoc* GetDocument();
// Operations
public:
void InitButtons();
void Reset();
void FitAll() { myView->FitAll(); myView->ZFitAll(); };
void GetViewCenter(Standard_Real& Xc, Standard_Real& Yc);
void SetViewCenter(const Standard_Real Xc, const Standard_Real Yc);
void GetViewEye(Standard_Real& X, Standard_Real& Y, Standard_Real& Z);
void SetViewEye(const Standard_Real X,const Standard_Real Y,const Standard_Real Z);
Standard_Real GetViewScale();
void SetViewScale(const Standard_Real Coef);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(COCCDemoView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual void OnInitialUpdate();
protected:
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~COCCDemoView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(COCCDemoView)
afx_msg void OnBUTTONAxo();
afx_msg void OnBUTTONBack();
afx_msg void OnBUTTONBottom();
afx_msg void OnBUTTONFront();
afx_msg void OnBUTTONHlrOn();
afx_msg void OnBUTTONLeft();
afx_msg void OnBUTTONPan();
afx_msg void OnBUTTONPanGlo();
afx_msg void OnBUTTONReset();
afx_msg void OnBUTTONRight();
afx_msg void OnBUTTONRot();
afx_msg void OnBUTTONTop();
afx_msg void OnBUTTONZoomAll();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnBUTTONZoomProg();
afx_msg void OnBUTTONZoomWin();
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnUpdateBUTTONPanGlo(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONPan(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomProg(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONZoomWin(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONRot(CCmdUI* pCmdUI);
afx_msg void OnBUTTONWire();
afx_msg void OnBUTTONShade();
afx_msg void OnUpdateBUTTONHlrOn(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONShade(CCmdUI* pCmdUI);
afx_msg void OnUpdateBUTTONWire(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
void RedrawVisMode();
private:
enum VisMode { VIS_WIREFRAME, VIS_SHADE, VIS_HLR };
Handle(V3d_View) myView;
Handle(Graphic3d_GraphicDriver) myGraphicDriver;
View3D_CurrentAction myCurrentMode;
VisMode myVisMode;
Standard_Integer myXmin;
Standard_Integer myYmin;
Standard_Integer myXmax;
Standard_Integer myYmax;
Standard_Real myCurZoom;
private:
enum LineStyle { Solid, Dot, ShortDash, LongDash, Default };
CPen* m_Pen;
virtual void DrawRectangle (const Standard_Integer MinX ,
const Standard_Integer MinY ,
const Standard_Integer MaxX ,
const Standard_Integer MaxY ,
const Standard_Boolean Draw ,
const LineStyle aLineStyle = Default );
};
#ifndef _DEBUG // debug version in OCCDemoView.cpp
inline COCCDemoDoc* COCCDemoView::GetDocument()
{ return (COCCDemoDoc*)m_pDocument; }
#endif
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OCCDEMOVIEW_H__57A6A230_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,206 @@
// ResultDialog.cpp : implementation file
//
#include "stdafx.h"
#include "OCCDemo.h"
#include "ResultDialog.h"
#include "MainFrm.h"
#include "OCCDemoDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// minimum distance between buttons, button and dialog border
#define d 5
/////////////////////////////////////////////////////////////////////////////
// CResultDialog dialog
CResultDialog::CResultDialog(CWnd* pParent /*=NULL*/)
: CDialog(CResultDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CResultDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CResultDialog::Empty()
{
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
pEd->Clear();
}
void CResultDialog::SetText(LPCSTR aText)
{
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
CString aCStr(aText);
pEd->SetWindowText(aCStr);
}
void CResultDialog::SetTitle(LPCSTR aTitle)
{
CString aCStr(aTitle);
SetWindowText(aCStr);
}
void CResultDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CResultDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CResultDialog, CDialog)
//{{AFX_MSG_MAP(CResultDialog)
ON_BN_CLICKED(IDC_CopySelectionToClipboard, OnCopySelectionToClipboard)
ON_BN_CLICKED(IDC_CopyAllToClipboard, OnCopyAllToClipboard)
ON_WM_SIZE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CResultDialog message handlers
void CResultDialog::OnCopySelectionToClipboard()
{
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
pEd->Copy( );
}
void CResultDialog::OnCopyAllToClipboard()
{
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
long nStartChar, nEndChar;
pEd->GetSel (nStartChar, nEndChar);
pEd->SetSel (0, -1);
pEd->Copy();
pEd->SetSel (nStartChar, nEndChar);
}
void CResultDialog::OnCancel()
{
CMainFrame* cFrame = (CMainFrame*) AfxGetApp()->GetMainWnd();
COCCDemoDoc* aDoc = (COCCDemoDoc*) cFrame->GetActiveDocument();
aDoc->IsShowResult() = FALSE;
CDialog::OnCancel();
}
void CResultDialog::Initialize()
{
// Set Fixed Width Font for rich edit control
CRichEditCtrl *pEd = (CRichEditCtrl *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
CFont aFixedWidthFont;
VERIFY(aFixedWidthFont.CreateFont(
15, // nHeight
5, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
FF_MODERN, // Fix width fonts are FF_MODERN
"Courier New")); // lpszFacename
pEd->SetFont(&aFixedWidthFont, false);
// save button's width and height, so they are calculated only once
RECT rect;
CWnd *pBCopy = (CWnd *) GetDlgItem (IDC_CopySelectionToClipboard);
pBCopy->GetWindowRect(&rect);
bw = rect.right - rect.left; // a button's width (they are all equal)
bh = rect.bottom - rect.top; // a button's height
}
// OnSize is a message handler of WM_SIZE messge,
// it is reimplemented in order to reposition the buttons
// (keep them always in the bottom part of the dialog)
// and resize the rich edit controls as user resized THIS dialog.
void CResultDialog::OnSize(UINT nType, int cx, int cy)
{
// call the base class handler
CDialog::OnSize(nType, cx, cy);
//resizes internal GUI controls (rich edit control and 3 buttons)
//according to given values of this dialog width (cx) and height (cy).
//the method is called from OnSize message handler and
//from InitInstance of OCCDemo to do initial resize
CWnd *pEd = (CWnd *) GetDlgItem (IDC_RICHEDIT_ResultDialog);
CWnd *pBCopy = (CWnd *) GetDlgItem (IDC_CopySelectionToClipboard);
CWnd *pBCopyAll = (CWnd *) GetDlgItem (IDC_CopyAllToClipboard);
CWnd *pBClose = (CWnd *) GetDlgItem (IDCANCEL);
if (pEd != NULL) // it is NULL when dialog is being created and OnSize is called
{
int butY = cy-bh-d; // y coordinate of buttons' top left corner
pEd->SetWindowPos(&wndTop, 0, 0, cx, butY-4*d, SWP_NOMOVE);
pBCopy->SetWindowPos(&wndTop, d, butY, 0, 0, SWP_NOSIZE);
pBCopyAll->SetWindowPos(&wndTop, d+bw+d, butY, 0, 0, SWP_NOSIZE);
pBClose->SetWindowPos(&wndTop, cx-bw-d, butY, 0, 0, SWP_NOSIZE);
}
RedrawWindow();
}
LRESULT CResultDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (message != WM_SIZING)
return CDialog::WindowProc(message, wParam, lParam);
LPRECT pRect = (LPRECT) lParam;
int cx = pRect->right - pRect->left;
int cy = pRect->bottom - pRect->top;
int minCx = 3*bw+5*d;
int minCy = 2*d+bh+200;
if (cx < minCx || cy < minCy)
{
switch (wParam)
{
case WMSZ_BOTTOM:
pRect->bottom = pRect->top + minCy;
break;
case WMSZ_TOP:
pRect->top = pRect->bottom - minCy;
break;
case WMSZ_LEFT:
pRect->left = pRect->right - minCx;
break;
case WMSZ_RIGHT:
pRect->right = pRect->left + minCx;
break;
case WMSZ_TOPLEFT:
if (cx < minCx) pRect->left = pRect->right - minCx;
if (cy < minCy) pRect->top = pRect->bottom - minCy;
break;
case WMSZ_BOTTOMRIGHT:
if (cx < minCx) pRect->right = pRect->left + minCx;
if (cy < minCy) pRect->bottom = pRect->top + minCy;
break;
case WMSZ_TOPRIGHT:
if (cx < minCx) pRect->right = pRect->left + minCx;
if (cy < minCy) pRect->top = pRect->bottom - minCy;
break;
case WMSZ_BOTTOMLEFT:
if (cx < minCx) pRect->left = pRect->right - minCx;
if (cy < minCy) pRect->bottom = pRect->top + minCy;
break;
}
}
return CDialog::WindowProc(message, wParam, lParam);
}

View File

@@ -0,0 +1,66 @@
#if !defined(AFX_RESULTDIALOG_H__6597303D_7F5B_11D5_BA4D_0060B0EE18EA__INCLUDED_)
#define AFX_RESULTDIALOG_H__6597303D_7F5B_11D5_BA4D_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ResultDialog.h : header file
//
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// CResultDialog dialog
class CResultDialog : public CDialog
{
// Construction
public:
void Initialize();
CResultDialog(CWnd* pParent = NULL); // standard constructor
void SetTitle(LPCSTR aTitle);
void SetText(LPCSTR aText);
void Empty();
// Dialog Data
//{{AFX_DATA(CResultDialog)
enum { IDD = IDD_ResultDialog };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CResultDialog)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CResultDialog)
afx_msg void OnCopySelectionToClipboard();
afx_msg void OnCopyAllToClipboard();
virtual void OnCancel();
// OnSize is a message handler of WM_SIZE messge,
// it is reimplemented in order to reposition the buttons
// (keep them always in the bottom part of the dialog)
// and resize the rich edit controls as user resized THIS dialog.
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
int bw, bh; // button width and height
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESULTDIALOG_H__6597303D_7F5B_11D5_BA4D_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// OCCDemo.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,44 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__57A6A22A_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_STDAFX_H__57A6A22A_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
//#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#if !defined(WNT)
#error WNT precompiler directive is mandatory for CasCade
#endif
#pragma warning( disable : 4244 ) // Issue warning 4244
#include "Standard_ShortReal.hxx"
#pragma warning( default : 4244 ) // Issue warning 4244
#include <Standard.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Shape.hxx>
#include <AIS_Point.hxx>
#include <Graphic3d_WNTGraphicDevice.hxx>
#include <V3d_Viewer.hxx>
#include <V3d_View.hxx>
#include <WNT_Window.hxx>
#include <Standard_ErrorHandler.hxx>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__57A6A22A_7B4F_11D5_BA4A_0060B0EE18EA__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1 @@
// This file is to be included in the main resource file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,49 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by OCCDemo.rc
//
#define IDR_MAINFRAME 128
#define IDR_TOOLBAR1 130
#define IDD_ResultDialog 133
#define IDC_CopySelectionToClipboard 1000
#define IDC_CopyAllToClipboard 1001
#define IDC_RICHEDIT_ResultDialog 1005
#define IDB_OCC_LOGO 1300
#define IDD_ABOUTBOX 10000
#define IDC_ABOUTBOX_TITLE 10001
#define ID_BUTTONZoomAll 40000
#define ID_BUTTONZoomWin 40002
#define ID_BUTTONZoomProg 40003
#define ID_BUTTONPan 40004
#define ID_BUTTONPanGlo 40005
#define ID_BUTTONFront 40006
#define ID_BUTTONLeft 40007
#define ID_BUTTONTop 40008
#define ID_BUTTONBack 40009
#define ID_BUTTONRight 40010
#define ID_BUTTONBottom 40011
#define ID_BUTTONAxo 40012
#define ID_BUTTONRot 40013
#define ID_BUTTONReset 40014
#define ID_BUTTONWire 40015
#define ID_BUTTONShade 40016
#define ID_BUTTONHlrOn 40017
#define ID_BUTTONStart 40103
#define ID_BUTTONNext 40104
#define ID_BUTTONShowResult 40105
#define ID_DUMP_VIEW 40106
#define ID_BUTTONEnd 40107
#define ID_BUTTONPrev 40109
#define ID_BUTTONRepeat 40110
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 136
#define _APS_NEXT_COMMAND_VALUE 40111
#define _APS_NEXT_CONTROL_VALUE 1007
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,428 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="Convert"
SccProjectName=""
SccLocalPath=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\../Release"
IntermediateDirectory=".\../Release/obj"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WNT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Release/obj/Convert.pch"
AssemblerListingLocation=".\../Release/obj/"
ObjectFile=".\../Release/obj/"
ProgramDataBaseFileName=".\../Release/obj/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib TKBO.lib"
OutputFile=".\../Release/Convert.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\../Release/Convert.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Release/Convert.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../Debug"
IntermediateDirectory=".\../Debug/objd"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WNT"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Debug/objd/Convert.pch"
AssemblerListingLocation=".\../Debug/objd/"
ObjectFile=".\../Debug/objd/"
ProgramDataBaseFileName=".\../Debug/objd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib TKBO.lib"
OutputFile=".\../Debug/Convert.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/Convert.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/Convert.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="Convert_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="Convert_Presentation.h">
</File>
</Filter>
<Filter
Name="Common"
Filter="">
<File
RelativePath="..\env.bat">
</File>
<File
RelativePath="..\readme.txt">
</File>
<File
RelativePath="..\run.bat">
</File>
<File
RelativePath="..\vc.bat">
</File>
<Filter
Name="Source Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\MainFrm.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\StdAfx.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.h">
</File>
<File
RelativePath="..\Common\WNT\MainFrm.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.h">
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.h">
</File>
<File
RelativePath="..\Common\WNT\resource.h">
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.h">
</File>
<File
RelativePath="..\Common\WNT\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="..\Common\WNT\res\OCCDemo.ico">
</File>
<File
RelativePath="..\Common\WNT\res\OCCDemo.rc2">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar.bmp">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar1.bmp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,461 @@
// Convert_Presentation.cpp: implementation of the Convert_Presentation class.
// Conversion of elementary geometry to BSpline curves and surfaces
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Convert_Presentation.h"
#include <Quantity_Color.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax2.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColgp_Array2OfPnt.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <GeomConvert.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_ConicalSurface.hxx>
// Initialization of global variable with an instance of this class
OCCDemo_Presentation* OCCDemo_Presentation::Current = new Convert_Presentation;
// Initialization of array of samples
const Convert_Presentation::PSampleFuncType Convert_Presentation::SampleFuncs[] =
{
&Convert_Presentation::sampleCircle,
&Convert_Presentation::sampleEllipse,
&Convert_Presentation::sampleBezier,
&Convert_Presentation::sampleBezierSurface,
&Convert_Presentation::sampleCylindricalSurface,
&Convert_Presentation::sampleRevolSurface,
&Convert_Presentation::sampleToroidalSurface,
&Convert_Presentation::sampleConicalSurface,
&Convert_Presentation::sampleSphericalSurface
};
// Colors of objects
static const Quantity_Color CurveColor (1,1,0, Quantity_TOC_RGB); // yellow
static const Quantity_Color SurfaceColor (1,1,0, Quantity_TOC_RGB); // yellow
static const Quantity_Color BSplineColor (1,0.647,0, Quantity_TOC_RGB); // orange
static const Quantity_Color BSplineSurfaceColor (0,0,1, Quantity_TOC_RGB); // blue
#ifdef WNT
#define EOL "\r\n"
#else
#define EOL "\n"
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Convert_Presentation::Convert_Presentation()
{
FitMode = true;
setName ("Conversion to BSpline curves and surfaces");
myIndex = 0;
myNbFuncs = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
myNbSamples = myNbFuncs;
}
//////////////////////////////////////////////////////////////////////
// Sample execution
//////////////////////////////////////////////////////////////////////
void Convert_Presentation::DoSample()
{
getAISContext()->EraseAll();
if (myIndex >=0 && myIndex < myNbFuncs)
(this->*SampleFuncs[myIndex])();
}
//================================================================
// Function : Convert_Presentation::drawSurfaceAndItsBSpline
// Purpose :
//================================================================
void Convert_Presentation::drawSurfaceAndItsBSpline(Handle(Geom_Surface) theSurface,
const Standard_CString theName,
TCollection_AsciiString& theText)
{
TCollection_AsciiString aTitle ("Converting ");
aTitle += theName;
aTitle += " to BSpline surface";
theText += EOL
" Handle(Geom_BSplineSurface) aBSplineSurface = " EOL
" GeomConvert::SurfaceToBSplineSurface(aSurface);" EOL;
setResultTitle (aTitle.ToCString());
setResultText (theText.ToCString());
drawSurface (theSurface, SurfaceColor);
if (WAIT_A_LITTLE) return;
Handle(Geom_BSplineSurface) aBSplineSurface = GeomConvert::SurfaceToBSplineSurface(theSurface);
_ASSERTE(!aBSplineSurface.IsNull());
drawSurface (aBSplineSurface, BSplineSurfaceColor);
}
//================================================================
// Function : Convert_Presentation::drawCurveAndItsBSpline
// Purpose :
//================================================================
void Convert_Presentation::drawCurveAndItsBSpline(Handle(Geom_Curve) theCurve,
const Standard_CString theName,
TCollection_AsciiString& theText)
{
TCollection_AsciiString aTitle ("Converting ");
aTitle += theName;
aTitle += " to BSpline curve";
theText += EOL
" Handle(Geom_BSplineCurve) aBSpline = " EOL
" GeomConvert::CurveToBSplineCurve(aCurve);" EOL;
setResultTitle (aTitle.ToCString());
setResultText (theText.ToCString());
drawCurve (theCurve, CurveColor);
if (WAIT_A_LITTLE) return;
Handle(Geom_BSplineCurve) aBSpline = GeomConvert::CurveToBSplineCurve(theCurve);
drawCurve (aBSpline, BSplineColor);
}
//////////////////////////////////////////////////////////////////////
// Sample functions
//////////////////////////////////////////////////////////////////////
//================================================================
// Function : Convert_Presentation::sampleCircle
// Purpose :
//================================================================
void Convert_Presentation::sampleCircle()
{
gp_Pnt aOrigin (0,0,0);
gp_Dir aDir (1,0,0);
gp_Ax2 aAxis (aOrigin, aDir);
Standard_Real aRadius = 300;
Handle(Geom_Circle) aCurve = new Geom_Circle (aAxis, aRadius);
TCollection_AsciiString aText (
" gp_Pnt aOrigin (0,0,0);" EOL
" gp_Dir aDir (1,0,0);" EOL
" gp_Ax2 aAxis (aOrigin, aDir);" EOL
" Standard_Real aRadius = 300;" EOL
" Handle(Geom_Circle) aCurve = new Geom_Circle (aAxis, aRadius);" EOL
);
drawCurveAndItsBSpline (aCurve, "Circle", aText);
}
//================================================================
// Function : Convert_Presentation::sampleEllipse
// Purpose :
//================================================================
void Convert_Presentation::sampleEllipse()
{
gp_Pnt aOrigin (0,0,0);
gp_Dir aDir (1,0,0);
gp_Ax2 aMajorAxis (aOrigin, aDir);
Standard_Real aMajorRadius = 300;
Standard_Real aMinorRadius = 150;
Handle(Geom_Ellipse) aCurve =
new Geom_Ellipse (aMajorAxis, aMajorRadius, aMinorRadius);
TCollection_AsciiString aText (
" gp_Pnt aOrigin (0,0,0);" EOL
" gp_Dir aDir (1,0,0);" EOL
" gp_Ax2 aAxis (aOrigin, aDir);" EOL
" Standard_Real aMajorRadius = 300;" EOL
" Standard_Real aMinorRadius = 150;" EOL
" Handle(Geom_Ellipse) aCurve = " EOL
" new Geom_Ellipse (aAxis, aMajorRadius, aMinorRadius);" EOL
);
drawCurveAndItsBSpline (aCurve, "Ellipse", aText);
}
//================================================================
// Function : Convert_Presentation::sampleBezier
// Purpose :
//================================================================
void Convert_Presentation::sampleBezier()
{
TCollection_AsciiString aText (
" Standard_Real aPolesCoords[][3] = {" EOL
" {0,0,0},{0,1,0},{1,1,0},{1,2,0},{2,2,0},{2,1,0},{3,1,0},{3,0,0},{2,0,0},{2,-1,0}," EOL
" {3,-1,0},{3,-2,0},{4,-2,0},{4,-1,0},{5,-1,0},{5,0,0},{6,0,0},{6,-1,0},{7,-1,0}," EOL
" {7,0,0},{8,0,0},{8,1,0}" EOL
" };" EOL
" TColgp_Array1OfPnt aPoles (1, sizeof(aPolesCoords)/(sizeof(Standard_Real)*2));" EOL
" " EOL
" for (Standard_Integer i=1; i <= aPoles.Upper(); i++)" EOL
" aPoles(i) = gp_Pnt (aPolesCoords[i-1][0]*100, " EOL
" aPolesCoords[i-1][1]*100, " EOL
" aPolesCoords[i-1][2]*100);" EOL
" " EOL
" Handle(Geom_BezierCurve) aCurve = new Geom_BezierCurve (aPoles);" EOL
);
Standard_Real aPolesCoords[][3] = {
{0,0,0},{0,1,0},{1,1,0},{1,2,0},{2,2,0},{2,1,0},{3,1,0},{3,0,0},{2,0,0},{2,-1,0},
{3,-1,0},{3,-2,0},{4,-2,0},{4,-1,0},{5,-1,0},{5,0,0},{6,0,0},{6,-1,0},{7,-1,0},
{7,0,0},{8,0,0},{8,1,0}
};
TColgp_Array1OfPnt aPoles (1, sizeof(aPolesCoords)/(sizeof(Standard_Real)*3));
for (Standard_Integer i=1; i <= aPoles.Upper(); i++)
aPoles(i) = gp_Pnt (aPolesCoords[i-1][0]*150-500,
aPolesCoords[i-1][1]*150,
aPolesCoords[i-1][2]*150);
Handle(Geom_BezierCurve) aCurve = new Geom_BezierCurve (aPoles);
drawCurveAndItsBSpline (aCurve, "BezierCurve", aText);
}
//================================================================
// Function : Convert_Presentation::sampleBezierSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleBezierSurface()
{
getAISContext()->EraseAll();
Standard_CString aName = "BezierSurface";
// Create a BezierSurface
TColgp_Array2OfPnt aPoles(1,2,1,4); // 8 points
TColStd_Array2OfReal aWeights(1,2,1,4);
// initializing array of points
aPoles.SetValue(1,1,gp_Pnt(0,10,0)); aPoles.SetValue(1,2,gp_Pnt(3.3,6.6,3));
aPoles.SetValue(1,3,gp_Pnt(6.6,6.6,-3)); aPoles.SetValue(1,4,gp_Pnt(10,10,0));
aPoles.SetValue(2,1,gp_Pnt(0,0,0)); aPoles.SetValue(2,2,gp_Pnt(3.3,3.3,-3));
aPoles.SetValue(2,3,gp_Pnt(6.6,3.3,3)); aPoles.SetValue(2,4,gp_Pnt(10,0,0));
// scaling poles
for (Standard_Integer i=1; i <= aPoles.ColLength(); i++)
for (Standard_Integer j=1; j <= aPoles.RowLength(); j++)
aPoles(i,j).ChangeCoord() = aPoles(i,j).Coord() * 100 + gp_XYZ(-500,-500,0);
//initializing array of weights
aWeights.SetValue(1,1,1); aWeights.SetValue(1,2,3);
aWeights.SetValue(1,3,9); aWeights.SetValue(1,4,1);
aWeights.SetValue(2,1,1); aWeights.SetValue(2,2,2);
aWeights.SetValue(2,3,5); aWeights.SetValue(2,4,1);
Handle(Geom_BezierSurface) aSurface =
new Geom_BezierSurface(aPoles, aWeights);
TCollection_AsciiString aText (
" // Create a BezierSurface" EOL
" TColgp_Array2OfPnt aPoles(1,2,1,4); // 8 points" EOL
" TColStd_Array2OfReal aWeights(1,2,1,4);" EOL
" // initializing array of points" EOL
" aPoles.SetValue(1,1,gp_Pnt(0,10,0)); aPoles.SetValue(1,2,gp_Pnt(3.3,6.6,3));" EOL
" aPoles.SetValue(1,3,gp_Pnt(6.6,6.6,-3)); aPoles.SetValue(1,4,gp_Pnt(10,10,0));" EOL
" aPoles.SetValue(2,1,gp_Pnt(0,0,0)); aPoles.SetValue(2,2,gp_Pnt(3.3,3.3,-3));" EOL
" aPoles.SetValue(2,3,gp_Pnt(6.6,3.3,3)); aPoles.SetValue(2,4,gp_Pnt(10,0,0)); " EOL
" // scaling poles" EOL
" for (Standard_Integer i=1; i <= aPoles.ColLength(); i++)" EOL
" for (Standard_Integer j=1; j <= aPoles.RowLength(); j++)" EOL
" aPoles(i,j).ChangeCoord() = aPoles(i,j).Coord() * 100 + gp_XYZ(-500,-500,0);" EOL
" //initializing array of weights" EOL
" aWeights.SetValue(1,1,1); aWeights.SetValue(1,2,3);" EOL
" aWeights.SetValue(1,3,9); aWeights.SetValue(1,4,1);" EOL
" aWeights.SetValue(2,1,1); aWeights.SetValue(2,2,2);" EOL
" aWeights.SetValue(2,3,5); aWeights.SetValue(2,4,1);" EOL
" Handle(Geom_BezierSurface) aSurface =" EOL
" new Geom_BezierSurface(aPoles, aWeights);" EOL
);
drawSurfaceAndItsBSpline (aSurface, aName, aText);
}
//================================================================
// Function : OCCDemo_Presentation::sampleCylindricalSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleCylindricalSurface()
{
getAISContext()->EraseAll();
Standard_CString aName = "Cylindrical Surface";
TCollection_AsciiString aText (
" // creating an axis parallel to Y axis" EOL
" gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));" EOL EOL
" // creating a cylindrical surface along anAx with radius = 100" EOL
" Handle(Geom_CylindricalSurface) aCylSurface = new Geom_CylindricalSurface(anAx, 100);" EOL EOL
" // only finit surfaces can be converted to BSpline surfaces, " EOL
" // cylindrical surface is infinite, it must be trimmed" EOL
" Handle(Geom_RectangularTrimmedSurface) aSurface = " EOL
" new Geom_RectangularTrimmedSurface(aCylSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True);" EOL);
// creating an axis parallel to Y axis
gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));
// creating a cylindrical surface along anAx with radius = 4
Handle(Geom_CylindricalSurface) aCylSurface = new Geom_CylindricalSurface(anAx, 100);
// only finit surfaces can be converted to BSpline surfaces,
// cylindrical surface is infinite, it must be trimmed
Handle(Geom_RectangularTrimmedSurface) aSurface =
new Geom_RectangularTrimmedSurface(aCylSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True);
drawSurfaceAndItsBSpline(aSurface, aName, aText);
}
//================================================================
// Function : OCCDemo_Presentation::sampleRevolSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleRevolSurface()
{
FitMode=false;
ResetView();
SetViewCenter(176.84682,102.12892);
SetViewScale(0.69326);
getAISContext()->EraseAll();
Standard_CString aName = "Surface of revolution";
TCollection_AsciiString aText (
" // creating a curve for revolution. Let it be a Bezier curve." EOL
" Handle(Geom_BezierCurve) aBezierCurve;" EOL EOL
" // array of the bezier curve poles" EOL
" TColgp_Array1OfPnt aPoles(1,4);" EOL
" // array of the poles' weights" EOL
" TColStd_Array1OfReal aWeights(1,4);" EOL EOL
" aPoles(1) = gp_Pnt(0, 0, 0); aWeights(1) = 1;" EOL
" aPoles(2) = gp_Pnt(150, 250, 0); aWeights(2) =75;" EOL
" aPoles(3) = gp_Pnt(350, 150, 0); aWeights(3) =120;" EOL
" aPoles(4) = gp_Pnt(500, 500, 0); aWeights(4) = 1;" EOL EOL
" // creating a bezier curve" EOL
" aBezierCurve = new Geom_BezierCurve(aPoles, aWeights);" EOL EOL
" // creating a surface of revolution of the bezier curve around Y axis" EOL
" gp_Ax1 anAx(gp_Pnt(0, 0, 0), gp_Dir(0,1,0));" EOL
" Handle(Geom_SurfaceOfRevolution) aSurface = new Geom_SurfaceOfRevolution(aBezierCurve, anAx);" EOL
);
// array of the bezier curve poles
TColgp_Array1OfPnt aPoles(1,4);
// array of the poles' weights
TColStd_Array1OfReal aWeights(1,4);
aPoles(1) = gp_Pnt(0, 0, 0); aWeights(1) = 1;
aPoles(2) = gp_Pnt(150, 250, 0); aWeights(2) =75;
aPoles(3) = gp_Pnt(350, 150, 0); aWeights(3) =120;
aPoles(4) = gp_Pnt(500, 500, 0); aWeights(4) = 1;
Handle(Geom_BezierCurve) aBezierCurve = new Geom_BezierCurve(aPoles, aWeights);
drawCurve(aBezierCurve);
// creating a surface of revolution of the bezier curve around Y axis
gp_Ax1 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));
Handle(Geom_SurfaceOfRevolution) aSurface = new Geom_SurfaceOfRevolution(aBezierCurve, anAx);
drawSurfaceAndItsBSpline (aSurface, aName, aText);
FitMode=true;
}
//================================================================
// Function : Convert_Presentation::sampleToroidalSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleToroidalSurface()
{
getAISContext()->EraseAll();
Standard_CString aName = "Toroidal surface";
TCollection_AsciiString aText (
" // creating an axis parallel to Y axis" EOL
" gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));" EOL
" // creating a toroidal surface with major radius = 240 and minor radius = 120" EOL
" Handle(Geom_ToroidalSurface) aSurface = new Geom_ToroidalSurface(anAx, 240, 120);" EOL);
// creating an axis parallel to Y axis
gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,1,0));
// creating a toroidal surface with major radius = 240 and minor radius = 120
Handle(Geom_ToroidalSurface) aSurface = new Geom_ToroidalSurface(anAx, 240, 120);
drawSurfaceAndItsBSpline(aSurface, aName, aText);
}
//================================================================
// Function : Convert_Presentation::sampleConicalSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleConicalSurface()
{
getAISContext()->EraseAll();
Standard_CString aName = "Conical surface";
TCollection_AsciiString aText (
" // creating an axis parallel to Z axis" EOL
" gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,0,1)); " EOL
" // creating a conical surface with base radius = 10 and angle = 20 deg" EOL
" Handle(Geom_ConicalSurface) aConicalSurface = new Geom_ConicalSurface(anAx,PI/9., 10);" EOL EOL
" // only finit surfaces can be converted to BSpline surfaces, " EOL
" // conical surface is infinite, it must be trimmed" EOL
" Handle(Geom_RectangularTrimmedSurface) aSurface = " EOL
" new Geom_RectangularTrimmedSurface(aConicalSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True);" EOL);
// creating an axis parallel to Z axis
gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,0,1));
// creating a conical surface with base radius = 10 and angle = 20 deg
Handle(Geom_ConicalSurface) aConicalSurface = new Geom_ConicalSurface(anAx,PI/9., 10);
// only finit surfaces can be converted to BSpline surfaces,
// conical surface is infinite, it must be trimmed
Handle(Geom_RectangularTrimmedSurface) aSurface =
new Geom_RectangularTrimmedSurface(aConicalSurface, 0, 2*PI, -1000, 1000, Standard_True, Standard_True);
drawSurfaceAndItsBSpline(aSurface, aName, aText);
}
//================================================================
// Function : Convert_Presentation::sampleSphericalSurface
// Purpose :
//================================================================
void Convert_Presentation::sampleSphericalSurface()
{
getAISContext()->EraseAll();
Standard_CString aName = "Spherical surface";
TCollection_AsciiString aText (
"// creating an axis parallel to Z axis" EOL
"gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,0,1));" EOL
"// creating a spherical surface with radius = 300" EOL
"Handle(Geom_SphericalSurface) aSurface = new Geom_SphericalSurface(anAx,300);" EOL);
// creating an axis parallel to Z axis
gp_Ax3 anAx(gp_Pnt(0,0,0), gp_Dir(0,0,1));
// creating a spherical surface with radius = 300
Handle(Geom_SphericalSurface) aSurface = new Geom_SphericalSurface(anAx,300);
drawSurfaceAndItsBSpline(aSurface, aName, aText);
}

View File

@@ -0,0 +1,55 @@
// Convert_Presentation.h: interface for the Convert_Presentation class.
// Conversion of elementary geometry to BSpline curves and surfaces
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_Convert_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_Convert_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <OCCDemo_Presentation.h>
class Geom_Curve;
class Geom_Surface;
class Quantity_Color;
class Convert_Presentation : public OCCDemo_Presentation
{
public:
// Construction
Convert_Presentation();
public:
// Iteration on samples
virtual void DoSample();
// one phase of iterations
private:
// Sample functions
void sampleCircle();
void sampleEllipse();
void sampleBezier();
void sampleBezierSurface();
void sampleCylindricalSurface();
void sampleRevolSurface();
void sampleToroidalSurface();
void sampleConicalSurface();
void sampleSphericalSurface();
void drawCurveAndItsBSpline (Handle(Geom_Curve) theCurve,
const Standard_CString theName, TCollection_AsciiString& theText);
void drawSurfaceAndItsBSpline (Handle(Geom_Surface) theSurface,
const Standard_CString theName, TCollection_AsciiString& theText);
private:
// Array of pointers to sample functions
typedef void (Convert_Presentation::*PSampleFuncType)();
static const PSampleFuncType SampleFuncs[];
int myNbFuncs;
};
#endif // !defined(AFX_Convert_Presentation_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

View File

@@ -0,0 +1,428 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="DCA"
SccProjectName=""
SccLocalPath=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\../Release"
IntermediateDirectory=".\../Release/obj"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WNT"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Release/obj/DCA.pch"
AssemblerListingLocation=".\../Release/obj/"
ObjectFile=".\../Release/obj/"
ProgramDataBaseFileName=".\../Release/obj/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib TKBO.lib"
OutputFile=".\../Release/DCA.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\../Release/DCA.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Release/DCA.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\../Debug"
IntermediateDirectory=".\../Debug/objd"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../,../Common,../Common/WNT,../Common/ISession"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WNT"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="StdAfx.h"
PrecompiledHeaderFile=".\../Debug/objd/DCA.pch"
AssemblerListingLocation=".\../Debug/objd/"
ObjectFile=".\../Debug/objd/"
ProgramDataBaseFileName=".\../Debug/objd/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="TKBool.lib TKCAF.lib TKCDF.lib TKDraw.lib TKernel.lib TKFeat.lib TKFillet.lib TKGeomAlgo.lib TKHLR.lib TKMath.lib TKOffset.lib TKPCAF.lib TKPrim.lib TKPShape.lib TKService.lib TKTopAlgo.lib TKV2d.lib TKV3d.lib TKBRep.lib TKG2d.lib TKG3d.lib TKGeomBase.lib TKBO.lib"
OutputFile=".\../Debug/DCA.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\../Debug/DCA.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\../Debug/DCA.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="DCA_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="DCA_Presentation.h">
</File>
</Filter>
<Filter
Name="Common"
Filter="">
<File
RelativePath="..\env.bat">
</File>
<File
RelativePath="..\readme.txt">
</File>
<File
RelativePath="..\run.bat">
</File>
<File
RelativePath="..\vc.bat">
</File>
<Filter
Name="Source Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\MainFrm.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="\RLS\tmp\demo\Common\WNT"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\WNT\StdAfx.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files No. 1"
Filter="">
<File
RelativePath="..\Common\ISession\ISession_Curve.h">
</File>
<File
RelativePath="..\Common\WNT\MainFrm.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemo.h">
</File>
<File
RelativePath="..\Common\OCCDemo_Presentation.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoDoc.h">
</File>
<File
RelativePath="..\Common\WNT\OCCDemoView.h">
</File>
<File
RelativePath="..\Common\WNT\resource.h">
</File>
<File
RelativePath="..\Common\WNT\ResultDialog.h">
</File>
<File
RelativePath="..\Common\WNT\StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="">
<File
RelativePath="..\Common\WNT\res\OCCDemo.ico">
</File>
<File
RelativePath="..\Common\WNT\res\OCCDemo.rc2">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar.bmp">
</File>
<File
RelativePath="..\Common\WNT\res\toolbar1.bmp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
// DCA_Presentation.h: interface for the DCA_Presentation class.
// Geometry Direct Construction Algorithms
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DCA_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)
#define AFX_DCA_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <OCCDemo_Presentation.h>
class DCA_Presentation : public OCCDemo_Presentation
{
public:
// Construction
DCA_Presentation();
public:
// Iteration on samples
virtual void DoSample();
// one phase of iterations
private:
// Sample functions
void sampleLine();
void sampleParabola();
void sampleHyperbola();
void sampleCircle();
void sampleEllipse();
void samplePlane();
void sampleCylindricalSurface();
void sampleToroidalSurface();
void sampleConicalSurface();
void sampleSphericalSurface();
void Comment(const Standard_CString theTitle,TCollection_AsciiString& theText);
private:
// Array of pointers to sample functions
typedef void (DCA_Presentation::*PSampleFuncType)();
static const PSampleFuncType SampleFuncs[];
};
#endif // !defined(AFX_DCA_PRESENTATION_H__790EED7F_7BA2_11D5_BA4A_0060B0EE18EA__INCLUDED_)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,359 @@
DBRep_DrawableShape
CASCADE Topology V1, (c) Matra-Datavision
Locations 1
1
1 0 0 0
0 1 0 0
0 0 1 0
Curve2ds 24
1 0 0 1 0
1 0 0 1 0
1 300 0 0 -1
1 0 0 0 1
1 0 -400 1 0
1 0 0 1 0
1 0 0 0 -1
1 0 0 0 1
1 0 0 1 0
1 0 400 1 0
1 300 0 0 -1
1 400 0 0 1
1 0 -400 1 0
1 0 400 1 0
1 0 0 0 -1
1 400 0 0 1
1 0 0 0 1
1 0 0 1 0
1 300 0 0 1
1 0 0 1 0
1 0 0 0 1
1 0 400 1 0
1 300 0 0 1
1 0 400 1 0
Curves 12
1 0 0 0 0 0 1
1 0 0 300 -0 1 0
1 0 400 0 0 0 1
1 0 0 0 -0 1 0
1 400 0 0 0 0 1
1 400 0 300 0 1 0
1 400 400 0 0 0 1
1 400 0 0 -0 1 0
1 0 0 0 1 0 -0
1 0 0 300 1 0 -0
1 0 400 0 1 0 -0
1 0 400 300 1 0 -0
Polygon3D 0
PolygonOnTriangulations 24
2 1 2
p 1.6000000008 1 0 300
2 1 4
p 1.6000000008 1 0 300
2 2 3
p 1.6000000008 1 0 400
2 1 2
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 300
2 1 4
p 1.6000000008 1 0 300
2 1 4
p 1.6000000008 1 0 400
2 1 2
p 1.6000000008 1 0 400
2 1 2
p 1.6000000008 1 0 300
2 2 3
p 1.6000000008 1 0 300
2 2 3
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 300
2 2 3
p 1.6000000008 1 0 300
2 1 4
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 400
2 1 2
p 1.6000000008 1 0 400
2 1 4
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 400
2 1 4
p 1.6000000008 1 0 400
2 1 2
p 1.6000000008 1 0 400
2 2 3
p 1.6000000008 1 0 400
2 4 3
p 1.6000000008 1 0 400
2 2 3
p 1.6000000008 1 0 400
Surfaces 6
1 0 0 0 1 0 -0 0 0 1 0 -1 0
1 0 0 0 -0 1 0 0 0 1 1 0 -0
1 0 0 300 0 0 1 1 0 -0 -0 1 0
1 0 400 0 -0 1 0 0 0 1 1 0 -0
1 0 0 0 0 0 1 1 0 -0 -0 1 0
1 400 0 0 1 0 -0 0 0 1 0 -1 0
Triangulations 6
4 2 1 1.6000000008
0 0 0 0 0 300 0 400 300 0 400 0 0 0 300 0 300 -400 0 -400 1 4 3 3 2 1
4 2 1 1.6000000008
0 0 0 400 0 0 400 0 300 0 0 300 0 0 0 400 300 400 300 0 2 1 4 4 3 2
4 2 1 1.6000000008
0 0 300 0 400 300 400 400 300 400 0 300 0 0 0 400 400 400 400 0 2 1 4 4 3 2
4 2 1 1.6000000008
0 400 0 400 400 0 400 400 300 0 400 300 0 0 0 400 300 400 300 0 2 1 4 4 3 2
4 2 1 1.6000000008
0 0 0 0 400 0 400 400 0 400 0 0 0 0 0 400 400 400 400 0 2 1 4 4 3 2
4 2 1 1.6000000008
400 0 0 400 0 300 400 400 300 400 400 0 0 0 300 0 300 -400 0 -400 1 4 3 3 2 1
TShapes 31
Ve
1e-07
0 0 300
0 0
0101100
*
Ve
1e-07
0 0 0
0 0
0101100
*
Ed
1e-07 1 1 0
1 1 0 0 300
2 1 1 0 0 300
2 2 2 0 0 300
6 1 1 0
6 2 2 0
0
0101000
-31 0 +30 0 *
Ve
1e-07
0 400 300
0 0
0101100
*
Ed
1e-07 1 1 0
1 2 0 0 400
2 3 1 0 0 400
2 4 3 0 0 400
6 3 1 0
6 4 3 0
0
0101000
-28 0 +31 0 *
Ve
1e-07
0 400 0
0 0
0101100
*
Ed
1e-07 1 1 0
1 3 0 0 300
2 5 1 0 0 300
2 6 4 0 0 300
6 5 1 0
6 6 4 0
0
0101000
-28 0 +26 0 *
Ed
1e-07 1 1 0
1 4 0 0 400
2 7 1 0 0 400
2 8 5 0 0 400
6 7 1 0
6 8 5 0
0
0101000
-26 0 +30 0 *
Wi
0101000
-29 0 -27 0 +25 0 +24 0 *
Fa
0 1e-07 1 0
2 1
0111000
+23 0 *
Ve
1e-07
400 0 300
0 0
0101100
*
Ve
1e-07
400 0 0
0 0
0101100
*
Ed
1e-07 1 1 0
1 5 0 0 300
2 9 6 0 0 300
2 10 2 0 0 300
6 9 6 0
6 10 2 0
0
0101000
-21 0 +20 0 *
Ve
1e-07
400 400 300
0 0
0101100
*
Ed
1e-07 1 1 0
1 6 0 0 400
2 11 6 0 0 400
2 12 3 0 0 400
6 11 6 0
6 12 3 0
0
0101000
-18 0 +21 0 *
Ve
1e-07
400 400 0
0 0
0101100
*
Ed
1e-07 1 1 0
1 7 0 0 300
2 13 6 0 0 300
2 14 4 0 0 300
6 13 6 0
6 14 4 0
0
0101000
-18 0 +16 0 *
Ed
1e-07 1 1 0
1 8 0 0 400
2 15 6 0 0 400
2 16 5 0 0 400
6 15 6 0
6 16 5 0
0
0101000
-16 0 +20 0 *
Wi
0101000
-19 0 -17 0 +15 0 +14 0 *
Fa
0 1e-07 6 0
2 6
0111000
+13 0 *
Ed
1e-07 1 1 0
1 9 0 0 400
2 17 2 0 0 400
2 18 5 0 0 400
6 17 2 0
6 18 5 0
0
0101000
-20 0 +30 0 *
Ed
1e-07 1 1 0
1 10 0 0 400
2 19 2 0 0 400
2 20 3 0 0 400
6 19 2 0
6 20 3 0
0
0101000
-21 0 +31 0 *
Wi
0101000
-11 0 -19 0 +10 0 +29 0 *
Fa
0 1e-07 2 0
2 2
0111000
+9 0 *
Ed
1e-07 1 1 0
1 11 0 0 400
2 21 4 0 0 400
2 22 5 0 0 400
6 21 4 0
6 22 5 0
0
0101000
-16 0 +26 0 *
Ed
1e-07 1 1 0
1 12 0 0 400
2 23 4 0 0 400
2 24 3 0 0 400
6 23 4 0
6 24 3 0
0
0101000
-18 0 +28 0 *
Wi
0101000
-7 0 -15 0 +6 0 +25 0 *
Fa
0 1e-07 4 0
2 4
0111000
+5 0 *
Wi
0101000
-24 0 -7 0 +14 0 +11 0 *
Fa
0 1e-07 5 0
2 5
0111000
+3 0 *
Co
1100000
-22 1 +12 1 -8 1 +4 1 -2 1 *
+1 0
0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

BIN
samples/mfc/occtdemo/Data/aev.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
samples/mfc/occtdemo/Data/agn.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
samples/mfc/occtdemo/Data/asv.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
samples/mfc/occtdemo/Data/emo.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
samples/mfc/occtdemo/Data/mla.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
samples/mfc/occtdemo/Data/msv.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@@ -0,0 +1,84 @@
80
-8 8 -1
-8 4 -1
-8 1 -1
-7 -2 -1
-8 -4 0
-6 -6 0
-3 -7 -1
-1 -4 -1
1 -6 0
3 -7 0
6 -7 -1
7 -5 -1
6 -1 -1
8 1 0
7 4 0
7 8 0
5 7 -1
2 8 -1
-2 7 -1
-4 8 0
-2 6 0
-6 6 0
-7 4 -1
-5 2 -1
-4 1 -1
-6 -2 0
-6 -4 0
-5 -6 0
-2 -5 0
0 -7 0
3 -6 -1
5 -5 -1
6 -3 -1
4 -2 0
3 -1 0
3 0 0
4 2 -1
6 4 -1
4 6 -1
1 7 -1
-4 7 -1
-6 7 -1
-5 5 -1
-6 2 -1
-5 0 0
-4 -2 -1
-3 -4 -1
-1 -2 -1
0 0 0
2 -2 0
4 -4 -1
6 -5 -1
8 -3 -1
7 -1 -1
7 1 0
5 3 0
4 5 0
2 4 0
-1 3 -1
-2 5 -1
-3 5 0
-5 3 0
-3 2 1
-3 0 1
-5 -2 1
-7 -4 0
-7 -7 0
-5 -7 0
-4 -6 -1
2 -5 -1
5 -2 -1
5 0 -1
7 3 0
6 6 0
5 5 -1
3 7 -1
2 5 0
2 3 0
-1 2 0
-1 5 0

Some files were not shown because too many files have changed in this diff Show More