Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cbaea36b11 | ||
|
bf36a1fb0c | ||
|
15cb25b8f3 |
@@ -661,10 +661,8 @@ endif()
|
||||
if (CAN_USE_GLES2)
|
||||
if (USE_GLES2)
|
||||
add_definitions (-DHAVE_GLES2_EXT)
|
||||
if (NOT IOS)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
endif()
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/egl")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/gles2")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_EGL")
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GLES2")
|
||||
|
@@ -454,7 +454,6 @@ t TKRWMesh
|
||||
n RWGltf
|
||||
n RWMesh
|
||||
n RWObj
|
||||
n RWPly
|
||||
n DFBrowser
|
||||
n DFBrowserPane
|
||||
n DFBrowserPaneXDE
|
||||
|
@@ -20,13 +20,13 @@ export aRapidJson=
|
||||
export aDraco=
|
||||
|
||||
# build stages to perform
|
||||
export toSimulator=0
|
||||
export isStatic=1
|
||||
export toCMake=1
|
||||
export toClean=1
|
||||
export toMake=1
|
||||
export toInstall=1
|
||||
export toPack=0
|
||||
export toPackFat=0
|
||||
export toDebug=0
|
||||
|
||||
export BUILD_ModelingData=ON
|
||||
@@ -41,25 +41,13 @@ export USE_RAPIDJSON=OFF
|
||||
export USE_DRACO=OFF
|
||||
|
||||
export IPHONEOS_DEPLOYMENT_TARGET=8.0
|
||||
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
|
||||
export anAbiList="iPhoneOS|arm64"
|
||||
export anAbi=arm64
|
||||
#export anAbi=x86_64
|
||||
|
||||
if [[ -f "${aScriptDir}/ios_custom.sh" ]]; then
|
||||
source "${aScriptDir}/ios_custom.sh"
|
||||
fi
|
||||
|
||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
aGitBranch=`git symbolic-ref --short HEAD`
|
||||
|
||||
YEAR=$(date +"%Y")
|
||||
MONTH=$(date +"%m")
|
||||
DAY=$(date +"%d")
|
||||
aRevision=-${YEAR}-${MONTH}-${DAY}
|
||||
#aRevision=-${aGitBranch}
|
||||
|
||||
set -o pipefail
|
||||
|
||||
aBuildType="Release"
|
||||
aBuildTypePrefix=
|
||||
if [[ $toDebug == 1 ]]; then
|
||||
@@ -70,52 +58,59 @@ aLibType="Shared"
|
||||
if [[ $isStatic == 1 ]]; then
|
||||
aLibType="Static"
|
||||
fi
|
||||
aPlatformAndCompiler=ios-${anAbi}${aBuildTypePrefix}-clang
|
||||
aPlatformSdk="iphoneos"
|
||||
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
|
||||
if [[ $toSimulator == 1 ]]; then
|
||||
#anAbi=x86_64
|
||||
aPlatformAndCompiler=ios-simulator64-${anAbi}${aBuildTypePrefix}-clang
|
||||
aPlatformSdk="iphonesimulator"
|
||||
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
|
||||
fi
|
||||
|
||||
function buildArch {
|
||||
anAbi=$1
|
||||
aPlatformSdk=$2
|
||||
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
||||
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
||||
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
||||
|
||||
aPlatformAndCompiler=${aPlatformSdk}-${anAbi}${aBuildTypePrefix}-clang
|
||||
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
||||
rm -r -f "$aWorkDir"
|
||||
rm -r -f "$aDestDir"
|
||||
fi
|
||||
mkdir -p "$aWorkDir"
|
||||
mkdir -p "$aDestDir"
|
||||
rm -f "$aLogFile"
|
||||
|
||||
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
||||
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
||||
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
aGitBranch=`git symbolic-ref --short HEAD`
|
||||
|
||||
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
||||
rm -r -f "$aWorkDir"
|
||||
rm -r -f "$aDestDir"
|
||||
# include some information about OCCT into archive
|
||||
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
||||
git status >> "${aWorkDir}/VERSION.html"
|
||||
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
||||
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
||||
|
||||
pushd "$aWorkDir"
|
||||
|
||||
aTimeZERO=$SECONDS
|
||||
set -o pipefail
|
||||
|
||||
function logDuration {
|
||||
if [[ $1 == 1 ]]; then
|
||||
aDur=$(($4 - $3))
|
||||
echo $2 time: $aDur sec>> "$aLogFile"
|
||||
fi
|
||||
mkdir -p "$aWorkDir"
|
||||
mkdir -p "$aDestDir"
|
||||
rm -f "$aLogFile"
|
||||
}
|
||||
|
||||
# include some information about OCCT into archive
|
||||
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
||||
git status >> "${aWorkDir}/VERSION.html"
|
||||
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
||||
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
||||
|
||||
pushd "$aWorkDir"
|
||||
|
||||
aTimeZERO=$SECONDS
|
||||
|
||||
function logDuration {
|
||||
if [[ $1 == 1 ]]; then
|
||||
aDur=$(($4 - $3))
|
||||
echo $2 time: $aDur sec>> "$aLogFile"
|
||||
fi
|
||||
}
|
||||
|
||||
aSysRoot="/Applications/Xcode.app/Contents/Developer/Platforms/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk"
|
||||
|
||||
# (re)generate Make files
|
||||
if [[ $toCMake == 1 ]]; then
|
||||
echo Configuring OCCT for iOS...
|
||||
cmake -G "Unix Makefiles" \
|
||||
# (re)generate Make files
|
||||
if [[ $toCMake == 1 ]]; then
|
||||
echo Configuring OCCT for iOS...
|
||||
cmake -G "Unix Makefiles" \
|
||||
-D CMAKE_SYSTEM_NAME="iOS" \
|
||||
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
|
||||
-D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
|
||||
-D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
|
||||
-D ENABLE_VISIBILITY:BOOL="TRUE" \
|
||||
-D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
|
||||
-D CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
|
||||
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
|
||||
@@ -150,118 +145,57 @@ function buildArch {
|
||||
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
|
||||
-D BUILD_MODULE_Draw:BOOL="OFF" \
|
||||
-D BUILD_DOC_Overview:BOOL="OFF" \
|
||||
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeGEN=$SECONDS
|
||||
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
||||
|
||||
# clean up from previous build
|
||||
if [[ $toClean == 1 ]]; then
|
||||
make clean
|
||||
fi
|
||||
|
||||
# build the project
|
||||
if [[ $toMake == 1 ]]; then
|
||||
echo Building...
|
||||
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeBUILD=$SECONDS
|
||||
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
||||
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
||||
|
||||
# install the project
|
||||
if [[ $toInstall == 1 ]]; then
|
||||
echo Installing OCCT into $aDestDir...
|
||||
make install 2>&1 | tee -a "$aLogFile"
|
||||
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
||||
echo Platform: ${aPlatformSdk} ABI: ${anAbi} Build: ${aBuildType} IPHONEOS_DEPLOYMENT_TARGET: ${IPHONEOS_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
|
||||
fi
|
||||
aTimeINSTALL=$SECONDS
|
||||
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
||||
|
||||
# create an archive
|
||||
if [[ $toPack == 1 ]]; then
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||
rm ${aDestDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aDestDir"
|
||||
tar -jcf ${aDestDir}/../${anArchName} *
|
||||
popd
|
||||
fi
|
||||
aTimePACK=$SECONDS
|
||||
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
||||
|
||||
# finished
|
||||
DURATION=$(($aTimePACK - $aTimeZERO))
|
||||
echo Total time: $DURATION sec
|
||||
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
for anArchIter in $anAbiList
|
||||
do
|
||||
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
|
||||
echo Platform: ${aPlatform} ABI: ${anArch} Build: ${aBuildType}
|
||||
buildArch $anArch $aPlatform
|
||||
done
|
||||
|
||||
# create a FAT archive
|
||||
if [[ $toPackFat == 1 ]]; then
|
||||
for aPlatIter in iPhoneOS iPhoneSimulator
|
||||
do
|
||||
aSuffixFat=${aPlatIter}${aBuildTypePrefix}-clang
|
||||
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
|
||||
|
||||
# merge per-arch builds into fat builds
|
||||
hasPlatform=0
|
||||
for anArchIter in $anAbiList
|
||||
do
|
||||
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
|
||||
if [[ $aPlatIter != ${aPlatform} ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
aSuffixThin=${aPlatform}-${anArch}${aBuildTypePrefix}-clang
|
||||
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
|
||||
if [[ $hasPlatform == 0 ]]; then
|
||||
hasPlatform=1
|
||||
echo Packing FAT archive for platform: ${aPlatform}
|
||||
rm -r -f "$aFatDir"
|
||||
mkdir -p "$aFatDir"
|
||||
rsync -r --exclude '*.a' "$anArchDir/" "$aFatDir"
|
||||
rm -f "$aFatDir/build_target.txt"
|
||||
for aLibIter in $anArchDir/lib/*.a; do
|
||||
aLibName=`basename $aLibIter`
|
||||
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||
done
|
||||
else
|
||||
for aLibIter in $aFatDir/lib/*.a; do
|
||||
aLibName=`basename $aLibIter`
|
||||
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||
#lipo -info "$aFatDir/lib/$aLibName"
|
||||
done
|
||||
fi
|
||||
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
|
||||
done
|
||||
|
||||
# create an archive
|
||||
for anArchIter in $anAbiList
|
||||
do
|
||||
IFS="|" read -r aPlatform anArch <<< "$anArchIter"
|
||||
if [[ $aPlatIter != ${aPlatform} ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
|
||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||
rm ${aFatDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aFatDir"
|
||||
tar -jcf ${aFatDir}/../${anArchName} *
|
||||
popd
|
||||
break
|
||||
done
|
||||
done
|
||||
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeGEN=$SECONDS
|
||||
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
||||
|
||||
# clean up from previous build
|
||||
if [[ $toClean == 1 ]]; then
|
||||
make clean
|
||||
fi
|
||||
|
||||
# build the project
|
||||
if [[ $toMake == 1 ]]; then
|
||||
echo Building...
|
||||
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeBUILD=$SECONDS
|
||||
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
||||
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
||||
|
||||
# install the project
|
||||
if [[ $toInstall == 1 ]]; then
|
||||
echo Installing OCCT into $aDestDir...
|
||||
make install 2>&1 | tee -a "$aLogFile"
|
||||
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
||||
fi
|
||||
aTimeINSTALL=$SECONDS
|
||||
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
||||
|
||||
# create an archive
|
||||
if [[ $toPack == 1 ]]; then
|
||||
YEAR=$(date +"%Y")
|
||||
MONTH=$(date +"%m")
|
||||
DAY=$(date +"%d")
|
||||
aRevision=-${YEAR}-${MONTH}-${DAY}
|
||||
#aRevision=-${aGitBranch}
|
||||
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||
rm ${aDestDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aDestDir"
|
||||
tar -jcf ${aDestDir}/../${anArchName} *
|
||||
popd
|
||||
fi
|
||||
aTimePACK=$SECONDS
|
||||
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
||||
|
||||
# finished
|
||||
DURATION=$(($aTimePACK - $aTimeZERO))
|
||||
echo Total time: $DURATION sec
|
||||
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
||||
|
||||
popd
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# environment configuration template for ios_build.sh (to be renamed as ios_custom_env.sh)
|
||||
# environment configuration template for macos_build.sh (to be renamed as macos_custom_env.sh)
|
||||
export PATH=/Applications/CMake.app/Contents/bin:$PATH
|
||||
export aFreeType="$aSrcRoot/../3rdparty/freetype-2.10.4-ios"
|
||||
export aFreeImage="$aSrcRoot/../3rdparty/freeimage-3.18-ios"
|
||||
@@ -6,13 +6,13 @@ export aRapidJson="$aSrcRoot/../3rdparty/rapidjson-1.1.0"
|
||||
export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
|
||||
|
||||
# Uncomment to customize building steps
|
||||
#export toSimulator=0
|
||||
#export isStatic=0
|
||||
#export toCMake=1
|
||||
#export toClean=1
|
||||
#export toMake=1
|
||||
#export toInstall=1
|
||||
#export toPack=0
|
||||
#export toPackFat=1
|
||||
#export toDebug=0
|
||||
|
||||
#export BUILD_ModelingData=ON
|
||||
@@ -26,5 +26,5 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-ios"
|
||||
#export USE_FREEIMAGE=ON
|
||||
|
||||
#export IPHONEOS_DEPLOYMENT_TARGET=8.0
|
||||
#export anAbiList="iPhoneOS|arm64 iPhoneSimulator|arm64 iPhoneSimulator|x86_64"
|
||||
#export anAbiList="iPhoneOS|arm64"
|
||||
#export anAbi=arm64
|
||||
#export anAbi=x86_64
|
||||
|
@@ -20,13 +20,11 @@ export aRapidJson=
|
||||
export aDraco=
|
||||
|
||||
# build stages to perform
|
||||
export isStatic=0
|
||||
export toCMake=1
|
||||
export toClean=1
|
||||
export toMake=1
|
||||
export toInstall=1
|
||||
export toPack=0
|
||||
export toPackFat=0
|
||||
export toDebug=0
|
||||
|
||||
export BUILD_ModelingData=ON
|
||||
@@ -36,92 +34,72 @@ export BUILD_ApplicationFramework=ON
|
||||
export BUILD_DataExchange=ON
|
||||
export BUILD_Draw=ON
|
||||
|
||||
export USE_FREETYPE=ON
|
||||
export USE_FREEIMAGE=ON
|
||||
export USE_RAPIDJSON=OFF
|
||||
export USE_DRACO=OFF
|
||||
|
||||
export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||
#export anAbiList="arm64 x86_64"
|
||||
export anAbiList="x86_64"
|
||||
aPlatform="macos"
|
||||
#export anAbi=arm64
|
||||
export anAbi=x86_64
|
||||
|
||||
if [[ -f "${aScriptDir}/macos_custom.sh" ]]; then
|
||||
source "${aScriptDir}/macos_custom.sh"
|
||||
fi
|
||||
|
||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
aGitBranch=`git symbolic-ref --short HEAD`
|
||||
|
||||
YEAR=$(date +"%Y")
|
||||
MONTH=$(date +"%m")
|
||||
DAY=$(date +"%d")
|
||||
aRevision=-${YEAR}-${MONTH}-${DAY}
|
||||
#aRevision=-${aGitBranch}
|
||||
|
||||
set -o pipefail
|
||||
|
||||
aBuildType="Release"
|
||||
aBuildTypePrefix=
|
||||
if [[ $toDebug == 1 ]]; then
|
||||
aBuildType="Debug"
|
||||
aBuildTypePrefix="-debug"
|
||||
fi
|
||||
aLibType="Shared"
|
||||
aLibExt="dylib"
|
||||
if [[ $isStatic == 1 ]]; then
|
||||
aLibType="Static"
|
||||
aLibExt="a"
|
||||
aPlatformAndCompiler=mac-${anAbi}${aBuildTypePrefix}-clang
|
||||
|
||||
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
||||
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
||||
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
||||
|
||||
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
||||
rm -r -f "$aWorkDir"
|
||||
rm -r -f "$aDestDir"
|
||||
fi
|
||||
mkdir -p "$aWorkDir"
|
||||
mkdir -p "$aDestDir"
|
||||
rm -f "$aLogFile"
|
||||
|
||||
function buildArch {
|
||||
anAbi=$1
|
||||
anOcctVerSuffix=`grep -e "#define OCC_VERSION_DEVELOPMENT" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
anOcctVersion=`grep -e "#define OCC_VERSION_COMPLETE" "$aCasSrc/src/Standard/Standard_Version.hxx" | awk '{print $3}' | xargs`
|
||||
aGitBranch=`git symbolic-ref --short HEAD`
|
||||
|
||||
aPlatformAndCompiler=${aPlatform}-${anAbi}${aBuildTypePrefix}-clang
|
||||
# include some information about OCCT into archive
|
||||
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
||||
git status >> "${aWorkDir}/VERSION.html"
|
||||
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
||||
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
||||
|
||||
aWorkDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}-make"
|
||||
aDestDir="${aCasSrc}/${aBuildRoot}/${aPlatformAndCompiler}"
|
||||
aLogFile="${aCasSrc}/${aBuildRoot}/build-${aPlatformAndCompiler}.log"
|
||||
pushd "$aWorkDir"
|
||||
|
||||
if [[ $toCMake == 1 ]] && [[ $toClean == 1 ]]; then
|
||||
rm -r -f "$aWorkDir"
|
||||
rm -r -f "$aDestDir"
|
||||
aTimeZERO=$SECONDS
|
||||
set -o pipefail
|
||||
|
||||
function logDuration {
|
||||
if [[ $1 == 1 ]]; then
|
||||
aDur=$(($4 - $3))
|
||||
echo $2 time: $aDur sec>> "$aLogFile"
|
||||
fi
|
||||
mkdir -p "$aWorkDir"
|
||||
mkdir -p "$aDestDir"
|
||||
rm -f "$aLogFile"
|
||||
}
|
||||
|
||||
# include some information about OCCT into archive
|
||||
echo \<pre\>> "${aWorkDir}/VERSION.html"
|
||||
git status >> "${aWorkDir}/VERSION.html"
|
||||
git log -n 100 >> "${aWorkDir}/VERSION.html"
|
||||
echo \</pre\>>> "${aWorkDir}/VERSION.html"
|
||||
|
||||
pushd "$aWorkDir"
|
||||
|
||||
aTimeZERO=$SECONDS
|
||||
|
||||
function logDuration {
|
||||
if [[ $1 == 1 ]]; then
|
||||
aDur=$(($4 - $3))
|
||||
echo $2 time: $aDur sec>> "$aLogFile"
|
||||
fi
|
||||
}
|
||||
|
||||
# (re)generate Make files
|
||||
if [[ $toCMake == 1 ]]; then
|
||||
echo Configuring OCCT for macOS...
|
||||
cmake -G "Unix Makefiles" \
|
||||
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
|
||||
# (re)generate Make files
|
||||
if [[ $toCMake == 1 ]]; then
|
||||
echo Configuring OCCT for macOS...
|
||||
cmake -G "Unix Makefiles" \
|
||||
-D CMAKE_BUILD_TYPE:STRING="$aBuildType" \
|
||||
-D BUILD_LIBRARY_TYPE:STRING="$aLibType" \
|
||||
-D BUILD_LIBRARY_TYPE:STRING="Shared" \
|
||||
-D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
|
||||
-D INSTALL_DIR:PATH="$aDestDir" \
|
||||
-D INSTALL_DIR_INCLUDE:STRING="inc" \
|
||||
-D INSTALL_DIR_LIB:STRING="lib" \
|
||||
-D INSTALL_DIR_RESOURCE:STRING="src" \
|
||||
-D INSTALL_NAME_DIR:STRING="@executable_path/../Frameworks" \
|
||||
-D USE_FREETYPE:BOOL="$USE_FREETYPE" \
|
||||
-D 3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
|
||||
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
|
||||
-D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
|
||||
@@ -147,122 +125,57 @@ function buildArch {
|
||||
-D BUILD_MODULE_DataExchange:BOOL="${BUILD_DataExchange}" \
|
||||
-D BUILD_MODULE_Draw:BOOL="${BUILD_Draw}" \
|
||||
-D BUILD_DOC_Overview:BOOL="OFF" \
|
||||
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeGEN=$SECONDS
|
||||
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
||||
"$aCasSrc" 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeGEN=$SECONDS
|
||||
logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
|
||||
|
||||
# clean up from previous build
|
||||
if [[ $toClean == 1 ]]; then
|
||||
make clean
|
||||
fi
|
||||
# clean up from previous build
|
||||
if [[ $toClean == 1 ]]; then
|
||||
make clean
|
||||
fi
|
||||
|
||||
# build the project
|
||||
if [[ $toMake == 1 ]]; then
|
||||
echo Building OCCT...
|
||||
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeBUILD=$SECONDS
|
||||
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
||||
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
||||
# build the project
|
||||
if [[ $toMake == 1 ]]; then
|
||||
echo Building OCCT...
|
||||
make -j $aNbJobs 2>&1 | tee -a "$aLogFile"
|
||||
aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
|
||||
fi
|
||||
aTimeBUILD=$SECONDS
|
||||
logDuration $toMake "Building" $aTimeGEN $aTimeBUILD
|
||||
logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
|
||||
|
||||
# install the project
|
||||
if [[ $toInstall == 1 ]]; then
|
||||
echo Installing OCCT into $aDestDir...
|
||||
make install 2>&1 | tee -a "$aLogFile"
|
||||
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
||||
echo Platform: macOS ABI: ${anAbi} Build: ${aBuildType} MACOSX_DEPLOYMENT_TARGET: ${MACOSX_DEPLOYMENT_TARGET} > "$aDestDir/build_target.txt"
|
||||
fi
|
||||
aTimeINSTALL=$SECONDS
|
||||
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
||||
# install the project
|
||||
if [[ $toInstall == 1 ]]; then
|
||||
echo Installing OCCT into $aDestDir...
|
||||
make install 2>&1 | tee -a "$aLogFile"
|
||||
cp -f "$aWorkDir/VERSION.html" "$aDestDir/VERSION.html"
|
||||
fi
|
||||
aTimeINSTALL=$SECONDS
|
||||
logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
|
||||
|
||||
# create an archive
|
||||
if [[ $toPack == 1 ]]; then
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||
rm ${aDestDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aDestDir"
|
||||
tar -jcf ${aDestDir}/../${anArchName} *
|
||||
popd
|
||||
fi
|
||||
aTimePACK=$SECONDS
|
||||
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
||||
# create an archive
|
||||
if [[ $toPack == 1 ]]; then
|
||||
YEAR=$(date +"%Y")
|
||||
MONTH=$(date +"%m")
|
||||
DAY=$(date +"%d")
|
||||
aRevision=-${YEAR}-${MONTH}-${DAY}
|
||||
#aRevision=-${aGitBranch}
|
||||
|
||||
# finished
|
||||
DURATION=$(($aTimePACK - $aTimeZERO))
|
||||
echo Total time: $DURATION sec
|
||||
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
for anArchIter in $anAbiList
|
||||
do
|
||||
echo Platform: macOS ABI: ${anArchIter} Build: ${aBuildType}
|
||||
buildArch $anArchIter
|
||||
done
|
||||
|
||||
# create a FAT archive
|
||||
if [[ $toPackFat == 1 ]]; then
|
||||
aSuffixFat=${aPlatform}${aBuildTypePrefix}-clang
|
||||
aFatDir="${aCasSrc}/${aBuildRoot}/${aSuffixFat}"
|
||||
|
||||
# merge per-arch builds into fat builds
|
||||
hasPlatform=0
|
||||
for anArchIter in $anAbiList
|
||||
do
|
||||
aSuffixThin=${aPlatform}-${anArchIter}${aBuildTypePrefix}-clang
|
||||
anArchDir="${aCasSrc}/${aBuildRoot}/${aSuffixThin}"
|
||||
if [[ $hasPlatform == 0 ]]; then
|
||||
hasPlatform=1
|
||||
echo Packing FAT archive
|
||||
rm -r -f "$aFatDir"
|
||||
mkdir -p "$aFatDir"
|
||||
if [[ $isStatic == 1 ]]; then
|
||||
rsync -r -l --exclude '*.a' "$anArchDir/" "$aFatDir"
|
||||
else
|
||||
rsync -r -l --exclude '*.dylib' "$anArchDir/" "$aFatDir"
|
||||
fi
|
||||
rm -f "$aFatDir/build_target.txt"
|
||||
|
||||
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
|
||||
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
|
||||
rm $aFatDir/bin/$aDrawExe
|
||||
lipo "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
|
||||
fi
|
||||
|
||||
for aLibIter in $anArchDir/lib/*.$aLibExt; do
|
||||
aLibName=`basename $aLibIter`
|
||||
if [[ -L "$anArchDir/lib/$aLibName" ]]; then
|
||||
cp -a "$anArchDir/lib/$aLibName" "$aFatDir/lib/"
|
||||
else
|
||||
lipo "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [[ -L "$anArchDir/bin/DRAWEXE" ]]; then
|
||||
aDrawExe=$(readlink "$anArchDir/bin/DRAWEXE")
|
||||
lipo "$aFatDir/bin/$aDrawExe" "$anArchDir/bin/$aDrawExe" -output "$aFatDir/bin/$aDrawExe" -create
|
||||
fi
|
||||
|
||||
for aLibIter in $aFatDir/lib/*.$aLibExt; do
|
||||
aLibName=`basename $aLibIter`
|
||||
if [[ ! -L "$anArchDir/lib/$aLibName" ]]; then
|
||||
lipo "$aFatDir/lib/$aLibName" "$anArchDir/lib/$aLibName" -output "$aFatDir/lib/$aLibName" -create
|
||||
#lipo -info "$aFatDir/lib/$aLibName"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
cat "$anArchDir/build_target.txt" >> "$aFatDir/build_target.txt"
|
||||
done
|
||||
|
||||
# create an archive
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aSuffixFat}.tar.bz2
|
||||
anArchName=occt-${anOcctVersion}${anOcctVerSuffix}${aRevision}-${aPlatformAndCompiler}.tar.bz2
|
||||
echo Creating an archive ${aCasSrc}/${aBuildRoot}/${anArchName}...
|
||||
rm ${aFatDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aFatDir"
|
||||
tar -jcf ${aFatDir}/../${anArchName} *
|
||||
rm ${aDestDir}/../${anArchName} &>/dev/null
|
||||
pushd "$aDestDir"
|
||||
tar -jcf ${aDestDir}/../${anArchName} *
|
||||
popd
|
||||
fi
|
||||
aTimePACK=$SECONDS
|
||||
logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
|
||||
|
||||
# finished
|
||||
DURATION=$(($aTimePACK - $aTimeZERO))
|
||||
echo Total time: $DURATION sec
|
||||
logDuration 1 "Total" $aTimeZERO $aTimePACK
|
||||
|
||||
popd
|
||||
|
@@ -12,7 +12,6 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
|
||||
#export toMake=1
|
||||
#export toInstall=1
|
||||
#export toPack=1
|
||||
#export toPackFat=1
|
||||
|
||||
#export BUILD_ModelingData=ON
|
||||
#export BUILD_ModelingAlgorithms=ON
|
||||
@@ -26,6 +25,5 @@ export aDraco="$aSrcRoot/../3rdparty/draco-1.4.1-macos"
|
||||
#export USE_FREEIMAGE=ON
|
||||
|
||||
#export MACOSX_DEPLOYMENT_TARGET=10.10
|
||||
#export anAbiList=arm64
|
||||
#export anAbiList=x86_64
|
||||
#export anAbiList="arm64 x86_64"
|
||||
#export anAbi=arm64
|
||||
#export anAbi=x86_64
|
||||
|
@@ -22,7 +22,6 @@ samples/samples.md
|
||||
samples/ocaf.md
|
||||
samples/ocaf_func.md
|
||||
samples/draw_scripts.md
|
||||
samples/ais_object.md
|
||||
|
||||
samples/novice_guide.md
|
||||
tutorial/tutorial.md
|
||||
|
651
dox/build/build_3rdparty/building_3rdparty.md
vendored
@@ -2,48 +2,60 @@
|
||||
==============================================
|
||||
@tableofcontents
|
||||
|
||||
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://dev.opencascade.org/resources/download/3rd-party-components.
|
||||
On Linux and macOS, it is recommended to use the version installed in the system natively.
|
||||
On Windows, the easiest way to install third-party libraries is to download archive with pre-built binaries from https://opencascade.com/content/3rd-party-components.
|
||||
On Linux and OS X, it is recommended to use the version installed in the system natively.
|
||||
|
||||
@section dev_guides__building_3rdparty_win_1 Windows
|
||||
|
||||
This section presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform.
|
||||
It is assumed that you are already familiar with MS Visual Studio / Visual C++.
|
||||
This document presents guidelines for building third-party products used by Open CASCADE Technology (OCCT) and samples on Windows platform. It is assumed that you are already familiar with MS Visual Studio / Visual C++.
|
||||
|
||||
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of runtime binaries.
|
||||
You need to use the same version of MS Visual Studio for building all third-party products and OCCT itself, in order to receive a consistent set of run-time binaries.
|
||||
|
||||
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, `c:/occ3rdparty`).
|
||||
Further in this document, this folder is referred to as `3rdparty`.
|
||||
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
|
||||
|
||||
There are two types of third-party products used by OCCT:
|
||||
|
||||
* Mandatory products:
|
||||
* Tcl/Tk 8.5 -- 8.6;
|
||||
* FreeType 2.4.10 -- 2.5.3.
|
||||
* Optional products:
|
||||
* TBB 3.x -- 4.x;
|
||||
* FreeImage 3.14.1 -- 3.16.0;
|
||||
* VTK 6.1.0.
|
||||
|
||||
It is recommended to create a separate new folder on your workstation, where you will unpack the downloaded archives of the third-party products, and where you will build these products (for example, *c:\\occ3rdparty*).
|
||||
|
||||
Further in this document, this folder is referred to as *3rdparty*.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_2 Tcl/Tk
|
||||
|
||||
Tcl/Tk is required for DRAW test harness.
|
||||
|
||||
**Installation from sources: Tcl**
|
||||
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. In the `win` sub-directory, edit file `buildall.vc.bat`:
|
||||
1. In the *win* sub-directory, edit file *buildall.vc.bat*:
|
||||
|
||||
* Edit the line `"call ... vcvars32.bat"` to have correct path to the version of Visual Studio to be used for building, for instance:
|
||||
* Edit the line "call ... vcvars32.bat" to have correct path to the version of Visual Studio to be used for building, for instance:
|
||||
|
||||
call "%VS80COMNTOOLS%\vsvars32.bat"
|
||||
|
||||
If you are building 64-bit version, set environment accordingly, e.g.:
|
||||
|
||||
call "%VS80COMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
|
||||
|
||||
* Define variable `INSTALLDIR` pointing to directory where Tcl/Tk will be installed, e.g.:
|
||||
|
||||
* Define variable *INSTALLDIR* pointing to directory where Tcl/Tk will be installed, e.g.:
|
||||
|
||||
set INSTALLDIR=D:\OCCT\3rdparty\tcltk-86-32
|
||||
|
||||
* Add option `install` to the first command line calling `nmake`:
|
||||
* Add option *install* to the first command line calling *nmake*:
|
||||
|
||||
nmake -nologo -f makefile.vc release htmlhelp install %1
|
||||
|
||||
* Remove second call to `nmake` (building statically linked executable)
|
||||
* Remove second call to *nmake* (building statically linked executable)
|
||||
|
||||
2. Edit file `rules.vc` replacing line
|
||||
2. Edit file *rules.vc* replacing line
|
||||
|
||||
SUFX = tsgx
|
||||
|
||||
@@ -53,18 +65,21 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
|
||||
|
||||
This is to avoid extra prefix 't' in the library name, which is not recognized by default by OCCT build tools.
|
||||
|
||||
|
||||
3. By default, Tcl uses dynamic version of run-time library (MSVCRT), which must be installed on the system where Tcl will be used.
|
||||
You may wish to link Tcl library with static version of run-time to avoid this dependency.
|
||||
For that:
|
||||
|
||||
* Edit file `makefile.vc` replacing strings `"crt = -MD"` by `"crt = -MT"`
|
||||
* Edit file *makefile.vc* replacing strings "crt = -MD" by "crt = -MT"
|
||||
|
||||
* Edit source file `tclMain.c` (located in folder `generic`) commenting out forward declaration of function `isatty()`.
|
||||
* Edit source file *tclMain.c* (located in folder *generic*) commenting out forward declaration of function *isatty()*.
|
||||
|
||||
4. In the command prompt, run `buildall.vc.bat`<br>
|
||||
You might need to run this script twice to have `tclsh` executable installed; check subfolder `bin` of specified installation path to verify this.
|
||||
|
||||
5. For convenience of use, we recommend making a copy of `tclsh` executable created in subfolder `bin` of `INSTALLDIR` and named with Tcl version number suffix, as `tclsh.exe` (with no suffix)
|
||||
4. In the command prompt, run *buildall.vc.bat*
|
||||
|
||||
You might need to run this script twice to have *tclsh* executable installed; check subfolder *bin* of specified installation path to verify this.
|
||||
|
||||
5. For convenience of use, we recommend making a copy of *tclsh* executable created in subfolder *bin* of *INSTALLDIR* and named with Tcl version number suffix, as *tclsh.exe* (with no suffix)
|
||||
|
||||
> cd D:\OCCT\3rdparty\tcltk-86-32\bin
|
||||
> cp tclsh86.exe tclsh.exe
|
||||
@@ -72,153 +87,190 @@ Download the necessary archive from https://www.tcl.tk/software/tcltk/download.h
|
||||
**Installation from sources: Tk**
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
Apply the same steps as described for building Tcl above, with the same `INSTALLDIR`.
|
||||
Note that Tk produces its own executable, called `wish`.
|
||||
|
||||
You might need to edit default value of `TCLDIR` variable defined in `buildall.vc.bat` (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
|
||||
Apply the same steps as described for building Tcl above, with the same INSTALLDIR.
|
||||
Note that Tk produces its own executable, called *wish*.
|
||||
|
||||
You might need to edit default value of *TCLDIR* variable defined in *buildall.vc.bat* (should be not necessary if you unpack both Tcl and Tk sources in the same folder).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_2_2 FreeType
|
||||
|
||||
FreeType is required for text display in a 3D viewer.
|
||||
You can download its sources from https://freetype.org/
|
||||
FreeType is required for text display in a 3D viewer. You can download its sources from https://sourceforge.net/projects/freetype/files/
|
||||
|
||||
1. Unpack the downloaded archive of FreeType product into the `3rdparty` folder.
|
||||
As a result, you will get a folder named, for example, `3rdparty/freetype-2.4.10`.
|
||||
Further in this document, this folder is referred to as `freetype`.
|
||||
### The building procedure
|
||||
|
||||
2. Open the solution file `freetype/builds/win32/vc20xx/freetype.sln` in Visual Studio.
|
||||
Here `vc20xx` stands for your version of Visual Studio.
|
||||
1. Unpack the downloaded archive of FreeType product into the *3rdparty* folder. As a result, you will get a folder named, for example, *3rdparty\\freetype-2.4.10*. Further in this document, this folder is referred to as *freetype*.
|
||||
|
||||
2. Open the solution file *freetype\\builds\\win32\\vc20xx\\freetype.sln* in Visual Studio. Here *vc20xx* stands for your version of Visual Studio.
|
||||
|
||||
3. Select the configuration to build: either `Debug` or `Release`.
|
||||
3. Select the configuration to build: either Debug or Release.
|
||||
|
||||
4. Build the `freetype` project.<br>
|
||||
As a result, you will get a `freetype` import library (`.lib`) in the `freetype/obj/win32/vc20xx` folder.
|
||||
4. Build the *freetype* project.
|
||||
|
||||
5. If you build FreeType for a 64 bit platform, select in the main menu `Build - Configuration Manager`
|
||||
and add `x64` platform to the solution configuration by copying the settings from `Win32` platform:
|
||||
As a result, you will get a freetype import library (.lib) in the *freetype\\obj\\win32\\vc20xx* folder.
|
||||
|
||||
|
||||
5. If you build FreeType for a 64 bit platform, select in the main menu **Build - Configuration Manager** and add *x64* platform to the solution configuration by copying the settings from Win32 platform:
|
||||
|
||||
@figure{/build/build_3rdparty/images/3rdparty_image001.png}
|
||||
|
||||
Update the value of the Output File for `x64` configuration:
|
||||
Update the value of the Output File for x64 configuration:
|
||||
|
||||
@figure{/build/build_3rdparty/images/3rdparty_image003.png}
|
||||
|
||||
Build the `freetype` project.<br>
|
||||
As a result, you will obtain a 64 bit import library (`.lib`) file in the `freetype/x64/vc20xx` folder.
|
||||
To build FreeType as a dynamic library (`.dll`) follow steps 6, 7 and 8 of this procedure.
|
||||
Build the *freetype* project.
|
||||
|
||||
6. Open menu Project-> Properties-> Configuration Properties-> General and change option `Configuration Type` to `Dynamic Library (.dll)`.
|
||||
7. Edit file `freetype/include/freetype/config/ftoption.h`:<br>
|
||||
in line 255, uncomment the definition of macro `FT_EXPORT` and change it as follows:
|
||||
As a result, you will obtain a 64 bit import library (.lib) file in the *freetype\\x64\\vc20xx* folder.
|
||||
|
||||
#define FT_EXPORT(x) __declspec(dllexport) x
|
||||
To build FreeType as a dynamic library (.dll) follow steps 6, 7 and 8 of this procedure.
|
||||
|
||||
8. Build the `freetype` project.<br>
|
||||
As a result, you will obtain the files of the import library (`.lib`) and the dynamic library (`.dll`) in folders `freetype/objs/release` or `freetype/objs/debug`.
|
||||
If you build for a 64 bit platform, follow step 5 of the procedure.
|
||||
6. Open menu Project-> Properties-> Configuration Properties-> General and change option **Configuration Type** to *Dynamic Library (.dll)*.
|
||||
7. Edit file *freetype\\include\\freetype\\config\\ftoption.h*:
|
||||
|
||||
in line 255, uncomment the definition of macro *FT_EXPORT* and change it as follows:
|
||||
|
||||
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures,
|
||||
it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern `freetype-compiler-bitness-building mode`, where:
|
||||
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
|
||||
* `bitness` is `32` or `64`;
|
||||
* `building mode` is `opt` (for `Release`) or `deb` (for `Debug`).
|
||||
#define FT_EXPORT(x) __declspec(dllexport) x
|
||||
|
||||
8. Build the *freetype* project.
|
||||
|
||||
As a result, you will obtain the files of the import library (.lib) and the dynamic library (.dll) in folders <i>freetype \\objs\\release</i> or <i>\\objs\\debug </i>.
|
||||
|
||||
If you build for a 64 bit platform, follow step 5 of the procedure.
|
||||
|
||||
To facilitate the use of FreeType libraries in OCCT with minimal adjustment of build procedures, it is recommended to copy the include files and libraries of FreeType into a separate folder, named according to the pattern: *freetype-compiler-bitness-building mode*, where:
|
||||
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
|
||||
* **bitness** is *32* or *64*;
|
||||
* **building mode** is *opt* (for Release) or *deb* (for Debug).
|
||||
|
||||
The *include* subfolder should be copied as is, while libraries should be renamed to *freetype.lib* and *freetype.dll* (suffixes removed) and placed to subdirectories *lib *and *bin*, respectively. If the Debug configuration is built, the Debug libraries should be put into subdirectories *libd* and *bind*.
|
||||
|
||||
The `include` subfolder should be copied as is, while libraries should be renamed to `freetype.lib` and `freetype.dll` (suffixes removed) and placed to subdirectories `lib` and `bin`, respectively.
|
||||
If the `Debug` configuration is built, the Debug libraries should be put into subdirectories `libd` and `bind`.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
|
||||
This third-party product is installed with binaries
|
||||
from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*) and pick the archive for Windows platform.
|
||||
|
||||
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
|
||||
Unpack the downloaded archive of TBB product into the *3rdparty* folder.
|
||||
|
||||
Further in this document, this folder is referred to as `tbb`.
|
||||
Further in this document, this folder is referred to as *tbb*.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_3 FreeImage
|
||||
|
||||
This third-party product should be built as a dynamically loadable library (`.dll` file).
|
||||
You can download its sources from
|
||||
This third-party product should be built as a dynamically loadable library (.dll file).
|
||||
You can download its sources from
|
||||
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
|
||||
|
||||
1. Unpack the downloaded archive of FreeImage product into `3rdparty` folder.<br>
|
||||
As a result, you should have a folder named `3rdparty/FreeImage`.
|
||||
Rename it according to the rule: `freeimage-platform-compiler-building mode`, where
|
||||
### The building procedure:
|
||||
|
||||
* `platform` is `win32` or `win64`;
|
||||
* `compiler` is `vc8` or `vc9` or `vc10` or `vc11`;
|
||||
* `building mode` is *opt* (for release) or `deb` (for debug)
|
||||
1. Unpack the downloaded archive of FreeImage product into *3rdparty* folder.
|
||||
|
||||
As a result, you should have a folder named *3rdparty\\FreeImage*.
|
||||
|
||||
Rename it according to the rule: *freeimage-platform-compiler-building mode*, where
|
||||
|
||||
* **platform** is *win32* or *win64*;
|
||||
* **compiler** is *vc8* or *vc9* or *vc10* or *vc11*;
|
||||
* **building mode** is *opt* (for release) or *deb* (for debug)
|
||||
|
||||
Further in this document, this folder is referred to as `freeimage`.
|
||||
Further in this document, this folder is referred to as *freeimage*.
|
||||
|
||||
2. Open the solution file `freeimage/FreeImage.*.sln` in your Visual Studio.<br>
|
||||
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
|
||||
Such conversion should be suggested automatically by Visual Studio.
|
||||
2. Open the solution file *freeimage\\FreeImage.*.sln* in your Visual Studio.
|
||||
|
||||
If you use a Visual Studio version higher than VC++ 2008, apply conversion of the workspace.
|
||||
Such conversion should be suggested automatically by Visual Studio.
|
||||
|
||||
3. Select a configuration to build.
|
||||
|
||||
3. Select a configuration to build.
|
||||
- Choose `Release` if you are building Release binaries.
|
||||
- Choose `Debug` if you are building Debug binaries.
|
||||
- Choose **Release** if you are building Release binaries.
|
||||
- Choose **Debug** if you are building Debug binaries.
|
||||
|
||||
*Note:*
|
||||
|
||||
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage projects:
|
||||
*Note:*
|
||||
|
||||
If you want to build a debug version of FreeImage binaries then you need to rename the following files in FreeImage and FreeimagePlus projects:
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Linker -> General -> Output File
|
||||
|
||||
FreeImage*d*.dll to FreeImage.dll
|
||||
FreeImage*d*.dll to FreeImage.dll
|
||||
FreeImagePlus*d*.dll to FreeImagePlus.dll
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Linker -> Debugging-> Generate Program Database File
|
||||
|
||||
FreeImage*d*.pdb to FreeImage.pdb
|
||||
FreeImage*d*.pdb to FreeImage.pdb
|
||||
FreeImagePlus*d*.pdb to FreeImagePlus.pdb
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Linker -> Advanced-Import Library
|
||||
|
||||
FreeImage*d*.lib to FreeImage.lib
|
||||
FreeImage*d*.lib to FreeImage.lib
|
||||
FreeImagePlus*d*.lib to FreeImagePlus.lib
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
|
||||
Project -> Properties -> Configuration Properties -> Build Events -> Post -> Build Event -> Command Line
|
||||
|
||||
FreeImage*d*.dll to FreeImage.dll
|
||||
FreeImage*d*.lib to FreeImage.lib
|
||||
FreeImage*d*.dll to FreeImage.dll
|
||||
FreeImage*d*.lib to FreeImage.lib
|
||||
FreeImagePlus*d*.dll to FreeImagePlus.dll
|
||||
FreeImagePlus*d*.lib to FreeImagePlus.lib
|
||||
|
||||
Additionally, rename in project FreeImagePlus
|
||||
Additionally, rename in project FreeImagePlus
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
|
||||
|
||||
Project -> Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies
|
||||
from FreeImage*d*.lib to FreeImage.lib
|
||||
|
||||
from FreeImage*d*.lib to FreeImage.lib
|
||||
4. Select a platform to build.
|
||||
|
||||
4. Select a platform to build.
|
||||
- Choose `Win32` if you are building for a 32 bit platform.
|
||||
- Choose `x64` if you are building for a 64 bit platform.
|
||||
- Choose *Win32* if you are building for a 32 bit platform.
|
||||
- Choose *x64* if you are building for a 64 bit platform.
|
||||
|
||||
5. Start the building process.<br>
|
||||
As a result, you should have the library files of FreeImage product in `freeimage/Dist` folder (`FreeImage.dll` and `FreeImage.lib`).
|
||||
5. Start the building process.
|
||||
|
||||
As a result, you should have the library files of FreeImage product in *freeimage\\Dist* folder (*FreeImage.dll* and *FreeImage.lib*) and in *freeimage\\Wrapper\\FreeImagePlus\\dist* folder (*FreeImagePlus.dll* and *FreeImagePlus.lib*).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_win_3_4 VTK
|
||||
|
||||
VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
|
||||
VTK is an open-source, freely available software system for 3D computer graphics, image processing and visualization. VTK Integration Services component provides adaptation functionality for visualization of OCCT topological shapes by means of VTK library.
|
||||
|
||||
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into `3rdparty` folder.<br>
|
||||
As a result, you will get a folder named, for example, `3rdparty/VTK-6.1.0`.
|
||||
Further in this document, this folder is referred to as `VTK`.
|
||||
### The building procedure:
|
||||
|
||||
1. Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it into *3rdparty* folder.
|
||||
|
||||
As a result, you will get a folder named, for example, <i>3rdparty\VTK-6.1.0.</i>
|
||||
|
||||
Further in this document, this folder is referred to as *VTK*.
|
||||
|
||||
2. Use CMake to generate VS projects for building the library:
|
||||
- Start CMake-GUI and select `VTK` folder as source path, and the folder of your choice for VS project and intermediate build data.
|
||||
- Start CMake-GUI and select VTK folder as source path, and the folder of your choice for VS project and intermediate build data.
|
||||
- Click **Configure**.
|
||||
- Select the VS version to be used from the ones you have installed (we recommend using VS 2015) and the architecture (32 or 64-bit).
|
||||
- Generate VS projects with default CMake options. The open solution `VTK.sln` will be generated in the build folder.
|
||||
- Generate VS projects with default CMake options. The open solution *VTK.sln* will be generated in the build folder.
|
||||
|
||||
3. Build project VTK in Release mode.
|
||||
|
||||
|
||||
@section build_3rdparty_linux Linux
|
||||
|
||||
This section presents additional guidelines for building third-party products used by Open CASCADE Technology and samples on Linux platform.
|
||||
This document presents additional guidelines for building third-party
|
||||
products used by Open CASCADE Technology and samples on Linux platform.
|
||||
|
||||
The links for downloading the third-party products are available on the web site at
|
||||
https://opencascade.com/content/3rd-party-components.
|
||||
|
||||
There are two types of third-party products, which are necessary to build OCCT:
|
||||
|
||||
* Mandatory products:
|
||||
* Tcl/Tk 8.5 - 8.6;
|
||||
* FreeType 2.4.10 - 2.5.3;
|
||||
* Optional products:
|
||||
* TBB 3.x - 4.x;
|
||||
* FreeImage 3.14.1 - 3.16.0;
|
||||
* VTK 6.1.0.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_4 Installation From Official Repositories
|
||||
|
||||
**Debian-based distributives**
|
||||
|
||||
All 3rd-party products required for building of OCCT could be installed from official repositories.
|
||||
You may install them from console using apt-get utility:
|
||||
All 3rd-party products required for building of OCCT could be installed
|
||||
from official repositories. You may install them from console using apt-get utility:
|
||||
|
||||
sudo apt-get install tcllib tklib tcl-dev tk-dev libfreetype-dev libx11-dev libgl1-mesa-dev libfreeimage-dev
|
||||
sudo apt-get install rapidjson-dev libdraco-dev
|
||||
@@ -227,148 +279,148 @@ Building is possible with C++ compliant compiler:
|
||||
|
||||
sudo apt-get install g++
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
|
||||
@subsection dev_guides__building_3rdparty_linux_2_1 Tcl/Tk
|
||||
|
||||
Tcl/Tk is required for DRAW test harness.
|
||||
Tcl/Tk is required for DRAW test harness.
|
||||
|
||||
**Installation from sources: Tcl**
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. Enter the `unix` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
|
||||
|
||||
cd TCL_SRC_DIR/unix
|
||||
|
||||
2. Run the `configure` command:
|
||||
|
||||
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
|
||||
|
||||
For a 64 bit platform also add `--enable-64bit` option to the command line.
|
||||
|
||||
3. If the configure command has finished successfully, start the building process:
|
||||
|
||||
make
|
||||
|
||||
4. If building is finished successfully, start the installation of Tcl.
|
||||
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`
|
||||
|
||||
make install
|
||||
|
||||
**Installation from sources: Tk**
|
||||
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. Enter the `unix` sub-directory of the directory where the Tk source files are located (`TK_SRC_DIR`)
|
||||
1. Enter the unix sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
|
||||
|
||||
cd TK_SRC_DIR/unix
|
||||
cd TCL_SRC_DIR/unix
|
||||
|
||||
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`.
|
||||
2. Run the *configure* command:
|
||||
|
||||
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
|
||||
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
|
||||
|
||||
For a 64 bit platform also add `--enable-64bit` option to the command line.
|
||||
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
|
||||
|
||||
3. If the configure command has finished successfully, start the building process:
|
||||
|
||||
make
|
||||
|
||||
3. If the configure command has finished successfully, start the building process:
|
||||
4. If building is finished successfully, start the installation of Tcl.
|
||||
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
4. If the building has finished successfully, start the installation of Tk.
|
||||
All binary and service files of the product will be copied
|
||||
to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`)
|
||||
**Installation from sources: Tk**
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. Enter the unix sub-directory of the directory where the Tk source files are located <i>(TK_SRC_DIR)</i>
|
||||
|
||||
make install
|
||||
cd TK_SRC_DIR/unix
|
||||
|
||||
2. Run the configure command, where <i>TCL_LIB_DIR</i> is *TCL_INSTALL_DIR/lib*.
|
||||
|
||||
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
|
||||
|
||||
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
|
||||
|
||||
3. If the configure command has finished successfully, start the building process:
|
||||
|
||||
make
|
||||
|
||||
4. If the building has finished successfully, start the installation of Tk.
|
||||
All binary and service files of the product will be copied
|
||||
to the directory defined by *TK_INSTALL_DIR* (usually it is *TCL_INSTALL_DIR*)
|
||||
|
||||
make install
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_2_2 FreeType
|
||||
|
||||
FreeType is required for text display in the 3D viewer.
|
||||
Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
|
||||
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
|
||||
FreeType is required for text display in the 3D viewer.
|
||||
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
|
||||
|
||||
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
|
||||
|
||||
cd FREETYPE_SRC_DIR
|
||||
|
||||
2. Run the `configure` command:
|
||||
2. Run the *configure* command:
|
||||
|
||||
configure --prefix=FREETYPE_INSTALL_DIR
|
||||
|
||||
configure --prefix=FREETYPE_INSTALL_DIR
|
||||
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
|
||||
|
||||
3. If the *configure* command has finished successfully, start the building process:
|
||||
|
||||
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
|
||||
make
|
||||
|
||||
3. If the `configure` command has finished successfully, start the building process:
|
||||
|
||||
make
|
||||
|
||||
4. If the building has finished successfully, start the installation of FreeType.
|
||||
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`
|
||||
|
||||
make install
|
||||
4. If the building has finished successfully, start the installation of FreeType.
|
||||
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*
|
||||
|
||||
make install
|
||||
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
|
||||
To install, unpack the downloaded archive of TBB product.
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
|
||||
|
||||
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/ and unpack it.
|
||||
The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
|
||||
Download the necessary archive from https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
|
||||
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
|
||||
|
||||
1. Modify *FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h*:
|
||||
In line 60 insert the following:
|
||||
|
||||
1. Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h`:<br>
|
||||
In line 60 insert the following:
|
||||
#include string.h
|
||||
|
||||
#include string.h
|
||||
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
|
||||
|
||||
cd FREEIMAGE_SRC_DIR
|
||||
|
||||
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
|
||||
3. Run the building process
|
||||
|
||||
make
|
||||
|
||||
cd FREEIMAGE_SRC_DIR
|
||||
4. Run the installation process
|
||||
|
||||
3. Run the building process
|
||||
|
||||
make
|
||||
|
||||
4. Run the installation process
|
||||
|
||||
a. If you have the permission to write into directories `/usr/include` and `/usr/lib`, run the following command:
|
||||
|
||||
make install
|
||||
|
||||
b. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.gnu`:
|
||||
a. If you have the permission to write into directories <i>/usr/include</i> and <i>/usr/lib</i>, run the following command:
|
||||
|
||||
make install
|
||||
b. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.gnu*:
|
||||
|
||||
Change lines 7-9 from:
|
||||
|
||||
DESTDIR ?= /
|
||||
INCDIR ?= $(DESTDIR)/usr/include
|
||||
INSTALLDIR ?= $(DESTDIR)/usr/lib
|
||||
|
||||
DESTDIR ?= /
|
||||
INCDIR ?= $(DESTDIR)/usr/include
|
||||
INSTALLDIR ?= $(DESTDIR)/usr/lib
|
||||
to:
|
||||
|
||||
DESTDIR ?= $(DESTDIR)
|
||||
INCDIR ?= $(DESTDIR)/include
|
||||
INSTALLDIR ?= $(DESTDIR)/lib
|
||||
|
||||
Change lines 65-67 from:
|
||||
|
||||
install -m 644 -o root -g root $(HEADER) $(INCDIR)
|
||||
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
|
||||
|
||||
to:
|
||||
|
||||
DESTDIR ?= $(DESTDIR)
|
||||
INCDIR ?= $(DESTDIR)/include
|
||||
INSTALLDIR ?= $(DESTDIR)/lib
|
||||
|
||||
Change lines 65-67 from:
|
||||
|
||||
install -m 644 -o root -g root $(HEADER) $(INCDIR)
|
||||
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
|
||||
|
||||
to:
|
||||
|
||||
install -m 755 $(HEADER) $(INCDIR)
|
||||
install -m 755 $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 $(HEADER) $(INCDIR)
|
||||
install -m 755 $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
|
||||
|
||||
Change line 70 from:
|
||||
Change line 70 from:
|
||||
|
||||
ldconfig
|
||||
|
||||
to:
|
||||
|
||||
\#ldconfig
|
||||
\#ldconfig
|
||||
|
||||
Then run the installation process by the following command:
|
||||
|
||||
Then run the installation process by the following command:
|
||||
|
||||
make DESTDIR=FREEIMAGE_INSTALL_DIR install
|
||||
make DESTDIR=FREEIMAGE_INSTALL_DIR install
|
||||
|
||||
5. Clean temporary files
|
||||
|
||||
@@ -376,180 +428,201 @@ The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DI
|
||||
|
||||
@subsection dev_guides__building_3rdparty_linux_3_4 VTK
|
||||
|
||||
You can download VTK sources from https://www.vtk.org/VTK/resources/software.html
|
||||
|
||||
### The building procedure:
|
||||
|
||||
Download the necessary archive from https://www.vtk.org/VTK/resources/software.html and unpack it.
|
||||
|
||||
1. Install or build `cmake` product from the source file.
|
||||
2. Start `cmake` in GUI mode with the directory where the source files of *VTK* are located:
|
||||
1. Install or build *cmake* product from the source file.
|
||||
2. Start *cmake* in GUI mode with the directory where the source files of *VTK* are located:
|
||||
|
||||
ccmake VTK_SRC_DIR
|
||||
|
||||
* Press `[c]` to make the initial configuration
|
||||
* Define the necessary options in `VTK_INSTALL_PREFIX`
|
||||
* Press `[c]` to make the final configuration
|
||||
* Press `[g]` to generate `Makefile` and exit
|
||||
* Press <i>[c]</i> to make the initial configuration
|
||||
* Define the necessary options in *VTK_INSTALL_PREFIX*
|
||||
* Press <i>[c]</i> to make the final configuration
|
||||
* Press <i>[g]</i> to generate Makefile and exit
|
||||
|
||||
3. Start the building of VTK:
|
||||
|
||||
make
|
||||
|
||||
4. Start the installation of VTK. Binaries will be installed according to the `VTK_INSTALL_PREFIX` option.
|
||||
4. Start the installation of VTK. Binaries will be installed according to the *VTK_INSTALL_PREFIX* option.
|
||||
|
||||
make install
|
||||
|
||||
@section build_3rdparty_macos Mac OS X
|
||||
|
||||
This section presents additional guidelines for building third-party products
|
||||
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
|
||||
This document presents additional guidelines for building third-party products
|
||||
used by Open CASCADE Technology and samples on Mac OS X platform (10.6.4 and later).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk
|
||||
The links for downloading the third-party products are available at https://opencascade.com/content/3rd-party-components.
|
||||
|
||||
Tcl/Tk is required for DRAW test harness.
|
||||
There are two types of third-party products, which are necessary to build OCCT:
|
||||
|
||||
* Mandatory products:
|
||||
* Tcl/Tk 8.5 - 8.6;
|
||||
* FreeType 2.4.10 - 2.5.3.
|
||||
* Optional products:
|
||||
* TBB 3.x - 4.x;
|
||||
* FreeImage 3.14.1 - 3.16.0
|
||||
|
||||
|
||||
**Installation from sources: Tcl**
|
||||
@subsection dev_guides__building_3rdparty_osx_2_1 Tcl/Tk 8.5
|
||||
|
||||
Tcl/Tk is required for DRAW test harness. Version 8.5 or 8.6 can be used with OCCT.
|
||||
|
||||
**Installation from sources: Tcl 8.5**
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. Enter the `macosx` sub-directory of the directory where the Tcl source files are located (`TCL_SRC_DIR`).
|
||||
1. Enter the *macosx* sub-directory of the directory where the Tcl source files are located <i>(TCL_SRC_DIR)</i>.
|
||||
|
||||
cd TCL_SRC_DIR/macosx
|
||||
cd TCL_SRC_DIR/macosx
|
||||
|
||||
2. Run the `configure` command
|
||||
2. Run the *configure* command
|
||||
|
||||
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
|
||||
configure --enable-gcc --enable-shared --enable-threads --prefix=TCL_INSTALL_DIR
|
||||
|
||||
For a 64 bit platform also add `--enable-64bit` option to the command line.
|
||||
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
|
||||
|
||||
3. If the `configure` command has finished successfully, start the building process
|
||||
3. If the *configure* command has finished successfully, start the building process
|
||||
|
||||
make
|
||||
make
|
||||
|
||||
4. If building is finished successfully, start the installation of Tcl.
|
||||
All binary and service files of the product will be copied to the directory defined by *TCL_INSTALL_DIR*.
|
||||
|
||||
4. If building is finished successfully, start the installation of Tcl.
|
||||
All binary and service files of the product will be copied to the directory defined by `TCL_INSTALL_DIR`.
|
||||
make install
|
||||
|
||||
make install
|
||||
|
||||
**Installation from sources: Tk**
|
||||
**Installation from sources: Tk 8.5**
|
||||
|
||||
Download the necessary archive from https://www.tcl.tk/software/tcltk/download.html and unpack it.
|
||||
|
||||
1. Enter the `macosx` sub-directory of the directory where the source files of Tk are located (`TK_SRC_DIR`).
|
||||
1. Enter the *macosx* sub-directory of the directory where the source files of Tk are located <i>(TK_SRC_DIR)</i>.
|
||||
|
||||
cd TK_SRC_DIR/macosx
|
||||
cd TK_SRC_DIR/macosx
|
||||
|
||||
2. Run the `configure` command, where `TCL_LIB_DIR` is `TCL_INSTALL_DIR/lib`
|
||||
2. Run the *configure* command, where TCL_LIB_DIR is TCL_INSTALL_DIR/lib
|
||||
|
||||
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
|
||||
configure --enable-gcc --enable-shared --enable-threads --with-tcl=TCL_LIB_DIR --prefix=TK_INSTALL_DIR
|
||||
|
||||
For a 64 bit platform also add `--enable-64bit` option to the command line.
|
||||
For a 64 bit platform also add <i>--enable-64bit</i> option to the command line.
|
||||
|
||||
3. If the `configure` command has finished successfully, start the building process:
|
||||
3. If the *configure* command has finished successfully, start the building process:
|
||||
|
||||
make
|
||||
make
|
||||
|
||||
4. If the building has finished successfully, start the installation of Tk.
|
||||
All binary and service files of the product will be copied to the directory defined by `TK_INSTALL_DIR` (usually it is `TCL_INSTALL_DIR`).
|
||||
4. If the building has finished successfully, start the installation of Tk. All binary and service files of the product will be copied to the directory defined by *TK_INSTALL_DIR* (usually it is TCL_INSTALL_DIR)
|
||||
|
||||
make install
|
||||
make install
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType
|
||||
@subsection dev_guides__building_3rdparty_osx_2_2 FreeType 2.4.10
|
||||
|
||||
FreeType is required for text display in the 3D viewer.
|
||||
|
||||
FreeType is required for text display in the 3D viewer.
|
||||
Download the necessary archive from https://freetype.org/ and unpack it.
|
||||
Download the necessary archive from https://sourceforge.net/projects/freetype/files/ and unpack it.
|
||||
|
||||
1. Enter the directory where the source files of FreeType are located (`FREETYPE_SRC_DIR`).
|
||||
1. Enter the directory where the source files of FreeType are located <i>(FREETYPE_SRC_DIR)</i>.
|
||||
|
||||
cd FREETYPE_SRC_DIR
|
||||
cd FREETYPE_SRC_DIR
|
||||
|
||||
2. Run the `configure` command
|
||||
2. Run the *configure* command
|
||||
|
||||
configure --prefix=FREETYPE_INSTALL_DIR
|
||||
|
||||
configure --prefix=FREETYPE_INSTALL_DIR
|
||||
For a 64 bit platform also add <i>CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'</i> option to the command line.
|
||||
|
||||
For a 64 bit platform also add `CFLAGS='-m64 -fPIC' CPPFLAGS='-m64 -fPIC'` option to the command line.
|
||||
3. If the *configure* command has finished successfully, start the building process
|
||||
|
||||
3. If the `configure` command has finished successfully, start the building process
|
||||
make
|
||||
|
||||
make
|
||||
4. If building has finished successfully, start the installation of FreeType.
|
||||
All binary and service files of the product will be copied to the directory defined by *FREETYPE_INSTALL_DIR*.
|
||||
|
||||
4. If building has finished successfully, start the installation of FreeType.
|
||||
All binary and service files of the product will be copied to the directory defined by `FREETYPE_INSTALL_DIR`.
|
||||
make install
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_1 TBB 3.x or 4.x
|
||||
|
||||
make install
|
||||
This third-party product is installed with binaries from the archive
|
||||
that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. *tbb30_018oss*)
|
||||
and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB 3.0 product (*tbb30_018oss_osx.tgz*).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
|
||||
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage 3.14.1 or 3.15.x
|
||||
|
||||
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
|
||||
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
|
||||
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
|
||||
|
||||
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage
|
||||
|
||||
Download the necessary archive from
|
||||
Download the necessary archive from
|
||||
https://sourceforge.net/projects/freeimage/files/Source%20Distribution/
|
||||
and unpack it. The directory with unpacked sources is further referred to as `FREEIMAGE_SRC_DIR`.
|
||||
and unpack it. The directory with unpacked sources is further referred to as *FREEIMAGE_SRC_DIR*.
|
||||
|
||||
Note that for building FreeImage on Mac OS X 10.7 you should replace `Makefile.osx`
|
||||
in `FREEIMAGE_SRC_DIR` by the corrected file, which you can find in attachment to issue [`#22811`](https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug) in OCCT Mantis bug tracker.
|
||||
Note that for building FreeImage on Mac OS X 10.7 you should replace *Makefile.osx*
|
||||
in *FREEIMAGE_SRC_DIR* by the corrected file, which you can find in attachment to issue #22811 in OCCT Mantis bug tracker
|
||||
(https://tracker.dev.opencascade.org/file_download.php?file_id=6937&type=bug).
|
||||
|
||||
1. If you build FreeImage 3.15.x you can skip this step.
|
||||
1. If you build FreeImage 3.15.x you can skip this step.
|
||||
Modify <i>FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:</i>
|
||||
|
||||
In line 60 insert the following:
|
||||
|
||||
Modify `FREEIMAGE_SRC_DIR/Source/OpenEXR/Imath/ImathMatrix.h:`<br>
|
||||
In line 60 insert the following:
|
||||
#include string.h
|
||||
|
||||
#include string.h
|
||||
Modify <i>FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp:</i>
|
||||
|
||||
In line 320 replace:
|
||||
|
||||
Modify `FREEIMAGE_SRC_DIR/Source/FreeImage/PluginTARGA.cpp`:<br>
|
||||
In line 320 replace:
|
||||
SwapShort(value);
|
||||
|
||||
SwapShort(value);
|
||||
with:
|
||||
|
||||
with:
|
||||
SwapShort(&value);
|
||||
|
||||
SwapShort(&value);
|
||||
2. Enter the directory where the source files of FreeImage are located <i>(FREEIMAGE_SRC_DIR)</i>.
|
||||
|
||||
2. Enter the directory where the source files of FreeImage are located (`FREEIMAGE_SRC_DIR`).
|
||||
|
||||
cd FREEIMAGE_SRC_DIR
|
||||
cd FREEIMAGE_SRC_DIR
|
||||
|
||||
3. Run the building process
|
||||
|
||||
make
|
||||
make
|
||||
|
||||
4. Run the installation process
|
||||
4. Run the installation process
|
||||
|
||||
1. If you have the permission to write into <i>/usr/local/include</i> and <i>/usr/local/lib</i> directories, run the following command:
|
||||
|
||||
1. If you have the permission to write into `/usr/local/include` and `/usr/local/lib` directories, run the following command:
|
||||
make install
|
||||
|
||||
make install
|
||||
2. If you do not have this permission, you need to modify file *FREEIMAGE_SRC_DIR/Makefile.osx*:
|
||||
|
||||
2. If you do not have this permission, you need to modify file `FREEIMAGE_SRC_DIR/Makefile.osx`:<br>
|
||||
Change line 49 from:
|
||||
Change line 49 from:
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
|
||||
to:
|
||||
|
||||
PREFIX ?= $(PREFIX)
|
||||
|
||||
PREFIX ?= $(PREFIX)
|
||||
Change lines 65-69 from:
|
||||
|
||||
Change lines 65-69 from:
|
||||
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
|
||||
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
|
||||
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
|
||||
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
|
||||
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
|
||||
|
||||
to:
|
||||
|
||||
install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
|
||||
install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
|
||||
install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
|
||||
ranlib -sf $(INSTALLDIR)/$(STATICLIB)
|
||||
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)
|
||||
|
||||
to:
|
||||
|
||||
install -d $(INCDIR) $(INSTALLDIR)
|
||||
install -m 755 $(HEADER) $(INCDIR)
|
||||
install -m 755 $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
|
||||
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
|
||||
install -d $(INCDIR) $(INSTALLDIR)
|
||||
install -m 755 $(HEADER) $(INCDIR)
|
||||
install -m 755 $(STATICLIB) $(INSTALLDIR)
|
||||
install -m 755 $(SHAREDLIB) $(INSTALLDIR)
|
||||
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
|
||||
ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
|
||||
|
||||
Then run the installation process by the following command:
|
||||
|
||||
make PREFIX=FREEIMAGE_INSTALL_DIR install
|
||||
|
||||
5. Clean temporary files
|
||||
|
||||
Then run the installation process by the following command:
|
||||
|
||||
make PREFIX=FREEIMAGE_INSTALL_DIR install
|
||||
|
||||
5. Clean temporary files
|
||||
|
||||
make clean
|
||||
|
@@ -1,911 +0,0 @@
|
||||
AIS: Custom Presentation {#tutorials__ais_object}
|
||||
========
|
||||
|
||||
@tableofcontents
|
||||
|
||||
@section intro Getting Started
|
||||
|
||||
OCCT provides a strong set of built-in Interactive Objects for rapid application development,
|
||||
but the real power and flexibility of **Application Interactive Services** (@c AIS) could be revealed by subclassing and implementing custom presentations.
|
||||
In this tutorial we will focus on the development of a custom @c AIS_InteractiveObject and show the basics step by step.
|
||||
|
||||
Let's start from the very beginning and try subclassing @c AIS_InteractiveObject object:
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisObject : public AIS_InteractiveObject
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(MyAisObject, AIS_InteractiveObject)
|
||||
public:
|
||||
MyAisObject() {}
|
||||
public:
|
||||
virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode) override {}
|
||||
|
||||
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode) override {}
|
||||
|
||||
virtual bool AcceptDisplayMode (const Standard_Integer theMode) const override
|
||||
{ return true; }
|
||||
};
|
||||
~~~~
|
||||
|
||||
@c DEFINE_STANDARD_RTTI_INLINE() macro will register the new class within the OCCT Run-Time Type Information (RTTI) system.
|
||||
This step is optional (you may skip it if you are not going to use methods like @c Standard_Transient::DynamicType() in application code), but it is a common practice while subclassing OCCT classes.
|
||||
|
||||
The @c AIS_InteractiveObject interface defines only a couple of pure virtual methods - @c @::Compute() defining an object presentation and @c @::ComputeSelection() defining a selectable (pickable) volume.
|
||||
Selection and presentation are two independent mechanisms in **AIS**. Presentation rendering is done with help of OpenGL or a similar low-level graphics library, while selection doesn't depend on a graphic driver at all.
|
||||
Providing an empty implementation of these two methods would be enough for adding the object to @c AIS_InteractiveContext (@c @::Display()), but obviously nothing will appear on the screen.
|
||||
|
||||
@section prs_builders Presentation builders
|
||||
|
||||
To go ahead, we need to define some presentation of our object.
|
||||
OCCT provides a set of presentation building tools for common elements like arrows, shapes, boxes, etc.
|
||||
These tools could be found within @c Prs3d, @c StdPrs and @c DsgPrs packages:
|
||||
|
||||
- **Prs3d**
|
||||
provides builders for simple geometric elements.
|
||||
- @c Prs3d_Arrow, @c Prs3d_BndBox, @c Prs3d_Point, @c Prs3d_Text, @c Prs3d_ToolCylinder, @c Prs3d_ToolDisk, @c Prs3d_ToolSector, @c Prs3d_ToolSphere, @c Prs3d_ToolTorus
|
||||
- **StdPrs**
|
||||
provides builders for analytical geometry and B-Rep shapes (@c TopoDS_Shape).
|
||||
- @c StdPrs_WFShape, @c StdPrs_ShadedShape, @c StdPrs_BRepTextBuilder
|
||||
- **DsgPrs**
|
||||
provides builders for datums, dimensions and relations.
|
||||
|
||||
Presentation builders are reusable bricks for constructing @c AIS objects.
|
||||
Standard OCCT interactive objects highly rely on them, so that you may easily replicate @c AIS_Shape presentation for displaying a shape with just a couple of lines calling @c StdPrs_ShadedShape:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
|
||||
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
|
||||
}
|
||||
...
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
theCtx->Display (aPrs, true);
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step1_shaded.png,"@c StdPrs_ShadedShape presentation builder.",409} height=409px
|
||||
|
||||
@c PrsMgr_PresentableObject::Compute() method takes three arguments:
|
||||
- **Presentation Manager** (@c PrsMgr_PresentationManager).
|
||||
Rarely used parameter, but might be necessary for some advanced use cases.
|
||||
- **Presentation** (@c Prs3d_Presentation or @c Graphic3d_Structure).
|
||||
Defines the structure to fill in with presentation elements.
|
||||
- **Display Mode** (integer number).
|
||||
Specifies the display mode to compute.
|
||||
**0** is a default display mode, if not overridden by @c AIS_InteractiveObject::SetDisplayMode() or by @c AIS_InteractiveContext::Display().
|
||||
|
||||
For each supported display mode, the **Presentation Manager** creates a dedicated @c Prs3d_Presentation and stores it within the object itself as a list of presentations @c PrsMgr_PresentableObject::Presentations().
|
||||
It is a good practice to reject unsupported display modes within @c @::Compute() method:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0) { return; } // reject non-zero display modes
|
||||
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
|
||||
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
|
||||
}
|
||||
~~~~
|
||||
|
||||
This wouldn't, however, prevent application from displaying the object with another display mode like this:
|
||||
|
||||
~~~~{.cpp}
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
theCtx->Display (aPrs, 100, -1, true);
|
||||
~~~~
|
||||
|
||||
The code above will display @c MyAisObject with display mode equal to 100, and after @c @::Compute() modifications nothing will be displayed on the screen.
|
||||
@c AIS will still create a presentation with specified display mode, but it will be empty - method @c @::AcceptDisplayMode() could be overridden to disallow even creation of an empty presentation:
|
||||
|
||||
~~~~{.cpp}
|
||||
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
|
||||
{
|
||||
return theMode == 0; // reject non-zero display modes
|
||||
}
|
||||
~~~~
|
||||
|
||||
@c AIS_InteractiveContext::Display() checks if requested display mode is actually supported by the object, and uses default display mode (_**0**_) if it is not.
|
||||
@c StdPrs_ShadedShape prepares a shaded (triangulated) presentation of a shape, while @c StdPrs_WFShape creates a wireframe presentation with B-Rep wire boundaries:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!AcceptDisplayMode (theMode)) { return; }
|
||||
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
|
||||
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
|
||||
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
|
||||
}
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step1_shaded_wf.png,"Result of @c StdPrs_ShadedShape + @c StdPrs_WFShape presentation builders.",409} height=409px
|
||||
|
||||
Presentation builders take the @c Prs3d_Drawer object defining various attributes - material of shaded shape, number of isolines in wireframe mode, tessellation quality, line colors and many others.
|
||||
@c PrsMgr_PresentableObject defines @c myDrawer property with default attributes.
|
||||
@c StdPrs makes it easy to display topological shapes.
|
||||
With the help of @c Prs3d tools we may display elements like arrows, boxes or text labels.
|
||||
Let's extend our presentation with a second **display mode 1** showing a bounding box using @c Prs3d_BndBox builder:
|
||||
|
||||
~~~~{.cpp}
|
||||
bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const
|
||||
{
|
||||
return theMode == 0 || theMode == 1;
|
||||
}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0);
|
||||
if (theMode == 0)
|
||||
{
|
||||
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
|
||||
StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
|
||||
}
|
||||
else if (theMode == 1)
|
||||
{
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add (aShape, aBox);
|
||||
Prs3d_BndBox::Add (thePrs, aBox, myDrawer);
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
Now, displaying an object with **display mode 1** will show a box:
|
||||
|
||||
~~~~{.cpp}
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
theCtx->Display (aPrs, 1, 0, true);
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step1_bndbox.png,"@c Prs3d_BndBox presentation builder.",409} height=409px
|
||||
|
||||
@c AIS disallows activating multiple display modes at the same time, so that these presentation modes should be alternatives to each other.
|
||||
But @c AIS may use non-active display mode for highlighting purposes - like wireframe (@c AIS_Wireframe) presentation displayed on top of shaded (@c AIS_Shaded) presentation for selected @c AIS_Shape objects.
|
||||
|
||||
Let's define a dedicated enumeration for display modes supported by our interactive object and setup the 1st (@c MyDispMode_Highlight) display mode for highlighting with help of @c PrsMgr_PresentableObject::SetHilightMode():
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisObject : public AIS_InteractiveObject
|
||||
{
|
||||
public:
|
||||
enum MyDispMode { MyDispMode_Main = 0, MyDispMode_Highlight = 1 };
|
||||
|
||||
...
|
||||
|
||||
MyAisObject::MyAisObject()
|
||||
{
|
||||
SetDisplayMode (MyDispMode_Main); // main (active) display mode
|
||||
SetHilightMode (MyDispMode_Highlight); // auxiliary (highlighting) mode
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
|
||||
theCtx->HilightWithColor (aPrs, aPrs->HilightAttributes(), false);
|
||||
theCtx->CurrentViewer()->Redraw();
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step1_highlight.png,"Highlighting by color (left) and highlighting by another display mode (right).",818} height=409px
|
||||
|
||||
In this particular use case we've used the method @c AIS_InteractiveContext::HilightWithColor() instead of @c @::SetSelected() - just because our object is not selectable yet and @c @::SetSelected() wouldn't work.
|
||||
Highlighted presentation appears on the screen with modulated color (see left screenshot above).
|
||||
Using a dedicated display mode for highlighting (right screenshot above) allows customizing presentation in selected / highlighted states.
|
||||
|
||||
@section prim_arrays Primitive arrays
|
||||
|
||||
@c Prs3d_Presentation might be filled in by the following **primitives**:
|
||||
- **Triangles**
|
||||
- @c Graphic3d_ArrayOfTriangles
|
||||
- @c Graphic3d_ArrayOfTriangleFans
|
||||
- @c Graphic3d_ArrayOfTriangleStrips
|
||||
- **Lines**
|
||||
- @c Graphic3d_ArrayOfSegments
|
||||
- @c Graphic3d_ArrayOfPolylines
|
||||
- **Points** or **Markers**
|
||||
- @c Graphic3d_ArrayOfPoints
|
||||
|
||||
This triplet of primitives is what graphics hardware is capable of rendering, so that it could be transferred directly to low-level graphics libraries in the form of *Vertex Buffer Objects* (VBO).
|
||||
Each **primitive array** consists of an array of vertex attributes (_**position**, **normal**, **texture coordinates**, **vertex colors**_, etc.) and optional **array of indices**.
|
||||
The latter one avoids duplicating vertices shared between connected elements (triangles, polylines) in attributes array.
|
||||
|
||||
@c Graphic3d_ArrayOfPrimitives and it's subclasses provide a convenient interface for filling in primitive arrays:
|
||||
- Constructor takes a number of vertices, number of edges (indices) and a bitmask of optional vertex attributes.
|
||||
- @c Graphic3d_ArrayOfPrimitives::AddVertex() appends a vertex with specified attributes to the end of the array (within the range specified at construction time).
|
||||
- @c Graphic3d_ArrayOfPrimitives::AddEdges() appends indices, starting with 1.
|
||||
Each line segment is defined by two consequential edges, each triangle is defined by three consequential edges.
|
||||
|
||||
Let's extend our sample and display a cylinder section contour defined by array of indexed segments (e.g. a polyline of four vertices):
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
|
||||
if (theMode == MyDispMode_Main)
|
||||
{
|
||||
StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer);
|
||||
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer);
|
||||
Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None);
|
||||
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, 0.0));
|
||||
aSegs->AddVertex (gp_Pnt (0.0, -aRadius, aHeight));
|
||||
aSegs->AddVertex (gp_Pnt (0.0, aRadius, aHeight));
|
||||
aSegs->AddVertex (gp_Pnt (0.0, aRadius, 0.0));
|
||||
aSegs->AddEdges (1, 2);
|
||||
aSegs->AddEdges (2, 3);
|
||||
aSegs->AddEdges (3, 4);
|
||||
aSegs->AddEdges (4, 1);
|
||||
Handle(Graphic3d_Group) aGroupSegs = thePrs->NewGroup();
|
||||
aGroupSegs->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect());
|
||||
aGroupSegs->AddPrimitiveArray (aSegs);
|
||||
}
|
||||
else if (theMode == MyDispMode_Highlight) { ... }
|
||||
}
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step2_segments.png,"Displaying @c Graphic3d_ArrayOfSegments.",409} height=409px
|
||||
|
||||
The process is quite straightforward:
|
||||
- Create a new @c Graphic3d_Group using @c Prs3d_Presentation::NewGroup();
|
||||
- Specify presentation aspects using @c Graphic3d_Group::SetGroupPrimitivesAspect();
|
||||
- Create and add an array of primitives using @c Graphic3d_Group::AddPrimitiveArray().
|
||||
|
||||
Standard presentation builders like @c StdPrs_ShadedShape / @c StdPrs_WFShape internally do exactly the same thing - a tessellated representation of a shape is added to presentation in form of triangles (shaded),
|
||||
line segments (wireframe and free edges) and markers (free shape vertices).
|
||||
|
||||
A single @c Graphic3d_Group normally defines just a single primitive array, but it is technically possible adding more arrays to the same group @c Graphic3d_Group::AddPrimitiveArray()
|
||||
and with different aspects @c Graphic3d_Group::SetPrimitivesAspect(), which might be considered in advanced scenarios.
|
||||
|
||||
Method @c Graphic3d_Group::AddText() allows adding text labels to a presentation.
|
||||
Internally, text labels are rendered as an array of textured triangles using texture atlas created from a font, but this complex logic is hidden from the user.
|
||||
|
||||
@section prim_aspects Primitive aspects
|
||||
|
||||
@c Graphic3d_Aspects is a class defining **display properties** of a primitive array (@c Graphic3d_Group::SetGroupPrimitivesAspect()) -
|
||||
_**material**, **shading model**, **color**, **texture maps**, **blending mode**, **line width**_ and others.
|
||||
|
||||
There are also subclasses @c Graphic3d_AspectFillArea3d (triangles), @c Graphic3d_AspectLine3d (lines), @c Graphic3d_AspectMarker3d (markers)
|
||||
and @c Graphic3d_AspectText3d (text labels) defined as specializations for a specific primitive array type.
|
||||
These subclasses exist for historical reasons and are treated by renderers in exactly the same way.
|
||||
|
||||
It is technically possible to create transient aspects directly within @c @::Compute() method like this:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
Handle(Graphic3d_Aspects) anAspects = new Graphic3d_Aspects();
|
||||
anAspects->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit);
|
||||
anAspects->SetColor (Quantity_NOC_RED);
|
||||
Handle(Graphic3d_Group) aGroup = thePrs->NewGroup();
|
||||
aGroup->SetGroupPrimitivesAspect (anAspects);
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
While this code would work as expected, but prevents further dynamic updates of presentation aspects without recomputing entire presentation.
|
||||
Instead, it is preferred taking attributes from @c PrsMgr_PresentableObject::myDrawer / @c @::Attributes() or storing custom attributes as class fields.
|
||||
@c Prs3d_Drawer defines a set of attributes used by @c AIS presentation builders, but the same parameters might be used by a custom builder as well.
|
||||
|
||||
It is also preferred preallocating attributes in the class constructor.
|
||||
This would allow changing attributes without recomputing the entire presentation - just by calling @c PrsMgr_PresentableObject::SynchronizeAspects() after modifications.
|
||||
Our custom object uses @c myDrawer->ShadingAspect() and @c myDrawer->WireAspect() aspects, so let's initialize them explicitly - assign silver material for shading and green color to line segments:
|
||||
|
||||
~~~~{.cpp}
|
||||
MyAisObject::MyAisObject()
|
||||
{
|
||||
SetHilightMode (MyDispMode_Highlight);
|
||||
myDrawer->SetupOwnShadingAspect();
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NameOfMaterial_Silver);
|
||||
myDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 2.0));
|
||||
}
|
||||
~~~~
|
||||
|
||||
@section quadric_builders Quadric builders
|
||||
|
||||
Previously, we've used @c StdPrs_ShadedShape for displaying cylinder geometry.
|
||||
The @c Prs3d package provides a simpler way for displaying geometry like cylinders, spheres and toruses - based on the @c Prs3d_ToolQuadric interface.
|
||||
This interface allows bypassing creation of a complex B-Rep (@c TopoDS_Shape) definition of a simple geometry, and to avoid using general-purpose tessellators like @c BRepMesh.
|
||||
|
||||
> This difference could be negligible for a small number of such objects, but might become considerable for larger amounts.
|
||||
> The B-Rep definition of a valid cylinder includes 2 unique @c TopoDS_Vertex, 3 @c TopoDS_Edge, 3 @c TopoDS_Wire, 3 @c TopoDS_Face, 1 @c TopoDS_Shell and 1 @c TopoDS_Solid.
|
||||
> Internally each @c TopoDS_Edge also defines curves (@c Geom_Curve as well as 2D parametric @c Geom2d_Curve) and each @c TopoDS_Face defines analytical surface (@c Geom_Surface).
|
||||
> Meshing such geometry with the help of @c BRepMesh is much more complicated than one may think.
|
||||
> A plenty of data structures (memory!) and computations (time!) for displaying a geometry that could be triangulated by a simple for loop.
|
||||
|
||||
@c Prs3d_ToolQuadric solves this problem by creating a triangulation for such kinds of shapes in a straight-forward way.
|
||||
Let's try using @c Prs3d_ToolCylinder in our sample:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
|
||||
if (theMode == MyDispMode_Main)
|
||||
{
|
||||
//StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading
|
||||
//StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 10, 10, gp_Trsf());
|
||||
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
|
||||
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroupTris->AddPrimitiveArray (aTris);
|
||||
...
|
||||
}
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step3_quadrics_10.png,"@c Prs3d_ToolCylinder (10 slices).",409} height=409px
|
||||
|
||||
Well... that looks a little bit edgy.
|
||||
Quadric builder creates a triangulation taking the following parameters:
|
||||
- Geometry parameters.
|
||||
(in case of a cylinder - base radius, top radius and height).
|
||||
- Number of subdivisions along U (slices) and V (stacks) parameters.
|
||||
In some cases only one parametric scope matters.
|
||||
- Transformation @c gp_Trsf to apply
|
||||
(original geometry is defined within some reference coordinate system).
|
||||
|
||||
Let's increase number of subdivisions from _10_ to _25_:
|
||||
~~~~{.cpp}
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step3_quadrics_25.png,"@c Prs3d_ToolCylinder (25 slices).",409} height=409px
|
||||
|
||||
It looks much better now! Note that @c Prs3d_ToolCylinder could be used for building both cones and cylinders depending on top/bottom radius definition.
|
||||
|
||||
There is one issue though - our cylinder doesn't have top and bottom anymore!
|
||||
To fix this problem we will use one more quadric builder @c Prs3d_ToolDisk:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
if (theMode == MyDispMode_Main)
|
||||
{
|
||||
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, 25, 25);
|
||||
Prs3d_ToolDisk aDisk (0.0, aRadius, 25, 1);
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb() + 2 * aDisk.VerticesNb(),
|
||||
3 * (aCyl.TrianglesNb() + 2 * aDisk.TrianglesNb()),
|
||||
Graphic3d_ArrayFlags_VertexNormal);
|
||||
aCyl .FillArray (aTris, gp_Trsf());
|
||||
aDisk.FillArray (aTris, gp_Trsf());
|
||||
|
||||
gp_Trsf aDisk2Trsf;
|
||||
aDisk2Trsf.SetTransformation (gp_Ax3 (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ(), gp::DX()), gp::XOY());
|
||||
aDisk.FillArray (aTris, aDisk2Trsf);
|
||||
|
||||
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
|
||||
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroupTris->AddPrimitiveArray (aTris);
|
||||
aGroupTris->SetClosed (true);
|
||||
...
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
Now our cylinder looks solid! The sample above merges two triangulations into a single one instead of appending each primitive array individually.
|
||||
|
||||
This looks like a minor difference, but it might have a _dramatic impact on performance_ in case of a large scene,
|
||||
as each `Graphic3d_ArrayOfPrimitives` is mapped into a dedicated draw call at graphic driver (OpenGL) level.
|
||||
|
||||
@figure{ais_object_step3_quadrics_fin.png,"@c Prs3d_ToolCylinder + @c Prs3d_ToolDisk.",409} height=409px
|
||||
|
||||
As an exercise, let's try computing a triangulation for cylinder disk without help of @c Prs3d_ToolDisk builder:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
if (theMode == MyDispMode_Main)
|
||||
{
|
||||
const int aNbSlices = 25;
|
||||
Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, aNbSlices, aNbSlices);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb(),
|
||||
3 * (aCyl.TrianglesNb()),
|
||||
Graphic3d_ArrayFlags_VertexNormal);
|
||||
aCyl.FillArray (aTris, gp_Trsf());
|
||||
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris2 =
|
||||
new Graphic3d_ArrayOfTriangles (aNbSlices + 1, aNbSlices * 3, Graphic3d_ArrayFlags_VertexNormal);
|
||||
aTris2->AddVertex (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ());
|
||||
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
|
||||
{
|
||||
double anAngle = M_PI * 2.0 * double(aSliceIter) / double(aNbSlices);
|
||||
aTris2->AddVertex (gp_Pnt (Cos (anAngle) * aRadius, Sin (anAngle) * aRadius, aHeight), -gp::DZ());
|
||||
}
|
||||
for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter)
|
||||
{
|
||||
aTris2->AddEdges (1, aSliceIter + 2, aSliceIter + 1 < aNbSlices ? (aSliceIter + 3) : 2);
|
||||
}
|
||||
|
||||
Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup();
|
||||
aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect());
|
||||
aGroupTris->AddPrimitiveArray (aTris);
|
||||
aGroupTris->AddPrimitiveArray (aTris2);
|
||||
...
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step3_quadrics_disk.png,"Manually triangulated disk.",409} height=409px
|
||||
|
||||
The disk is here, but it has a strange color - like it is not affected by lighting.
|
||||
This happens when vertex normals are defined incorrectly.
|
||||
In our case we defined disk normal as @c -DZ (see the second argument of @c Graphic3d_ArrayOfTriangles::AddVertex()),
|
||||
but normal direction should be also aligned to triangulation winding rule.
|
||||
Graphic driver defines the front side of triangle using clockwise order of triangle nodes, and normal should be defined for a front side of triangle - e.g. it should be @c gp::DZ() in our case.
|
||||
After reversing vertex normal direction, cylinder looks exactly like when @c Prs3d_ToolDisk was used.
|
||||
|
||||
Front / back face orientation might be displayed using different material based on @c Graphic3d_Aspects::SetDistinguish() flag and @c @::FrontMaterial() / @c @::BackMaterial() setup.
|
||||
|
||||
@section ais_selection Computing selection
|
||||
In the first part of the tutorial we have created a custom @c AIS object @c MyAisObject computing presentation by implementing the @c PrsMgr_PresentableObject::Compute() interface.
|
||||
In this part we will extend our object with interactive capabilities and make it selectable through implementing @c SelectMgr_SelectableObject interface.
|
||||
|
||||
Let's do the first step and put into @c @::ComputeSelection() method some logic.
|
||||
This method should fill in the @c SelectMgr_Selection argument with @c SelectMgr_SensitiveEntity entities defining selectable elements - triangulations, polylines, points and their composition.
|
||||
@c Select3D_SensitiveBox is probably the simplest way to define selectable volume - by it's bounding box:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
|
||||
Bnd_Box aBox;
|
||||
BRepBndLib::Add (aShape, aBox);
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBox);
|
||||
theSel->Add (aSensBox);
|
||||
}
|
||||
~~~~
|
||||
|
||||
@c SelectMgr_EntityOwner is a key object in selection logic - it serves as an identifier of a pickable object or it's part.
|
||||
You may see this object in methods like @c AIS_InteractiveContext::DetectedOwner(), **Owners** are stored within the list of selection objects @c AIS_Selection
|
||||
and it received by methods like @c AIS_InteractiveContext::SetSelected() and @c AIS_InteractiveContext::AddOrRemoveSelected().
|
||||
From the Selector's point of view, @c AIS_InteractiveObject is just a drawer for @c SelectMgr_EntityOwner.
|
||||
|
||||
The _**0th selection mode**_ normally defines a single Owner of the entire object.
|
||||
To make a composite object selectable as whole, we add to Selection as many SensitiveEntity as necessary referring to the same Owner.
|
||||
It might look confusing from first glance, that @c SelectMgr_SensitiveEntity stores @c SelectMgr_EntityOwner as a class field, and not in the opposite way
|
||||
(@c SelectMgr_EntityOwner doesn't store the list of @c SelectMgr_SensitiveEntity defining it's picking volume).
|
||||
|
||||
For local selection (selection of object parts) we create individual Owners for each part and add SensitiveEntity to Selection in the same way.
|
||||
Owner may store an additional identifier as a class field, like @c StdSelect_BRepOwner stores @c TopoDS_Shape as an identifier of picked sub-shape with @c AIS_Shape object.
|
||||
|
||||
In a similar way as @c StdPrs_ShadedShape is a **presentation builder** for @c TopoDS_Shape, the @c StdSelect_BRepSelectionTool can be seen as a standard **selection builder** for shapes:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight);
|
||||
Standard_Real aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer);
|
||||
StdSelect_BRepSelectionTool::Load (theSel, this, aShape, TopAbs_SHAPE, aDefl,
|
||||
myDrawer->DeviationAngle(),
|
||||
myDrawer->IsAutoTriangulation());
|
||||
}
|
||||
~~~~
|
||||
|
||||
Internally, @c StdSelect_BRepSelectionTool iterates over sub-shapes and appends to the Selection (@c theSel) entities like @c Select3D_SensitiveTriangulation (for faces) and @c Select3D_SensitiveCurve (for edges).
|
||||
|
||||
Previously, we have used @c Prs3d_ToolCylinder to triangulate a cylinder, so let's try to construct @c Select3D_SensitivePrimitiveArray from the same triangulation:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf());
|
||||
Handle(Select3D_SensitivePrimitiveArray) aSensTri =
|
||||
new Select3D_SensitivePrimitiveArray (anOwner);
|
||||
aSensTri->InitTriangulation (aTris->Attributes(), aTris->Indices(),
|
||||
TopLoc_Location());
|
||||
theSel->Add (aSensTri);
|
||||
}
|
||||
~~~~
|
||||
|
||||
Selection is computed independently from presentation, so that they don't have to match each other.
|
||||
But inconsistency between presentation and selection might confuse a user, when he will not be able to pick an object clearly displayed under the mouse cursor.
|
||||
These issues might happen, for example, when selection uses tessellated representation of the same geometry computed with different parameters (different number of subdivisions, or different deflection parameters).
|
||||
|
||||
As in case of @c @::Compute(), it makes sense defining some enumeration of **selection modes** supported by specific object and reject unsupported ones to avoid unexpected behavior:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (theMode != 0) { return; }
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
Unlike display modes, @c AIS_InteractiveContext allows activating an arbitrary combination of selection modes.
|
||||
A user should be careful to activate only the modes that actually make sense and may work together.
|
||||
|
||||
Selection mode to activate could be specified while displaying the object (passing _**-1**_ instead of _**0**_ would display an object with deactivated selection):
|
||||
|
||||
~~~~{.cpp}
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
|
||||
~~~~
|
||||
|
||||
Later on @c AIS_InteractiveContext::SetSelectionModeActive(), or it's wrappers @c AIS_InteractiveContext::Activate() and @c AIS_InteractiveContext::Deactivate(),
|
||||
could be used to enable or disable desired selection modes one by one.
|
||||
|
||||
@section sel_owner_highlight Highlighting selection owner
|
||||
|
||||
As has been mentioned in the previous section, @c SelectMgr_EntityOwner is a key object which can be used as an identifier of selectable part(s).
|
||||
Naturally, you might want to subclass it to put some application-specific ids for identification of selected parts.
|
||||
But there are more things you may do with the Owner class like customized highlighting.
|
||||
|
||||
Let's start from the beginning and define a custom Owner class:
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
DEFINE_STANDARD_RTTI_INLINE(MyAisOwner, SelectMgr_EntityOwner)
|
||||
public:
|
||||
MyAisOwner (const Handle(MyAisObject)& theObj, int thePriority = 0)
|
||||
: SelectMgr_EntityOwner (theObj, thePriority) {}
|
||||
|
||||
virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theMode) override
|
||||
{ base_type::HilightWithColor (thePrsMgr, theStyle, theMode); }
|
||||
|
||||
virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Standard_Integer theMode) override
|
||||
{ base_type::Unhilight (thePrsMgr, theMode); }
|
||||
protected:
|
||||
Handle(Prs3d_Presentation) myPrs;
|
||||
};
|
||||
~~~~
|
||||
|
||||
@c SelectMgr_EntityOwner doesn't define any pure virtual methods, and can be instanced straight ahead, like it was done within @c MyAisObject::ComputeSelection() implementation above.
|
||||
Let's revert usage of a dedicated display mode for highlighting (remove @c SetHilightMode() in @c MyAisObject constructor) and use our new class @c MyAisOwner within @c @::ComputeSelection():
|
||||
|
||||
~~~~{.cpp}
|
||||
MyAisObject::MyAisObject()
|
||||
{
|
||||
//SetHilightMode (MyDispMode_Highlight);
|
||||
myDrawer->SetupOwnShadingAspect();
|
||||
...
|
||||
}
|
||||
|
||||
void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const double aRadius = 100.0, aHeight = 100.0;
|
||||
Handle(MyAisOwner) anOwner = new MyAisOwner (this);
|
||||
...
|
||||
}
|
||||
~~~~
|
||||
|
||||
The further logic creating sensitive entities and filling in Selection could be left as is.
|
||||
Substitution of @c SelectMgr_EntityOwner with @c MyAisOwner currently doesn't change behavior and we see highlighting of the entire object through color modulation.
|
||||
This is because default implementation of @c SelectMgr_EntityOwner for highlighting logic looks like this (simplified):
|
||||
|
||||
~~~~{.cpp}
|
||||
void SelectMgr_EntityOwner::HilightWithColor (
|
||||
const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
const Graphic3d_ZLayerId aHiLayer =
|
||||
theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN
|
||||
? theStyle->ZLayer()
|
||||
: mySelectable->ZLayer();
|
||||
thePrsMgr->Color (mySelectable, theStyle, theMode, NULL, aHiLayer);
|
||||
}
|
||||
~~~~
|
||||
|
||||
@figure{ais_object_step4_highlight1.png,"Default behavior of @c SelectMgr_EntityOwner::HilightWithColor().",409} height=409px
|
||||
|
||||
Now, let's override the @c SelectMgr_EntityOwner::HilightWithColor() method and display a bounding box presentation:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (myPrs.IsNull())
|
||||
{
|
||||
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
|
||||
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
|
||||
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
|
||||
}
|
||||
if (!thePrsMgr->IsImmediateModeOn())
|
||||
{
|
||||
myPrs->Display();
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
@c SelectMgr_EntityOwner::HilightWithColor() doesn't receive a presentation to fill in as an argument; highlight presentation should be manually created and even explicitly displayed on the screen.
|
||||
To avoid code duplication, the code above reuses @c MyAisObject::Compute() already implementing computation of highlight presentation.
|
||||
|
||||
@figure{ais_object_step4_highlight2.png,"Result of custom implementation @c MyAisOwner::HilightWithColor().",409} height=409px
|
||||
|
||||
The visual result of the selected object looks exactly the same as when we've used a dedicated highlight mode.
|
||||
One thing became broken, though - highlighting remains displayed even after clearing selection.
|
||||
To fix this issue, we need implementing @c SelectMgr_EntityOwner::Unhilight() and hide our custom presentation explicitly:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (!myPrs.IsNull()) { myPrs->Erase(); }
|
||||
}
|
||||
~~~~
|
||||
|
||||
Another problem is that the object is no longer dynamically highlighted.
|
||||
To fix that we need to handle @c PrsMgr_PresentationManager::IsImmediateModeOn() specifically.
|
||||
Within this mode turned ON, presentation should be displayed on the screen with help of @c PrsMgr_PresentationManager::AddToImmediateList() method
|
||||
(it will be cleared from the screen automatically on the next mouse movement):
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
if (myPrs.IsNull())
|
||||
{
|
||||
myPrs = new Prs3d_Presentation (thePrsMgr->StructureManager());
|
||||
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
|
||||
anObj->Compute (thePrsMgr, myPrs, MyAisObject::MyDispMode_Highlight);
|
||||
}
|
||||
if (thePrsMgr->IsImmediateModeOn())
|
||||
{
|
||||
Handle(Prs3d_PresentationShadow) aShadow =
|
||||
new Prs3d_PresentationShadow (thePrsMgr->StructureManager(), myPrs);
|
||||
aShadow->SetZLayer (Graphic3d_ZLayerId_Top);
|
||||
aShadow->Highlight (theStyle);
|
||||
thePrsMgr->AddToImmediateList (aShadow);
|
||||
}
|
||||
else
|
||||
{
|
||||
myPrs->Display();
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
We may create two dedicated presentations for dynamic highlighting or reuse existing one for both cases with help of a transient object @c Prs3d_PresentationShadow.
|
||||
|
||||
Let's go further and make dynamic highlighting a little bit more interesting - by drawing a surface normal at the point where mouse picked the object:
|
||||
|
||||
~~~~{.cpp}
|
||||
void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr,
|
||||
const Handle(Prs3d_Drawer)& theStyle,
|
||||
const Standard_Integer theMode)
|
||||
{
|
||||
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
|
||||
if (thePrsMgr->IsImmediateModeOn())
|
||||
{
|
||||
Handle(StdSelect_ViewerSelector) aSelector =
|
||||
anObj->InteractiveContext()->MainSelector();
|
||||
SelectMgr_SortCriterion aPickPnt;
|
||||
for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter)
|
||||
{
|
||||
if (aSelector->Picked (aPickIter) == this)
|
||||
{
|
||||
aPickPnt = aSelector->PickedData (aPickIter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Handle(Prs3d_Presentation) aPrs = mySelectable->GetHilightPresentation (thePrsMgr);
|
||||
aPrs->SetZLayer (Graphic3d_ZLayerId_Top);
|
||||
aPrs->Clear();
|
||||
Handle(Graphic3d_Group) aGroup = aPrs->NewGroup();
|
||||
aGroupPnt->SetGroupPrimitivesAspect (theStyle->ArrowAspect()->Aspect());
|
||||
gp_Trsf aTrsfInv = mySelectable->LocalTransformation().Inverted();
|
||||
gp_Dir aNorm (aPickPnt.Normal.x(), aPickPnt.Normal.y(), aPickPnt.Normal.z());
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTris =
|
||||
Prs3d_Arrow::DrawShaded (gp_Ax1(aPickPnt.Point, aNorm).Transformed (aTrsfInv),
|
||||
1.0, 15.0,
|
||||
3.0, 4.0, 10);
|
||||
aGroupPnt->AddPrimitiveArray (aTris);
|
||||
thePrsMgr->AddToImmediateList (aPrs);
|
||||
}
|
||||
}
|
||||
~~~~
|
||||
|
||||
Code above does not store our new highlight presentation as a property of @c MyAisOwner, and instead uses @c SelectMgr_SelectableObject::GetHilightPresentation() method
|
||||
to create a presentation stored directly inside of our interactive object.
|
||||
|
||||
Next trick is passing through the last picking results in @c StdSelect_ViewerSelector.
|
||||
Dynamic highlighting is expected to be called right after picking, so that highlighted Owner should be always found in picking results.
|
||||
@c StdSelect_ViewerSelector::Picked() returns entities in the descending order of their distance from picking ray origin (mouse cursor);
|
||||
normally our Owner should be the very first one in this list when no selection filters are assigned to @c AIS_InteractiveContext.
|
||||
|
||||
@c SelectMgr_SortCriterion provides us useful information like 3D point on detected object lying on the picking ray, and surface normal direction at this point (actually, it would be a normal to a picked triangle),
|
||||
which we display as an arrow with help of @c Prs3d_Arrow presentation builder.
|
||||
|
||||
@figure{ais_object_step4_highlight3.png,"Surface normal on mouse over.",409} height=409px
|
||||
|
||||
Result looks pretty nice on the screenshot, but has interaction problems - once displayed, an arrow is no longer updated with further mouse movements.
|
||||
But this behavior is not a bug - @c AIS calls @c MyAisOwner::HilightWithColor() only when picking Owner changes to avoid unnecessary Viewer updates.
|
||||
To override this behavior, we may override @c SelectMgr_EntityOwner::IsForcedHilight() option:
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
...
|
||||
virtual bool IsForcedHilight() const override { return true; }
|
||||
};
|
||||
~~~~
|
||||
|
||||
This solves the problem within our specific use case.
|
||||
Keep in mind that most objects don't need updating highlight presentation on every mouse move;
|
||||
overriding this flag everywhere would be a waste of resources and may cause performance issues - use it sparingly.
|
||||
|
||||
@section highlight_apporaches Highlighting approaches
|
||||
|
||||
@c AIS provides one more alternative to handle presentation highlighting, which is managed by option @c SelectMgr_SelectableObject::IsAutoHilight().
|
||||
By default, this option is turned ON and redirects highlighting logic to @c SelectMgr_EntityOwner::HilightWithColor() demonstrated in the previous section.
|
||||
Turning this option OFF redirects highlighting logic to the interactive object itself @c SelectMgr_SelectableObject::HilightSelected().
|
||||
|
||||
Apart from moving the logic from Owner to Interactive Object, this approach allows handling highlighting of all selected Owners within the same Object at once and sharing a common presentation
|
||||
instead of per-Owner presentation - improving performance and reducing memory utilization in case of a large number of small selectable elements, like mesh nodes in @c MeshVS_Mesh object.
|
||||
|
||||
The further optimization of such a scenario would be using a single Owner for the entire Object
|
||||
storing the list of selected elements within the Owner itself - as utilized by @c AIS_PointCloud object for highlighting individual points.
|
||||
|
||||
We wouldn't describe these advanced techniques here in detail - let's just summarize main highlighting approaches available in @c AIS:
|
||||
- Highlighting of a main presentation of Interactive Object (active display mode)
|
||||
filled in by @c PrsMgr_PresentableObject::Compute()
|
||||
and displayed with color modulation by @c AIS logic.
|
||||
- Example: @c AIS_TextLabel.
|
||||
- Highlighting of a secondary presentation of Interactive Object
|
||||
filled in by @c PrsMgr_PresentableObject::Compute()
|
||||
and displayed with color modulation by @c AIS logic.
|
||||
- Example: @c AIS_Shape, displayed in @c AIS_Shaded display mode and highlighted using @c AIS_Wireframe display mode (default behavior).
|
||||
See also @c PrsMgr_PresentableObject::SetHilightMode().
|
||||
- Highlight presentation stored within a custom @c SelectMgr_EntityOwner
|
||||
and managed by @c SelectMgr_EntityOwner::HilightWithColor().
|
||||
- Example: @c StdSelect_BRepOwner for selection of sub-shapes.
|
||||
- Custom highlight presentation stored within Interactive Object itself
|
||||
(see @c SelectMgr_SelectableObject::GetHilightPresentation() / @c @::GetSelectPresentation() methods).
|
||||
- Filled in by @c SelectMgr_EntityOwner::HilightWithColor()
|
||||
with @c SelectMgr_SelectableObject::IsAutoHilight() turned ON.<br>
|
||||
Example: @c AIS_PointCloud.
|
||||
- Filled in by @c SelectMgr_SelectableObject::HilightSelected()
|
||||
with @c SelectMgr_SelectableObject::IsAutoHilight() turned OFF.<br>
|
||||
Example: @c MeshVS_Mesh.
|
||||
- Main presentation of Interactive Object (active display mode)
|
||||
filled in by @c PrsMgr_PresentableObject::Compute()
|
||||
and manually updated (recomputed or modified aspects) on highlight events.
|
||||
- Example: @c AIS_Manipulator.
|
||||
|
||||
The number of options looks overwhelming but in general, it is better to stick to the simplest approach working for you and consider alternatives only when you have to.
|
||||
|
||||
@section mouse_click Mouse click
|
||||
|
||||
Dynamic highlighting is only one of scenarios where @c SelectMgr_EntityOwner could be useful.
|
||||
Another feature is an interface for handling a mouse click @c SelectMgr_EntityOwner @c @::HandleMouseClick().
|
||||
|
||||
This interface is useful for defining some user interface elements like buttons, and most likely your application will use a more comprehensive GUI framework for this purpose instead of @c AIS.
|
||||
But let's have some fun and make our object to change a color on each mouse click:
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
...
|
||||
virtual bool HandleMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick) override;
|
||||
};
|
||||
|
||||
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick)
|
||||
{
|
||||
static math_BullardGenerator aRandGen;
|
||||
Quantity_Color aRandColor (float(aRandGen.NextInt() % 256) / 255.0f,
|
||||
float(aRandGen.NextInt() % 256) / 255.0f,
|
||||
float(aRandGen.NextInt() % 256) / 255.0f,
|
||||
Quantity_TOC_sRGB);
|
||||
mySelectable->Attributes()->ShadingAspect()->SetColor(aRandColor);
|
||||
mySelectable->SynchronizeAspects();
|
||||
return true;
|
||||
}
|
||||
~~~~
|
||||
|
||||
Looks pretty simple. Now let's make things more interesting and launch some simple object animation on each click.
|
||||
We use a couple of global (@c static) variables in our sample for simplicity - don't do that in a real production code.
|
||||
|
||||
~~~~{.cpp}
|
||||
class MyAisOwner : public SelectMgr_EntityOwner
|
||||
{
|
||||
...
|
||||
void SetAnimation (const Handle(AIS_Animation)& theAnim)
|
||||
{ myAnim = theAnim; }
|
||||
...
|
||||
Handle(AIS_Animation) myAnim;
|
||||
};
|
||||
|
||||
bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint,
|
||||
Aspect_VKeyMouse theButton,
|
||||
Aspect_VKeyFlags theModifiers,
|
||||
bool theIsDoubleClick)
|
||||
{
|
||||
static bool isFirst = true;
|
||||
isFirst = !isFirst;
|
||||
MyAisObject* anObj = dynamic_cast<MyAisObject*> (mySelectable);
|
||||
gp_Trsf aTrsfTo;
|
||||
aTrsfTo.SetRotation (gp_Ax1 (gp::Origin(), gp::DX()),
|
||||
isFirst ? M_PI * 0.5 : -M_PI * 0.5);
|
||||
gp_Trsf aTrsfFrom = anObj->LocalTransformation();
|
||||
Handle(AIS_AnimationObject) anAnim =
|
||||
new AIS_AnimationObject ("MyAnim", anObj->InteractiveContext(),
|
||||
anObj, aTrsfFrom, aTrsfTo);
|
||||
anAnim->SetOwnDuration (2.0);
|
||||
|
||||
myAnim->Clear();
|
||||
myAnim->Add (anAnim);
|
||||
myAnim->StartTimer (0.0, 1.0, true);
|
||||
return true;
|
||||
}
|
||||
~~~~
|
||||
|
||||
Animation is a complex topic that is worth a dedicated article - let's not go too deep in detail here.
|
||||
To perform animation in a non-interrupted way, it should be handled by some class like @c AIS_ViewController, which is responsible for managing user input events and for 3D viewer updates.
|
||||
To utilize it, you need adding a custom object animation to @c AIS_ViewController::ObjectsAnimation() or adding custom view animation to @c AIS_ViewController::ViewAnimation().
|
||||
Somewhere in application this might look like this:
|
||||
|
||||
~~~~{.cpp}
|
||||
Handle(AIS_InteractiveContext) theCtx;
|
||||
Handle(AIS_ViewController) theViewCtrl;
|
||||
Handle(MyAisObject) aPrs = new MyAisObject();
|
||||
aPrs->SetAnimation (theViewCtrl->ObjectsAnimation());
|
||||
theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false);
|
||||
~~~~
|
||||
|
||||
@section final Final result
|
||||
|
||||
The final sample could be seen by calling @c QATutorialAisObject command from Draw Harness plugin @c QAcommands (@c TKQADraw toolkit):
|
||||
|
||||
~~~~
|
||||
pload VISUALIZATION QAcommands
|
||||
vinit View1
|
||||
QATutorialAisObject p
|
||||
vfit
|
||||
~~~~
|
||||
|
||||
You may also take a look onto source code of this command at @c src/QADraw/QADraw_Tutorials.cxx if you have some problems following the tutorial.
|
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,76 +1,82 @@
|
||||
OCAF: Usage Tutorial {#samples__ocaf}
|
||||
========
|
||||
|
||||
## Getting Started
|
||||
|
||||
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
|
||||
You only have to create and determine the resources of the application for specifying the format of your documents (you generally use the standard one) and their file extension.
|
||||
|
||||
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
|
||||
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
|
||||
you aggregate a User attribute identified as a reflection coefficient
|
||||
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
|
||||
|
||||
If you need application specific data not provided with OCAF, for example, to incorporate a finite element model in the data structure,
|
||||
you define a new attribute class containing the mesh, and you include its persistent homologue in a new file format.
|
||||
|
||||
Once you have implemented the commands which create and modify the data structure according to your specification, OCAF provides you, without any additional programming:
|
||||
|
||||
* Persistent reference to any data, including geometric elements - several documents can be linked with such reference;
|
||||
* Document-View association;
|
||||
* Ready-to-use functions such as:
|
||||
* Undo-redo;
|
||||
* Save and open application data.
|
||||
|
||||
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
|
||||
* KDE Qt or GNOME GTK+ on Linux;
|
||||
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
|
||||
* Other commercial products such as Ilog Views.
|
||||
|
||||
You can also implement the user interface in the Java language using the Swing-based Java Application Desktop component (JAD) provided with OCAF.
|
||||
## Getting Started
|
||||
|
||||
At the beginning of your development, you first define an application class by inheriting from the Application abstract class.
|
||||
You only have to create and determine the resources of the application
|
||||
for specifying the format of your documents (you generally use the standard one) and their file extension.
|
||||
|
||||
Then, you design the application data model by organizing attributes you choose among those provided with OCAF.
|
||||
You can specialize these attributes using the User attribute. For example, if you need a reflection coefficient,
|
||||
you aggregate a User attribute identified as a reflection coefficient
|
||||
with a Real attribute containing the value of the coefficient (as such, you don't define a new class).
|
||||
|
||||
If you need application specific data not provided with OCAF, for example,
|
||||
to incorporate a finite element model in the data structure,
|
||||
you define a new attribute class containing the mesh,
|
||||
and you include its persistent homologue in a new file format.
|
||||
|
||||
Once you have implemented the commands which create and modify the data structure
|
||||
according to your specification, OCAF provides you, without any additional programming:
|
||||
|
||||
* Persistent reference to any data, including geometric elements â€" several documents can be linked with such reference;
|
||||
* Document-View association;
|
||||
* Ready-to-use functions such as :
|
||||
* Undo-redo;
|
||||
* Save and open application data.
|
||||
|
||||
Finally, you develop the application's graphical user interface using the toolkit of your choice, for example:
|
||||
* KDE Qt or GNOME GTK+ on Linux;
|
||||
* Microsoft Foundation Classes (MFC) on Windows Motif on Sun;
|
||||
* Other commercial products such as Ilog Views.
|
||||
|
||||
You can also implement the user interface in the Java language using
|
||||
the Swing-based Java Application Desktop component (JAD) provided with OCAF.
|
||||
|
||||
## An example of OCAF usage
|
||||
|
||||
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i>Formats</i> and <i>ResourcesName</i>
|
||||
To create a useful OCAF-based application, it is necessary to redefine two deferred methods: <i> Formats</i> and <i> ResourcesName</i>
|
||||
|
||||
In the <i>Formats</i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
|
||||
In the <i> Formats </i> method, add the format of the documents, which need to be read by the application and may have been built in other applications.
|
||||
|
||||
For example:
|
||||
|
||||
~~~~{.cpp}
|
||||
~~~~
|
||||
void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)
|
||||
{
|
||||
Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));
|
||||
}
|
||||
~~~~
|
||||
|
||||
In the <i>ResourcesName</i> method, you only define the name of the resource file.
|
||||
This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file.
|
||||
In the <i> ResourcesName</i> method, you only define the name of the resource file. This
|
||||
file contains several definitions for the saving and opening mechanisms associated
|
||||
with each format and calling of the plug-in file.
|
||||
|
||||
~~~~{.cpp}
|
||||
~~~~
|
||||
Standard_CString myApplication::ResourcesName()
|
||||
{
|
||||
return Standard_CString ("Resources");
|
||||
}
|
||||
~~~~
|
||||
|
||||
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i>CSF_PluginDefaults</i>, which defines the path of the plug-in file,
|
||||
and <i>CSF_ResourcesDefault</i>, which defines the resource file:
|
||||
To obtain the saving and opening mechanisms, it is necessary to set two environment variables: <i> CSF_PluginDefaults</i>, which defines the path of the plug-in file, and <i> CSF_ResourcesDefault</i>, which defines the resource file:
|
||||
|
||||
~~~~{.cpp}
|
||||
SetEnvironmentVariable ("CSF_ResourcesDefaults", myDirectory);
|
||||
SetEnvironmentVariable ("CSF_PluginDefaults", myDirectory);
|
||||
~~~~
|
||||
SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory);
|
||||
SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory);
|
||||
~~~~
|
||||
|
||||
The plugin and the resource files of the application will be located in <i>myDirector</i>.
|
||||
The plugin and the resource files of the application will be located in <i> myDirector</i>.
|
||||
The name of the plugin file must be <i>Plugin</i>.
|
||||
|
||||
### Resource File
|
||||
|
||||
The resource file describes the documents (type and extension) and the type of data that the application can manipulate
|
||||
The resource file describes the documents (type and extension) and
|
||||
the type of data that the application can manipulate
|
||||
by identifying the storage and retrieval drivers appropriate for this data.
|
||||
|
||||
Each driver is unique and identified by a GUID generated, for example, with the <i>uuidgen</i> tool in Windows.
|
||||
Each driver is unique and identified by a GUID generated, for example, with the <i> uuidgen </i> tool in Windows.
|
||||
|
||||
Five drivers are required to use all standard attributes provided within OCAF:
|
||||
|
||||
@@ -80,7 +86,8 @@ Five drivers are required to use all standard attributes provided within OCAF:
|
||||
* the attribute storage driver (47b0b826-d931-11d1-b5da-00a0c9064368)
|
||||
* the attribute retrieval driver (47b0b827-d931-11d1-b5da-00a0c9064368)
|
||||
|
||||
These drivers are provided as plug-ins and are located in the <i>PappStdPlugin</i> library.
|
||||
These drivers are provided as plug-ins and are located in the <i> PappStdPlugin</i> library.
|
||||
|
||||
|
||||
For example, this is a resource file, which declares a new model document OCAF-MyApplication:
|
||||
|
||||
@@ -97,11 +104,12 @@ OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c906436
|
||||
|
||||
### Plugin File
|
||||
|
||||
The plugin file describes the list of required plug-ins to run the application and the libraries in which plug-ins are located.
|
||||
The plugin file describes the list of required plug-ins to run the application and the
|
||||
libraries in which plug-ins are located.
|
||||
|
||||
You need at least the <i>FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
|
||||
You need at least the <i> FWOSPlugin</i> and the plug-in drivers to run an OCAF application.
|
||||
|
||||
The syntax of each item is <i>Identification.Location Library_Name</i>, where:
|
||||
The syntax of each item is <i> Identification.Location Library_Name, </i> where:
|
||||
* Identification is GUID.
|
||||
* Location defines the location of the Identification (where its definition is found).
|
||||
* Library_Name is the name (and path to) the library, where the plug-in is located.
|
||||
@@ -117,414 +125,412 @@ ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin
|
||||
47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
|
||||
47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin
|
||||
~~~~
|
||||
|
||||
|
||||
## Implementation of Attribute Transformation in a HXX file
|
||||
|
||||
~~~~{.cpp}
|
||||
#include <TDF_Attribute.hxx>
|
||||
~~~~
|
||||
\#include <TDF_Attribute.hxx>
|
||||
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
\#include <gp_Ax3.hxx>
|
||||
\#include <gp_Pnt.hxx>
|
||||
\#include <gp_Vec.hxx>
|
||||
\#include <gp_Trsf.hxx>
|
||||
|
||||
//! This attribute implements a transformation data container
|
||||
class MyPackage_Transformation : public TDF_Attribute
|
||||
{
|
||||
public: //!@ name Static methods
|
||||
public:
|
||||
//!@ name Static methods
|
||||
|
||||
//! The method returns a unique GUID of this attribute.
|
||||
//! By means of this GUID this attribute may be identified
|
||||
//! among other attributes attached to the same label.
|
||||
//! The method returns a unique GUID of this attribute.
|
||||
//! By means of this GUID this attribute may be identified
|
||||
//! among other attributes attached to the same label.
|
||||
Standard_EXPORT static const Standard_GUID& GetID ();
|
||||
|
||||
//! Finds or creates the attribute attached to <theLabel>.
|
||||
//! The found or created attribute is returned.
|
||||
//! Finds or creates the attribute attached to <theLabel>.
|
||||
//! The found or created attribute is returned.
|
||||
Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel);
|
||||
|
||||
public: //!@ name Methods for access to the attribute data
|
||||
//!@ name Methods for access to the attribute data
|
||||
|
||||
//! The method returns the transformation.
|
||||
Standard_EXPORT gp_Trsf Get () const;
|
||||
|
||||
//! The method returns the transformation.
|
||||
Standard_EXPORT gp_Trsf Get () const;
|
||||
//!@ name Methods for setting the data of transformation
|
||||
|
||||
public: //!@ name Methods for setting the data of transformation
|
||||
//! The method defines a rotation type of transformation.
|
||||
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
|
||||
|
||||
//! The method defines a rotation type of transformation.
|
||||
Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle);
|
||||
//! The method defines a translation type of transformation.
|
||||
Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
|
||||
|
||||
//! The method defines a translation type of transformation.
|
||||
Standard_EXPORT void SetTranslation (const gp_Vec& theVector);
|
||||
//! The method defines a point mirror type of transformation (point symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
|
||||
|
||||
//! The method defines a point mirror type of transformation (point symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Pnt& thePoint);
|
||||
//! The method defines an axis mirror type of transformation (axial symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
|
||||
|
||||
//! The method defines an axis mirror type of transformation (axial symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Ax1& theAxis);
|
||||
//! The method defines a point mirror type of transformation (planar symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
|
||||
|
||||
//! The method defines a point mirror type of transformation (planar symmetry).
|
||||
Standard_EXPORT void SetMirror (const gp_Ax2& thePlane);
|
||||
|
||||
//! The method defines a scale type of transformation.
|
||||
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
|
||||
//! The method defines a scale type of transformation.
|
||||
Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale);
|
||||
|
||||
//! The method defines a complex type of transformation from one coordinate system to another.
|
||||
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
|
||||
Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2);
|
||||
|
||||
public: //!@ name Overridden methods from TDF_Attribute
|
||||
//!@ name Overridden methods from TDF_Attribute
|
||||
|
||||
//! The method returns a unique GUID of the attribute.
|
||||
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
|
||||
Standard_EXPORT const Standard_GUID& ID () const;
|
||||
|
||||
//! The method returns a unique GUID of the attribute.
|
||||
//! By means of this GUID this attribute may be identified among other attributes attached to the same label.
|
||||
Standard_EXPORT const Standard_GUID& ID () const;
|
||||
//! The method is called on Undo / Redo.
|
||||
//! It copies the content of theAttribute into this attribute (copies the fields).
|
||||
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
|
||||
|
||||
//! The method is called on Undo / Redo.
|
||||
//! It copies the content of theAttribute into this attribute (copies the fields).
|
||||
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute);
|
||||
|
||||
//! It creates a new instance of this attribute.
|
||||
//! It is called on Copy / Paste, Undo / Redo.
|
||||
//! It creates a new instance of this attribute.
|
||||
//! It is called on Copy / Paste, Undo / Redo.
|
||||
Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const;
|
||||
|
||||
//! The method is called on Copy / Paste.
|
||||
//! It copies the content of this attribute into theAttribute (copies the fields).
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
|
||||
//! The method is called on Copy / Paste.
|
||||
//! It copies the content of this attribute into theAttribute (copies the fields).
|
||||
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable);
|
||||
|
||||
//! Prints the content of this attribute into the stream.
|
||||
//! Prints the content of this attribute into the stream.
|
||||
Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS);
|
||||
|
||||
public: //!@ name Constructor
|
||||
//!@ name Constructor
|
||||
|
||||
//! The C++ constructor of this attribute class.
|
||||
//! Usually it is never called outside this class.
|
||||
//! Usually it is never called outside this class.
|
||||
Standard_EXPORT MyPackage_Transformation();
|
||||
|
||||
private:
|
||||
gp_TrsfForm myType;
|
||||
|
||||
// Axes (Ax1, Ax2, Ax3)
|
||||
// Axes (Ax1, Ax2, Ax3)
|
||||
gp_Ax1 myAx1;
|
||||
gp_Ax2 myAx2;
|
||||
gp_Ax3 myFirstAx3;
|
||||
gp_Ax3 mySecondAx3;
|
||||
|
||||
// Scalar values
|
||||
// Scalar values
|
||||
Standard_Real myAngle;
|
||||
Standard_Real myScale;
|
||||
|
||||
// Points
|
||||
// Points
|
||||
gp_Pnt myFirstPoint;
|
||||
gp_Pnt mySecondPoint;
|
||||
};
|
||||
};
|
||||
~~~~
|
||||
|
||||
## Implementation of Attribute Transformation in a CPP file
|
||||
|
||||
~~~~{.cpp}
|
||||
#include <MyPackage_Transformation.hxx>
|
||||
\#include <MyPackage_Transformation.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose : The method returns a unique GUID of this attribute.
|
||||
// By means of this GUID this attribute may be identified
|
||||
// among other attributes attached to the same label.
|
||||
//=======================================================================
|
||||
const Standard_GUID& MyPackage_Transformation::GetID()
|
||||
{
|
||||
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
|
||||
return ID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose : Finds or creates the attribute attached to <theLabel>.
|
||||
// The found or created attribute is returned.
|
||||
//=======================================================================
|
||||
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(MyPackage_Transformation) T;
|
||||
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
|
||||
{
|
||||
T = new MyPackage_Transformation();
|
||||
theLabel.AddAttribute(T);
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose : The method returns the transformation.
|
||||
//=======================================================================
|
||||
gp_Trsf MyPackage_Transformation::Get() const
|
||||
{
|
||||
gp_Trsf transformation;
|
||||
switch (myType)
|
||||
{
|
||||
case gp_Identity:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case gp_Rotation:
|
||||
{
|
||||
transformation.SetRotation(myAx1, myAngle);
|
||||
break;
|
||||
}
|
||||
case gp_Translation:
|
||||
{
|
||||
transformation.SetTranslation(myFirstPoint, mySecondPoint);
|
||||
break;
|
||||
}
|
||||
case gp_PntMirror:
|
||||
{
|
||||
transformation.SetMirror(myFirstPoint);
|
||||
break;
|
||||
}
|
||||
case gp_Ax1Mirror:
|
||||
{
|
||||
transformation.SetMirror(myAx1);
|
||||
break;
|
||||
}
|
||||
case gp_Ax2Mirror:
|
||||
{
|
||||
transformation.SetMirror(myAx2);
|
||||
break;
|
||||
}
|
||||
case gp_Scale:
|
||||
{
|
||||
transformation.SetScale(myFirstPoint, myScale);
|
||||
break;
|
||||
}
|
||||
case gp_CompoundTrsf:
|
||||
{
|
||||
transformation.SetTransformation(myFirstAx3, mySecondAx3);
|
||||
break;
|
||||
}
|
||||
case gp_Other:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return transformation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRotation
|
||||
//purpose : The method defines a rotation type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Rotation;
|
||||
myAx1 = theAxis;
|
||||
myAngle = theAngle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTranslation
|
||||
//purpose : The method defines a translation type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Translation;
|
||||
myFirstPoint.SetCoord(0, 0, 0);
|
||||
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines a point mirror type of transformation
|
||||
// (point symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_PntMirror;
|
||||
myFirstPoint = thePoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines an axis mirror type of transformation
|
||||
// (axial symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Ax1Mirror;
|
||||
myAx1 = theAxis;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines a point mirror type of transformation
|
||||
// (planar symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Ax2Mirror;
|
||||
myAx2 = thePlane;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetScale
|
||||
//purpose : The method defines a scale type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Scale;
|
||||
myFirstPoint = thePoint;
|
||||
myScale = theScale;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformation
|
||||
//purpose : The method defines a complex type of transformation
|
||||
// from one coordinate system to another.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetTransformation(const gp_Ax3& theCoordinateSystem1,
|
||||
const gp_Ax3& theCoordinateSystem2)
|
||||
{
|
||||
Backup();
|
||||
myFirstAx3 = theCoordinateSystem1;
|
||||
mySecondAx3 = theCoordinateSystem2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose : The method returns a unique GUID of the attribute.
|
||||
// By means of this GUID this attribute may be identified
|
||||
// among other attributes attached to the same label.
|
||||
//=======================================================================
|
||||
const Standard_GUID& MyPackage_Transformation::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose : The method is called on Undo / Redo.
|
||||
// It copies the content of <theAttribute>
|
||||
// into this attribute (copies the fields).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
|
||||
{
|
||||
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
|
||||
myType = theTransformation->myType;
|
||||
myAx1 = theTransformation->myAx1;
|
||||
myAx2 = theTransformation->myAx2;
|
||||
myFirstAx3 = theTransformation->myFirstAx3;
|
||||
mySecondAx3 = theTransformation->mySecondAx3;
|
||||
myAngle = theTransformation->myAngle;
|
||||
myScale = theTransformation->myScale;
|
||||
myFirstPoint = theTransformation->myFirstPoint;
|
||||
mySecondPoint = theTransformation->mySecondPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose : It creates a new instance of this attribute.
|
||||
// It is called on Copy / Paste, Undo / Redo.
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
|
||||
{
|
||||
return new MyPackage_Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : The method is called on Copy / Paste.
|
||||
// It copies the content of this attribute into
|
||||
// <theAttribute> (copies the fields).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::Paste(const Handle(TDF_Attribute)& theAttribute,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
|
||||
theTransformation->myType = myType;
|
||||
theTransformation->myAx1 = myAx1;
|
||||
theTransformation->myAx2 = myAx2;
|
||||
theTransformation->myFirstAx3 = myFirstAx3;
|
||||
theTransformation->mySecondAx3 = mySecondAx3;
|
||||
theTransformation->myAngle = myAngle;
|
||||
theTransformation->myScale = myScale;
|
||||
theTransformation->myFirstPoint = myFirstPoint;
|
||||
theTransformation->mySecondPoint = mySecondPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose : Prints the content of this attribute into the stream.
|
||||
//=======================================================================
|
||||
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& anOS) const
|
||||
{
|
||||
anOS = "Transformation: ";
|
||||
switch (myType)
|
||||
{
|
||||
case gp_Identity:
|
||||
{
|
||||
anOS = "gp_Identity";
|
||||
break;
|
||||
}
|
||||
case gp_Rotation:
|
||||
{
|
||||
anOS = "gp_Rotation";
|
||||
break;
|
||||
}
|
||||
case gp_Translation:
|
||||
{
|
||||
anOS = "gp_Translation";
|
||||
break;
|
||||
}
|
||||
case gp_PntMirror:
|
||||
{
|
||||
anOS = "gp_PntMirror";
|
||||
break;
|
||||
}
|
||||
case gp_Ax1Mirror:
|
||||
{
|
||||
anOS = "gp_Ax1Mirror";
|
||||
break;
|
||||
}
|
||||
case gp_Ax2Mirror:
|
||||
{
|
||||
anOS = "gp_Ax2Mirror";
|
||||
break;
|
||||
}
|
||||
case gp_Scale:
|
||||
{
|
||||
anOS = "gp_Scale";
|
||||
break;
|
||||
}
|
||||
case gp_CompoundTrsf:
|
||||
{
|
||||
anOS = "gp_CompoundTrsf";
|
||||
break;
|
||||
}
|
||||
case gp_Other:
|
||||
{
|
||||
anOS = "gp_Other";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose : The method returns a unique GUID of this attribute.
|
||||
// By means of this GUID this attribute may be identified
|
||||
// among other attributes attached to the same label.
|
||||
//function : MyPackage_Transformation
|
||||
//purpose : A constructor.
|
||||
//=======================================================================
|
||||
const Standard_GUID& MyPackage_Transformation::GetID()
|
||||
{
|
||||
static Standard_GUID ID("4443368E-C808-4468-984D-B26906BA8573");
|
||||
return ID;
|
||||
}
|
||||
MyPackage_Transformation::MyPackage_Transformation():myType(gp_Identity){
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose : Finds or creates the attribute attached to <theLabel>.
|
||||
// The found or created attribute is returned.
|
||||
//=======================================================================
|
||||
Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel)
|
||||
{
|
||||
Handle(MyPackage_Transformation) T;
|
||||
if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T))
|
||||
{
|
||||
T = new MyPackage_Transformation();
|
||||
theLabel.AddAttribute(T);
|
||||
}
|
||||
return T;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose : The method returns the transformation.
|
||||
//=======================================================================
|
||||
gp_Trsf MyPackage_Transformation::Get() const
|
||||
{
|
||||
gp_Trsf transformation;
|
||||
switch (myType)
|
||||
{
|
||||
case gp_Identity:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case gp_Rotation:
|
||||
{
|
||||
transformation.SetRotation(myAx1, myAngle);
|
||||
break;
|
||||
}
|
||||
case gp_Translation:
|
||||
{
|
||||
transformation.SetTranslation(myFirstPoint, mySecondPoint);
|
||||
break;
|
||||
}
|
||||
case gp_PntMirror:
|
||||
{
|
||||
transformation.SetMirror(myFirstPoint);
|
||||
break;
|
||||
}
|
||||
case gp_Ax1Mirror:
|
||||
{
|
||||
transformation.SetMirror(myAx1);
|
||||
break;
|
||||
}
|
||||
case gp_Ax2Mirror:
|
||||
{
|
||||
transformation.SetMirror(myAx2);
|
||||
break;
|
||||
}
|
||||
case gp_Scale:
|
||||
{
|
||||
transformation.SetScale(myFirstPoint, myScale);
|
||||
break;
|
||||
}
|
||||
case gp_CompoundTrsf:
|
||||
{
|
||||
transformation.SetTransformation(myFirstAx3, mySecondAx3);
|
||||
break;
|
||||
}
|
||||
case gp_Other:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return transformation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRotation
|
||||
//purpose : The method defines a rotation type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Rotation;
|
||||
myAx1 = theAxis;
|
||||
myAngle = theAngle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTranslation
|
||||
//purpose : The method defines a translation type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetTranslation(const gp_Vec& theVector)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Translation;
|
||||
myFirstPoint.SetCoord(0, 0, 0);
|
||||
mySecondPoint.SetCoord(theVector.X(), theVector.Y(), theVector.Z());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines a point mirror type of transformation
|
||||
// (point symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Pnt& thePoint)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_PntMirror;
|
||||
myFirstPoint = thePoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines an axis mirror type of transformation
|
||||
// (axial symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Ax1& theAxis)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Ax1Mirror;
|
||||
myAx1 = theAxis;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetMirror
|
||||
//purpose : The method defines a point mirror type of transformation
|
||||
// (planar symmetry).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Ax2Mirror;
|
||||
myAx2 = thePlane;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetScale
|
||||
//purpose : The method defines a scale type of transformation.
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale)
|
||||
{
|
||||
Backup();
|
||||
myType = gp_Scale;
|
||||
myFirstPoint = thePoint;
|
||||
myScale = theScale;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTransformation
|
||||
//purpose : The method defines a complex type of transformation
|
||||
// from one coordinate system to another
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::SetTransformation (const gp_Ax3& theCoordinateSystem1,
|
||||
const gp_Ax3& theCoordinateSystem2)
|
||||
{
|
||||
Backup();
|
||||
myFirstAx3 = theCoordinateSystem1;
|
||||
mySecondAx3 = theCoordinateSystem2;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose : The method returns a unique GUID of the attribute.
|
||||
// By means of this GUID this attribute may be identified
|
||||
// among other attributes attached to the same label.
|
||||
//=======================================================================
|
||||
const Standard_GUID& MyPackage_Transformation::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose : The method is called on Undo / Redo.
|
||||
// It copies the content of <theAttribute>
|
||||
// into this attribute (copies the fields).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute)
|
||||
{
|
||||
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
|
||||
myType = theTransformation->myType;
|
||||
myAx1 = theTransformation->myAx1;
|
||||
myAx2 = theTransformation->myAx2;
|
||||
myFirstAx3 = theTransformation->myFirstAx3;
|
||||
mySecondAx3 = theTransformation->mySecondAx3;
|
||||
myAngle = theTransformation->myAngle;
|
||||
myScale = theTransformation->myScale;
|
||||
myFirstPoint = theTransformation->myFirstPoint;
|
||||
mySecondPoint = theTransformation->mySecondPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose : It creates a new instance of this attribute.
|
||||
// It is called on Copy / Paste, Undo / Redo.
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const
|
||||
{
|
||||
return new MyPackage_Transformation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose : The method is called on Copy / Paste.
|
||||
// It copies the content of this attribute into
|
||||
// <theAttribute> (copies the fields).
|
||||
//=======================================================================
|
||||
void MyPackage_Transformation::Paste (const Handle(TDF_Attribute)& theAttribute,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute);
|
||||
theTransformation->myType = myType;
|
||||
theTransformation->myAx1 = myAx1;
|
||||
theTransformation->myAx2 = myAx2;
|
||||
theTransformation->myFirstAx3 = myFirstAx3;
|
||||
theTransformation->mySecondAx3 = mySecondAx3;
|
||||
theTransformation->myAngle = myAngle;
|
||||
theTransformation->myScale = myScale;
|
||||
theTransformation->myFirstPoint = myFirstPoint;
|
||||
theTransformation->mySecondPoint = mySecondPoint;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose : Prints the content of this attribute into the stream.
|
||||
//=======================================================================
|
||||
Standard_OStream& MyPackage_Transformation::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
anOS << "Transformation: ";
|
||||
switch (myType)
|
||||
{
|
||||
case gp_Identity:
|
||||
{
|
||||
anOS << "gp_Identity";
|
||||
break;
|
||||
}
|
||||
case gp_Rotation:
|
||||
{
|
||||
anOS << "gp_Rotation";
|
||||
break;
|
||||
}
|
||||
case gp_Translation:
|
||||
{
|
||||
anOS << "gp_Translation";
|
||||
break;
|
||||
}
|
||||
case gp_PntMirror:
|
||||
{
|
||||
anOS << "gp_PntMirror";
|
||||
break;
|
||||
}
|
||||
case gp_Ax1Mirror:
|
||||
{
|
||||
anOS << "gp_Ax1Mirror";
|
||||
break;
|
||||
}
|
||||
case gp_Ax2Mirror:
|
||||
{
|
||||
anOS << "gp_Ax2Mirror";
|
||||
break;
|
||||
}
|
||||
case gp_Scale:
|
||||
{
|
||||
anOS << "gp_Scale";
|
||||
break;
|
||||
}
|
||||
case gp_CompoundTrsf:
|
||||
{
|
||||
anOS << "gp_CompoundTrsf";
|
||||
break;
|
||||
}
|
||||
case gp_Other:
|
||||
{
|
||||
anOS << "gp_Other";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MyPackage_Transformation
|
||||
//purpose : A constructor.
|
||||
//=======================================================================
|
||||
MyPackage_Transformation::MyPackage_Transformation()
|
||||
: myType (gp_Identity)
|
||||
{
|
||||
//
|
||||
}
|
||||
~~~~
|
||||
|
||||
## Implementation of typical actions with standard OCAF attributes.
|
||||
## Implementation of typical actions with standard OCAF attributes.
|
||||
|
||||
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'.
|
||||
They present typical actions with OCAF services (mainly for newcomers).
|
||||
There are four sample files provided in the directory 'OpenCasCade/ros/samples/ocafsamples'. They present typical actions with OCAF services (mainly for newcomers).
|
||||
The method *Sample()* of each file is not dedicated for execution 'as is', it is rather a set of logical actions using some OCAF services.
|
||||
|
||||
### TDataStd_Sample.cxx
|
||||
@@ -543,7 +549,7 @@ This sample contains templates for typical actions with the following standard O
|
||||
- TDataXtd_Constraint attribute management;
|
||||
- TDataStd_Directory attribute management;
|
||||
- TDataStd_TreeNode attribute management.
|
||||
|
||||
|
||||
### TDocStd_Sample.cxx
|
||||
This sample contains template for the following typical actions:
|
||||
- creating application;
|
||||
@@ -554,7 +560,7 @@ This sample contains template for the following typical actions:
|
||||
- closing a document;
|
||||
- opening the document stored in the file;
|
||||
- copying content of a document to another document with possibility to update the copy in the future.
|
||||
|
||||
|
||||
### TPrsStd_Sample.cxx
|
||||
This sample contains template for the following typical actions:
|
||||
- starting with data framework;
|
||||
@@ -571,7 +577,7 @@ This sample contains template for the following typical actions:
|
||||
- updating and displaying presentation of the attribute to be displayed;
|
||||
- setting a color to the displayed attribute;
|
||||
- getting transparency of the displayed attribute;
|
||||
- modify attribute;
|
||||
- modify attribute;
|
||||
- updating presentation of the attribute in viewer.
|
||||
|
||||
### TNaming_Sample.cxx
|
||||
@@ -585,3 +591,4 @@ The following scenario is used:
|
||||
- creating a Fillet (using the selected edges) and pushing the result as a modification of Box1;
|
||||
- creating a Cut (Box1, Box2) as a modification of Box1 and push it in DF;
|
||||
- recovering the result from DF.
|
||||
|
||||
|
@@ -14,8 +14,6 @@
|
||||
<br>A set of code snippets performing typical actions with @ref occt_user_guides__ocaf "OCAF" services for newcomers.
|
||||
* @ref samples__ocaf_func
|
||||
<br>A simple example dedicated to the usage of "Function Mechanism" of @ref occt_user_guides__ocaf "OCCT Application Framework".
|
||||
* @ref tutorials__ais_object
|
||||
<br>A programming tutorial teaching how to compute presentation within AIS_InteractiveObject subclass for displaying in @ref occt_user_guides__visualization "OCCT 3D Viewer".
|
||||
- @subpage samples__projects
|
||||
* @ref samples_qt_iesample
|
||||
<br>A cross-platform multi-document 3D Viewer sample with CAD import / export functionality based on **Qt Widgets** framework.
|
||||
@@ -46,7 +44,6 @@
|
||||
- @subpage occt__tutorial
|
||||
- @subpage samples__ocaf
|
||||
- @subpage samples__ocaf_func
|
||||
- @subpage tutorials__ais_object
|
||||
|
||||
@page samples__projects Sample Projects
|
||||
- @subpage samples_qt_iesample
|
||||
|
@@ -7,8 +7,6 @@ Upgrade from older OCCT versions {#occt__upgrade}
|
||||
|
||||
This document provides technical details on changes made in particular versions of OCCT. It can help to upgrade user applications based on previous versions of OCCT to newer ones.
|
||||
|
||||
@ref upgrade_occt770 "SEEK TO THE LAST CHAPTER (UPGRADE TO 7.7.0)"
|
||||
|
||||
@subsection upgrade_intro_precautions Precautions
|
||||
|
||||
Back-up your code before the upgrade.
|
||||
@@ -26,6 +24,7 @@ The automatic upgrade tool is provided as is, without warranty of any kind, and
|
||||
It is your responsibility to ensure that the changes you made in your code are correct.
|
||||
When you upgrade the code by an automatic script, make sure to carefully review the introduced changes at each step before committing them.
|
||||
|
||||
|
||||
@section upgrade_65 Upgrade to OCCT 6.5.0
|
||||
|
||||
Porting of user applications from an earlier OCCT version to version 6.5 requires taking into account the following major changes:
|
||||
@@ -2300,10 +2299,6 @@ void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface,
|
||||
Building OCCT now requires C++11-compliant compiler, so that some legacy compilers (Visual Studio 2010 and 2012) are no more supported.
|
||||
It is recommended using Visual Studio 2015 or newer for building OCCT on Windows platform.
|
||||
|
||||
@subsection upgrade_770_removed_features Removed features
|
||||
|
||||
* One of the constructors of the BRepExtrema_DistanceSS class (the one without deflection parameter) has been removed as excessive. The remaining constructor has to be used instead.
|
||||
|
||||
@subsection upgrade_occt770_parallel_flag_removed Removed parameter theIsParallel from Put/Compute/Perform
|
||||
|
||||
theIsParallel parameter has been removed from Put/Compute/Perform from the next classes:
|
||||
@@ -2326,10 +2321,3 @@ aValidateEdge.Process();
|
||||
`Prs3d_Drawer` getters no more implicitly create "default" aspects.
|
||||
If specific property has not been set before to this drawer instance nor to linked drawer instance, then NULL property will be returned.
|
||||
Make sure to set property beforehand or to call `SetOwn*` / `SetupOwn*` methods to derive from defaults.
|
||||
|
||||
@subsection upgrade_occt770_opengl OpenGL functions
|
||||
|
||||
Applications extending OCCT 3D Viewer and calling OpenGL functions directly (like @c @::glEnable(), e.g. using global namespace) might be affected by changes in `OpenGl_GlFunctions.hxx`.
|
||||
This header, as well as `OpenGl_GlCore20.hxx` and similar, no more include system OpenGL / OpenGL ES headers to define function table.
|
||||
Application code calling OpenGL functions directly should be changed to either use `OpenGl_Context::core11fwd` (as designed)
|
||||
or to include system OpenGL headers in advance (with help of `OpenGl_GlNative.hxx`).
|
||||
|
@@ -165,9 +165,7 @@ if (!Interface_Static::SetIVal ("read.maxprecision.mode",1))
|
||||
Default value is *Preferred (0)*.
|
||||
|
||||
<h4>read.maxprecision.val</h4>
|
||||
defines the maximum allowable tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape.
|
||||
It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*).
|
||||
Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
|
||||
defines the maximum allowable tolerance (in mm) of the shape. It should be not less than the basis value of tolerance set in processor (either Resolution from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance.
|
||||
Read this parameter with:
|
||||
~~~~{.cpp}
|
||||
Standard_Real rp = Interface_Static::RVal("read.maxprecision.val");
|
||||
|
@@ -182,9 +182,7 @@ By default this value is 0.0001.
|
||||
The value given to this parameter is a basic value for ShapeHealing algorithms and the processor. It does its best to reach it. Under certain circumstances, the value you give may not be attached to all of the entities concerned at the end of processing. STEP-to-OpenCASCADE translation does not improve the quality of the geometry in the original STEP file. This means that the value you enter may be impossible to attach to all shapes with the given quality of the geometry in the STEP file.
|
||||
|
||||
<h4>read.maxprecision.val</h4>
|
||||
Defines the maximum allowed tolerance (in internal units, which are specified in xstep.cascade.unit) of the shape.
|
||||
It should be not less than the basic value of tolerance set in the processor (either the uncertainty from the file or *read.precision.val*).
|
||||
Actually, the maximum between *read.maxprecision.val* and the basis tolerance is used to define the maximum allowed tolerance.
|
||||
Defines the maximum allowed tolerance (in mm) of the shape. It should be not less than the basic value of tolerance set in the processor (either the uncertainty from the file or *read.precision.val*). Actually, the maximum between *read.maxprecision.val* and the basis tolerance is used to define the maximum allowed tolerance.
|
||||
|
||||
Read this parameter with:
|
||||
~~~~{.cpp}
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include <AIS_AnimationCamera.hxx>
|
||||
|
||||
#include <Graphic3d_Camera.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationCamera, AIS_Animation)
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#include <AIS_AnimationObject.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_AnimationObject, AIS_Animation)
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
class SelectMgr_EntityOwner;
|
||||
|
||||
|
@@ -36,6 +36,8 @@
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_NumericError.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <UnitsAPI.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Axis,AIS_InteractiveObject)
|
||||
|
@@ -17,9 +17,12 @@
|
||||
// <g_design>
|
||||
|
||||
#include <AIS_BadEdgeFilter.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_BadEdgeFilter,SelectMgr_Filter)
|
||||
|
@@ -18,10 +18,12 @@
|
||||
#define _AIS_BadEdgeFilter_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopTools_DataMapOfIntegerListOfShape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
class SelectMgr_EntityOwner;
|
||||
class TopoDS_Edge;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include <AIS_C0RegularityFilter.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
@@ -18,9 +18,11 @@
|
||||
#define _AIS_C0RegularityFilter_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
class TopoDS_Shape;
|
||||
class SelectMgr_EntityOwner;
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <GC_MakeArcOfCircle.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
@@ -31,6 +32,8 @@
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_DeflectionCurve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Circle,AIS_InteractiveObject)
|
||||
|
||||
|
@@ -17,18 +17,26 @@
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Aspect_TypeOfColorScaleData.hxx>
|
||||
#include <Aspect_TypeOfColorScalePosition.hxx>
|
||||
#include <Aspect_Window.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Graphic3d_ArrayOfPolygons.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveSegment.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ColorScale, AIS_InteractiveObject)
|
||||
|
@@ -19,21 +19,28 @@
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepMesh_IncrementalMesh.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <StdSelect_BRepSelectionTool.hxx>
|
||||
#include <StdPrs_ShadedShape.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <AIS_DataMapOfShapeDrawer.hxx>
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <NCollection_IndexedDataMap.hxx>
|
||||
#include <StdPrs_Volume.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TColStd_MapTransientHasher.hxx>
|
||||
|
@@ -20,16 +20,22 @@
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_ProgramError.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_HLRPolyShape.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <StdSelect.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_OrientedShapeMapHasher.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ConnectedInteractive,AIS_InteractiveObject)
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <AIS_ColoredDrawer.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, Handle(AIS_ColoredDrawer), TopTools_ShapeMapHasher> AIS_DataMapOfShapeDrawer;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_ExclusionFilter,SelectMgr_Filter)
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColStd_DataMapOfIntegerListOfInteger.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
|
@@ -18,10 +18,13 @@
|
||||
#define _AIS_GlobalStatus_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <AIS_DisplayStatus.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
|
||||
|
@@ -16,7 +16,9 @@
|
||||
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <Aspect_InteriorStyle.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_DimensionAspect.hxx>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Quantity_NameOfColor.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <AIS_TypeOfAttribute.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
|
@@ -21,7 +21,9 @@
|
||||
#include <AIS_GlobalStatus.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_MultipleConnectedInteractive.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_BasicAspect.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
@@ -29,6 +31,7 @@
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfMapOfTransient.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TopAbs_ShapeEnum.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class V3d_Viewer;
|
||||
@@ -1433,8 +1434,8 @@ protected: //! @name internal methods
|
||||
}
|
||||
|
||||
//! Bind/Unbind status to object and its children
|
||||
//! @param[in] theIObj the object to change status
|
||||
//! @param[in] theStatus status, if NULL, unbind object
|
||||
//! @param theObj [in] the object to change status
|
||||
//! @param theStatus status, if NULL, unbind object
|
||||
Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
|
||||
const PrsMgr_DisplayStatus theStatus,
|
||||
const Standard_Integer theDispyMode,
|
||||
|
@@ -17,6 +17,10 @@
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_CStructure.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_CView.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#define _AIS_LightSource_HeaderFile
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Graphic3d_CLight.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
||||
class Select3D_SensitiveSphere;
|
||||
|
@@ -18,11 +18,13 @@
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <GC_MakeSegment.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
#include <Geom_Point.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
@@ -32,6 +34,7 @@
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Curve.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <UnitsAPI.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject)
|
||||
|
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <AIS_Manipulator.hxx>
|
||||
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_ManipulatorOwner.hxx>
|
||||
#include <Extrema_ExtElC.hxx>
|
||||
|
@@ -18,14 +18,17 @@
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_ManipulatorMode.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfQuadrangles.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <NCollection_HSequence.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Standard_Version.hxx>
|
||||
#include <Standard_DefineHandle.hxx>
|
||||
|
||||
NCOLLECTION_HSEQUENCE(AIS_ManipulatorObjectSequence, Handle(AIS_InteractiveObject))
|
||||
|
@@ -16,8 +16,10 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Media_PlayerContext.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_MediaTexture.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
@@ -19,7 +19,10 @@
|
||||
#include <AIS_ConnectedInteractive.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_MultipleConnectedInteractive,AIS_InteractiveObject)
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <AIS_Plane.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <DsgPrs_ShadedPlanePresentation.hxx>
|
||||
#include <DsgPrs_XYZPlanePresentation.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
@@ -44,7 +45,11 @@
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StdPrs_Plane.hxx>
|
||||
#include <StdPrs_ShadedShape.hxx>
|
||||
#include <StdPrs_ShadedSurface.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_HArray1OfPnt.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Plane,AIS_InteractiveObject)
|
||||
|
||||
|
@@ -18,10 +18,13 @@
|
||||
// + (-1) selection mode token into account
|
||||
// (SAMTECH specific)
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_Line.hxx>
|
||||
#include <AIS_PlaneTrihedron.hxx>
|
||||
#include <AIS_Point.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <DsgPrs_XYZAxisPresentation.hxx>
|
||||
#include <Geom_Axis1Placement.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Geom_Line.hxx>
|
||||
@@ -30,6 +33,9 @@
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
|
@@ -17,11 +17,15 @@
|
||||
#include <AIS_Point.hxx>
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||
#include <Geom_Point.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitivePoint.hxx>
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#ifndef _AIS_Point_HeaderFile
|
||||
#define _AIS_Point_HeaderFile
|
||||
|
||||
#include <Aspect_TypeOfMarker.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
|
||||
class Geom_Point;
|
||||
|
@@ -17,11 +17,13 @@
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_Presentations.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitivePrimitiveArray.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
|
@@ -23,7 +23,10 @@
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_TransModeFlags.hxx>
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <SelectMgr_EntityOwner.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
|
||||
|
||||
|
@@ -80,10 +80,10 @@ public:
|
||||
const Handle(SelectMgr_EntityOwner)& Value() const { return myIterator.Value(); }
|
||||
|
||||
//! Select or deselect owners depending on the selection scheme.
|
||||
//! @param[in] thePickedOwners elements to change selection state
|
||||
//! @param[in] theSelScheme selection scheme, defines how owner is selected
|
||||
//! @param[in] theToAllowSelOverlap selection flag, if true - overlapped entities are allowed
|
||||
//! @param[in] theFilter context filter to skip not acceptable owners
|
||||
//! @param theOwners [in] elements to change selection state
|
||||
//! @param theSelScheme [in] selection scheme, defines how owner is selected
|
||||
//! @param theToAllowSelOverlap [in] selection flag, if true - overlapped entities are allowed
|
||||
//! @param theFilter [in] context filter to skip not acceptable owners
|
||||
Standard_EXPORT virtual void SelectOwners (const AIS_NArray1OfEntityOwner& thePickedOwners,
|
||||
const AIS_SelectionScheme theSelScheme,
|
||||
const Standard_Boolean theToAllowSelOverlap,
|
||||
|
@@ -18,25 +18,36 @@
|
||||
|
||||
#include <AIS_GraphicTool.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <Aspect_TypeOfLine.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTools_ShapeSet.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
#include <Graphic3d_SequenceOfGroup.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <HLRBRep.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_BndBox.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Select3D_SensitiveBox.hxx>
|
||||
#include <Select3D_SensitiveEntity.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -45,7 +56,10 @@
|
||||
#include <StdPrs_ShadedShape.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <StdSelect.hxx>
|
||||
#include <StdSelect_BRepOwner.hxx>
|
||||
#include <StdSelect_BRepSelectionTool.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#ifndef _AIS_Shape_HeaderFile
|
||||
#define _AIS_Shape_HeaderFile
|
||||
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <AIS_TypeFilter.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class SelectMgr_EntityOwner;
|
||||
|
||||
|
||||
|
@@ -25,8 +25,10 @@
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
@@ -34,6 +36,7 @@
|
||||
#include <StdPrs_ShadedShape.hxx>
|
||||
#include <StdPrs_ToolTriangulatedShape.hxx>
|
||||
#include <StdPrs_WFShape.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(AIS_TexturedShape,AIS_Shape)
|
||||
|
@@ -18,10 +18,12 @@
|
||||
|
||||
#include <AIS_Shape.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <Graphic3d_NameOfTexture2D.hxx>
|
||||
#include <Image_PixMap.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
|
||||
|
@@ -16,10 +16,14 @@
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Poly_Array1OfTriangle.hxx>
|
||||
#include <Poly_Triangulation.hxx>
|
||||
#include <Prs3d_Drawer.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <TShort_Array1OfShortReal.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TShort_HArray1OfShortReal.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
|
@@ -18,9 +18,10 @@
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <AIS_TrihedronOwner.hxx>
|
||||
#include <AIS_TrihedronSelectionMode.hxx>
|
||||
#include <Geom_Axis2Placement.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_AspectLine3d.hxx>
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
|
@@ -19,13 +19,17 @@
|
||||
|
||||
#include <AIS_InteractiveObject.hxx>
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <AIS_TrihedronSelectionMode.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <PrsMgr_PresentationManager.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_DatumMode.hxx>
|
||||
#include <Prs3d_DatumParts.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_PointAspect.hxx>
|
||||
#include <SelectMgr_Selection.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class Geom_Axis2Placement;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <AIS_KindOfInteractive.hxx>
|
||||
#include <SelectMgr_Filter.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class SelectMgr_EntityOwner;
|
||||
|
||||
|
||||
|
@@ -21,7 +21,10 @@
|
||||
#include <Aspect_XRSession.hxx>
|
||||
#include <Aspect_Grid.hxx>
|
||||
#include <Geom_CartesianPoint.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <gp_Quaternion.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d_Viewer.hxx>
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#ifndef _AIS_ViewController_HeaderFile
|
||||
#define _AIS_ViewController_HeaderFile
|
||||
|
||||
#include <Aspect_VKeySet.hxx>
|
||||
#include <Aspect_TouchMap.hxx>
|
||||
#include <Aspect_WindowInputListener.hxx>
|
||||
#include <Aspect_XRHapticActionData.hxx>
|
||||
#include <Aspect_XRTrackedDeviceRole.hxx>
|
||||
|
@@ -18,12 +18,14 @@
|
||||
#include <AIS_AnimationCamera.hxx>
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <Graphic3d_ViewAffinity.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <NCollection_Lerp.hxx>
|
||||
#include <Prs3d.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <Prs3d_DatumAspect.hxx>
|
||||
#include <Prs3d_Text.hxx>
|
||||
#include <Prs3d_ToolDisk.hxx>
|
||||
#include <Prs3d_ToolSphere.hxx>
|
||||
#include <SelectMgr_SequenceOfOwner.hxx>
|
||||
#include <V3d.hxx>
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Image_Texture.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <APIHeaderSection_EditHeader.hxx>
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
#include <IFSelect_EditForm.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
@@ -18,8 +18,10 @@
|
||||
#define _APIHeaderSection_EditHeader_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <IFSelect_Editor.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
class TCollection_AsciiString;
|
||||
class IFSelect_EditForm;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Interface_Version.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
class HeaderSection_FileName;
|
||||
class HeaderSection_FileSchema;
|
||||
|
@@ -25,7 +25,10 @@
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Adaptor2d_Curve2d, Standard_Transient)
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
|
@@ -19,8 +19,10 @@
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
@@ -15,6 +15,8 @@
|
||||
#include <Geom2d_BezierCurve.hxx>
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom2dEvaluator.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
#include <gp.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
@@ -24,6 +26,7 @@
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_VectorWithNullMagnitude.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
|
@@ -26,7 +26,10 @@
|
||||
#include <gp_Parab.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_Curve, Standard_Transient)
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#ifndef _Adaptor3d_Curve_HeaderFile
|
||||
#define _Adaptor3d_Curve_HeaderFile
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
|
@@ -25,7 +25,9 @@
|
||||
#include <Geom2d_BSplineCurve.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_OffsetSurface.hxx>
|
||||
#include <Geom_SurfaceOfLinearExtrusion.hxx>
|
||||
#include <Geom_SurfaceOfRevolution.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
@@ -48,6 +50,7 @@
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
#include <TColStd_Array1OfInteger.hxx>
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#define _Adaptor3d_CurveOnSurface_HeaderFile
|
||||
|
||||
#include <Adaptor2d_Curve2d.hxx>
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
@@ -22,6 +22,10 @@
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
#include <Geom_BSplineSurface.hxx>
|
||||
#include <Geom_OffsetCurve.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
Standard_Integer Adaptor3d_HSurfaceTool::NbSamplesU(const Handle(Adaptor3d_Surface)& S)
|
||||
{
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
|
||||
class Adaptor3d_HSurfaceTool
|
||||
|
@@ -15,6 +15,8 @@
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <BSplCLib.hxx>
|
||||
#include <BSplSLib.hxx>
|
||||
#include <ElCLib.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
#include <Geom_BezierCurve.hxx>
|
||||
@@ -31,8 +33,12 @@
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColgp_Array1OfPnt.hxx>
|
||||
#include <TColgp_Array2OfPnt.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_IsoCurve, Adaptor3d_Curve)
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#ifndef _Adaptor3d_IsoCurve_HeaderFile
|
||||
#define _Adaptor3d_IsoCurve_HeaderFile
|
||||
|
||||
#include <Adaptor3d_Curve.hxx>
|
||||
#include <Adaptor3d_Surface.hxx>
|
||||
#include <GeomAbs_IsoType.hxx>
|
||||
|
||||
|
@@ -28,7 +28,10 @@
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <Standard_NotImplemented.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Adaptor3d_Surface, Standard_Transient)
|
||||
|
||||
|
@@ -29,10 +29,13 @@
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include <Standard_OutOfRange.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray2OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
|
||||
#include <gp_XY.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <TColgp_HArray2OfPnt.hxx>
|
||||
|
||||
#include <Convert_GridPolynomialToPoles.hxx>
|
||||
|
@@ -23,7 +23,10 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GeomAbs_IsoType.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
#include <AdvApp2Var_Context.hxx>
|
||||
#include <AdvApp2Var_Network.hxx>
|
||||
#include <AdvApp2Var_Framework.hxx>
|
||||
|
@@ -15,7 +15,9 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <AdvApp2Var_Context.hxx>
|
||||
#include <AdvApp2Var_Criterion.hxx>
|
||||
#include <AdvApp2Var_Patch.hxx>
|
||||
|
||||
AdvApp2Var_Criterion::~AdvApp2Var_Criterion()
|
||||
{}
|
||||
|
@@ -17,6 +17,8 @@
|
||||
#ifndef AdvApp2Var_EvaluatorFunc2Var_HeaderFile
|
||||
#define AdvApp2Var_EvaluatorFunc2Var_HeaderFile
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <Standard_PrimitiveTypes.hxx>
|
||||
|
||||
// History - the C function pointer converted to a virtual class
|
||||
|
@@ -14,6 +14,7 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <AdvApp2Var_SysBase.hxx>
|
||||
#include <AdvApp2Var_MathBase.hxx>
|
||||
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include <AdvApp2Var_Network.hxx>
|
||||
#include <AdvApp2Var_Patch.hxx>
|
||||
#include <AdvApp2Var_SequenceOfPatch.hxx>
|
||||
#include <Standard_NoSuchObject.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
|
||||
//==========================================================================================
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include <AdvApp2Var_SequenceOfPatch.hxx>
|
||||
#include <TColStd_SequenceOfReal.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
class AdvApp2Var_Patch;
|
||||
|
||||
|
||||
|