1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

67 Commits

Author SHA1 Message Date
emv
b8e440d295 # revert changes in ProjLib_ComputeApproxOnPolarSurface just for testing. 2020-10-02 08:17:47 +03:00
emv
12aa7b0704 # compute all grid points in a single pass to avoid cache rebuild on BSpline surfaces.
# use iterator for array initialization with default distance values.
2020-10-02 08:17:46 +03:00
emv
4059fcddcb 0030892: Improve Extrema_ExtPS algorithm by unifying the GRAD and TREE methods
Refactoring of the Extrema_GenExtPS class in order to improve performance and robustness of the algorithm by unifying the GRAD and TREE search methods.
2020-10-02 08:17:45 +03:00
imn
68922bccc4 0027342: STEP - support C++ streams for import / export
- STEP low-level parser is converted to C++; required minimal version of flex is elevated to 2.5.37.
- Added possibility to import STEP from stream, see new method XSControl_Reader::ReadStream() (now implemented in STEP only).
- Parsers ported to win_flex_bison 2.5.23 (flex 2.6.4, bison 3.7.1)
- Added support of C++ flex and bison scanners in in CMake scripts
- Some code clean-up in StepFile and around (unused files and functions are eliminated)
- Option to read from stream is added in DRAW command testreadstep for testing ReadStream() function
- Added test bugs step bug27342
2020-09-28 10:46:04 +03:00
sshutina
ed75148574 0031786: Data Exchange - After the importing STEP file the free shape is empty
- Fixed the exception
 - Added the test
2020-09-28 10:46:03 +03:00
kgv
8c36926a54 0031701: Visualization, SelectMgr_ViewerSelector - make depth tolerance configurable
SelectMgr_ViewerSelector::SetDepthTolerance() - added property defining depth tolerance type and value.
Default value remains the same (SelectMgr_TypeOfDepthTolerance_SensitivityFactor),
while new values (SelectMgr_TypeOfDepthTolerance_Uniform, SelectMgr_TypeOfDepthTolerance_UniformPixels) change behavior.

AIS_Manipulator - removed obsolete suggestion to use AIS_InteractiveContext::SetPickClosest()
for issue fixed long time ago by #0027797.
2020-09-28 10:46:02 +03:00
dpasukhi
14abc514ed 0031685: Data Exchange, STEPCAFControl_Reader - NULL dereference on translating PLACED_DATUM_TARGET_FEATURE
- Fix incorrect sharing DatumTargetType_Area
- Add check for null object
2020-09-28 10:46:02 +03:00
abv
8a39adb7d8 0031785: [REGRESSION] Application Framework - application crashes on reading XBF document in background thread
Class CDF_Session is removed.

Integrated previously but not described:

0029195: OCAF - ensure thread safety for different documents.

Static local variables are eliminated in PCDM package.
Global documents metadata look-up table and directory of opened documents are removed.
Look-up table is maintained now as field in instances of the CDM_Application class.
Methods providing iteration by components are removed from class CDF_Store; signature of methods returned Standard_ExtString is changed to return Handle(TCollection_HExtendedString).
Support of different "Presentations" of documents is eliminated.
2020-09-28 10:46:01 +03:00
mkrylova
0e57793fc6 0031688: Visualization - Wrong ISO lines for a face created from BSpline
Added a check to see if the ISO line intersects the bounding contour.
2020-09-27 12:00:08 +03:00
kgv
9df0497931 0031765: Coding Rules - eliminate GCC compiler warnings -Wcatch-value in IVtk
Catched exceptions are now passed by reference and error message is printed.
Added Standard_FALLTHROUGH to IVtkOCC_ShapePickerAlgo::SetSelectionMode().
2020-09-27 12:00:07 +03:00
oan
f2006a6f19 0028089: Mesh - New algorithm for triangulation of 2d polygons
Added custom meshing core algorithm to generate base mesh using Delabella library,
which can be enabled via IMeshTools_Parameters::MeshAlgo option or CSF_MeshAlgo environment variable.

Do not fill cirles filter upon explicit initialization.
Call base postProcessMesh functionality after initialization of circles in BRepMesh_CustomDelaunayBaseMeshAlgo.

Added Vsprintf() wrapper for vsprintf() preserving C locale.
2020-09-27 12:00:07 +03:00
mpv
689dc3b1c9 0031323: OCAF, TObj - TObj_OcafObjectIterator does not go recursively to children if type argument is used
Added theAllSubChildren flag to the TObj_OcafObjectIterator to iterate all sub-children.
By default it still iterates only the first level of children.
2020-09-27 12:00:06 +03:00
tiv
0b55d29b6a 0031628: Configuration - Visual Studio 2019 compiler hangs on building 32-bit target
The workaround for a bug occurred in MS Visual Studio 2019 / Win32 / Release configuration with disabled Whole Program Optimization is implemented.
The problem was at the line "std::stable_sort(aPairList.begin(), aPairList.end(), BRepExtrema_CheckPair_Comparator);" of BRepExtrema_DistShapeShape.cxx source file,
and linked to NCollection_Vector::Differ() method.
This workaround was suggested by MSFT team.
2020-09-27 12:00:05 +03:00
bugmaster
99178701db 0031738: Samples: Update of samples for public release 7.5.0
- Adding VS 2019 redefinition
- Update sln files for vc14,141,142
2020-09-27 12:00:05 +03:00
emv
d476fc37f8 0030559: BOP Fuse: result is inconsistent
Implement alternative approach for making the edge seam (closed) on the face. This approach is useful for non-periodic surfaces (e.g. tore-like surface of revolution is periodic in U direction only).
Avoid internal faces in the affected solids of the result of BOP Fuse.
2020-09-27 12:00:04 +03:00
nds
b3bf8485a2 0031379: Configuration - using defined variable of THIRDPARTY_DIR 2020-09-23 18:49:14 +03:00
mzernova
113bda7072 0031773: Visualization - add Prs3d_ToolTorus
Added Prs3d_ToolTorus tool to create a torus

Added DRAW commands:
- vtorus
- vcylinder
- vsphere

Added test cases:
- v3d/quadric/torus
- v3d/quadric/cylinder
- v3d/quadric/sphere
2020-09-21 12:36:27 +03:00
ika
b0b7668261 0027185: Data Exchange - IGES - incorrect reading of DE for undefined entity
Fix reading of pointers to color entity.
2020-09-18 18:17:21 +03:00
dpasukhi
4661dcadd4 0025171: Data Exchange - STEP Lexer - the strings with quote sign inside can't be properly lexed
Add a test case to verify that the .STEP is read correctly
2020-09-18 18:15:09 +03:00
dpasukhi
3d46ce87d7 0030014: Data Exchange - Step File import does not create shapes, after transfer roots
Add a test case to verify that the .STEP is read correctly
2020-09-18 18:15:01 +03:00
dpasukhi
ebfd071c3c 0031191: Data Exchange - STEP import returns empty shape for a file written by SolidWorks 2018
Add a test case to verify that the .STEP is read correctly
2020-09-18 18:10:03 +03:00
dpasukhi
c6d45aceb8 0030539: Data Exchange - Step file can't be imported (ADT.step)
Add a test case to verify that the .STEP is read correctly
2020-09-18 18:10:03 +03:00
dpasukhi
87cf7029c3 0025440: Data Exchange - STEP file with Japanese unicode symbols cannot be read
Add a test case to verify that the .STEP is read correctly
2020-09-18 18:10:02 +03:00
jgv
06f68996cf 0031766: Modeling Algorithms - Instability on pipe bugs bug26088 test case
Correction in GeomFill_Sweep: set the flags "myExchUV", "isUReversed", "isVReversed" to FALSE (initial state) after failure of BuildKPart method.
2020-09-18 17:47:03 +03:00
ika
ba98b079eb 0031491: Data Exchange, STEP Import - Regression due to patch 29068
Add parameter read.step.root.transformation to switch on/off using transformation placed in the root shape representation.
2020-09-18 17:47:02 +03:00
dpasukhi
16bb5630bc 0031675: Data Exchange - Error opening the STEP-file
Add a check for null array object ("Elements") within StepShape_GeometricSet.cxx
2020-09-18 17:47:01 +03:00
emv
ce97cd9708 0025113: Mesh - Progress indication and user break functionality for BRepMesh component
Added Progress Indicator to BRep_Mesh
2020-09-18 17:47:01 +03:00
abv
99ca2eec6b 0031595: Foundation Classes - make methods Message_Report::SendMessages() virtual 2020-09-18 17:47:00 +03:00
jgv
9390642d49 0025495: Documentation - Enumeration Approx_ParameterizationType is not documented 2020-09-18 17:46:59 +03:00
kgv
df9f66149b 0031513: Data Exchange - FSD_Base64Decoder::Decode() returns buffer with wrong length 2020-09-18 17:46:58 +03:00
age
6a2fb7a1d1 0031757: Visualization - Prebuild BVH for Select3D_SensitiveEntity in separate threads
- Added a new mode in SelectMgr_ViewerSelector for computing BVH for Select3D_SensitiveEntity in background which can be activated via method SelectMgr_ViewerSelector::SetToPrebuildBVH(). Default behavior has not been changed.
- New class SelectMgr_BVHThreadPool manages background processing of BVH building queue.
- Added Select3D_SensitiveEntity::ToBuildBVH() method that checks if BVH (if it used) is in invalidated state. Defined this method for all standard classes inherited from Select3D_SensitiveEntity.
2020-09-18 17:46:57 +03:00
mpv
ee3280a94f 0031769: Application Framework - regression : can not initialize two kinds of application in one thread 2020-09-18 17:46:56 +03:00
emv
296f017a16 0029789: Modeling Algorithms - General Fuse produces invalid shape for valid arguments
Integrating test case for the issue.
2020-09-18 17:46:56 +03:00
emv
242af8c222 0025462: BRepAlgoAPI_Fuse not work correctly for a planar face
Fixed by 0028747. Integrating test case only.
2020-09-18 17:46:55 +03:00
mpv
74fdb82c73 0031770: Application Framework - To add tests of Abort command to 31748 2020-09-18 17:46:54 +03:00
vro
8fde921fbe 0031759: Application Framework - regression: support of old versions of OCAF document fails 2020-09-18 17:46:53 +03:00
kgv
48cbe5f797 0031768: Foundation Classes - use usleep within OSD::MilliSecSleep() 2020-09-18 17:46:52 +03:00
agv
97454ee0cb 0031173: Point Cloud Rendering - Enable remote file systems as input and output for the Point Cloud converter
Make RWStl_Reader::IsAscii() accepting optional argument pointing how to rewind the input stream, using unget() or seekg(). This allows writing a reader that uses a stream supporting seekg but not supporting unget.
2020-09-18 17:46:51 +03:00
emv
cd0705f660 0024789: BOPAlgo_Builder produces invalid result on planar, conical and spherical surfaces
BOPAlgo_PaveFiller::MakeBlocks() - Improve Face/Face post treatment procedure by:
* Adding more existing edge for intersection with section edges to resolve all possible intersections.
* Using tree for edges selection.
* Avoiding intersection of the existing edges among themselves.

IntPatch_ImpImpIntersection::CyCyNoGeometric - add more points to wline to make it more smooth.
2020-09-18 17:46:50 +03:00
gka
65da6e2e3e 0031452: Impossible to get Backup of the attribute and status that attribute was modified before commit transaction
Method TObj_Object::HasModifications() was added to get flag that object or it's children was modified in the current open transaction
2020-09-18 17:46:50 +03:00
emv
7f7d121f90 0030786: BOP Cut: artifacts with enabled nondestructive flag
Avoid PaveBlocks initialization on vertex update.
Test case for the issue.
2020-09-18 17:46:49 +03:00
dpasukhi
2547d97917 0031711: Data Exchange - STEPCAFControl_Reader hangs on attached file in an infinite loop
Add check if .step external file is the same main file.
2020-09-18 17:46:48 +03:00
bugmaster
2fa0e902f0 0030308: OCCT Qt Tutorial Sample Cannot Be Built on Linux 2020-09-18 17:46:48 +03:00
gka
8b77b2fc99 0031219: Application Framework - TObj_Object::SetName(const Standard_CString theName) should use conversion to TCollection_HAsciiString
In the method TObj_Object::TObj_Object::SetName(const Standard_CString theName) conversion to the HAsciiString was used instead of the conversion to the TCollection_HExtendedString. -
2020-09-18 17:46:47 +03:00
emv
6c9f3cf15c 0030792: Modeling Algorithms, BOP Fuse - some parts of the shape are dropped
Integrating test case for the issue.
2020-09-16 19:32:57 +03:00
abv
7a3e8aad74 0031763: Foundation Classes - reporting of progress within parallel algorithms
Classes Message_ProgressRange and Message_ProgressScope are improved to store start point of the range.
Method Message_ProgressScope::Value() is improved to compute the value in the current scope from the actual current value of the global progress.
Description of Message_ProgressScope class is improved.

Off-topic:
- method Message_ProgressScope::Relieve() is renamed to Close() for semantic consistency
- article in Upgrade Guide is revised and corrected
2020-09-16 19:32:57 +03:00
gka
88610dfc0e 0031228: It is impossible switch off setting default names for objects inherited TObj_Partition
In order to switch off setting default names for objects of the type TObj_Partition argument "theSetName" defining addition of the default names was added
2020-09-12 20:42:26 +03:00
kgv
0784d6e3cb 0030662: Documentation - update programming example in Visualization user guide
"A programming example" section has been updated to provide a working code.
2020-09-12 20:42:25 +03:00
sshutina
897aeb207f 0031221: Visualization - selection filter in context
- Added the new filter SelectMgr_AndOrFilter which allows to define the context filter. By default OR selection filter is used
 - Added the enumeration SelectMgr_FilterType provides filter types
 - To define behavior SelectMgr_AndOrFilter use  SetFilterType in AIS_InteractiveContext
 - Added the test
 - SelectMgr_OrFilter don't store the disabled objects, it's stored in SelectMgr_AndOrFilter
2020-09-12 20:42:24 +03:00
ika
b95caec47d 0031466: Data Exchange - Cannot import layers from STeP file (7.4.0 regression)
Return possibility to find layers fir subshapes.
2020-09-12 20:42:23 +03:00
msv
7e785937b3 0025748: Parallel version of progress indicator
Progress indication mechanism is refactored to support incrementing progress within multithreaded algorithms.

The class Message_ProgressIndicator is only an interface to the user application.
It accumulates the progress provided by progress scopes.
The counter is protected by mutex for thread-safety.

The new class Message_ProgressScope replacing Message_ProgressSentry should be used to advance the progress.
The scopes are nested to each other to reflect the nested nature of operations.
The new class Message_ProgressRange should be used to pass the progress to sub-scopes.

All OCCT algorithms involving progress indication have been updated to new API.

Improvements in Draw_ProgressIndicator:
- Separate console mode has been added in order to make possible to put the progress into std::cout instead
  or in addition to the draw interpreter, instead of trigger option "-tclOutput".
- Treatment of Ctrl-Break signal has been added.
  Now any operation can be aborted by Ctrl-C or Ctrl-Break keystroke.

Added new test case 'perf fclasses progr_par' for testing of parallel work of the progress.
2020-09-12 20:42:22 +03:00
mkrylova
99289bed0a 0031683: Visualization - V3d_View::SetBackgroundImage() should accept Image_PixMap
Added V3d_View::SetBackgroundImage() accepting Graphic3d_Texture2D on input.

Graphic3d_CView/OpenGl_View have been modified to merge Graphic3d_CView::SetBackgroundImage()
and ::SetBackgroundCubeMap() implementations into a single method.
2020-09-12 20:42:21 +03:00
dpasukhi
bf0114a372 0030848: Data Exchange - Problem load step file
Update .step scanner rules to read anything within the text, including nested apostrophes
2020-09-12 20:42:20 +03:00
dpasukhi
183c99caf8 0030053: STEP read fails due to comment string
- Update .step scanner:
  - add rules to read anything within the comment
  - add a function to initialize of lexical scanner
  - add states for Commit & End instead of global variables modcom & modend
2020-09-12 20:42:19 +03:00
dpasukhi
e0a25f3d93 0030397: Data Exchange - STEP Reader extension to support entities which have a text description field with not supported symbols
STEP file is now opened in binary mode (instead of text mode) to avoid unexpected handling of control symbols inside string constants.
2020-09-12 20:42:19 +03:00
mpv
c99ad5d760 0030773: Application Framework - To allow to inherit existing attributes to reuse persistence mechanisms
Added possibility to inherit existing attributes if the same persistent fields are used. All methods that allow controlling the data model changes or getting some callbacks may be overridden in successor. They may have same GUIDs as a base class or new ones.

Special macros IMPLEMENT_DERIVED_ATTRIBUTE and IMPLEMENT_DERIVED_ATTRIBUTE_WITH_TYPE must be used instead of standard Handle macro definition IMPLEMENT_STANDARD_RTTIEXT to register new derived attributes.

Using this improvement several existing attributes from TDataStd, TDataXtd and XCAFDoc packages become inherited from other base attribute-classes. XML and Bin drivers of these attributes are removed. New base attribute classes are added: TDataStd_GenericEmpty and TDataStd_GenericExtString.

This improvement does not change both present formats Bin and XML documents. The obsolete Standard scheme is not changed at all.
2020-09-12 20:42:18 +03:00
vro
59e11a2f75 0031310: Application Framework - A document with a reference array attribute crashes on attempt to save on disk 2020-09-12 20:42:17 +03:00
mpv
dbab9c538c 0031748: Application Framework - Efficient OCAF transactions in OCCT 2020-09-12 20:42:16 +03:00
mpv
d9d03f10c3 0029195: OCAF - ensure thread safety for different documents.
OCAF persistence architecture modification to satisfy multi-threading criteria.
2020-09-12 20:42:02 +03:00
jgv
c3e0e1de43 0031736: ShapeUpgrade_UnifySameDomain algorithm does not unify all possible faces
1. Correct processing faces that can be converted into planar ones.
2. Correct processing faces based on V-closed surfaces.
2020-09-10 18:16:44 +03:00
nds
ed753e10df 0031658: Inspector - using AIS_ViewController in View package
- View: using AIS_ViewController, AIS_ViewCube.
2020-09-10 18:15:06 +03:00
nds
630ab53881 0031656: Visualization - drag item to handle in AIS_ViewController
ProcessDragging method in AIS_InteractiveObject. Empty by default. Should be implemented if drag is used for the object.
2020-09-09 19:48:49 +03:00
osa
bbbb6bff1f 0031758: Visualization, AIS_InteractiveContext - unify clearDynamicHighlight() method 2020-09-09 19:46:14 +03:00
nds
6b63dc83c3 0031326: Foundation Classes - Init from Json for base OCCT classes
InitFromJson method implementation for some simple classes.
OCCT_INIT_* defines introduction to do automatic parsing of the stream into values.
Inspector is extended to visualize objects created on the dump stream if it might be created.
2020-09-09 19:36:06 +03:00
nds
b19cde437e 0030784: Visualization - check if selectable of owner in internal container in AIS_InteractiveContext before using 2020-09-09 19:34:18 +03:00
dpasukhi
4637000015 0031489: Data Exchange - STEP Reader can't read a big file
- Add checking for null object for edge_curve within TranslateEdgeLoop;
- Update STEP parser rule allowing empty element in the list of entity parameters;
- Update test case of bug26451 for a new scanner rule;
- Update test case of bug30273 for a new added check for null object
2020-09-09 19:32:00 +03:00
nds
60f7b22536 0030537: Visualization - wrapping text in font text formatter
Font_TextFormatter inherits Standard_Transient, now it is given as a handle in functions.
Graphic3d_Text - extended with Font_TextFormatter to be able to have it filled out of text render. If it is not defined here, the default text formatter of context is used.
OpenGl_Context - has default Font_TextFormatter for rendering OpenGl_Text.
AIS_TextLabel extending with Font_TextFormatter to prepare test case for text wrapping.
Prs3d_Text returns created graphic text to be able to manage it outside.
2020-09-07 11:10:32 +03:00
864 changed files with 23109 additions and 21654 deletions

View File

@@ -7,7 +7,7 @@ unset (3RDPARTY_BISON_EXECUTABLE CACHE)
# delete BISON_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
# without reasonable diagnostic
if (NOT BISON_EXECUTABLE)
if (NOT BISON_EXECUTABLE OR NOT EXISTS "${BISON_EXECUTABLE}")
unset (BISON_EXECUTABLE CACHE)
endif()
@@ -22,8 +22,6 @@ if (3RDPARTY_DIR)
endforeach()
endif()
find_package (BISON 2.7)
if (NOT BISON_FOUND OR NOT BISON_EXECUTABLE OR NOT EXISTS "${BISON_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED BISON_EXECUTABLE)
endif()
# bison 3.2 is required because it provides options to avoid generation of redundant header
# files and embedding of local paths in the generated code
find_package (BISON 3.2)

View File

@@ -7,23 +7,29 @@ unset (3RDPARTY_FLEX_EXECUTABLE CACHE)
# delete FLEX_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
# without reasonable diagnostic
if (NOT FLEX_EXECUTABLE)
if (NOT FLEX_EXECUTABLE OR NOT EXISTS "${FLEX_EXECUTABLE}")
unset (FLEX_EXECUTABLE CACHE)
endif()
if (NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}")
unset (FLEX_INCLUDE_DIR CACHE)
endif()
# Add paths to 3rdparty subfolders containing name "flex" to CMAKE_PROGRAM_PATH variable to make
# these paths searhed by find_package
# Add paths to 3rdparty subfolders containing name "flex" to CMAKE_PROGRAM_PATH and
# CMAKE_INCLUDE_PATH variables to make these paths searhed by find_package
if (3RDPARTY_DIR)
file (GLOB FLEX_PATHS LIST_DIRECTORIES true "${3RDPARTY_DIR}/*flex*")
foreach (candidate_path ${FLEX_PATHS})
if (IS_DIRECTORY ${candidate_path})
list (APPEND CMAKE_PROGRAM_PATH ${candidate_path})
list (APPEND CMAKE_INCLUDE_PATH ${candidate_path})
endif()
endforeach()
endif()
find_package (FLEX 2.5.3)
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0,
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
find_package (FLEX 2.5.37)
if (NOT FLEX_FOUND OR NOT FLEX_EXECUTABLE OR NOT EXISTS "${FLEX_EXECUTABLE}")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_EXECUTABLE)
endif()
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)
endif()

View File

@@ -91,10 +91,40 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
string (COMPARE EQUAL ${CURRENT_FLEX_FILE_NAME} ${CURRENT_BISON_FILE_NAME} ARE_FILES_EQUAL)
if (EXISTS "${CURRENT_FLEX_FILE}" AND EXISTS "${CURRENT_BISON_FILE}" AND ${ARE_FILES_EQUAL})
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.c)
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.c)
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${BISON_OUTPUT_FILE} COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}/${FLEX_OUTPUT_FILE} COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME} -L")
# Note: files are generated in original source directory (not in patch!)
set (FLEX_BISON_TARGET_DIR "${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/${OCCT_PACKAGE}")
# choose apropriate extension for generated files: "cxx" if source file contains
# instruction to generate C++ code, "c" otherwise
set (BISON_OUTPUT_FILE_EXT "c")
set (FLEX_OUTPUT_FILE_EXT "c")
file (STRINGS "${CURRENT_BISON_FILE}" FILE_BISON_CONTENT)
foreach (FILE_BISON_CONTENT_LINE ${FILE_BISON_CONTENT})
string (REGEX MATCH "%language \"C\\+\\+\"" CXX_BISON_LANGUAGE_FOUND ${FILE_BISON_CONTENT_LINE})
if (CXX_BISON_LANGUAGE_FOUND)
set (BISON_OUTPUT_FILE_EXT "cxx")
endif()
endforeach()
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
if (CXX_FLEX_LANGUAGE_FOUND)
set (FLEX_OUTPUT_FILE_EXT "cxx")
# install copy of FlexLexer.h locally to allow further building without flex
if (FLEX_INCLUDE_DIR AND EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
configure_file("${FLEX_INCLUDE_DIR}/FlexLexer.h" "${FLEX_BISON_TARGET_DIR}/FlexLexer.h" @ONLY NEWLINE_STYLE LF)
endif()
endif()
endforeach()
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"
COMPILE_FLAGS "-P${CURRENT_FLEX_FILE_NAME} -L")
ADD_FLEX_BISON_DEPENDENCY (Scanner_${CURRENT_FLEX_FILE_NAME} Parser_${CURRENT_BISON_FILE_NAME})
list (APPEND SOURCE_FILES ${BISON_OUTPUT_FILE} ${FLEX_OUTPUT_FILE})

View File

@@ -119,12 +119,14 @@ rem ----- For compatability with external application using CASROOT -----
if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
rem ----- Define path to 3rdparty products -----
set "THIRDPARTY_DIR=@3RDPARTY_DIR@"
if ["%THIRDPARTY_DIR%"] == [""] set "THIRDPARTY_DIR=@3RDPARTY_DIR@"
if ["%ARCH%"] == ["32"] set VCARCH=x86
if ["%ARCH%"] == ["64"] set VCARCH=amd64
if /I ["%1"] == ["vc141"] set "VCVER=vc14"
if /I ["%1"] == ["vc142"] set "VCVER=vc14"
if exist "%CASROOT%\custom.bat" (
call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
)

View File

@@ -8,7 +8,9 @@ if [ "${CASROOT}" == "" ]; then
fi
# ----- Define path to 3rdparty products -----
export THIRDPARTY_DIR="@3RDPARTY_DIR@"
if [ "${THIRDPARTY_DIR}" == "" ]; then
export THIRDPARTY_DIR="@3RDPARTY_DIR@"
fi
# ----- Read script arguments -----
shopt -s nocasematch

View File

@@ -6,6 +6,7 @@ if exist "%~dp0custom.bat" (
call "@INSTALL_DIR_ABSOLUTE@\@INSTALL_DIR_SCRIPT@\env.bat" %1 %2 %3
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"

View File

@@ -71,6 +71,7 @@ BOPTools::MapShapesAndAncestors TopExp::MapShapesAndAncestors
BOPCol_Box2DBndTreeSelector BOPTools_BoxSelector<Bnd_Box2d>
BiTgte_DataMapOfShapeBox TopTools_DataMapOfShapeBox
CDM_MessageDriver Message_Messenger
Message_ProgressSentry Message_ProgressScope
[tcollection]
AdvApp2Var_SequenceOfNode

View File

@@ -1935,6 +1935,142 @@ Offset direction, which used in class Adaptor2d_OffsetCurve for evaluating value
Adaptor2d_OffsetCurve aOC(BaseCurve, Offset) --> Adaptor2d_OffsetCurve aOC(BaseCurve, -Offset)
@subsection upgrade_750_ProgressIndicator Change of progress indication API
The progress indication mechanism has been revised to eliminate its weak points in
previous design (leading to implementation mistakes).
Redesign also allows using progress indicator in multi-threaded algorithms
in more straight-forward way with minimal overhead.
Note however, that multi-threaded algorithm should pre-allocate per-task
progress ranges in advance to ensure thread-safety -
see examples in documentation of class Message_ProgressScope for details.
Classes Message_ProgressSentry and Message_ProgressScale have been removed.
New classes Message_ProgressScope and Message_ProgressRange should be used as main
API classes to organize progress indication in the algorithms.
Instances of the class Message_ProgressRange are used to pass the progress capability to
nested levels of the algorithm, and an instance of the class Message_ProgressScope is to
be created (preferably as local variable) to manage progress at each level of the algorithm.
The instance of Message_ProgressIndicator is not passed anymore to sub-algorithms.
See documentation of the class Message_ProgressScope for more details and examples.
Methods to deal with progress scopes and to advance progress are removed from class
Message_ProgressIndicator; now it only provides interface to the application-level progress indicator.
Virtual method Message_ProgressIndicator::Show() has changed its signature and should be
updated accordingly in descendants of Message_ProgressIndicator.
The scope passed as argument to this method can be used to obtain information on context
of the current process (instead of calling method GetScope() in previous implementation).
Methods Show(), UserBreak(), and Reset() are made protected in class Message_ProgressIndicator;
methods More() or UserBreak() of classes Message_ProgressScope or Message_ProgressRange should
be used to know if the cancel event has come.
See documentation of the class Message_ProgressIndicator for more details and implementation
of Draw_ProgressIndicator for an example.
Let's take a look onto typical algorithm using an old API:
@code
class MyAlgo
{
public:
//! Algorithm entry point taking an optional Progress Indicator.
bool Perform (const TCollection_AsciiString& theFileName,
const Handle(Message_ProgressIndicator)& theProgress = Handle(Message_ProgressIndicator)())
{
Message_ProgressSentry aPSentry (theProgress, (TCollection_AsciiString("Processing ") + theFileName).ToCString(), 2);
{
Message_ProgressSentry aPSentry1 (theProgress, "Stage 1", 0, 153, 1);
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
{
if (!aPSentry1.More()) { return false; }
// do some job here...
}
}
aPSentry.Next();
{
perform2 (theProgress);
}
aPSentry.Next();
bool wasAborted = !theProgress.IsNull() && theProgress->UserBreak();
return !wasAborted;
}
private:
//! Nested sub-algorithm taking Progress Indicator.
bool perform2 (const Handle(Message_ProgressIndicator)& theProgress)
{
Message_ProgressSentry aPSentry2 (theProgress, "Stage 2", 0, 100, 1);
for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
return !aPSentry2.UserBreak();
}
};
// application executing an algorithm
Handle(Message_ProgressIndicator) aProgress = new MyProgress();
MyAlgo anAlgo;
anAlgo.Perform ("FileName", aProgress);
@endcode
The following guidance can be used to update such code:
- Replace `const Handle(Message_ProgressIndicator)&` with `const Message_ProgressRange&`
in arguments of the methods that support progress indication.
Message_ProgressIndicator object should be now created only at place where application starts algorithms.
- Replace `Message_ProgressSentry` with `Message_ProgressScope`.
Take note that Message_ProgressScope has less arguments (no "minimal value").
In other aspects, Message_ProgressScope mimics an iterator-style interface
(with methods More() and Next()) close to the old Message_ProgressSentry (pay attention
to extra functionality of Message_ProgressScope::Next() method below).
Note that method Message_ProgressScope::Close() is equivalent of the method
Relieve() of Message_ProgressSentry in previous version.
Class Message_ProgressSentry is still defined (marked as deprecated) providing
API more close to old one, and can be still used to reduce porting efforts.
- Each Message_ProgressScope should take the next Range object to work with.
Within old API, Message_ProgressSentry received the root Progress Indicator
object which mantained the sequence of ranges internally.
Message_ProgressScope in new API takes Message_ProgressRange, which should be
returned by Message_ProgressScope::Next() method of the parent scope.
Do not use the same Range passed to the algorithm for all sub-Scopes like
it was possible in old API; each range object may be used only once.
Take a look onto ported code and compare with code above to see differences:
@code
class MyAlgo
{
public:
//! Algorithm entry point taking an optional Progress Range.
bool Perform (const TCollection_AsciiString& theFileName,
const Message_ProgressRange& theProgress = Message_ProgressRange())
{
Message_ProgressScope aPSentry (theProgress, TCollection_AsciiString("Processing ") + theFileName, 2);
{
Message_ProgressScope aPSentry1 (aPSentry.Next(), "Stage 1", 153);
for (int anIter = 0; anIter < 153; ++anIter, aPSentry1.Next())
{
if (!aPSentry1.More()) { return false; };
// do some job here...
}
}
{
perform2 (aPSentry.Next());
}
bool wasAborted = aPSentry.UserBreak();
return !wasAborted;
}
//! Nested sub-algorithm taking Progress sub-Range.
bool perform2 (const Message_ProgressRange& theProgress)
{
Message_ProgressScope aPSentry2 (theProgress, "Stage 2", 100);
for (int anIter = 0; anIter < 100 && aPSentry2.More(); ++anIter, aPSentry2.Next()) {}
return !aPSentry2.UserBreak();
}
};
// application executing an algorithm
Handle(Message_ProgressIndicator) aProgress = new MyProgress();
MyAlgo anAlgo;
anAlgo.Perform ("FileName", aProgress->Start());
@endcode
@subsection upgrade_750_message_messenger Message_Messenger interface change
Operators << with left argument *Handle(Message_Messenger)*, used to output messages with
@@ -1984,6 +2120,26 @@ Old three Message_Printer::Send() methods remain defined virtual with unused las
Redundant class Prs3d_Root has been marked as deprecated - Prs3d_Presentation::NewGroup() should be called directly.
@subsection upgrade_750_cdf_session Support of multiple OCAF application instances
Class *CDF_Session* has been removed.
That class was used to store global instance of OCAF application (object of class *CDM_Application* or descendant, typically *TDataStd_Application*).
Global directory of all opened OCAF documents has been removed as well; such directory is maintained now by each instance of the *CDM_Application* class.
This allows creating programs that work with different OCAF documents concurrently in paralel threads,
provided that each thread deals with its own instance of *TDataStd_Application* and documents managed by this instance.
Note that neither *TDataStd_Application* nor *TDocStd_Document* is protected from concurrent access from several threads.
Such protection, if necessary, shall be implemented on the application level.
For an example, access to labels and attributes could be protected by mutex if there is a probability that different threads access the same labels / attributes:
~~~~~
{
Standard_Mutex::Sentry aSentry (myMainLabelAccess);
TDF_Label aChildLab = aDocument->Main().NewChild();
TDataStd_Integer::Set(aChildLab, 0);
}
~~~~~
@subsection upgrade_750_draw_hotkeys Draw Harness hotkeys
Draw Harness hotkeys **W** (Wireframe) and **S** (Shaded) have been re-mapped to **Ctrl+W** and **Ctrl+S**.

View File

@@ -156,6 +156,10 @@ RapidJSON is optionally used by OCCT for reading glTF files (https://rapidjson.o
**DejaVu** fonts are a font family based on the Vera Fonts under a permissive license (MIT-like, https://dejavu-fonts.github.io/License.html).
DejaVu Sans (basic Latin sub-set) is used by OCCT as fallback font when no system font is available.
**Delabella** is an open-source, cross-platform implementation of the Newton Apple Wrapper algorithm producing 2D Delaunay triangulation.
Delabella is used by BRepMesh as one of alternative 2D triangulation algorithms.
Delabella is licensed under the MIT license (https://github.com/msokalski/delabella).
Adobe Systems, Inc. provides **Adobe Reader**, which can be used to view files in Portable Document Format (PDF).
@section OCCT_OVW_SECTION_3 Documentation

View File

@@ -3251,6 +3251,40 @@ In general, face meshing algorithms have the following structure:
* Classes *BRepMesh_DelaunayNodeInsertionMeshAlgo* and *BRepMesh_SweepLineNodeInsertionMeshAlgo* implement algorithm-specific functionality related to addition of internal nodes supplementing functionality provided by *BRepMesh_NodeInsertionMeshAlgo*;
* *BRepMesh_DelaunayDeflectionControlMeshAlgo* extends functionality of *BRepMesh_DelaunayNodeInsertionMeshAlgo* by additional procedure controlling deflection of generated triangles.
BRepMesh provides user a way to switch default triangulation algorithm to a custom one, either implemented by user or available worldwide.
There are three base classes that can be currently used to integrate 3rd-party algorithms:
* *BRepMesh_ConstrainedBaseMeshAlgo* base class for tools providing generation of triangulations with constraints requiring no common processing by BRepMesh;
* *BRepMesh_CustomBaseMeshAlgo* provides the entry point for generic algorithms without support of constraints and supposed for generation of base mesh only.
Constraint edges are processed using standard functionality provided by the component itself upon background mesh produced by 3rd-party solver;
* *BRepMesh_CustomDelaunayBaseMeshAlgo* contains initialization part for tools used by BRepMesh for checks or optimizations using results of 3rd-party algorithm.
Meshing algorithms could be provided by implemeting IMeshTools_MeshAlgoFactory with related interfaces and passing it to BRepMesh_Context::SetFaceDiscret().
OCCT comes with two base 2D meshing algorithms: BRepMesh_MeshAlgoFactory (used by default) and BRepMesh_DelabellaMeshAlgoFactory.
The following example demonstrates how it could be done from Draw environment:
~~~~~
psphere s 10
### Default Algo ###
incmesh s 0.0001 -algo default
### Delabella Algo ###
incmesh s 0.0001 -algo delabella
~~~~~
The code snippet below shows passing a custom mesh factory to BRepMesh_IncrementalMesh:
~~~~~
IMeshTools_Parameters aMeshParams;
Handle(IMeshTools_Context) aContext = new BRepMesh_Context();
aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory()));
BRepMesh_IncrementalMesh aMesher;
aMesher.SetShape (aShape);
aMesher.ChangeParameters() = aMeshParams;
aMesher.Perform (aContext);
~~~~~
#### Range splitter
Range splitter tools provide functionality to generate internal surface nodes defined within the range computed using discrete model data. The base functionality is provided by *BRepMesh_DefaultRangeSplitter* which can be used without modifications in case of planar surface. The default splitter does not generate any internal node.

View File

@@ -1542,40 +1542,38 @@ Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (aDispCon
// create a Viewer to this Driver
Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver);
aViewer->SetDefaultBackgroundColor (Quantity_NOC_DARKVIOLET);
aViewer->SetDefaultViewProj (V3d_Xpos);
// Create a structure in this Viewer
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (aViewer->Viewer());
Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (aViewer->StructureManager());
aStruct->SetVisual (Graphic3d_TOS_SHADING); // Type of structure
// Create a group of primitives in this structure
Handle(Graphic3d_Group) aPrsGroup = new Graphic3d_Group (aStruct);
Handle(Graphic3d_Group) aPrsGroup = aStruct->NewGroup();
// Fill this group with one quad of size 100
Handle(Graphic3d_ArrayOfTriangleStrips) aTriangles = new Graphic3d_ArrayOfTriangleStrips (4);
aTriangles->AddVertex (-100./2., -100./2., 0.0);
aTriangles->AddVertex (-100./2., 100./2., 0.0);
aTriangles->AddVertex ( 100./2., -100./2., 0.0);
aTriangles->AddVertex ( 100./2., 100./2., 0.0);
Handle(Graphic3d_AspectFillArea3d) anAspects = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_RED,
Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0f,
Graphic3d_NOM_GOLD, Graphic3d_NOM_GOLD);
aPrsGroup->SetGroupPrimitivesAspect (anAspects);
aPrsGroup->AddPrimitiveArray (aTriangles);
aPrsGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectFillArea3d());
// Create Ambient and Infinite Lights in this Viewer
Handle(V3d_AmbientLight) aLight1 = new V3d_AmbientLight (Quantity_NOC_GRAY50);
Handle(V3d_DirectionalLight) aLight2 = new V3d_DirectionalLight (V3d_XnegYnegZneg, Quantity_NOC_WHITE);
Handle(V3d_DirectionalLight) aLight2 = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE, true);
aViewer->AddLight (aLight1);
aViewer->AddLight (aLight2);
aViewer->SetLightOn();
// Create a 3D quality Window with the same DisplayConnection
Handle(Xw_Window) aWindow = new Xw_Window (aDispConnection, "Test V3d", 100, 100, 500, 500);
aWindow->Map(); // Map this Window to this screen
// Create a Perspective View in this Viewer
Handle(V3d_View) aView = new V3d_View (aViewer);
aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective);
// Associate this View with the Window
aView->SetWindow (aWindow);
// Display ALL structures in this View
aViewer->Viewer()->Display();
// Display presentation in this View
aStruct->Display();
// Finally update the Visualization in this View
aView->Update();
// Fit view to object size

View File

@@ -1,6 +1,7 @@
// include required OCCT headers
#include <Standard_Version.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressScope.hxx>
//for OCC graphic
#include <Aspect_DisplayConnection.hxx>
#include <WNT_Window.hxx>

View File

@@ -4,6 +4,7 @@
// include required OCCT headers
#include <Standard_Version.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressScope.hxx>
//for OCC graphic
#include <WNT_Window.hxx>
#include <WNT_WClass.hxx>

View File

@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 2015
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geometry", "01_Geometry\adm\win\vc10\Geometry.vcxproj", "{31E8199C-C981-4B7F-9CC2-B8502565B581}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modeling", "02_Modeling\adm\win\vc10\Modeling.vcxproj", "{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}"

View File

@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 14.00
# Visual Studio 2017
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geometry", "01_Geometry\adm\win\vc10\Geometry.vcxproj", "{31E8199C-C981-4B7F-9CC2-B8502565B581}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modeling", "02_Modeling\adm\win\vc10\Modeling.vcxproj", "{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}"

View File

@@ -0,0 +1,125 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Geometry", "01_Geometry\adm\win\vc10\Geometry.vcxproj", "{31E8199C-C981-4B7F-9CC2-B8502565B581}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modeling", "02_Modeling\adm\win\vc10\Modeling.vcxproj", "{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Viewer2d", "03_Viewer2d\adm\win\vc10\Viewer2d.vcxproj", "{6B905DC2-4E72-4EDA-99C2-7473634690FE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Viewer3d", "04_Viewer3d\adm\win\vc10\Viewer3d.vcxproj", "{949DFBDF-9007-4C88-8925-43209C36A5D6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImportExport", "05_ImportExport\adm\win\vc10\ImportExport.vcxproj", "{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ocaf", "06_Ocaf\adm\win\vc10\Ocaf.vcxproj", "{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Triangulation", "07_Triangulation\adm\win\vc10\Triangulation.vcxproj", "{B50C10C8-5260-498B-A80F-48FFB4534360}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HLR", "08_HLR\adm\win\vc10\HLR.vcxproj", "{76045260-8DA6-4A3E-B220-F5B1B4ADE192}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Animation", "09_Animation\adm\win\vc10\Animation.vcxproj", "{92492ACB-1F57-40BB-818F-33AD1C20273A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mfcsample", "mfcsample\adm\win\vc10\mfcsample.vcxproj", "{2D6CBBE8-6965-4016-B503-0D715AE26691}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Convert", "10_Convert\adm\win\vc10\Convert.vcxproj", "{C527B648-F98D-42E5-9F59-251FD95D15A0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Debug|Win32.ActiveCfg = Debug|Win32
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Debug|Win32.Build.0 = Debug|Win32
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Debug|x64.ActiveCfg = Debug|x64
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Debug|x64.Build.0 = Debug|x64
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Release|Win32.ActiveCfg = Release|Win32
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Release|Win32.Build.0 = Release|Win32
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Release|x64.ActiveCfg = Release|x64
{31E8199C-C981-4B7F-9CC2-B8502565B581}.Release|x64.Build.0 = Release|x64
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Debug|Win32.ActiveCfg = Debug|Win32
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Debug|Win32.Build.0 = Debug|Win32
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Debug|x64.ActiveCfg = Debug|x64
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Debug|x64.Build.0 = Debug|x64
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Release|Win32.ActiveCfg = Release|Win32
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Release|Win32.Build.0 = Release|Win32
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Release|x64.ActiveCfg = Release|x64
{B10FC678-B9AF-4B05-B3DC-8F790C610CC3}.Release|x64.Build.0 = Release|x64
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Debug|Win32.ActiveCfg = Debug|Win32
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Debug|Win32.Build.0 = Debug|Win32
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Debug|x64.ActiveCfg = Debug|x64
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Debug|x64.Build.0 = Debug|x64
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Release|Win32.ActiveCfg = Release|Win32
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Release|Win32.Build.0 = Release|Win32
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Release|x64.ActiveCfg = Release|x64
{6B905DC2-4E72-4EDA-99C2-7473634690FE}.Release|x64.Build.0 = Release|x64
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Debug|Win32.ActiveCfg = Debug|Win32
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Debug|Win32.Build.0 = Debug|Win32
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Debug|x64.ActiveCfg = Debug|x64
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Debug|x64.Build.0 = Debug|x64
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Release|Win32.ActiveCfg = Release|Win32
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Release|Win32.Build.0 = Release|Win32
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Release|x64.ActiveCfg = Release|x64
{949DFBDF-9007-4C88-8925-43209C36A5D6}.Release|x64.Build.0 = Release|x64
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Debug|Win32.ActiveCfg = Debug|Win32
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Debug|Win32.Build.0 = Debug|Win32
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Debug|x64.ActiveCfg = Debug|x64
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Debug|x64.Build.0 = Debug|x64
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Release|Win32.ActiveCfg = Release|Win32
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Release|Win32.Build.0 = Release|Win32
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Release|x64.ActiveCfg = Release|x64
{1C9A05AE-AF5A-4ACE-9A72-83436D77504C}.Release|x64.Build.0 = Release|x64
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Debug|Win32.ActiveCfg = Debug|Win32
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Debug|Win32.Build.0 = Debug|Win32
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Debug|x64.ActiveCfg = Debug|x64
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Debug|x64.Build.0 = Debug|x64
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Release|Win32.ActiveCfg = Release|Win32
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Release|Win32.Build.0 = Release|Win32
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Release|x64.ActiveCfg = Release|x64
{B3C10EF6-42C7-4DB8-A49C-7E38255D5B1B}.Release|x64.Build.0 = Release|x64
{B50C10C8-5260-498B-A80F-48FFB4534360}.Debug|Win32.ActiveCfg = Debug|Win32
{B50C10C8-5260-498B-A80F-48FFB4534360}.Debug|Win32.Build.0 = Debug|Win32
{B50C10C8-5260-498B-A80F-48FFB4534360}.Debug|x64.ActiveCfg = Debug|x64
{B50C10C8-5260-498B-A80F-48FFB4534360}.Debug|x64.Build.0 = Debug|x64
{B50C10C8-5260-498B-A80F-48FFB4534360}.Release|Win32.ActiveCfg = Release|Win32
{B50C10C8-5260-498B-A80F-48FFB4534360}.Release|Win32.Build.0 = Release|Win32
{B50C10C8-5260-498B-A80F-48FFB4534360}.Release|x64.ActiveCfg = Release|x64
{B50C10C8-5260-498B-A80F-48FFB4534360}.Release|x64.Build.0 = Release|x64
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Debug|Win32.ActiveCfg = Debug|Win32
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Debug|Win32.Build.0 = Debug|Win32
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Debug|x64.ActiveCfg = Debug|x64
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Debug|x64.Build.0 = Debug|x64
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Release|Win32.ActiveCfg = Release|Win32
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Release|Win32.Build.0 = Release|Win32
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Release|x64.ActiveCfg = Release|x64
{76045260-8DA6-4A3E-B220-F5B1B4ADE192}.Release|x64.Build.0 = Release|x64
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Debug|Win32.ActiveCfg = Debug|Win32
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Debug|Win32.Build.0 = Debug|Win32
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Debug|x64.ActiveCfg = Debug|x64
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Debug|x64.Build.0 = Debug|x64
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Release|Win32.ActiveCfg = Release|Win32
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Release|Win32.Build.0 = Release|Win32
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Release|x64.ActiveCfg = Release|x64
{92492ACB-1F57-40BB-818F-33AD1C20273A}.Release|x64.Build.0 = Release|x64
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Debug|Win32.ActiveCfg = Debug|Win32
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Debug|Win32.Build.0 = Debug|Win32
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Debug|x64.ActiveCfg = Debug|x64
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Debug|x64.Build.0 = Debug|x64
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Release|Win32.ActiveCfg = Release|Win32
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Release|Win32.Build.0 = Release|Win32
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Release|x64.ActiveCfg = Release|x64
{2D6CBBE8-6965-4016-B503-0D715AE26691}.Release|x64.Build.0 = Release|x64
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Debug|Win32.ActiveCfg = Debug|Win32
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Debug|Win32.Build.0 = Debug|Win32
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Debug|x64.ActiveCfg = Debug|x64
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Debug|x64.Build.0 = Debug|x64
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Release|Win32.ActiveCfg = Release|Win32
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Release|Win32.Build.0 = Release|Win32
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Release|x64.ActiveCfg = Release|x64
{C527B648-F98D-42E5-9F59-251FD95D15A0}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -19,7 +19,6 @@
#include <TDocStd_Application.hxx>
#include <TDocStd_Document.hxx>
#include <TDocStd_XLinkTool.hxx>
#include <CDF_Session.hxx>
// ====================================================================================
// This sample contains template for typical actions with OCAF document at application
@@ -33,23 +32,7 @@ static void Sample()
//...Creating application
Handle(TDocStd_Application) app;
// the application is now handled by the CDF_Session variable
//...Retrieving the application
if (!CDF_Session::Exists()) {
Handle(CDF_Session) S = CDF_Session::CurrentSession();
if (!S->HasCurrentApplication())
Standard_DomainError::Raise("DDocStd::Find no applicative session");
app = Handle(TDocStd_Application)::DownCast(S->CurrentApplication());
}
else {
// none active application
}
Handle(TDocStd_Application) app = new TDocStd_Application;
//...Creating the new document (document conatins a framework)

View File

@@ -53,8 +53,6 @@ unix {
equals(MACOSX_USE_GLX, true): DEFINES += MACOSX_USE_GLX
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
LIBS += -lfreeimageplus
LIBS += -ltbb -ltbbmalloc
QMAKE_CXXFLAGS += -std=gnu++11
}

View File

@@ -518,8 +518,6 @@ void AIS_ColoredShape::ComputeSelection (const Handle(SelectMgr_Selection)& theS
const Handle(SelectMgr_EntityOwner)& anOwner = aSelEntIter.Value()->BaseSensitive()->OwnerId();
anOwner->SetSelectable (aThis);
}
StdSelect_BRepSelectionTool::PreBuildBVH (theSelection);
}
//=======================================================================

View File

@@ -128,7 +128,7 @@ myMainVwr(MainViewer),
myMainSel(new StdSelect_ViewerSelector3d()),
myToHilightSelected(Standard_True),
mySelection(new AIS_Selection()),
myFilters(new SelectMgr_OrFilter()),
myFilters (new SelectMgr_AndOrFilter(SelectMgr_FilterType_OR)),
myDefaultDrawer(new Prs3d_Drawer()),
myCurDetected(0),
myCurHighlighted(0),

View File

@@ -32,6 +32,7 @@
#include <Prs3d_Drawer.hxx>
#include <Prs3d_TypeOfHighlight.hxx>
#include <PrsMgr_PresentationManager3d.hxx>
#include <SelectMgr_AndOrFilter.hxx>
#include <SelectMgr_IndexedMapOfOwner.hxx>
#include <SelectMgr_ListOfFilter.hxx>
#include <SelectMgr_PickingStrategy.hxx>
@@ -46,7 +47,6 @@
class SelectMgr_SelectionManager;
class V3d_Viewer;
class SelectMgr_OrFilter;
class V3d_View;
class TopLoc_Location;
class TCollection_ExtendedString;
@@ -736,6 +736,15 @@ public: //! @name management of active Selection Modes
public: //! @name Selection Filters management
//! @return the context selection filter type.
SelectMgr_FilterType FilterType() const { return myFilters->FilterType(); }
//! Sets the context selection filter type.
//! SelectMgr_TypeFilter_OR selection filter is used by default.
//! @param theFilterType the filter type.
void SetFilterType (const SelectMgr_FilterType theFilterType)
{ myFilters->SetFilterType (theFilterType); }
//! Returns the list of filters active in a local context.
Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
@@ -1332,14 +1341,7 @@ protected: //! @name internal methods
if (myLastPicked.IsNull())
return;
if (myLastPicked->IsAutoHilight())
{
myMainPM->ClearImmediateDraw();
}
else
{
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
}
myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
}
//! Bind/Unbind status to object and its children
@@ -1361,7 +1363,8 @@ protected: //! @name internal fields
Handle(SelectMgr_EntityOwner) myLastPicked;
Standard_Boolean myToHilightSelected;
Handle(AIS_Selection) mySelection;
Handle(SelectMgr_OrFilter) myFilters;
Handle(SelectMgr_AndOrFilter) myFilters; //!< context filter (the content active filters
//! can be applied with AND or OR operation)
Handle(Prs3d_Drawer) myDefaultDrawer;
Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
TColStd_SequenceOfInteger myDetectedSeq;

View File

@@ -172,8 +172,8 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
{
const Handle(SelectMgr_EntityOwner) anOwner = aSelIter.Value();
const Handle(AIS_InteractiveObject) anInteractive = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable());
Handle(AIS_GlobalStatus) aStatus;
if (!myObjects.Find (anInteractive, aStatus))
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anInteractive);
if (!aStatusPtr)
{
continue;
}
@@ -183,9 +183,9 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
anOwner->Unhilight (myMainPM);
if (theIsToHilightSubIntensity)
{
if (aStatus->IsSubIntensityOn())
if ((*aStatusPtr)->IsSubIntensityOn())
{
const Standard_Integer aHiMode = getHilightMode (anInteractive, aStatus->HilightStyle(), aStatus->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anInteractive, (*aStatusPtr)->HilightStyle(), (*aStatusPtr)->DisplayMode());
highlightWithSubintensity (anOwner, aHiMode);
}
}
@@ -196,7 +196,7 @@ void AIS_InteractiveContext::unhighlightOwners (const AIS_NListOfEntityOwner& th
}
if (anOwner == anInteractive->GlobalSelOwner())
{
aStatus->SetHilightStatus (Standard_False);
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
}
for (NCollection_IndexedMap<Handle(AIS_InteractiveObject)>::Iterator anIter (anObjToClear); anIter.More(); anIter.Next())
@@ -746,11 +746,15 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
continue;
const Handle(Prs3d_Drawer)& anObjSelStyle = getSelStyle (anObj, anOwner);
Handle(AIS_GlobalStatus)& aState = myObjects.ChangeFind(anObj);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
continue;
}
if (anOwner == anObj->GlobalSelOwner())
{
aState->SetHilightStatus (Standard_True);
aState->SetHilightStyle (anObjSelStyle);
(*aStatusPtr)->SetHilightStatus (Standard_True);
(*aStatusPtr)->SetHilightStyle (anObjSelStyle);
}
if (!anOwner->IsAutoHilight())
{
@@ -768,7 +772,7 @@ void AIS_InteractiveContext::highlightOwners (const AIS_NListOfEntityOwner& theO
}
else
{
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, aState->DisplayMode());
const Standard_Integer aHiMode = getHilightMode (anObj, anObjSelStyle, (*aStatusPtr)->DisplayMode());
anOwner->HilightWithColor (myMainPM, anObjSelStyle, aHiMode);
}
}
@@ -872,7 +876,10 @@ void AIS_InteractiveContext::SetSelected (const Handle(AIS_InteractiveObject)& t
}
if (aSelOwner == aSelectable->GlobalSelOwner())
{
myObjects.ChangeFind (aSelectable)->SetHilightStatus (Standard_False);
if (Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (aSelectable))
{
(*aStatusPtr)->SetHilightStatus (Standard_False);
}
}
}
@@ -990,7 +997,12 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
if (myAutoHilight)
{
const Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (theOwner->Selectable());
Handle(AIS_GlobalStatus)& aStatus = myObjects.ChangeFind (anObj);
Handle(AIS_GlobalStatus)* aStatusPtr = myObjects.ChangeSeek (anObj);
if (!aStatusPtr)
{
return;
}
if (theOwner->IsSelected())
{
highlightSelected (theOwner);
@@ -1001,7 +1013,7 @@ void AIS_InteractiveContext::AddOrRemoveSelected (const Handle(SelectMgr_EntityO
anOwners.Append (theOwner);
unhighlightOwners (anOwners);
aStatus->SetHilightStyle (Handle(Prs3d_Drawer)());
(*aStatusPtr)->SetHilightStyle (Handle(Prs3d_Drawer)());
}
}

View File

@@ -23,7 +23,6 @@
#include <Quantity_Color.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_Filter.hxx>
#include <SelectMgr_OrFilter.hxx>
#include <SelectMgr_SelectionManager.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>

View File

@@ -56,6 +56,20 @@ void AIS_InteractiveObject::Redisplay (const Standard_Boolean AllModes)
myCTXPtr->Redisplay (this, Standard_False, AllModes);
}
//=======================================================================
//function : ProcessDragging
//purpose :
//=======================================================================
Standard_Boolean AIS_InteractiveObject::ProcessDragging (const Handle(AIS_InteractiveContext)&,
const Handle(V3d_View)&,
const Handle(SelectMgr_EntityOwner)&,
const Graphic3d_Vec2i&,
const Graphic3d_Vec2i&,
const AIS_DragAction)
{
return Standard_False;
}
//=======================================================================
//function :
//purpose :

View File

@@ -18,12 +18,14 @@
#define _AIS_InteractiveObject_HeaderFile
#include <AIS_KindOfInteractive.hxx>
#include <AIS_DragAction.hxx>
#include <SelectMgr_SelectableObject.hxx>
class AIS_InteractiveContext;
class Graphic3d_MaterialAspect;
class Prs3d_BasicAspect;
class Bnd_Box;
class V3d_View;
//! Defines a class of objects with display and selection services.
//! Entities which are visualized and selected are Interactive Objects.
@@ -103,6 +105,21 @@ public:
//! This method removes the owner from the graphic entity.
void ClearOwner() { myOwner.Nullify(); }
//! Drag object in the viewer.
//! @param theCtx [in] interactive context
//! @param theView [in] active View
//! @param theOwner [in] the owner of detected entity
//! @param theDragFrom [in] drag start point
//! @param theDragTo [in] drag end point
//! @param theAction [in] drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction);
public:
//! Returns the context pointer to the interactive context.

View File

@@ -639,6 +639,44 @@ Standard_Boolean AIS_Manipulator::ObjectTransformation (const Standard_Integer t
return Standard_False;
}
//=======================================================================
//function : ProcessDragging
//purpose :
//=======================================================================
Standard_Boolean AIS_Manipulator::ProcessDragging (const Handle(AIS_InteractiveContext)&,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)&,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction)
{
switch (theAction)
{
case AIS_DragAction_Start:
{
if (HasActiveMode())
{
StartTransform (theDragFrom.x(), theDragFrom.y(), theView);
return Standard_True;
}
break;
}
case AIS_DragAction_Update:
{
Transform (theDragTo.x(), theDragTo.y(), theView);
return Standard_True;
}
case AIS_DragAction_Abort:
{
StopTransform (false);
return Standard_True;
}
case AIS_DragAction_Stop:
break;
}
return Standard_False;
}
//=======================================================================
//function : StartTransform
//purpose :

View File

@@ -94,9 +94,6 @@ DEFINE_STANDARD_HANDLE (AIS_Manipulator, AIS_InteractiveObject)
//! @endcode
//! The last method erases manipulator object.
//! @warning
//! On construction an instance of AIS_Manipulator object is bound to Graphic3d_ZLayerId_Topmost layer,
//! so make sure to call for your AIS_InteractiveContext the method MainSelector()->SetPickClosest (Standard_False)
//! otherwise you may notice issues with activation of modes.
class AIS_Manipulator : public AIS_InteractiveObject
{
public:
@@ -163,6 +160,20 @@ public:
}
public:
//! Drag object in the viewer.
//! @param theCtx [in] interactive context
//! @param theView [in] active View
//! @param theOwner [in] the owner of detected entity
//! @param theDragFrom [in] drag start point
//! @param theDragTo [in] drag end point
//! @param theAction [in] drag action
//! @return FALSE if object rejects dragging action (e.g. AIS_DragAction_Start)
Standard_EXPORT virtual Standard_Boolean ProcessDragging (const Handle(AIS_InteractiveContext)& theCtx,
const Handle(V3d_View)& theView,
const Handle(SelectMgr_EntityOwner)& theOwner,
const Graphic3d_Vec2i& theDragFrom,
const Graphic3d_Vec2i& theDragTo,
const AIS_DragAction theAction) Standard_OVERRIDE;
//! Init start (reference) transformation.
//! @warning It is used in chain with StartTransform-Transform(gp_Trsf)-StopTransform

View File

@@ -20,6 +20,7 @@
#include <Font_Rect.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_RenderingParams.hxx>
#include <Graphic3d_Text.hxx>
#include <Prs3d_Text.hxx>
#include <Prs3d_TextAspect.hxx>
@@ -308,7 +309,9 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
{
aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
}
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor);
Handle(Graphic3d_Text) aText =
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, anOrientation, aHasOwnAnchor);
aText->SetTextFormatter (myFormatter);
if (myHasFlipping && isInit)
{
thePrs->CurrentGroup()->SetFlippingOptions (Standard_False, gp_Ax2());
@@ -316,7 +319,9 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
}
else
{
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, aPosition);
Handle(Graphic3d_Text) aText =
Prs3d_Text::Draw (thePrs->CurrentGroup(), anAsp, myText, aPosition);
aText->SetTextFormatter (myFormatter);
}
if (isInit)

View File

@@ -24,6 +24,8 @@
#include <Font_FontAspect.hxx>
#include <TCollection_ExtendedString.hxx>
class Font_TextFormatter;
//! Presentation of the text.
class AIS_TextLabel : public AIS_InteractiveObject
{
@@ -121,6 +123,12 @@ public:
//! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
Standard_EXPORT void SetColorSubTitle (const Quantity_Color& theColor);
//! Returns text presentation formatter; NULL by default, which means standard text formatter will be used.
const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; }
//! Setup text formatter for presentation. It's empty by default.
void SetTextFormatter (const Handle(Font_TextFormatter)& theFormatter) { myFormatter = theFormatter; }
protected:
//! Compute
@@ -144,6 +152,8 @@ protected:
protected:
Handle(Font_TextFormatter) myFormatter;
TCollection_ExtendedString myText;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;

View File

@@ -15,7 +15,6 @@
#include <AIS_AnimationCamera.hxx>
#include <AIS_InteractiveContext.hxx>
#include <AIS_Manipulator.hxx>
#include <AIS_Point.hxx>
#include <AIS_RubberBand.hxx>
#include <AIS_XRTrackedDevice.hxx>
@@ -2611,19 +2610,20 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
case AIS_DragAction_Start:
{
myDragObject.Nullify();
myDragOwner.Nullify();
if (!theCtx->HasDetected())
{
return;
}
Handle(AIS_InteractiveObject) aPrs = theCtx->DetectedInteractive();
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (aPrs))
const Handle(SelectMgr_EntityOwner)& aDetectedOwner = theCtx->DetectedOwner();
Handle(AIS_InteractiveObject) aDetectedPrs = Handle(AIS_InteractiveObject)::DownCast (aDetectedOwner->Selectable());
if (aDetectedPrs->ProcessDragging (theCtx, theView, aDetectedOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction))
{
if (aManip->HasActiveMode())
{
myDragObject = aManip;
aManip->StartTransform (myGL.Dragging.PointStart.x(), myGL.Dragging.PointStart.y(), theView);
}
myDragObject = aDetectedPrs;
myDragOwner = aDetectedOwner;
}
return;
}
@@ -2638,10 +2638,9 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
{
theCtx->SetSelectedState (aGlobOwner, true);
}
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
{
aManip->Transform (myGL.Dragging.PointTo.x(), myGL.Dragging.PointTo.y(), theView);
}
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
theView->Invalidate();
return;
}
@@ -2655,10 +2654,8 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
myGL.Dragging.PointTo = myGL.Dragging.PointStart;
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
if (Handle(AIS_Manipulator) aManip = Handle(AIS_Manipulator)::DownCast (myDragObject))
{
aManip->StopTransform (false);
}
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
Standard_FALLTHROUGH
}
case AIS_DragAction_Stop:
@@ -2673,8 +2670,11 @@ void AIS_ViewController::OnObjectDragged (const Handle(AIS_InteractiveContext)&
theCtx->SetSelectedState (aGlobOwner, false);
}
myDragObject->ProcessDragging (theCtx, theView, myDragOwner, myGL.Dragging.PointStart,
myGL.Dragging.PointTo, theAction);
theView->Invalidate();
myDragObject.Nullify();
myDragOwner.Nullify();
return;
}
}

View File

@@ -40,6 +40,7 @@ class AIS_Point;
class AIS_RubberBand;
class AIS_XRTrackedDevice;
class Graphic3d_Camera;
class SelectMgr_EntityOwner;
class V3d_View;
class WNT_HIDSpaceMouse;
@@ -737,6 +738,7 @@ protected:
Handle(AIS_AnimationCamera) myViewAnimation; //!< view animation
Handle(AIS_RubberBand) myRubberBand; //!< Rubber-band presentation
Handle(SelectMgr_EntityOwner) myDragOwner; //!< detected owner of currently dragged object
Handle(AIS_InteractiveObject) myDragObject; //!< currently dragged object
Graphic3d_Vec2i myPrevMoveTo; //!< previous position of MoveTo event in 3D viewer
Standard_Boolean myHasHlrOnBeforeRotation; //!< flag for restoring Computed mode after rotation

View File

@@ -20,9 +20,9 @@
enum Approx_ParametrizationType
{
Approx_ChordLength,
Approx_Centripetal,
Approx_IsoParametric
Approx_ChordLength, //!< parameters of points are proportionate to distances between them
Approx_Centripetal, //!< parameters of points are proportionate to square roots of distances between them
Approx_IsoParametric //!< parameters of points are distributed uniformly
};
#endif // _Approx_ParametrizationType_HeaderFile

View File

@@ -17,7 +17,7 @@
#ifndef _Approx_Status_HeaderFile
#define _Approx_Status_HeaderFile
//! It is an auxiliary flag being used in inner computations
enum Approx_Status
{
Approx_PointsAdded,

View File

@@ -124,3 +124,6 @@ Unable to glue the shapes
.BOPAlgo_AlertShapeIsNotPeriodic
The shape is not periodic
.BOPAlgo_AlertUnableToMakeClosedEdgeOnFace
Unable to make closed edge on face.

View File

@@ -138,4 +138,7 @@ DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToGlue)
//! The shape is not periodic
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertShapeIsNotPeriodic)
//! Unable to make closed edge on face (to make a seam)
DEFINE_ALERT_WITH_SHAPE(BOPAlgo_AlertUnableToMakeClosedEdgeOnFace)
#endif // _BOPAlgo_Alerts_HeaderFile

View File

@@ -357,7 +357,7 @@ void BOPAlgo_ArgumentAnalyzer::TestSelfInterferences()
aChecker.SetNonDestructive(Standard_True);
aChecker.SetRunParallel(myRunParallel);
aChecker.SetFuzzyValue(myFuzzyValue);
aChecker.SetProgressIndicator(myProgressIndicator);
aChecker.SetProgressIndicator(*myProgressScope);
//
aChecker.Perform();
Standard_Boolean hasError = aChecker.HasErrors();

View File

@@ -60,8 +60,7 @@ static
//
static
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
TopTools_IndexedDataMapOfShapeListOfShape& theMFS,
TopTools_IndexedMapOfShape& theMFI);
TopTools_IndexedDataMapOfShapeListOfShape& theMFS);
//=======================================================================
//function :
@@ -388,7 +387,7 @@ void BOPAlgo_BOP::Perform()
pPF=new BOPAlgo_PaveFiller(aAllocator);
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
@@ -1002,8 +1001,6 @@ void BOPAlgo_BOP::BuildSolid()
TopTools_IndexedMapOfShape aMUSols;
// Use map to chose the most outer faces to build result solids
aMFS.Clear();
// Internal faces
TopTools_IndexedMapOfShape aMFI;
//
TopoDS_Iterator aIt(myRC);
for (; aIt.More(); aIt.Next()) {
@@ -1015,7 +1012,7 @@ void BOPAlgo_BOP::BuildSolid()
}
}
//
MapFacesToBuildSolids(aSx, aMFS, aMFI);
MapFacesToBuildSolids(aSx, aMFS);
} // for (; aIt.More(); aIt.Next()) {
//
// Process possibly untouched solids.
@@ -1035,7 +1032,7 @@ void BOPAlgo_BOP::BuildSolid()
}
//
if (aExp.More()) {
MapFacesToBuildSolids(aSx, aMFS, aMFI);
MapFacesToBuildSolids(aSx, aMFS);
}
else {
BOPTools_Set aST;
@@ -1058,13 +1055,6 @@ void BOPAlgo_BOP::BuildSolid()
aSFS.Append(aFx);
}
}
// Internal faces
aNb = aMFI.Extent();
for (i = 1; i <= aNb; ++i) {
TopoDS_Shape aFx = aMFI.FindKey(i);
aSFS.Append(aFx.Oriented(TopAbs_FORWARD));
aSFS.Append(aFx.Oriented(TopAbs_REVERSED));
}
//
TopoDS_Shape aRC;
BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
@@ -1073,6 +1063,7 @@ void BOPAlgo_BOP::BuildSolid()
BOPAlgo_BuilderSolid aBS;
aBS.SetContext(myContext);
aBS.SetShapes(aSFS);
aBS.SetAvoidInternalShapes (Standard_True);
aBS.Perform();
if (aBS.HasErrors()) {
AddError (new BOPAlgo_AlertSolidBuilderFailed); // SolidBuilder failed
@@ -1518,19 +1509,16 @@ Standard_Integer NbCommonItemsInMap(const TopTools_MapOfShape& theM1,
//=======================================================================
//function : MapFacesToBuildSolids
//purpose : Stores the faces of the given solid into outgoing maps:
// <theMFS> - not internal faces with reference to solid;
// <theMFI> - internal faces.
// <theMFS> - not internal faces with reference to solid.
//=======================================================================
void MapFacesToBuildSolids(const TopoDS_Shape& theSol,
TopTools_IndexedDataMapOfShapeListOfShape& theMFS,
TopTools_IndexedMapOfShape& theMFI)
TopTools_IndexedDataMapOfShapeListOfShape& theMFS)
{
TopExp_Explorer aExp(theSol, TopAbs_FACE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aF = aExp.Current();
//
if (aF.Orientation() == TopAbs_INTERNAL) {
theMFI.Add(aF);
continue;
}
//

View File

@@ -126,4 +126,7 @@ static const char BOPAlgo_BOPAlgo_msg[] =
"Unable to glue the shapes\n"
"\n"
".BOPAlgo_AlertShapeIsNotPeriodic\n"
"The shape is not periodic\n";
"The shape is not periodic\n"
"\n"
".BOPAlgo_AlertUnableToMakeClosedEdgeOnFace\n"
"Unable to make closed edge on face.\n";

View File

@@ -195,7 +195,7 @@ void BOPAlgo_Builder::Perform()
//
pPF->SetArguments(myArguments);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
@@ -632,7 +632,7 @@ void BOPAlgo_Builder::BuildBOP(const TopTools_ListOfShape& theObjects,
aBS.SetRunParallel(myRunParallel);
aBS.SetContext(myContext);
aBS.SetFuzzyValue(myFuzzyValue);
aBS.SetProgressIndicator(myProgressIndicator);
aBS.SetProgressIndicator(*myProgressScope);
aBS.Perform();
// Resulting solids

View File

@@ -17,6 +17,7 @@
#include <BOPAlgo_Builder.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <BOPAlgo_BuilderFace.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Tools.hxx>
@@ -383,7 +384,18 @@ void BOPAlgo_Builder::BuildSplitFaces()
if (bIsClosed) {
if (aMFence.Add(aSp)) {
if (!BRep_Tool::IsClosed(aSp, aF)){
BOPTools_AlgoTools3D::DoSplitSEAMOnFace(aSp, aF);
if (!BOPTools_AlgoTools3D::DoSplitSEAMOnFace(aSp, aF))
{
// try different approach
if (!BOPTools_AlgoTools3D::DoSplitSEAMOnFace(aE, aSp, aF))
{
TopoDS_Compound aWS;
BRep_Builder().MakeCompound (aWS);
BRep_Builder().Add (aWS, aF);
BRep_Builder().Add (aWS, aSp);
AddWarning (new BOPAlgo_AlertUnableToMakeClosedEdgeOnFace (aWS));
}
}
}
//
aSp.Orientation(TopAbs_FORWARD);
@@ -438,7 +450,7 @@ void BOPAlgo_Builder::BuildSplitFaces()
aBF.SetFace(aF);
aBF.SetShapes(aLE);
aBF.SetRunParallel(myRunParallel);
aBF.SetProgressIndicator(myProgressIndicator);
aBF.SetProgressIndicator(*myProgressScope);
//
}// for (i=0; i<aNbS; ++i) {
//
@@ -625,7 +637,7 @@ void BOPAlgo_Builder::FillSameDomainFaces()
aPSB.Shape1() = aF1;
aPSB.Shape2() = aF2;
aPSB.SetFuzzyValue(myFuzzyValue);
aPSB.SetProgressIndicator(myProgressIndicator);
aPSB.SetProgressIndicator(*myProgressScope);
}
}
}
@@ -778,7 +790,7 @@ void BOPAlgo_Builder::FillInternalVertices()
aVFI.SetVertex(aV);
aVFI.SetFace(aFIm);
aVFI.SetFuzzyValue(myFuzzyValue);
aVFI.SetProgressIndicator(myProgressIndicator);
aVFI.SetProgressIndicator(*myProgressScope);
}
}
}

View File

@@ -432,7 +432,7 @@ void BOPAlgo_Builder::BuildSplitSolids(TopTools_DataMapOfShapeShape& theDraftSol
aBS.SetSolid(aSolid);
aBS.SetShapes(aSFS);
aBS.SetRunParallel(myRunParallel);
aBS.SetProgressIndicator(myProgressIndicator);
aBS.SetProgressIndicator(*myProgressScope);
}//for (i=0; i<aNbS; ++i) {
//
Standard_Integer k, aNbBS;

View File

@@ -432,7 +432,7 @@ void BOPAlgo_CheckerSI::CheckFaceSelfIntersection()
aFaceSelfIntersect.SetFace(aF);
aFaceSelfIntersect.SetTolF(aTolF);
//
aFaceSelfIntersect.SetProgressIndicator(myProgressIndicator);
aFaceSelfIntersect.SetProgressIndicator(*myProgressScope);
}
Standard_Integer aNbFace = aVFace.Length();

View File

@@ -86,7 +86,7 @@ void BOPAlgo_MakerVolume::Perform()
}
//
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -15,8 +15,9 @@
#include <BOPAlgo_Options.hxx>
#include <Message_MsgFile.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressScope.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <TCollection_AsciiString.hxx>
#include <Precision.hxx>
#include <Standard_NotImplemented.hxx>
#include <Standard_ProgramError.hxx>
@@ -51,6 +52,7 @@ BOPAlgo_Options::BOPAlgo_Options()
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion()),
myProgressScope(0L),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
@@ -67,6 +69,7 @@ BOPAlgo_Options::BOPAlgo_Options
myReport(new Message_Report),
myRunParallel(myGlobalRunParallel),
myFuzzyValue(Precision::Confusion()),
myProgressScope(0L),
myUseOBB(Standard_False)
{
BOPAlgo_LoadMessages();
@@ -132,22 +135,21 @@ void BOPAlgo_Options::SetFuzzyValue(const Standard_Real theFuzz)
//purpose :
//=======================================================================
void BOPAlgo_Options::SetProgressIndicator
(const Handle(Message_ProgressIndicator)& theObj)
(const Message_ProgressScope& theScope)
{
if (!theObj.IsNull()) {
myProgressIndicator = theObj;
}
myProgressScope = &theScope;
}
//=======================================================================
//function : UserBreak
//purpose :
//=======================================================================
void BOPAlgo_Options::UserBreak() const
{
if (myProgressIndicator.IsNull()) {
if (!myProgressScope) {
return;
}
if (myProgressIndicator->UserBreak()) {
if (myProgressScope->UserBreak()) {
throw Standard_NotImplemented("BOPAlgo_Options::UserBreak(), method is not implemented");
}
}

View File

@@ -20,7 +20,7 @@
#include <NCollection_BaseAllocator.hxx>
class Message_ProgressIndicator;
class Message_ProgressScope;
//! The class provides the following options for the algorithms in Boolean Component:
//! - *Memory allocation tool* - tool for memory allocations;
@@ -156,7 +156,7 @@ public:
//!@name Progress indicator
//! Set the Progress Indicator object.
Standard_EXPORT void SetProgressIndicator(const Handle(Message_ProgressIndicator)& theObj);
Standard_EXPORT void SetProgressIndicator(const Message_ProgressScope& theProgress);
public:
//!@name Usage of Oriented Bounding boxes
@@ -185,7 +185,7 @@ protected:
Handle(Message_Report) myReport;
Standard_Boolean myRunParallel;
Standard_Real myFuzzyValue;
Handle(Message_ProgressIndicator) myProgressIndicator;
const Message_ProgressScope* myProgressScope;
Standard_Boolean myUseOBB;
};

View File

@@ -57,7 +57,8 @@ BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
BOPAlgo_Algo(theAllocator),
myFPBDone(1, theAllocator),
myIncreasedSS(1, theAllocator),
myVertsToAvoidExtension(1, theAllocator)
myVertsToAvoidExtension(1, theAllocator),
myDistances(1, theAllocator)
{
myDS = NULL;
myIterator = NULL;

View File

@@ -35,6 +35,7 @@
#include <BOPDS_PDS.hxx>
#include <BOPDS_PIterator.hxx>
#include <BOPDS_VectorOfCurve.hxx>
#include <BOPTools_BoxTree.hxx>
#include <IntSurf_ListOfPntOn2S.hxx>
#include <IntTools_ShrunkRange.hxx>
#include <NCollection_BaseAllocator.hxx>
@@ -319,7 +320,9 @@ protected:
//! created the section curve.
Standard_EXPORT Standard_Boolean IsExistingPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC,
const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB,
const Standard_Real theTolR3D,
const BOPDS_IndexedMapOfPaveBlock& theMPB,
BOPTools_BoxTree& thePBTree,
const BOPDS_MapOfPaveBlock& theMPBCommon,
Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew);
@@ -412,6 +415,21 @@ protected:
TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
const Standard_Integer aType = 0);
//! Adds the existing edges for intersection with section edges
//! by checking the possible intersection with the faces comparing
//! pre-saved E-F distances with new tolerances.
Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt,
const Standard_Integer theCur,
const Standard_Integer nF1,
const Standard_Integer nF2,
const TopoDS_Edge& theES,
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
BOPTools_BoxTree& thePBTree,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
TopTools_DataMapOfShapeInteger& theMVI,
BOPDS_ListOfPaveBlock& theLPBC,
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
BOPDS_MapOfPaveBlock& theMPB);
//! Adds the existing edges from the map <theMPBOnIn> which interfere
//! with the vertices from <theMVB> map to the post treatment of section edges.
@@ -419,12 +437,12 @@ protected:
const Standard_Integer nF1,
const Standard_Integer nF2,
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
BOPTools_BoxTree& thePBTree,
const TColStd_DataMapOfIntegerListOfInteger& theDMBV,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
TopTools_DataMapOfShapeInteger& theMVI,
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
BOPDS_MapOfPaveBlock& theMPB);
//! Replaces existing pave block <thePB> with new pave blocks <theLPB>.
//! The list <theLPB> contains images of <thePB> which were created in
@@ -599,6 +617,22 @@ protected:
//! Check all edges on the micro status and remove the positive ones
Standard_EXPORT void RemoveMicroEdges();
//! Auxiliary structure to hold the edge distance to the face
struct EdgeRangeDistance
{
Standard_Real First;
Standard_Real Last;
Standard_Real Distance;
EdgeRangeDistance (const Standard_Real theFirst = 0.0,
const Standard_Real theLast = 0.0,
const Standard_Real theDistance = RealLast())
: First (theFirst), Last (theLast), Distance (theDistance)
{}
};
protected: //! Fields
TopTools_ListOfShape myArguments;
BOPDS_PDS myDS;
BOPDS_PIterator myIterator;
@@ -615,6 +649,11 @@ protected:
//! which has already been extended to cover the real intersection
//! points, and should not be extended any longer to be put
//! on a section curve.
NCollection_DataMap <BOPDS_Pair,
NCollection_List<EdgeRangeDistance>,
BOPDS_PairMapHasher> myDistances; //!< Map to store minimal distances between shapes
//! which have no real intersections
};

View File

@@ -152,8 +152,6 @@ Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
//
// add vertex to SD map
myDS->AddShapeSD(nV, nVNew);
//
myDS->InitPaveBlocksForVertex(nV);
// Add new vertex to map of vertices to avoid further extension
myVertsToAvoidExtension.Add(nVNew);

View File

@@ -264,7 +264,7 @@ void BOPAlgo_PaveFiller::IntersectVE
aVESolver.SetEdge(aE);
aVESolver.SetPaveBlock(aPB);
aVESolver.SetFuzzyValue(myFuzzyValue);
aVESolver.SetProgressIndicator(myProgressIndicator);
aVESolver.SetProgressIndicator(*myProgressScope);
}
}
//

View File

@@ -253,7 +253,7 @@ void BOPAlgo_PaveFiller::PerformEE()
anEdgeEdge.SetEdge2(aE2, aT21, aT22);
anEdgeEdge.SetBoxes (aBB1, aBB2);
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}//for (; aIt2.More(); aIt2.Next()) {
}//for (; aIt1.More(); aIt1.Next()) {
}//for (; myIterator->More(); myIterator->Next()) {
@@ -1073,7 +1073,7 @@ void BOPAlgo_PaveFiller::ForceInterfEE()
anEdgeEdge.SetFuzzyValue(myFuzzyValue + aTolAdd);
else
anEdgeEdge.SetFuzzyValue(myFuzzyValue);
anEdgeEdge.SetProgressIndicator(myProgressIndicator);
anEdgeEdge.SetProgressIndicator(*myProgressScope);
}
}
}

View File

@@ -217,7 +217,7 @@ void BOPAlgo_PaveFiller::PerformVF()
aVertexFace.SetVertex(aV);
aVertexFace.SetFace(aF);
aVertexFace.SetFuzzyValue(myFuzzyValue);
aVertexFace.SetProgressIndicator(myProgressIndicator);
aVertexFace.SetProgressIndicator(*myProgressScope);
}//for (; myIterator->More(); myIterator->Next()) {
//
aNbVF=aVVF.Length();

View File

@@ -278,7 +278,7 @@ void BOPAlgo_PaveFiller::PerformEF()
aSR = aPBRange;
BOPTools_AlgoTools::CorrectRange(aE, aF, aSR, aPBRange);
aEdgeFace.SetRange (aPBRange);
aEdgeFace.SetProgressIndicator(myProgressIndicator);
aEdgeFace.SetProgressIndicator(*myProgressScope);
// Save the pair to avoid their forced intersection
BOPDS_MapOfPaveBlock* pMPB = myFPBDone.ChangeSeek(nF);
if (!pMPB)
@@ -300,12 +300,6 @@ void BOPAlgo_PaveFiller::PerformEF()
continue;
}
//
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
aNbCPrts = aCPrts.Length();
if (!aNbCPrts) {
continue;
}
//
aEdgeFace.Indices(nE, nF);
//
const TopoDS_Edge& aE=aEdgeFace.Edge();
@@ -313,6 +307,23 @@ void BOPAlgo_PaveFiller::PerformEF()
//
aTolE=BRep_Tool::Tolerance(aE);
aTolF=BRep_Tool::Tolerance(aF);
//
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeFace.CommonParts();
aNbCPrts = aCPrts.Length();
if (!aNbCPrts) {
if (aEdgeFace.MinimalDistance() < RealLast() &&
aEdgeFace.MinimalDistance() > aTolE + aTolF)
{
const Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
aPB->Range(aT1, aT2);
NCollection_List<EdgeRangeDistance>* pList = myDistances.ChangeSeek (BOPDS_Pair (nE, nF));
if (!pList)
pList = myDistances.Bound (BOPDS_Pair (nE, nF), NCollection_List<EdgeRangeDistance>());
pList->Append (EdgeRangeDistance (aT1, aT2, aEdgeFace.MinimalDistance()));
}
continue;
}
//
const IntTools_Range& anewSR=aEdgeFace.NewSR();
Handle(BOPDS_PaveBlock)& aPB=aEdgeFace.PaveBlock();
//
@@ -999,7 +1010,7 @@ void BOPAlgo_PaveFiller::ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB
aEdgeFace.SetFuzzyValue(myFuzzyValue + aTolAdd);
aEdgeFace.UseQuickCoincidenceCheck(Standard_True);
aEdgeFace.SetRange(IntTools_Range(aPB->Pave1().Parameter(), aPB->Pave2().Parameter()));
aEdgeFace.SetProgressIndicator(myProgressIndicator);
aEdgeFace.SetProgressIndicator(*myProgressScope);
}
}
}

View File

@@ -38,7 +38,9 @@
#include <BOPDS_VectorOfPoint.hxx>
#include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_BoxSelector.hxx>
#include <BOPTools_Parallel.hxx>
#include <Bnd_Tools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
@@ -306,7 +308,7 @@ void BOPAlgo_PaveFiller::PerformFF()
//
aFaceFace.SetParameters(bApprox, bCompC2D1, bCompC2D2, anApproxTol);
aFaceFace.SetFuzzyValue(myFuzzyValue);
aFaceFace.SetProgressIndicator(myProgressIndicator);
aFaceFace.SetProgressIndicator(*myProgressScope);
}
else {
// for the Glue mode just add all interferences of that type
@@ -500,7 +502,6 @@ void BOPAlgo_PaveFiller::MakeBlocks()
myDS->SubShapesOnIn(nF1, nF2, aMVOnIn, aMVCommon, aMPBOnIn, aMPBCommon);
myDS->SharedEdges(nF1, nF2, aLSE, aAllocator);
//
Standard_Boolean bHasRealSectionEdge = Standard_False;
// 1. Treat Points
for (j=0; j<aNbP; ++j) {
TopoDS_Vertex aV;
@@ -573,6 +574,27 @@ void BOPAlgo_PaveFiller::MakeBlocks()
BOPDS_Curve& aNC=aVC.ChangeValue(j);
PutClosingPaveOnCurve (aNC);
}
//
BOPTools_BoxTree aPBTree;
{
// Fill the tree with boxes of pave blocks ON/IN
// Tree will be build on first selection from the tree.
const Standard_Integer aNbPB = aMPBOnIn.Extent();
aPBTree.SetSize (aNbPB);
for (Standard_Integer iPB = 1; iPB <= aNbPB; ++iPB)
{
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn (iPB);
if (!aPB->HasEdge())
continue;
if (myDS->ShapeInfo (aPB->OriginalEdge()).HasFlag())
continue;
aPBTree.Add (iPB, Bnd_Tools::Bnd2BVH (myDS->ShapeInfo (aPB->Edge()).Box()));
}
}
//
// 3. Make section edges
for (j=0; j<aNbC; ++j) {
@@ -640,7 +662,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
continue;
}
//
bExist = IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aMPBCommon, aPBOut, aTolNew);
bExist = IsExistingPaveBlock(aPB, aNC, aTolR3D, aMPBOnIn, aPBTree, aMPBCommon, aPBOut, aTolNew);
if (bExist)
{
Standard_Boolean bInF1 = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
@@ -670,23 +692,24 @@ void BOPAlgo_PaveFiller::MakeBlocks()
if (pFaces->IsEmpty() || !pFaces->Contains(nF))
pFaces->Append(nF);
// Try fusing the vertices of the existing pave block
// with the vertices put on the real section curve (except
// for technological vertices, which will be removed)
Standard_Integer nVOut1, nVOut2;
aPBOut->Indices(nVOut1, nVOut2);
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
{
aVertsOnRejectedPB.Add(aV1);
}
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
{
aVertsOnRejectedPB.Add(aV2);
}
if (aMPBAdd.Add(aPBOut))
{
// Add edge for processing as the section edge
PreparePostTreatFF(i, j, aPBOut, aMSCPB, aMVI, aLPBC);
// Try fusing the vertices of the existing pave block
// with the vertices put on the real section curve (except
// for technological vertices, which will be removed)
Standard_Integer nVOut1, nVOut2;
aPBOut->Indices(nVOut1, nVOut2);
if (nV1 != nVOut1 && nV1 != nVOut2 && !aMVBounds.Contains(nV1))
{
aVertsOnRejectedPB.Add(aV1);
}
if (nV2 != nVOut1 && nV2 != nVOut2 && !aMVBounds.Contains(nV2))
{
aVertsOnRejectedPB.Add(aV2);
}
}
}
continue;
@@ -715,8 +738,10 @@ void BOPAlgo_PaveFiller::MakeBlocks()
//
aMVTol.UnBind(nV1);
aMVTol.UnBind(nV2);
//
bHasRealSectionEdge = Standard_True;
// Add existing pave blocks for post treatment
ProcessExistingPaveBlocks (i, j, nF1, nF2, aES, aMPBOnIn, aPBTree,
aMSCPB, aMVI, aLPBC, aPBFacesMap, aMPBAdd);
}
//
aLPBC.RemoveFirst();
@@ -744,29 +769,7 @@ void BOPAlgo_PaveFiller::MakeBlocks()
aDMVLV.UnBind(nV1);
}
//
ProcessExistingPaveBlocks(i, nF1, nF2, aMPBOnIn, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
//
// If the pair of faces has produced any real section edges
// it is necessary to check if these edges do not intersect
// any common IN edges of the faces. For that, all such edges
// are added for Post Treatment along with sections edges.
if (bHasRealSectionEdge) {
const BOPDS_IndexedMapOfPaveBlock& aMPBIn1 = aFI1.PaveBlocksIn();
const BOPDS_IndexedMapOfPaveBlock& aMPBIn2 = aFI2.PaveBlocksIn();
//
// For simplicity add all IN edges into the first set of section curves.
// These existing edges will be removed from the set on the post treatment
// stage in the UpdateFaceInfo function.
BOPDS_ListOfPaveBlock& aLPBC = aVC.ChangeValue(0).ChangePaveBlocks();
//
Standard_Integer aNbIn1 = aMPBIn1.Extent();
for (j = 1; j <= aNbIn1; ++j) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBIn1(j);
if (aMPBIn2.Contains(aPB) && aMPBAdd.Add(aPB)) {
PreparePostTreatFF(i, 0, aPB, aMSCPB, aMVI, aLPBC);
}
}
}
ProcessExistingPaveBlocks(i, nF1, nF2, aMPBOnIn, aPBTree, aDMBV, aMSCPB, aMVI, aPBFacesMap, aMPBAdd);
}//for (i=0; i<aNbFF; ++i) {
// Remove "micro" section edges
@@ -928,10 +931,17 @@ void BOPAlgo_PaveFiller::PostTreatFF
}
//
// 1 prepare arguments
// Avoid intersection of existing edges among themselves
TopoDS_Compound anExistingEdges;
BRep_Builder().MakeCompound (anExistingEdges);
TopTools_MapOfShape anAddedSD;
for (k = aNbS; k > 0; --k) {
const TopoDS_Shape& aS=theMSCPB.FindKey(k);
aLS.Append(aS);
const Handle(BOPDS_PaveBlock)& aPB = theMSCPB (k).PaveBlock1();
if (!aPB.IsNull() && aPB->HasEdge())
BRep_Builder().Add (anExistingEdges, aS);
else
aLS.Append(aS);
// add vertices-candidates for SD from the map aDMNewSD,
// so that they took part in fuse operation.
TopoDS_Iterator itV(aS);
@@ -948,6 +958,8 @@ void BOPAlgo_PaveFiller::PostTreatFF
}
}
}
if (anExistingEdges.NbChildren() > 0)
aLS.Append (anExistingEdges);
//
// The section edges considered as a micro should be
// specially treated - their vertices should be united and
@@ -1007,7 +1019,7 @@ void BOPAlgo_PaveFiller::PostTreatFF
}
//
// 2 Fuse shapes
aPF.SetProgressIndicator(myProgressIndicator);
aPF.SetProgressIndicator(*myProgressScope);
aPF.SetRunParallel(myRunParallel);
aPF.SetArguments(aLS);
aPF.Perform();
@@ -1029,6 +1041,12 @@ void BOPAlgo_PaveFiller::PostTreatFF
aItLS.Initialize(aLS);
for (; aItLS.More(); aItLS.Next()) {
const TopoDS_Shape& aSx=aItLS.Value();
if (aSx.ShapeType() == TopAbs_COMPOUND)
{
for (TopoDS_Iterator itC (aSx); itC.More(); itC.Next())
aLS.Append (itC.Value());
continue;
}
nSx=aPDS->Index(aSx);
const BOPDS_ShapeInfo& aSIx=aPDS->ShapeInfo(nSx);
//
@@ -1596,108 +1614,124 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
const BOPDS_Curve& theNC,
const Standard_Real theTolR3D,
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
BOPTools_BoxTree& thePBTree,
const BOPDS_MapOfPaveBlock& theMPBCommon,
Handle(BOPDS_PaveBlock)& aPBOut,
Standard_Real& theTolNew)
{
Standard_Boolean bRet;
Standard_Real aT1, aT2, aTm, aTx, aTolCheck;
Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB;
gp_Pnt aP1, aPm, aP2;
Bnd_Box aBoxP1, aBoxPm, aBoxP2, aBoxTmp;
//
bRet=Standard_False;
aTolCheck = theTolR3D + myFuzzyValue;
const IntTools_Curve& aIC=theNC.Curve();
//
Standard_Real aT1, aT2;
thePB->Range(aT1, aT2);
thePB->Indices(nV11, nV12);
const Standard_Real aTolV11 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV11)));
const Standard_Real aTolV12 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV12)));
const Standard_Real aTolV1 = Max(aTolV11, aTolV12) + myFuzzyValue;
Standard_Integer nV11, nV12;
thePB->Indices (nV11, nV12);
//first point
aIC.D0(aT1, aP1);
aBoxP1.Add(aP1);
aBoxP1.Enlarge(aTolV11);
Bnd_Box aBoxP1;
gp_Pnt aP1;
aIC.D0 (aT1, aP1);
aBoxP1.Add (aP1);
const Standard_Real aTolV11 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV11)));
aBoxP1.Enlarge (aTolV11);
// Find edges intersecting by AABB with the first point
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxP1));
aSelector.SetBVHSet (&thePBTree);
if (!aSelector.Select())
return Standard_False;
//intermediate point
aTm=IntTools_Tools::IntermediatePoint (aT1, aT2);
Bnd_Box aBoxPm;
Standard_Real aTm = IntTools_Tools::IntermediatePoint (aT1, aT2);
gp_Pnt aPm;
aIC.D0(aTm, aPm);
aBoxPm.Add(aPm);
//last point
aIC.D0(aT2, aP2);
aBoxP2.Add(aP2);
aBoxP2.Enlarge(aTolV12);
//
aBoxPm.Add (aPm);
// last point
Bnd_Box aBoxP2;
gp_Pnt aP2;
aIC.D0 (aT2, aP2);
aBoxP2.Add (aP2);
const Standard_Real aTolV12 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV12)));
aBoxP2.Enlarge (aTolV12);
const Standard_Real aTolV1 = Max(aTolV11, aTolV12) + myFuzzyValue;
Standard_Real aTolCheck = theTolR3D + myFuzzyValue;
// Look for the existing pave block closest to the section curve
Standard_Boolean bFound = Standard_False;
theTolNew = ::RealLast();
aNbPB = theMPBOnIn.Extent();
for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i);
aPB->Indices(nV21, nV22);
const Standard_Real aTolV21 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV21)));
const Standard_Real aTolV22 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV22)));
const Standard_Real aTolV2 = Max(aTolV21, aTolV22) + myFuzzyValue;
nSp=aPB->Edge();
if (nSp < 0)
for (TColStd_ListOfInteger::Iterator it (aSelector.Indices()); it.More(); it.Next())
{
const Handle (BOPDS_PaveBlock)& aPB = theMPBOnIn (it.Value());
Standard_Integer nV21, nV22;
aPB->Indices (nV21, nV22);
const Standard_Real aTolV21 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV21)));
const Standard_Real aTolV22 = BRep_Tool::Tolerance (TopoDS::Vertex (myDS->Shape (nV22)));
const Standard_Real aTolV2 = Max (aTolV21, aTolV22) + myFuzzyValue;
const BOPDS_ShapeInfo& aSISp = myDS->ChangeShapeInfo (aPB->Edge());
const TopoDS_Edge& aSp = (*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp = aSISp.Box();
Standard_Integer iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 : 1;
Standard_Integer iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 : (!aBoxSp.IsOut (aBoxP2) ? 1 : 0);
if (!iFlag2)
continue;
const BOPDS_ShapeInfo& aSISp=myDS->ChangeShapeInfo(nSp);
const TopoDS_Edge& aSp=(*(TopoDS_Edge *)(&aSISp.Shape()));
const Bnd_Box& aBoxSp=aSISp.Box();
//
iFlag1 = (nV11 == nV21 || nV11 == nV22) ? 2 :
(!aBoxSp.IsOut(aBoxP1) ? 1 : 0);
iFlag2 = (nV12 == nV21 || nV12 == nV22) ? 2 :
(!aBoxSp.IsOut(aBoxP2) ? 1 : 0);
if (iFlag1 && iFlag2) {
Standard_Real aDist = 0.;
Standard_Real aRealTol = aTolCheck;
if (myDS->IsCommonBlock(aPB))
{
aRealTol = Max(aRealTol, Max(aTolV1, aTolV2));
if (theMPBCommon.Contains(aPB))
// for an edge, which is a common block with a face,
// increase the chance to coincide with section curve
aRealTol *= 2.;
}
Standard_Real aDist = 0.;
Standard_Real aRealTol = aTolCheck;
if (myDS->IsCommonBlock(aPB))
{
aRealTol = Max(aRealTol, Max(aTolV1, aTolV2));
if (theMPBCommon.Contains(aPB))
// for an edge, which is a common block with a face,
// increase the chance to coincide with section curve
aRealTol *= 2.;
}
aBoxTmp = aBoxPm;
aBoxTmp.Enlarge(aRealTol);
Bnd_Box aBoxTmp = aBoxPm;
aBoxTmp.Enlarge(aRealTol);
Standard_Real aDistToSp = 0.;
if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm,
aRealTol,
aSp,
aTx, aDistToSp)) {
continue;
}
//
if (iFlag1 == 1) {
iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
if (iFlag1 && aDistToSp < aDist)
aDistToSp = aDist;
}
//
if (iFlag2 == 1) {
iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist);
if (iFlag2 && aDistToSp < aDist)
aDistToSp = aDist;
}
//
if (iFlag1 && iFlag2)
Standard_Real aDistToSp = 0.;
Standard_Real aTx;
if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm,
aRealTol,
aSp,
aTx, aDistToSp)) {
continue;
}
//
if (iFlag1 == 1) {
iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist);
if (iFlag1 && aDistToSp < aDist)
aDistToSp = aDist;
}
//
if (iFlag2 == 1) {
iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist);
if (iFlag2 && aDistToSp < aDist)
aDistToSp = aDist;
}
//
if (iFlag1 && iFlag2)
{
if (aDistToSp < theTolNew)
{
if (aDistToSp < theTolNew)
{
aPBOut = aPB;
theTolNew = aDistToSp;
bRet = Standard_True;
}
aPBOut = aPB;
theTolNew = aDistToSp;
bFound = Standard_True;
}
}
}
return bRet;
return bFound;
}
//=======================================================================
@@ -2476,6 +2510,96 @@ void BOPAlgo_PaveFiller::PutPaveOnCurve
}
}
//=======================================================================
//function : ProcessExistingPaveBlocks
//purpose :
//=======================================================================
void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks (const Standard_Integer theInt,
const Standard_Integer theCur,
const Standard_Integer nF1,
const Standard_Integer nF2,
const TopoDS_Edge& theES,
const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn,
BOPTools_BoxTree& thePBTree,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
TopTools_DataMapOfShapeInteger& theMVI,
BOPDS_ListOfPaveBlock& theLPBC,
BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap,
BOPDS_MapOfPaveBlock& theMPB)
{
Bnd_Box aBoxES;
BRepBndLib::Add (theES, aBoxES, false);
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxES));
aSelector.SetBVHSet (&thePBTree);
if (!aSelector.Select())
return;
const Standard_Real aTolES = BRep_Tool::Tolerance (theES);
const BOPDS_FaceInfo& aFI1 = myDS->FaceInfo (nF1);
const BOPDS_FaceInfo& aFI2 = myDS->FaceInfo (nF2);
for (TColStd_ListOfInteger::Iterator itPB (aSelector.Indices()); itPB.More(); itPB.Next())
{
const Handle(BOPDS_PaveBlock)& aPBF = theMPBOnIn (itPB.Value());
if (theMPB.Contains (aPBF))
continue;
Standard_Boolean bInF1 = (aFI1.PaveBlocksOn().Contains(aPBF) ||
aFI1.PaveBlocksIn().Contains(aPBF));
Standard_Boolean bInF2 = (aFI2.PaveBlocksOn().Contains(aPBF) ||
aFI2.PaveBlocksIn().Contains(aPBF));
if (bInF1 && bInF2)
{
// Add all common edges for post treatment
theMPB.Add (aPBF);
PreparePostTreatFF (theInt, theCur, aPBF, theMSCPB, theMVI, theLPBC);
continue;
}
const Standard_Integer nF = bInF1 ? nF2 : nF1;
const NCollection_List<EdgeRangeDistance>* pList = myDistances.Seek (BOPDS_Pair (aPBF->OriginalEdge(), nF));
if (!pList)
continue;
Standard_Real aT1, aT2;
aPBF->Range (aT1, aT2);
Standard_Real aDist = RealLast();
for (NCollection_List<EdgeRangeDistance>::Iterator itR (*pList); itR.More(); itR.Next())
{
const EdgeRangeDistance& aRangeDist = itR.Value();
if ((aT1 <= aRangeDist.First && aRangeDist.First <= aT2) ||
(aT1 <= aRangeDist.Last && aRangeDist.Last <= aT2) ||
(aRangeDist.First <= aT1 && aT1 <= aRangeDist.Last) ||
(aRangeDist.First <= aT2 && aT2 <= aRangeDist.Last))
{
aDist = aRangeDist.Distance;
break;
}
}
if (aDist < RealLast())
{
const TopoDS_Edge& aEF = TopoDS::Edge (myDS->Shape (aPBF->Edge()));
const Standard_Real aTolSum = aTolES + BRep_Tool::Tolerance (aEF);
if (aDist <= aTolSum)
{
theMPB.Add (aPBF);
PreparePostTreatFF (theInt, theCur, aPBF, theMSCPB, theMVI, theLPBC);
TColStd_ListOfInteger* pFaces = thePBFacesMap.ChangeSeek(aPBF);
if (!pFaces)
pFaces = thePBFacesMap.Bound (aPBF, TColStd_ListOfInteger());
if (pFaces->IsEmpty() || !pFaces->Contains (nF))
pFaces->Append (nF);
}
}
}
}
//=======================================================================
//function : ProcessExistingPaveBlocks
//purpose :
@@ -2485,6 +2609,7 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
const Standard_Integer nF1,
const Standard_Integer nF2,
const BOPDS_IndexedMapOfPaveBlock& aMPBOnIn,
BOPTools_BoxTree& thePBTree,
const TColStd_DataMapOfIntegerListOfInteger& aDMBV,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
TopTools_DataMapOfShapeInteger& aMVI,
@@ -2496,7 +2621,7 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
}
//
Standard_Real aT, dummy;
Standard_Integer i, nV, nE, iC, aNbPB, iFlag;
Standard_Integer nV, nE, iC, iFlag;
TColStd_ListIteratorOfListOfInteger aItLI;
TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aItBV;
//
@@ -2507,8 +2632,6 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
const BOPDS_FaceInfo& aFI1 = myDS->FaceInfo(nF1);
const BOPDS_FaceInfo& aFI2 = myDS->FaceInfo(nF2);
//
aNbPB = aMPBOnIn.Extent();
//
aItBV.Initialize(aDMBV);
for (; aItBV.More(); aItBV.Next()) {
iC = aItBV.Key();
@@ -2527,8 +2650,15 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
continue;
}
//
for (i = 1; i <= aNbPB; ++i) {
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn(i);
BOPTools_BoxTreeSelector aSelector;
aSelector.SetBox (Bnd_Tools::Bnd2BVH (aBoxV));
aSelector.SetBVHSet (&thePBTree);
if (!aSelector.Select())
continue;
for (TColStd_ListOfInteger::Iterator it (aSelector.Indices()); it.More(); it.Next())
{
const Handle(BOPDS_PaveBlock)& aPB = aMPBOnIn (it.Value());
if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
continue;
}
@@ -2536,18 +2666,8 @@ void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
if (aMPB.Contains(aPB)) {
continue;
}
if (myDS->ShapeInfo(aPB->OriginalEdge()).HasFlag()) { // skip degenerated edges
continue;
}
//
nE = aPB->Edge();
const BOPDS_ShapeInfo& aSIE = myDS->ShapeInfo(nE);
const Bnd_Box& aBoxE = aSIE.Box();
//
if (aBoxV.IsOut(aBoxE)) {
continue;
}
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aSIE.Shape();
//
iFlag = myContext->ComputeVE(aV, aE, aT, dummy, myFuzzyValue);
@@ -3250,6 +3370,7 @@ void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
aTolV=BRep_Tool::Tolerance(aV);
//
UpdateVertex(nV, aTolV);
myDS->InitPaveBlocksForVertex (nV);
}
}//for (j=0; j<aNbC; ++j) {
}//for (i=0; i<aNbFF; ++i) {

View File

@@ -484,7 +484,7 @@ void BOPAlgo_PaveFiller::MakeSplitEdges()
aBSE.SetCommonBlock(aCB);
}
aBSE.SetDS(myDS);
aBSE.SetProgressIndicator(myProgressIndicator);
aBSE.SetProgressIndicator(*myProgressScope);
} // for (; aItPB.More(); aItPB.Next()) {
} // for (i=0; i<aNbPBP; ++i) {
//
@@ -596,7 +596,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
BOPAlgo_MPC& aMPC=aVMPC.Appended();
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
aMPC.SetProgressIndicator(*myProgressScope);
}
//
// On
@@ -660,7 +660,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aF1F);
aMPC.SetProgressIndicator(myProgressIndicator);
aMPC.SetProgressIndicator(*myProgressScope);
}
}// for (i=0; i<aNbFI; ++i) {
//
@@ -710,7 +710,7 @@ void BOPAlgo_PaveFiller::MakePCurves()
aMPC.SetEdge(aE);
aMPC.SetFace(aFf[m]);
aMPC.SetFlag(Standard_True);
aMPC.SetProgressIndicator(myProgressIndicator);
aMPC.SetProgressIndicator(*myProgressScope);
}
}
}

View File

@@ -89,7 +89,7 @@ void BOPAlgo_Splitter::Perform()
BOPAlgo_PaveFiller *pPF = new BOPAlgo_PaveFiller();
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetProgressIndicator(myProgressIndicator);
pPF->SetProgressIndicator(*myProgressScope);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);

View File

@@ -786,7 +786,7 @@ Standard_Integer NbWaysOut(const BOPAlgo_ListOfEdgeInfo& aLEInfo)
//for case chl/927/r9
aTX=0.05*(aLast - aFirst);//aTX=0.25*(aLast - aFirst);
if (aTX < 5.e-5) {
aTX = 5.e-5;
aTX = Min (5.e-5, (aLast - aFirst) / 2.);
}
if(dt > aTX) {
// to save direction of the curve as much as it possible

View File

@@ -825,7 +825,8 @@ Standard_Boolean BOPTools_AlgoTools::IsInternalFace
const TopoDS_Face& aF2=(*(TopoDS_Face*)(&aLF.Last()));
iRet=BOPTools_AlgoTools::IsInternalFace(theFace, aE, aF1, aF2,
theContext);
break;
if (iRet != 2)
break;
}
}//for(; aExp.More(); aExp.Next()) {
//
@@ -901,8 +902,6 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
const TopoDS_Face& theFace2,
const Handle(IntTools_Context)& theContext)
{
Standard_Boolean bRet;
Standard_Integer iRet;
TopoDS_Edge aE1, aE2;
TopoDS_Face aFOff;
BOPTools_ListOfCoupleOfShape theLCSOff;
@@ -931,17 +930,15 @@ Standard_Integer BOPTools_AlgoTools::IsInternalFace
aCS2.SetShape2(theFace2);
theLCSOff.Append(aCS2);
//
bRet=GetFaceOff(aE1, theFace1, theLCSOff, aFOff, theContext);
//
iRet=0; // theFace is not internal
if (theFace.IsEqual(aFOff)) {
Standard_Integer iRet = 0; // theFace is not internal
Standard_Boolean isDone = GetFaceOff (aE1, theFace1, theLCSOff, aFOff, theContext);
if (!isDone)
// error, unable to classify face by this edge
iRet = 2;
else if (theFace.IsEqual (aFOff))
// theFace is internal
iRet=1;
if (!bRet) {
// theFace seems to be internal
iRet=2;
}
}
iRet = 1;
return iRet;
}
//=======================================================================
@@ -957,7 +954,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
{
Standard_Boolean bRet, bIsComputed;
Standard_Real aT, aT1, aT2, aAngle, aTwoPI, aAngleMin, aDt3D;
Standard_Real aUmin, aUsup, aVmin, aVsup, aPA;
Standard_Real aUmin, aUsup, aVmin, aVsup;
gp_Pnt aPn1, aPn2, aPx;
gp_Dir aDN1, aDN2, aDBF, aDBF2, aDTF;
gp_Vec aVTgt;
@@ -967,7 +964,6 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
BOPTools_ListIteratorOfListOfCoupleOfShape aIt;
GeomAPI_ProjectPointOnSurf aProjPL;
//
aPA=Precision::Angular();
aAngleMin=100.;
aTwoPI=M_PI+M_PI;
aC3D =BRep_Tool::Curve(theE1, aT1, aT2);
@@ -994,6 +990,10 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
//
aDTF=aDN1^aDBF;
//
// The difference between faces should be obvious enough
// to guarantee the correctness of the classification
Standard_Real anAngleCriteria = Precision::Confusion();
bRet=Standard_True;
aIt.Initialize(theLCSOff);
for (; aIt.More(); aIt.Next()) {
@@ -1012,11 +1012,7 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
//Angle
aAngle=AngleWithRef(aDBF, aDBF2, aDTF);
//
if(aAngle<0.) {
aAngle=aTwoPI+aAngle;
}
//
if (aAngle<aPA) {
if (Abs(aAngle) < Precision::Angular()) {
if (aF2==theF1) {
aAngle=M_PI;
}
@@ -1025,19 +1021,21 @@ Standard_Boolean BOPTools_AlgoTools::GetFaceOff
}
}
//
if (fabs(aAngle-aAngleMin)<aPA) {
if (Abs(aAngle) < anAngleCriteria ||
Abs (aAngle-aAngleMin) < anAngleCriteria) {
// the minimal angle can not be found
bRet=Standard_False;
}
//
if (aAngle < 0.)
{
aAngle = aTwoPI + aAngle;
}
//
if (aAngle<aAngleMin){
aAngleMin=aAngle;
theFOff=aF2;
}
else if (aAngle==aAngleMin) {
// the minimal angle can not be found
bRet=Standard_False;
}
}
return bRet;
}

View File

@@ -39,6 +39,7 @@
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_Surface.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Dir.hxx>
#include <gp_Dir2d.hxx>
@@ -72,8 +73,8 @@ static
//function : DoSplitSEAMOnFace
//purpose :
//=======================================================================
void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
const TopoDS_Face& aF)
Standard_Boolean BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
const TopoDS_Face& aF)
{
Standard_Boolean bIsUPeriodic, bIsVPeriodic, bIsLeft;
Standard_Real aTol, a, b, anUPeriod, anVPeriod, aT, anU, dU, anU1;
@@ -131,7 +132,7 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
bIsVPeriodic=aSB->IsVPeriodic();
//
if (!(bIsUPeriodic || bIsVPeriodic)) {
return;
return Standard_False;
}
anUPeriod = bIsUPeriodic ? aSB->UPeriod() : 0.;
anVPeriod = bIsVPeriodic ? aSB->VPeriod() : 0.;
@@ -139,7 +140,7 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
//
if (aRTS.IsNull()) {
if (!bIsUClosed && !bIsVClosed) {
return;
return Standard_False;
}
//
if (bIsUClosed) {
@@ -191,7 +192,7 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
}
//
if (anU1==anU && anV1==anV) {
return;
return Standard_False;
}
//
aScPr = (anU1==anU) ? aDir2D1*aDOX : aDir2D1*aDOY;
@@ -222,7 +223,96 @@ void BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& aSplit,
BB.UpdateEdge(aSp, aC2, aC1, aF, aTol);
}
}
return Standard_True;
}
//=======================================================================
//function : DoSplitSEAMOnFace
//purpose :
//=======================================================================
Standard_Boolean BOPTools_AlgoTools3D::DoSplitSEAMOnFace (const TopoDS_Edge& theEOrigin,
const TopoDS_Edge& theESplit,
const TopoDS_Face& theFace)
{
if (!BRep_Tool::IsClosed (theEOrigin, theFace))
return Standard_False;
if (BRep_Tool::IsClosed (theESplit, theFace))
return Standard_True;
TopoDS_Edge aESplit = theESplit;
aESplit.Orientation (TopAbs_FORWARD);
TopoDS_Face aFace = theFace;
aFace.Orientation (TopAbs_FORWARD);
Standard_Real aTS1, aTS2;
Handle(Geom2d_Curve) aC2DSplit = BRep_Tool::CurveOnSurface (aESplit, aFace, aTS1, aTS2);
if (aC2DSplit.IsNull())
return Standard_False;
Standard_Real aT1, aT2;
Handle(Geom2d_Curve) aC2D1 = BRep_Tool::CurveOnSurface (
TopoDS::Edge (theEOrigin.Oriented (TopAbs_FORWARD)), aFace, aT1, aT2);
Handle(Geom2d_Curve) aC2D2 = BRep_Tool::CurveOnSurface (
TopoDS::Edge (theEOrigin.Oriented (TopAbs_REVERSED)), aFace, aT1, aT2);
Standard_Real aT = BOPTools_AlgoTools2D::IntermediatePoint (aTS1, aTS2);
gp_Pnt2d aPMid;
gp_Vec2d aVTgt;
aC2DSplit->D1 (aT, aPMid, aVTgt);
// project on original 2d curves
Geom2dAPI_ProjectPointOnCurve aProjPC1, aProjPC2;
aProjPC1.Init (aPMid, aC2D1, aT1, aT2);
aProjPC2.Init (aPMid, aC2D2, aT1, aT2);
if (!aProjPC1.NbPoints() && !aProjPC2.NbPoints())
return Standard_False;
Standard_Real aDist1 = aProjPC1.NbPoints() ? aProjPC1.LowerDistance() : RealLast();
Standard_Real aDist2 = aProjPC2.NbPoints() ? aProjPC2.LowerDistance() : RealLast();
if (aDist1 > Precision::PConfusion() && aDist2 > Precision::PConfusion())
return Standard_False;
// choose the closest and take corresponding point from the opposite
gp_Pnt2d aNewPnt = aDist1 < aDist2 ? aC2D2->Value (aProjPC1.LowerDistanceParameter()) :
aC2D1->Value (aProjPC2.LowerDistanceParameter());
Handle (Geom2d_Curve) aTmpC1 = Handle (Geom2d_Curve)::DownCast (aC2DSplit->Copy());
Handle (Geom2d_Curve) aTmpC2 = Handle (Geom2d_Curve)::DownCast (aC2DSplit->Copy());
Handle (Geom2d_TrimmedCurve) aC1 = new Geom2d_TrimmedCurve (aTmpC1, aTS1, aTS2);
Handle (Geom2d_TrimmedCurve) aC2 = new Geom2d_TrimmedCurve (aTmpC2, aTS1, aTS2);
gp_Vec2d aTrVec (aPMid, aNewPnt);
aC2->Translate (aTrVec);
gp_Pnt2d aPProj;
gp_Vec2d aVTgtOrigin;
if (aDist1 < aDist2)
{
aC2D1->D1 (aProjPC1.LowerDistanceParameter(), aPProj, aVTgtOrigin);
}
else
{
aC2D2->D1 (aProjPC2.LowerDistanceParameter(), aPProj, aVTgtOrigin);
}
Standard_Real aDot = aVTgt.Dot (aVTgtOrigin);
if ((aDist1 < aDist2) == (aDot > 0))
{
BRep_Builder().UpdateEdge (aESplit, aC1, aC2, aFace, BRep_Tool::Tolerance (aESplit));
}
else
{
BRep_Builder().UpdateEdge (aESplit, aC2, aC1, aFace, BRep_Tool::Tolerance (aESplit));
}
return Standard_True;
}
//=======================================================================
//function : GetNormalToFaceOnEdge
//purpose :

View File

@@ -43,11 +43,15 @@ public:
DEFINE_STANDARD_ALLOC
//! Makes the edge <theESplit> seam edge for the face <theFace> basing on the surface properties (U and V periods)
Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace (const TopoDS_Edge& theESplit,
const TopoDS_Face& theFace);
//! Make the edge <aSp> seam edge for the face <aF>
Standard_EXPORT static void DoSplitSEAMOnFace (const TopoDS_Edge& aSp,
const TopoDS_Face& aF);
//! Makes the split edge <theESplit> seam edge for the face <theFace> basing on the positions
//! of 2d curves of the original edge <theEOrigin>.
Standard_EXPORT static Standard_Boolean DoSplitSEAMOnFace (const TopoDS_Edge& theEOrigin,
const TopoDS_Edge& theESplit,
const TopoDS_Face& theFace);
//! Computes normal to the face <aF> for the point on the edge <aE>
//! at parameter <aT>.<br>

View File

@@ -24,9 +24,8 @@
#include <Standard_Boolean.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
#include <BOPAlgo_Options.hxx>
class Message_ProgressIndicator;
class TopoDS_Shape;
class TopoDS_Shape;
//! Provides the root interface for the API algorithms

View File

@@ -125,7 +125,7 @@ void BRepAlgoAPI_BuilderAlgo::IntersectShapes(const TopTools_ListOfShape& theArg
myDSFiller->SetArguments(theArgs);
// Set options for intersection
myDSFiller->SetRunParallel(myRunParallel);
myDSFiller->SetProgressIndicator(myProgressIndicator);
myDSFiller->SetProgressIndicator(*myProgressScope);
myDSFiller->SetFuzzyValue(myFuzzyValue);
myDSFiller->SetNonDestructive(myNonDestructive);
myDSFiller->SetGlue(myGlue);
@@ -145,7 +145,7 @@ void BRepAlgoAPI_BuilderAlgo::BuildResult()
{
// Set options to the builder
myBuilder->SetRunParallel(myRunParallel);
myBuilder->SetProgressIndicator(myProgressIndicator);
myBuilder->SetProgressIndicator(*myProgressScope);
myBuilder->SetCheckInverted(myCheckInverted);
myBuilder->SetToFillHistory(myFillHistory);
// Perform building of the result with pre-calculated intersections

View File

@@ -94,7 +94,7 @@ void BRepAlgoAPI_Check::Perform()
anAnalyzer.SelfInterMode() = myTestSI;
// Set options from BOPAlgo_Options
anAnalyzer.SetRunParallel(myRunParallel);
anAnalyzer.SetProgressIndicator(myProgressIndicator);
anAnalyzer.SetProgressIndicator(*myProgressScope);
anAnalyzer.SetFuzzyValue(myFuzzyValue);
// Perform the check
anAnalyzer.Perform();

View File

@@ -85,8 +85,7 @@
#include <GeomLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressSentry.hxx>
#include <Message_ProgressScope.hxx>
#include <NCollection_UBTreeFiller.hxx>
#include <Precision.hxx>
#include <Standard_ErrorHandler.hxx>
@@ -1812,10 +1811,10 @@ void BRepBuilderAPI_Sewing::Add(const TopoDS_Shape& aShape)
#include <OSD_Timer.hxx>
#endif
void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::Perform(const Message_ProgressRange& theProgress)
{
const Standard_Integer aNumberOfStages = myAnalysis + myCutting + mySewing + 2;
Message_ProgressSentry aPS (thePI, "Sewing", 0, aNumberOfStages, 1);
Message_ProgressScope aPS (theProgress, "Sewing", aNumberOfStages);
#ifdef OCCT_DEBUG
Standard_Real t_total = 0., t_analysis = 0., t_assembling = 0., t_cutting = 0., t_merging = 0.;
OSD_Chronometer chr_total, chr_local;
@@ -1831,10 +1830,9 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
chr_local.Reset();
chr_local.Start();
#endif
FaceAnalysis (thePI);
FaceAnalysis (aPS.Next());
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_analysis);
@@ -1855,10 +1853,9 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
chr_local.Reset();
chr_local.Start();
#endif
VerticesAssembling (thePI);
VerticesAssembling (aPS.Next());
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_assembling);
@@ -1871,10 +1868,9 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
chr_local.Reset();
chr_local.Start();
#endif
Cutting (thePI);
Cutting (aPS.Next());
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_cutting);
@@ -1886,10 +1882,9 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
chr_local.Reset();
chr_local.Start();
#endif
Merging (Standard_True, thePI);
Merging (Standard_True, aPS.Next());
if (!aPS.More())
return;
aPS.Next();
#ifdef OCCT_DEBUG
chr_local.Stop();
chr_local.Show(t_merging);
@@ -1898,10 +1893,10 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
}
else
{
aPS.Next( 1, Handle(TCollection_HAsciiString)());
aPS.Next();
if (myCutting)
aPS.Next( 1, Handle(TCollection_HAsciiString)());
aPS.Next( 1, Handle(TCollection_HAsciiString)());
aPS.Next();
aPS.Next();
if (!aPS.More())
return;
}
@@ -1913,7 +1908,7 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
std::cout << "Creating sewed shape..." << std::endl;
#endif
// examine the multiple edges if any and process sameparameter for edges if necessary
EdgeProcessing (thePI);
EdgeProcessing (aPS.Next());
if (!aPS.More())
return;
CreateSewedShape();
@@ -1923,7 +1918,7 @@ void BRepBuilderAPI_Sewing::Perform(const Handle(Message_ProgressIndicator)& the
return;
}
EdgeRegularity (thePI);
EdgeRegularity (aPS.Next());
if (mySameParameterMode && myFaceMode)
SameParameterShape();
@@ -2235,7 +2230,7 @@ void BRepBuilderAPI_Sewing::Dump() const
// myDegenerated
//=======================================================================
void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::FaceAnalysis(const Message_ProgressRange& theProgress)
{
if (!myShape.IsNull() && myOldShapes.IsEmpty()) {
Add(myShape);
@@ -2246,7 +2241,7 @@ void BRepBuilderAPI_Sewing::FaceAnalysis(const Handle(Message_ProgressIndicator)
TopTools_MapOfShape SmallEdges;
TopTools_IndexedDataMapOfShapeListOfShape GluedVertices;
Standard_Integer i = 1;
Message_ProgressSentry aPS (thePI, "Shape analysis", 0, myOldShapes.Extent(), 1);
Message_ProgressScope aPS (theProgress, "Shape analysis", myOldShapes.Extent());
for (i = 1; i <= myOldShapes.Extent() && aPS.More(); i++, aPS.Next()) {
for (TopExp_Explorer fexp(myOldShapes(i),TopAbs_FACE); fexp.More(); fexp.Next()) {
@@ -2777,7 +2772,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
TopTools_DataMapOfShapeListOfShape& aNodeEdges,
const TopTools_IndexedDataMapOfShapeListOfShape& aBoundFaces,
const Standard_Real Tolerance,
const Handle(Message_ProgressIndicator)& theProgress)
const Message_ProgressRange& theProgress)
{
// Create map of node -> vertices
TopTools_IndexedDataMapOfShapeListOfShape NodeVertices;
@@ -2805,7 +2800,7 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
#endif
// Merge nearest nodes
TopTools_IndexedDataMapOfShapeShape NodeNearestNode;
Message_ProgressSentry aPS (theProgress, "Glueing nodes", 0, nbNodes, 1, Standard_True);
Message_ProgressScope aPS (theProgress, "Glueing nodes", nbNodes, Standard_True);
for (Standard_Integer i = 1; i <= nbNodes && aPS.More(); i++, aPS.Next()) {
const TopoDS_Vertex& node1 = TopoDS::Vertex(NodeVertices.FindKey(i));
// Find near nodes
@@ -2938,11 +2933,11 @@ static Standard_Boolean GlueVertices(TopTools_IndexedDataMapOfShapeShape& aVerte
return CreateNewNodes(NodeNearestNode,NodeVertices,aVertexNode,aNodeEdges);
}
void BRepBuilderAPI_Sewing::VerticesAssembling(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::VerticesAssembling(const Message_ProgressRange& theProgress)
{
Standard_Integer nbVert = myVertexNode.Extent();
Standard_Integer nbVertFree = myVertexNodeFree.Extent();
Message_ProgressSentry aPS (thePI, "Vertices assembling", 0, 2, 1);
Message_ProgressScope aPS (theProgress, "Vertices assembling", 2);
if (nbVert || nbVertFree) {
// Fill map node -> sections
Standard_Integer i;
@@ -2964,16 +2959,15 @@ void BRepBuilderAPI_Sewing::VerticesAssembling(const Handle(Message_ProgressIndi
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVert << " vertices on faces..." << std::endl;
#endif
while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, thePI));
while (GlueVertices(myVertexNode,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
}
if (!aPS.More())
return;
aPS.Next();
if (nbVertFree) {
#ifdef OCCT_DEBUG
std::cout << "Assemble " << nbVertFree << " vertices on floating edges..." << std::endl;
#endif
while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, thePI));
while (GlueVertices(myVertexNodeFree,myNodeSections,myBoundFaces,myTolerance, aPS.Next()));
}
}
}
@@ -3133,11 +3127,11 @@ static void ReplaceEdge(const TopoDS_Shape& oldEdge,
//=======================================================================
void BRepBuilderAPI_Sewing::Merging(const Standard_Boolean /* firstTime */,
const Handle(Message_ProgressIndicator)& thePI)
const Message_ProgressRange& theProgress)
{
BRep_Builder B;
// TopTools_MapOfShape MergedEdges;
Message_ProgressSentry aPS (thePI, "Merging bounds", 0, myBoundFaces.Extent(), 1);
Message_ProgressScope aPS (theProgress, "Merging bounds", myBoundFaces.Extent());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
@@ -3623,7 +3617,7 @@ Standard_Boolean BRepBuilderAPI_Sewing::MergedNearestEdges(const TopoDS_Shape& e
// myCuttingNode
//=======================================================================
void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::Cutting(const Message_ProgressRange& theProgress)
{
Standard_Integer i, nbVertices = myVertexNode.Extent();
if (!nbVertices) return;
@@ -3646,7 +3640,7 @@ void BRepBuilderAPI_Sewing::Cutting(const Handle(Message_ProgressIndicator)& the
Standard_Real first, last;
// Iterate on all boundaries
Standard_Integer nbBounds = myBoundFaces.Extent();
Message_ProgressSentry aPS (thePI, "Cutting bounds", 0, nbBounds, 1);
Message_ProgressScope aPS (theProgress, "Cutting bounds", nbBounds);
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Edge& bound = TopoDS::Edge(anIterB.Key());
@@ -3986,12 +3980,12 @@ static TopoDS_Edge DegeneratedSection(const TopoDS_Shape& section, const TopoDS_
// - make the contigous edges sameparameter
//=======================================================================
void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::EdgeProcessing(const Message_ProgressRange& theProgress)
{
// constructs sectionEdge
TopTools_IndexedMapOfShape MapFreeEdges;
TopTools_DataMapOfShapeShape EdgeFace;
Message_ProgressSentry aPS (thePI, "Edge processing", 0, myBoundFaces.Extent(), 1);
Message_ProgressScope aPS (theProgress, "Edge processing", myBoundFaces.Extent());
TopTools_IndexedDataMapOfShapeListOfShape::Iterator anIterB(myBoundFaces);
for (; anIterB.More() && aPS.More(); anIterB.Next(), aPS.Next()) {
const TopoDS_Shape& bound = anIterB.Key();
@@ -4051,12 +4045,12 @@ void BRepBuilderAPI_Sewing::EdgeProcessing(const Handle(Message_ProgressIndicato
//purpose : update Continuity flag on newly created edges
//=======================================================================
void BRepBuilderAPI_Sewing::EdgeRegularity(const Handle(Message_ProgressIndicator)& thePI)
void BRepBuilderAPI_Sewing::EdgeRegularity(const Message_ProgressRange& theProgress)
{
TopTools_IndexedDataMapOfShapeListOfShape aMapEF;
TopExp::MapShapesAndAncestors(mySewedShape, TopAbs_EDGE, TopAbs_FACE, aMapEF);
Message_ProgressSentry aPS(thePI, "Encode edge regularity", 0, myMergedEdges.Extent(), 1);
Message_ProgressScope aPS(theProgress, "Encode edge regularity", myMergedEdges.Extent());
for (TopTools_MapIteratorOfMapOfShape aMEIt(myMergedEdges); aMEIt.More() && aPS.More(); aMEIt.Next(), aPS.Next())
{
TopoDS_Edge anEdge = TopoDS::Edge(myReShape->Apply(aMEIt.Value()));

View File

@@ -41,13 +41,12 @@
#include <TColgp_Array1OfPnt.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
class BRepTools_ReShape;
class Standard_OutOfRange;
class Standard_NoSuchObject;
class TopoDS_Shape;
class Message_ProgressIndicator;
class TopoDS_Edge;
class TopoDS_Face;
class Geom_Surface;
@@ -105,8 +104,8 @@ public:
Standard_EXPORT void Add (const TopoDS_Shape& shape);
//! Computing
//! thePI - progress indicator of algorithm
Standard_EXPORT void Perform (const Handle(Message_ProgressIndicator)& thePI = 0);
//! theProgress - progress indicator of algorithm
Standard_EXPORT void Perform (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Gives the sewed shape
//! a null shape if nothing constructed
@@ -248,10 +247,10 @@ protected:
//! Performs cutting of sections
//! thePI - progress indicator of processing
Standard_EXPORT void Cutting (const Handle(Message_ProgressIndicator)& thePI = 0);
//! theProgress - progress indicator of processing
Standard_EXPORT void Cutting (const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void Merging (const Standard_Boolean passage, const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT void Merging (const Standard_Boolean passage, const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT Standard_Boolean IsMergedClosed (const TopoDS_Edge& Edge1, const TopoDS_Edge& Edge2, const TopoDS_Face& fase) const;
@@ -262,10 +261,10 @@ protected:
//! Merged nearest edges.
Standard_EXPORT Standard_Boolean MergedNearestEdges (const TopoDS_Shape& edge, TopTools_SequenceOfShape& SeqMergedEdge, TColStd_SequenceOfBoolean& SeqMergedOri);
Standard_EXPORT void EdgeProcessing (const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT void EdgeProcessing (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! Recompute regularity on merged edges
Standard_EXPORT void EdgeRegularity (const Handle(Message_ProgressIndicator)& thePI = 0);
Standard_EXPORT void EdgeRegularity (const Message_ProgressRange& theProgress = Message_ProgressRange());
Standard_EXPORT void CreateOutputInformations();
@@ -277,8 +276,8 @@ protected:
//! This method is called from Perform only
//! thePI - progress indicator of processing
Standard_EXPORT virtual void FaceAnalysis (const Handle(Message_ProgressIndicator)& thePI = 0);
//! theProgress - progress indicator of processing
Standard_EXPORT virtual void FaceAnalysis (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! This method is called from Perform only
@@ -286,8 +285,8 @@ protected:
//! This method is called from Perform only
//! thePI - progress indicator of processing
Standard_EXPORT virtual void VerticesAssembling (const Handle(Message_ProgressIndicator)& thePI = 0);
//! theProgress - progress indicator of processing
Standard_EXPORT virtual void VerticesAssembling (const Message_ProgressRange& theProgress = Message_ProgressRange());
//! This method is called from Perform only

View File

@@ -154,7 +154,7 @@ void BRepExtrema_DistShapeShape::DistanceMapMap (const TopTools_IndexedMapOfShap
const TopoDS_Shape& aShape1 = theMap1 (aPair.Index1);
const TopoDS_Shape& aShape2 = theMap2 (aPair.Index2);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps);
BRepExtrema_DistanceSS aDistTool (aShape1, aShape2, aBox1, aBox2, myDistRef, myEps, myFlag);
if (aDistTool.IsDone())
{
if (aDistTool.DistValue() < myDistRef - myEps)
@@ -199,8 +199,7 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (Extrema_ExtFlag_MINMAX),
myAlgo (Extrema_ExtAlgo_Grad)
myFlag (Extrema_ExtFlag_MINMAX)
{
//
}
@@ -211,16 +210,14 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape()
//=======================================================================
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
const Extrema_ExtFlag F)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (Precision::Confusion()),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F),
myAlgo (A)
myFlag (F)
{
LoadS1(Shape1);
LoadS2(Shape2);
@@ -235,16 +232,14 @@ BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape
BRepExtrema_DistShapeShape::BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,
const TopoDS_Shape& Shape2,
const Standard_Real theDeflection,
const Extrema_ExtFlag F,
const Extrema_ExtAlgo A)
const Extrema_ExtFlag F)
: myDistRef (0.0),
myIsDone (Standard_False),
myInnerSol (Standard_False),
myEps (theDeflection),
myIsInitS1 (Standard_False),
myIsInitS2 (Standard_False),
myFlag (F),
myAlgo (A)
myFlag (F)
{
LoadS1(Shape1);
LoadS2(Shape2);

View File

@@ -18,7 +18,6 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <BRepExtrema_SolutionElem.hxx>
#include <BRepExtrema_SupportType.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Extrema_ExtFlag.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Shape.hxx>
@@ -39,9 +38,9 @@ class BRepExtrema_DistShapeShape
Standard_EXPORT BRepExtrema_DistShapeShape();
//! computation of the minimum distance (value and pair of points) using default deflection <br>
//! Default value is Precision::Confusion(). <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
//! create tool and load both shapes into it <br>
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad);
Standard_EXPORT BRepExtrema_DistShapeShape(const TopoDS_Shape& Shape1,const TopoDS_Shape& Shape2,const Standard_Real theDeflection,const Extrema_ExtFlag F = Extrema_ExtFlag_MIN);
void SetDeflection(const Standard_Real theDeflection)
{
@@ -129,11 +128,6 @@ class BRepExtrema_DistShapeShape
myFlag = F;
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
//! computes the minimum distance between two maps of shapes (Face,Edge,Vertex) <br>
@@ -156,7 +150,6 @@ private:
Standard_Boolean myIsInitS1;
Standard_Boolean myIsInitS2;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
Bnd_SeqOfBox myBV1;
Bnd_SeqOfBox myBV2;
Bnd_SeqOfBox myBE1;

View File

@@ -772,7 +772,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Vertex& S1, const TopoDS_Face&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S1,S2,myFlag,myAlgo);
BRepExtrema_ExtPF Ext(S1,S2,myFlag);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{
@@ -828,7 +828,7 @@ void BRepExtrema_DistanceSS::Perform(const TopoDS_Face& S1, const TopoDS_Vertex&
const Standard_Real Dst=B1.Distance(B2);
if ((Dst < myDstRef - myEps) || (fabs(Dst-myDstRef) < myEps))
{
BRepExtrema_ExtPF Ext(S2,S1,myFlag,myAlgo);
BRepExtrema_ExtPF Ext(S2,S1,myFlag);
const Standard_Integer NbExtrema = Ext.IsDone()? Ext.NbExt() : 0;
if ( NbExtrema > 0 )
{

View File

@@ -16,7 +16,6 @@
#include <BRepExtrema_SeqOfSolution.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
#include <Precision.hxx>
#include <Standard_DefineAlloc.hxx>
@@ -39,9 +38,8 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F), myAlgo(A)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(Precision::Confusion()), myFlag(F)
{
Perform(S1, S2, B1, B2);
}
@@ -52,9 +50,8 @@ class BRepExtrema_DistanceSS
BRepExtrema_DistanceSS(const TopoDS_Shape& S1, const TopoDS_Shape& S2,
const Bnd_Box& B1, const Bnd_Box& B2,
const Standard_Real DstRef, const Standard_Real aDeflection,
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo A = Extrema_ExtAlgo_Grad)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F), myAlgo(A)
const Extrema_ExtFlag F = Extrema_ExtFlag_MINMAX)
: myDstRef(DstRef), myModif(Standard_False), myEps(aDeflection), myFlag(F)
{
Perform(S1, S2, B1, B2);
}
@@ -83,11 +80,6 @@ class BRepExtrema_DistanceSS
{
myFlag = F;
}
//! sets the flag controlling ...
void SetAlgo(const Extrema_ExtAlgo A)
{
myAlgo = A;
}
private:
@@ -130,7 +122,6 @@ class BRepExtrema_DistanceSS
Standard_Boolean myModif;
Standard_Real myEps;
Extrema_ExtFlag myFlag;
Extrema_ExtAlgo myAlgo;
};
#endif

View File

@@ -32,9 +32,9 @@
//=======================================================================
BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
const Extrema_ExtFlag TheFlag)
{
Initialize(TheFace,TheFlag,TheAlgo);
Initialize(TheFace,TheFlag);
Perform(TheVertex,TheFace);
}
@@ -44,7 +44,7 @@ BRepExtrema_ExtPF::BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex, const TopoD
//=======================================================================
void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag, const Extrema_ExtAlgo TheAlgo)
const Extrema_ExtFlag TheFlag)
{
// cette surface doit etre en champ. Extrema ne fait
// pas de copie et prend seulement un pointeur dessus.
@@ -60,7 +60,6 @@ void BRepExtrema_ExtPF::Initialize(const TopoDS_Face& TheFace,
Standard_Real U1, U2, V1, V2;
BRepTools::UVBounds(TheFace, U1, U2, V1, V2);
myExtPS.SetFlag(TheFlag);
myExtPS.SetAlgo(TheAlgo);
myExtPS.Initialize(mySurf, U1, U2, V1, V2, aTolU, aTolV);
}

View File

@@ -21,7 +21,6 @@
#include <Extrema_SequenceOfPOnSurf.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <Extrema_ExtFlag.hxx>
#include <Extrema_ExtAlgo.hxx>
class TopoDS_Vertex;
class TopoDS_Face;
@@ -38,12 +37,10 @@ class BRepExtrema_ExtPF
{}
//! It calculates all the distances. <br>
Standard_EXPORT BRepExtrema_ExtPF(const TopoDS_Vertex& TheVertex,const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
Standard_EXPORT void Initialize(const TopoDS_Face& TheFace,
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX,
const Extrema_ExtAlgo TheAlgo = Extrema_ExtAlgo_Grad);
const Extrema_ExtFlag TheFlag = Extrema_ExtFlag_MINMAX);
//! An exception is raised if the fields have not been initialized. <br>
//! Be careful: this method uses the Face only for classify not for the fields. <br>
@@ -79,11 +76,6 @@ class BRepExtrema_ExtPF
myExtPS.SetFlag(F);
}
void SetAlgo(const Extrema_ExtAlgo A)
{
myExtPS.SetAlgo(A);
}
private:
Extrema_ExtPS myExtPS;

View File

@@ -23,6 +23,7 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <GCPnts.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
@@ -181,39 +182,6 @@ BRepLib_FindSurface::BRepLib_FindSurface(const TopoDS_Shape& S,
namespace
{
static void fillParams (const TColStd_Array1OfReal& theKnots,
Standard_Integer theDegree,
Standard_Real theParMin,
Standard_Real theParMax,
NCollection_Vector<Standard_Real>& theParams)
{
Standard_Real aPrevPar = theParMin;
theParams.Append (aPrevPar);
Standard_Integer aNbP = Max (theDegree, 1);
for (Standard_Integer i = 1;
(i < theKnots.Length()) && (theKnots (i) < (theParMax - Precision::PConfusion())); ++i)
{
if (theKnots (i + 1) < theParMin + Precision::PConfusion())
continue;
Standard_Real aStep = (theKnots (i + 1) - theKnots (i)) / aNbP;
for (Standard_Integer k = 1; k <= aNbP ; ++k)
{
Standard_Real aPar = theKnots (i) + k * aStep;
if (aPar > theParMax - Precision::PConfusion())
break;
if (aPar > aPrevPar + Precision::PConfusion())
{
theParams.Append (aPar);
aPrevPar = aPar;
}
}
}
theParams.Append (theParMax);
}
static void fillPoints (const BRepAdaptor_Curve& theCurve,
const NCollection_Vector<Standard_Real> theParams,
@@ -361,13 +329,13 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aKnots.SetValue (1, GC->FirstParameter());
aKnots.SetValue (2, GC->LastParameter());
fillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
GCPnts::FillParams (aKnots, GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_BSplineCurve:
{
Handle(Geom_BSplineCurve) GC = c.BSpline();
fillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
GCPnts::FillParams (GC->Knots(), GC->Degree(), dfUf, dfUl, aParams);
break;
}
case GeomAbs_Line:
@@ -394,7 +362,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
aBounds.SetValue (1, dfUf);
aBounds.SetValue (2, dfUl);
fillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
GCPnts::FillParams (aBounds, iNbPoints - 1, dfUf, dfUl, aParams);
}
}

View File

@@ -46,7 +46,8 @@ BRepMesh_BaseMeshAlgo::~BRepMesh_BaseMeshAlgo()
//=======================================================================
void BRepMesh_BaseMeshAlgo::Perform(
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
{
try
{
@@ -61,7 +62,11 @@ void BRepMesh_BaseMeshAlgo::Perform(
if (initDataStructure())
{
generateMesh();
if (!theRange.More())
{
return;
}
generateMesh(theRange);
commitSurfaceTriangulation();
}
}

View File

@@ -25,7 +25,7 @@
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality for algorithms building face triangulation.
//! Class provides base functionality for algorithms building face triangulation.
//! Performs initialization of BRepMesh_DataStructureOfDelaun and nodes map structures.
class BRepMesh_BaseMeshAlgo : public IMeshTools_MeshAlgo
{
@@ -42,7 +42,8 @@ public:
//! Performs processing of the given face.
Standard_EXPORT virtual void Perform(
const IMeshData::IFaceHandle& theDFace,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_BaseMeshAlgo, IMeshTools_MeshAlgo)
@@ -103,11 +104,11 @@ protected:
Standard_EXPORT virtual Standard_Boolean initDataStructure();
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh() = 0;
Standard_EXPORT virtual void generateMesh(const Message_ProgressRange& theRange) = 0;
private:
//! If the given edge has another pcurve for current face coinsiding with specified one,
//! If the given edge has another pcurve for current face coinciding with specified one,
//! returns TopAbs_INTERNAL flag. Elsewhere returns orientation of specified pcurve.
TopAbs_Orientation fixSeamEdgeOrientation(
const IMeshData::IEdgeHandle& theDEdge,

View File

@@ -23,7 +23,7 @@
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
//! Class provides base functionality to build face triangulation using Dealunay approach.
//! Performs generation of mesh using raw data from model.
class BRepMesh_ConstrainedBaseMeshAlgo : public BRepMesh_BaseMeshAlgo
{
@@ -49,10 +49,11 @@ protected:
return std::pair<Standard_Integer, Standard_Integer> (-1, -1);
}
//! Perfroms processing of generated mesh.
//! Performs processing of generated mesh.
//! By default does nothing.
//! Expected to be called from method generateMesh() in successor classes.
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/)
virtual void postProcessMesh (BRepMesh_Delaun& /*theMesher*/,
const Message_ProgressRange& /*theRange*/)
{
}
};

View File

@@ -20,19 +20,59 @@
#include <BRepMesh_FaceDiscret.hxx>
#include <BRepMesh_ModelPreProcessor.hxx>
#include <BRepMesh_ModelPostProcessor.hxx>
#include <BRepMesh_MeshAlgoFactory.hxx>
#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
#include <Message.hxx>
#include <OSD_Environment.hxx>
//=======================================================================
// Function: Constructor
// Purpose :
//=======================================================================
BRepMesh_Context::BRepMesh_Context ()
BRepMesh_Context::BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType)
{
if (theMeshType == IMeshTools_MeshAlgoType_DEFAULT)
{
TCollection_AsciiString aValue = OSD_Environment ("CSF_MeshAlgo").Value();
aValue.LowerCase();
if (aValue == "watson"
|| aValue == "0")
{
theMeshType = IMeshTools_MeshAlgoType_Watson;
}
else if (aValue == "delabella"
|| aValue == "1")
{
theMeshType = IMeshTools_MeshAlgoType_Delabella;
}
else
{
if (!aValue.IsEmpty())
{
Message::SendWarning (TCollection_AsciiString("BRepMesh_Context, ignore unknown algorithm '") + aValue + "' specified in CSF_MeshAlgo variable");
}
theMeshType = IMeshTools_MeshAlgoType_Watson;
}
}
Handle (IMeshTools_MeshAlgoFactory) aAlgoFactory;
switch (theMeshType)
{
case IMeshTools_MeshAlgoType_DEFAULT:
case IMeshTools_MeshAlgoType_Watson:
aAlgoFactory = new BRepMesh_MeshAlgoFactory();
break;
case IMeshTools_MeshAlgoType_Delabella:
aAlgoFactory = new BRepMesh_DelabellaMeshAlgoFactory();
break;
}
SetModelBuilder (new BRepMesh_ModelBuilder);
SetEdgeDiscret (new BRepMesh_EdgeDiscret);
SetModelHealer (new BRepMesh_ModelHealer);
SetPreProcessor (new BRepMesh_ModelPreProcessor);
SetFaceDiscret (new BRepMesh_FaceDiscret(new BRepMesh_MeshAlgoFactory));
SetFaceDiscret (new BRepMesh_FaceDiscret (aAlgoFactory));
SetPostProcessor(new BRepMesh_ModelPostProcessor);
}

View File

@@ -25,7 +25,7 @@ class BRepMesh_Context : public IMeshTools_Context
public:
//! Constructor.
Standard_EXPORT BRepMesh_Context ();
Standard_EXPORT BRepMesh_Context (IMeshTools_MeshAlgoType theMeshType = IMeshTools_MeshAlgoType_DEFAULT);
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_Context ();

View File

@@ -25,7 +25,7 @@
class BRepMesh_DataStructureOfDelaun;
//! Class provides base fuctionality to build face triangulation using custom triangulation algorithm.
//! Class provides base functionality to build face triangulation using custom triangulation algorithm.
//! Performs generation of mesh using raw data from model.
class BRepMesh_CustomBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
{
@@ -46,19 +46,42 @@ public:
protected:
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh () Standard_OVERRIDE
Standard_EXPORT virtual void generateMesh (const Message_ProgressRange& theRange) Standard_OVERRIDE
{
const Handle (BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure ();
const Standard_Integer aNodesNb = aStructure->NbNodes ();
buildBaseTriangulation ();
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes ());
BRepMesh_Delaun aMesher (aStructure, aCellsCount.first, aCellsCount.second, Standard_False);
const Standard_Integer aNewNodesNb = aStructure->NbNodes ();
const Standard_Boolean isRemoveAux = aNewNodesNb > aNodesNb;
if (isRemoveAux)
{
IMeshData::VectorOfInteger aAuxVertices (aNewNodesNb - aNodesNb);
for (Standard_Integer aExtNodesIt = aNodesNb + 1; aExtNodesIt <= aNewNodesNb; ++aExtNodesIt)
{
aAuxVertices.Append (aExtNodesIt);
}
// Set aux vertices if there are some to clean up mesh correctly.
aMesher.SetAuxVertices (aAuxVertices);
}
aMesher.ProcessConstraints ();
// Destruction of triangles containing aux vertices added (possibly) during base mesh computation.
if (isRemoveAux)
{
aMesher.RemoveAuxElements ();
}
BRepMesh_MeshTool aCleaner (aStructure);
aCleaner.EraseFreeLinks ();
postProcessMesh (aMesher);
postProcessMesh (aMesher, theRange);
}
protected:

View File

@@ -19,7 +19,7 @@
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using custom
//! Class provides base functionality to build face triangulation using custom
//! triangulation algorithm with possibility to modify final mesh.
//! Performs generation of mesh using raw data from model.
template<class BaseAlgo>
@@ -39,14 +39,15 @@ public:
protected:
//! Perfroms processing of generated mesh.
virtual void postProcessMesh(BRepMesh_Delaun& theMesher)
//! Performs processing of generated mesh.
virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
const Message_ProgressRange& theRange)
{
BaseAlgo::postProcessMesh (theMesher);
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
std::pair<Standard_Integer, Standard_Integer> aCellsCount = this->getCellsCount (aStructure->NbNodes());
theMesher.InitCirclesTool (aCellsCount.first, aCellsCount.second);
BaseAlgo::postProcessMesh (theMesher, theRange);
}
};

View File

@@ -0,0 +1,193 @@
// Created on: 2019-07-05
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
#include <BRepMesh_MeshTool.hxx>
#include <BRepMesh_Delaun.hxx>
#include <Message.hxx>
#include <string.h>
#include <stdarg.h>
#include "delabella.pxx"
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
namespace
{
//! Redirect algorithm messages to OCCT messenger.
static int logDelabella2Occ (void* theStream, const char* theFormat, ...)
{
(void )theStream;
char aBuffer[1024]; // should be more than enough for Delabella messages
va_list anArgList;
va_start(anArgList, theFormat);
Vsprintf(aBuffer, theFormat, anArgList);
va_end(anArgList);
Message_Gravity aGravity = Message_Warning;
switch ((int )theFormat[1])
{
case int('E'): aGravity = Message_Fail; break; // [ERR]
case int('W'): aGravity = Message_Trace; break; // [WRN]
case int('N'): aGravity = Message_Trace; break; // [NFO]
}
Message::Send (aBuffer, aGravity);
return 0;
}
}
//=======================================================================
// Function: Constructor
// Purpose :
//=======================================================================
BRepMesh_DelabellaBaseMeshAlgo::BRepMesh_DelabellaBaseMeshAlgo ()
{
}
//=======================================================================
// Function: Destructor
// Purpose :
//=======================================================================
BRepMesh_DelabellaBaseMeshAlgo::~BRepMesh_DelabellaBaseMeshAlgo ()
{
}
//=======================================================================
//function : buildBaseTriangulation
//purpose :
//=======================================================================
void BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation()
{
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = this->getStructure();
Bnd_B2d aBox;
const Standard_Integer aNodesNb = aStructure->NbNodes ();
std::vector<Standard_Real> aPoints (2 * (aNodesNb + 4));
for (Standard_Integer aNodeIt = 0; aNodeIt < aNodesNb; ++aNodeIt)
{
const BRepMesh_Vertex& aVertex = aStructure->GetNode (aNodeIt + 1);
const size_t aBaseIdx = 2 * static_cast<size_t> (aNodeIt);
aPoints[aBaseIdx + 0] = aVertex.Coord ().X ();
aPoints[aBaseIdx + 1] = aVertex.Coord ().Y ();
aBox.Add (gp_Pnt2d(aVertex.Coord ()));
}
aBox.Enlarge (0.1 * (aBox.CornerMax () - aBox.CornerMin ()).Modulus ());
const gp_XY aMin = aBox.CornerMin ();
const gp_XY aMax = aBox.CornerMax ();
aPoints[2 * aNodesNb + 0] = aMin.X ();
aPoints[2 * aNodesNb + 1] = aMin.Y ();
aStructure->AddNode (BRepMesh_Vertex (
aPoints[2 * aNodesNb + 0],
aPoints[2 * aNodesNb + 1], BRepMesh_Free));
aPoints[2 * aNodesNb + 2] = aMax.X ();
aPoints[2 * aNodesNb + 3] = aMin.Y ();
aStructure->AddNode (BRepMesh_Vertex (
aPoints[2 * aNodesNb + 2],
aPoints[2 * aNodesNb + 3], BRepMesh_Free));
aPoints[2 * aNodesNb + 4] = aMax.X ();
aPoints[2 * aNodesNb + 5] = aMax.Y ();
aStructure->AddNode (BRepMesh_Vertex (
aPoints[2 * aNodesNb + 4],
aPoints[2 * aNodesNb + 5], BRepMesh_Free));
aPoints[2 * aNodesNb + 6] = aMin.X ();
aPoints[2 * aNodesNb + 7] = aMax.Y ();
aStructure->AddNode (BRepMesh_Vertex (
aPoints[2 * aNodesNb + 6],
aPoints[2 * aNodesNb + 7], BRepMesh_Free));
const Standard_Real aDiffX = (aMax.X () - aMin.X ());
const Standard_Real aDiffY = (aMax.Y () - aMin.Y ());
for (size_t i = 0; i < aPoints.size(); i += 2)
{
aPoints[i + 0] = (aPoints[i + 0] - aMin.X ()) / aDiffX - 0.5;
aPoints[i + 1] = (aPoints[i + 1] - aMin.Y ()) / aDiffY - 0.5;
}
IDelaBella* aTriangulator = IDelaBella::Create();
if (aTriangulator == NULL) // should never happen
{
throw Standard_ProgramError ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: unable creating a triangulation algorithm");
}
aTriangulator->SetErrLog (logDelabella2Occ, NULL);
try
{
const int aVerticesNb = aTriangulator->Triangulate (
static_cast<int>(aPoints.size () / 2),
&aPoints[0], &aPoints[1], 2 * sizeof (Standard_Real));
if (aVerticesNb > 0)
{
const DelaBella_Triangle* aTrianglePtr = aTriangulator->GetFirstDelaunayTriangle();
while (aTrianglePtr != NULL)
{
Standard_Integer aNodes[3] = {
aTrianglePtr->v[0]->i + 1,
aTrianglePtr->v[2]->i + 1,
aTrianglePtr->v[1]->i + 1
};
Standard_Integer aEdges [3];
Standard_Boolean aOrientations[3];
for (Standard_Integer k = 0; k < 3; ++k)
{
const BRepMesh_Edge aLink (aNodes[k], aNodes[(k + 1) % 3], BRepMesh_Free);
const Standard_Integer aLinkInfo = aStructure->AddLink (aLink);
aEdges [k] = Abs (aLinkInfo);
aOrientations[k] = aLinkInfo > 0;
}
const BRepMesh_Triangle aTriangle (aEdges, aOrientations, BRepMesh_Free);
aStructure->AddElement (aTriangle);
aTrianglePtr = aTrianglePtr->next;
}
}
aTriangulator->Destroy ();
aTriangulator = NULL;
}
catch (Standard_Failure const& theException)
{
if (aTriangulator != NULL)
{
aTriangulator->Destroy ();
aTriangulator = NULL;
}
throw Standard_Failure (theException);
}
catch (...)
{
if (aTriangulator != NULL)
{
aTriangulator->Destroy ();
aTriangulator = NULL;
}
throw Standard_Failure ("BRepMesh_DelabellaBaseMeshAlgo::buildBaseTriangulation: exception in triangulation algorithm");
}
}

View File

@@ -0,0 +1,46 @@
// Created on: 2019-07-05
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
#define _BRepMesh_DelabellaBaseMeshAlgo_HeaderFile
#include <BRepMesh_CustomBaseMeshAlgo.hxx>
#include <NCollection_Shared.hxx>
#include <IMeshTools_Parameters.hxx>
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base functionality to build face triangulation using Delabella project.
//! Performs generation of mesh using raw data from model.
class BRepMesh_DelabellaBaseMeshAlgo : public BRepMesh_CustomBaseMeshAlgo
{
public:
//! Constructor.
Standard_EXPORT BRepMesh_DelabellaBaseMeshAlgo ();
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_DelabellaBaseMeshAlgo ();
DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaBaseMeshAlgo, BRepMesh_CustomBaseMeshAlgo)
protected:
//! Builds base triangulation using Delabella project.
Standard_EXPORT virtual void buildBaseTriangulation() Standard_OVERRIDE;
};
#endif

View File

@@ -0,0 +1,145 @@
// Created on: 2019-07-05
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BRepMesh_DelabellaMeshAlgoFactory.hxx>
#include <BRepMesh_DefaultRangeSplitter.hxx>
#include <BRepMesh_NURBSRangeSplitter.hxx>
#include <BRepMesh_SphereRangeSplitter.hxx>
#include <BRepMesh_CylinderRangeSplitter.hxx>
#include <BRepMesh_ConeRangeSplitter.hxx>
#include <BRepMesh_TorusRangeSplitter.hxx>
#include <BRepMesh_DelaunayBaseMeshAlgo.hxx>
#include <BRepMesh_DelabellaBaseMeshAlgo.hxx>
#include <BRepMesh_CustomDelaunayBaseMeshAlgo.hxx>
#include <BRepMesh_DelaunayNodeInsertionMeshAlgo.hxx>
#include <BRepMesh_DelaunayDeflectionControlMeshAlgo.hxx>
#include <BRepMesh_BoundaryParamsRangeSplitter.hxx>
namespace
{
struct DefaultBaseMeshAlgo
{
typedef BRepMesh_DelaunayBaseMeshAlgo Type;
};
template<class RangeSplitter>
struct DefaultNodeInsertionMeshAlgo
{
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_DelaunayBaseMeshAlgo> Type;
};
struct BaseMeshAlgo
{
typedef BRepMesh_DelabellaBaseMeshAlgo Type;
};
template<class RangeSplitter>
struct NodeInsertionMeshAlgo
{
typedef BRepMesh_DelaunayNodeInsertionMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
};
template<class RangeSplitter>
struct DeflectionControlMeshAlgo
{
typedef BRepMesh_DelaunayDeflectionControlMeshAlgo<RangeSplitter, BRepMesh_CustomDelaunayBaseMeshAlgo<BRepMesh_DelabellaBaseMeshAlgo> > Type;
};
}
IMPLEMENT_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
//=======================================================================
// Function: Constructor
// Purpose :
//=======================================================================
BRepMesh_DelabellaMeshAlgoFactory::BRepMesh_DelabellaMeshAlgoFactory ()
{
}
//=======================================================================
// Function: Destructor
// Purpose :
//=======================================================================
BRepMesh_DelabellaMeshAlgoFactory::~BRepMesh_DelabellaMeshAlgoFactory ()
{
}
//=======================================================================
// Function: GetAlgo
// Purpose :
//=======================================================================
Handle(IMeshTools_MeshAlgo) BRepMesh_DelabellaMeshAlgoFactory::GetAlgo(
const GeomAbs_SurfaceType theSurfaceType,
const IMeshTools_Parameters& theParameters) const
{
switch (theSurfaceType)
{
case GeomAbs_Plane:
return theParameters.InternalVerticesMode ?
new NodeInsertionMeshAlgo<BRepMesh_DefaultRangeSplitter>::Type :
new BaseMeshAlgo::Type;
break;
case GeomAbs_Sphere:
{
NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type* aMeshAlgo =
new NodeInsertionMeshAlgo<BRepMesh_SphereRangeSplitter>::Type;
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
return aMeshAlgo;
}
break;
case GeomAbs_Cylinder:
return theParameters.InternalVerticesMode ?
new DefaultNodeInsertionMeshAlgo<BRepMesh_CylinderRangeSplitter>::Type :
new DefaultBaseMeshAlgo::Type;
break;
case GeomAbs_Cone:
{
NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type* aMeshAlgo =
new NodeInsertionMeshAlgo<BRepMesh_ConeRangeSplitter>::Type;
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
return aMeshAlgo;
}
break;
case GeomAbs_Torus:
{
NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type* aMeshAlgo =
new NodeInsertionMeshAlgo<BRepMesh_TorusRangeSplitter>::Type;
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
return aMeshAlgo;
}
break;
case GeomAbs_SurfaceOfRevolution:
{
DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type* aMeshAlgo =
new DeflectionControlMeshAlgo<BRepMesh_BoundaryParamsRangeSplitter>::Type;
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
return aMeshAlgo;
}
break;
default:
{
DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type* aMeshAlgo =
new DeflectionControlMeshAlgo<BRepMesh_NURBSRangeSplitter>::Type;
aMeshAlgo->SetPreProcessSurfaceNodes (Standard_True);
return aMeshAlgo;
}
}
}

View File

@@ -0,0 +1,44 @@
// Created on: 2019-07-05
// Copyright (c) 2019 OPEN CASCADE SAS
// Created by: Oleg AGASHIN
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
#define _BRepMesh_DelabellaMeshAlgoFactory_HeaderFile
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <IMeshTools_MeshAlgoFactory.hxx>
//! Implementation of IMeshTools_MeshAlgoFactory providing Delabella-based
//! algorithms of different complexity depending on type of target surface.
class BRepMesh_DelabellaMeshAlgoFactory : public IMeshTools_MeshAlgoFactory
{
public:
//! Constructor.
Standard_EXPORT BRepMesh_DelabellaMeshAlgoFactory ();
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_DelabellaMeshAlgoFactory ();
//! Creates instance of meshing algorithm for the given type of surface.
Standard_EXPORT virtual Handle(IMeshTools_MeshAlgo) GetAlgo(
const GeomAbs_SurfaceType theSurfaceType,
const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(BRepMesh_DelabellaMeshAlgoFactory, IMeshTools_MeshAlgoFactory)
};
#endif

View File

@@ -90,9 +90,10 @@ BRepMesh_Delaun::BRepMesh_Delaun (
const Standard_Boolean isFillCircles)
: myMeshData ( theOldMesh ),
myCircles (new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
mySupVert (3),
myInitCircles (Standard_False)
{
memset (mySupVert, 0, sizeof (mySupVert));
if (isFillCircles)
{
InitCirclesTool (theCellsCountU, theCellsCountV);
@@ -105,9 +106,10 @@ BRepMesh_Delaun::BRepMesh_Delaun (
//=======================================================================
BRepMesh_Delaun::BRepMesh_Delaun(IMeshData::Array1OfVertexOfDelaun& theVertices)
: myCircles (theVertices.Length(), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
mySupVert (3),
myInitCircles (Standard_False)
{
memset (mySupVert, 0, sizeof (mySupVert));
if ( theVertices.Length() > 2 )
{
myMeshData = new BRepMesh_DataStructureOfDelaun(
@@ -126,9 +128,10 @@ BRepMesh_Delaun::BRepMesh_Delaun(
IMeshData::Array1OfVertexOfDelaun& theVertices)
: myMeshData( theOldMesh ),
myCircles ( theVertices.Length(), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
mySupVert (3),
myInitCircles (Standard_False)
{
memset (mySupVert, 0, sizeof (mySupVert));
if ( theVertices.Length() > 2 )
{
Init( theVertices );
@@ -144,9 +147,10 @@ BRepMesh_Delaun::BRepMesh_Delaun(
IMeshData::VectorOfInteger& theVertexIndices)
: myMeshData( theOldMesh ),
myCircles ( theVertexIndices.Length(), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
mySupVert (3),
myInitCircles (Standard_False)
{
memset (mySupVert, 0, sizeof (mySupVert));
perform(theVertexIndices);
}
@@ -160,9 +164,10 @@ BRepMesh_Delaun::BRepMesh_Delaun (const Handle (BRepMesh_DataStructureOfDelaun)&
const Standard_Integer theCellsCountV)
: myMeshData (theOldMesh),
myCircles (theVertexIndices.Length (), new NCollection_IncAllocator(
IMeshData::MEMORY_BLOCK_SIZE_HUGE))
IMeshData::MEMORY_BLOCK_SIZE_HUGE)),
mySupVert (3),
myInitCircles (Standard_False)
{
memset (mySupVert, 0, sizeof (mySupVert));
perform (theVertexIndices, theCellsCountU, theCellsCountV);
}
@@ -240,6 +245,8 @@ void BRepMesh_Delaun::initCirclesTool (const Bnd_Box2d& theBox,
myCircles.SetMinMaxSize( gp_XY( aMinX, aMinY ), gp_XY( aMaxX, aMaxY ) );
myCircles.SetCellSize ( aDeltaX / Max (theCellsCountU, aScaler),
aDeltaY / Max (theCellsCountV, aScaler));
myInitCircles = Standard_True;
}
//=======================================================================
@@ -290,14 +297,14 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
Standard_Real aDeltaMax = Max( aDeltaX, aDeltaY );
Standard_Real aDelta = aDeltaX + aDeltaY;
mySupVert[0] = myMeshData->AddNode(
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) );
mySupVert.Append (myMeshData->AddNode(
BRepMesh_Vertex( ( aMinX + aMaxX ) / 2, aMaxY + aDeltaMax, BRepMesh_Free ) ) );
mySupVert[1] = myMeshData->AddNode(
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
mySupVert.Append (myMeshData->AddNode(
BRepMesh_Vertex( aMinX - aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
mySupVert[2] = myMeshData->AddNode(
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) );
mySupVert.Append (myMeshData->AddNode(
BRepMesh_Vertex( aMaxX + aDelta, aMinY - aDeltaMin, BRepMesh_Free ) ) );
Standard_Integer e[3];
Standard_Boolean o[3];
@@ -324,7 +331,7 @@ void BRepMesh_Delaun::superMesh(const Bnd_Box2d& theBox)
void BRepMesh_Delaun::deleteTriangle(const Standard_Integer theIndex,
IMeshData::MapOfIntegerInteger& theLoopEdges )
{
if (!myCircles.IsEmpty())
if (myInitCircles)
{
myCircles.Delete (theIndex);
}
@@ -370,15 +377,28 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
createTriangles( theVertexIndexes( anVertexIdx ), aLoopEdges );
// Add other nodes to the mesh
createTrianglesOnNewVertices( theVertexIndexes );
createTrianglesOnNewVertices (theVertexIndexes, Message_ProgressRange());
}
RemoveAuxElements ();
}
//=======================================================================
//function : RemoveAuxElements
//purpose :
//=======================================================================
void BRepMesh_Delaun::RemoveAuxElements ()
{
Handle (NCollection_IncAllocator) aAllocator = new NCollection_IncAllocator (
IMeshData::MEMORY_BLOCK_SIZE_HUGE);
IMeshData::MapOfIntegerInteger aLoopEdges (10, aAllocator);
// Destruction of triangles containing a top of the super triangle
BRepMesh_SelectorOfDataStructureOfDelaun aSelector( myMeshData );
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
BRepMesh_SelectorOfDataStructureOfDelaun aSelector (myMeshData);
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size(); ++aSupVertId)
aSelector.NeighboursOfNode( mySupVert[aSupVertId] );
aLoopEdges.Clear();
IMeshData::IteratorOfMapOfInteger aFreeTriangles( aSelector.Elements() );
for ( ; aFreeTriangles.More(); aFreeTriangles.Next() )
deleteTriangle( aFreeTriangles.Key(), aLoopEdges );
@@ -393,7 +413,7 @@ void BRepMesh_Delaun::compute(IMeshData::VectorOfInteger& theVertexIndexes)
}
// The tops of the super triangle are destroyed
for (Standard_Integer aSupVertId = 0; aSupVertId < 3; ++aSupVertId)
for (Standard_Integer aSupVertId = 0; aSupVertId < mySupVert.Size (); ++aSupVertId)
myMeshData->RemoveNode( mySupVert[aSupVertId] );
}
@@ -523,7 +543,8 @@ void BRepMesh_Delaun::createTriangles(const Standard_Integer theVertexI
//purpose : Creation of triangles from the new nodes
//=======================================================================
void BRepMesh_Delaun::createTrianglesOnNewVertices(
IMeshData::VectorOfInteger& theVertexIndexes)
IMeshData::VectorOfInteger& theVertexIndexes,
const Message_ProgressRange& theRange)
{
Handle(NCollection_IncAllocator) aAllocator =
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
@@ -537,8 +558,13 @@ void BRepMesh_Delaun::createTrianglesOnNewVertices(
Standard_Integer anIndex = theVertexIndexes.Lower();
Standard_Integer anUpper = theVertexIndexes.Upper();
for( ; anIndex <= anUpper; ++anIndex )
Message_ProgressScope aPS(theRange, "Create triangles on new vertices", anUpper);
for (; anIndex <= anUpper; ++anIndex, aPS.Next())
{
if (!aPS.More())
{
return;
}
aAllocator->Reset(Standard_False);
IMeshData::MapOfIntegerInteger aLoopEdges(10, aAllocator);
@@ -780,9 +806,7 @@ void BRepMesh_Delaun::cleanupMesh()
myMeshData->ElementNodes (aCurTriangle, v);
for (int aNodeIdx = 0; aNodeIdx < 3 && isCanNotBeRemoved; ++aNodeIdx)
{
if (v[aNodeIdx] == mySupVert[0] ||
v[aNodeIdx] == mySupVert[1] ||
v[aNodeIdx] == mySupVert[2])
if (isSupVertex (v[aNodeIdx]))
{
isCanNotBeRemoved = Standard_False;
}
@@ -1240,11 +1264,15 @@ void BRepMesh_Delaun::addTriangle( const Standard_Integer (&theEdgesId)[3],
myMeshData->AddElement(BRepMesh_Triangle(theEdgesId,
theEdgesOri, BRepMesh_Free));
Standard_Boolean isAdded = myCircles.Bind(
aNewTriangleId,
GetVertex( theNodesId[0] ).Coord(),
GetVertex( theNodesId[1] ).Coord(),
GetVertex( theNodesId[2] ).Coord() );
Standard_Boolean isAdded = Standard_True;
if (myInitCircles)
{
isAdded = myCircles.Bind(
aNewTriangleId,
GetVertex( theNodesId[0] ).Coord(),
GetVertex( theNodesId[1] ).Coord(),
GetVertex( theNodesId[2] ).Coord() );
}
if ( !isAdded )
myMeshData->RemoveElement( aNewTriangleId );
@@ -2207,13 +2235,14 @@ void BRepMesh_Delaun::RemoveVertex( const BRepMesh_Vertex& theVertex )
//function : AddVertices
//purpose : Adds some vertices in the triangulation.
//=======================================================================
void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices)
void BRepMesh_Delaun::AddVertices(IMeshData::VectorOfInteger& theVertices,
const Message_ProgressRange& theRange)
{
ComparatorOfIndexedVertexOfDelaun aCmp(myMeshData);
std::make_heap(theVertices.begin(), theVertices.end(), aCmp);
std::sort_heap(theVertices.begin(), theVertices.end(), aCmp);
createTrianglesOnNewVertices(theVertices);
createTrianglesOnNewVertices(theVertices, theRange);
}
//=======================================================================

View File

@@ -29,6 +29,7 @@
#include <TColStd_Array1OfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <Message_ProgressRange.hxx>
class Bnd_B2d;
class Bnd_Box2d;
@@ -75,7 +76,8 @@ public:
Standard_EXPORT void RemoveVertex (const BRepMesh_Vertex& theVertex);
//! Adds some vertices into the triangulation.
Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices);
Standard_EXPORT void AddVertices (IMeshData::VectorOfInteger& theVerticesIndices,
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Modify mesh to use the edge.
//! @return True if done
@@ -147,6 +149,17 @@ public:
const Standard_Real theSqTolerance,
Standard_Integer& theEdgeOn) const;
//! Explicitly sets ids of auxiliary vertices used to build mesh and used by 3rd-party algorithms.
inline void SetAuxVertices (const IMeshData::VectorOfInteger& theSupVert)
{
mySupVert = theSupVert;
}
//! Destruction of auxiliary triangles containing the given vertices.
//! Removes auxiliary vertices also.
//! @param theAuxVertices auxiliary vertices to be cleaned up.
Standard_EXPORT void RemoveAuxElements ();
private:
enum ReplaceFlag
@@ -284,7 +297,8 @@ private:
IMeshData::SequenceOfBndB2d& thePolyBoxes);
//! Creates the triangles on new nodes.
void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices);
void createTrianglesOnNewVertices (IMeshData::VectorOfInteger& theVertexIndices,
const Message_ProgressRange& theRange);
//! Cleanup mesh from the free triangles.
void cleanupMesh();
@@ -350,13 +364,27 @@ private:
//! Performs insertion of internal edges into mesh.
void insertInternalEdges();
//! Checks whether the given vertex id relates to super contour.
Standard_Boolean isSupVertex (const Standard_Integer theVertexIdx) const
{
for (IMeshData::VectorOfInteger::Iterator aIt (mySupVert); aIt.More (); aIt.Next ())
{
if (theVertexIdx == aIt.Value ())
{
return Standard_True;
}
}
return Standard_False;
}
private:
Handle(BRepMesh_DataStructureOfDelaun) myMeshData;
BRepMesh_CircleTool myCircles;
Standard_Integer mySupVert[3];
IMeshData::VectorOfInteger mySupVert;
Standard_Boolean myInitCircles;
BRepMesh_Triangle mySupTrian;
};
#endif

View File

@@ -37,7 +37,7 @@ BRepMesh_DelaunayBaseMeshAlgo::~BRepMesh_DelaunayBaseMeshAlgo()
//function : generateMesh
//purpose :
//=======================================================================
void BRepMesh_DelaunayBaseMeshAlgo::generateMesh()
void BRepMesh_DelaunayBaseMeshAlgo::generateMesh(const Message_ProgressRange& theRange)
{
const Handle(BRepMesh_DataStructureOfDelaun)& aStructure = getStructure();
const Handle(VectorOfPnt)& aNodesMap = getNodesMap();
@@ -53,5 +53,9 @@ void BRepMesh_DelaunayBaseMeshAlgo::generateMesh()
BRepMesh_MeshTool aCleaner(aStructure);
aCleaner.EraseFreeLinks();
postProcessMesh(aMesher);
if (!theRange.More())
{
return;
}
postProcessMesh(aMesher, theRange);
}

View File

@@ -23,7 +23,7 @@
class BRepMesh_DataStructureOfDelaun;
class BRepMesh_Delaun;
//! Class provides base fuctionality to build face triangulation using Dealunay approach.
//! Class provides base functionality to build face triangulation using Dealunay approach.
//! Performs generation of mesh using raw data from model.
class BRepMesh_DelaunayBaseMeshAlgo : public BRepMesh_ConstrainedBaseMeshAlgo
{
@@ -40,7 +40,7 @@ public:
protected:
//! Generates mesh for the contour stored in data structure.
Standard_EXPORT virtual void generateMesh() Standard_OVERRIDE;
Standard_EXPORT virtual void generateMesh (const Message_ProgressRange& theRange) Standard_OVERRIDE;
};
#endif

View File

@@ -46,22 +46,33 @@ public:
protected:
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
//! Performs processing of generated mesh. Generates surface nodes and inserts them into structure.
virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
const Message_ProgressRange& theRange) Standard_OVERRIDE
{
Message_ProgressScope aPS(theRange, "Post process mesh", 2);
// Insert surface nodes.
DelaunayInsertionBaseClass::postProcessMesh(theMesher);
DelaunayInsertionBaseClass::postProcessMesh (theMesher, aPS.Next());
if (!aPS.More())
{
return;
}
if (this->getParameters().ControlSurfaceDeflection &&
this->getStructure()->ElementsOfDomain().Extent() > 0)
{
optimizeMesh(theMesher);
optimizeMesh(theMesher, aPS.Next());
}
else
{
aPS.Next();
}
}
//! Checks deviation of a mesh from geometrical surface.
//! Inserts additional nodes in case of huge deviation.
virtual void optimizeMesh(BRepMesh_Delaun& theMesher)
virtual void optimizeMesh (BRepMesh_Delaun& theMesher,
const Message_ProgressRange& theRange)
{
Handle(NCollection_IncAllocator) aTmpAlloc =
new NCollection_IncAllocator(IMeshData::MEMORY_BLOCK_SIZE_HUGE);
@@ -72,8 +83,13 @@ protected:
const Standard_Integer aIterationsNb = 11;
Standard_Boolean isInserted = Standard_True;
Message_ProgressScope aPS(theRange, "Iteration", aIterationsNb);
for (Standard_Integer aPass = 1; aPass <= aIterationsNb && isInserted && !myIsAllDegenerated; ++aPass)
{
if (!aPS.More())
{
return;
}
// Reset stop condition
myMaxSqDeflection = -1.;
myIsAllDegenerated = Standard_True;
@@ -83,7 +99,6 @@ protected:
{
break;
}
// Iterate on current triangles
IMeshData::IteratorOfMapOfInteger aTriangleIt(this->getStructure()->ElementsOfDomain());
for (; aTriangleIt.More(); aTriangleIt.Next())
@@ -92,7 +107,7 @@ protected:
splitTriangleGeometry(aTriangle);
}
isInserted = this->insertNodes(myControlNodes, theMesher);
isInserted = this->insertNodes(myControlNodes, theMesher, aPS.Next());
}
myCouplesMap.Nullify();

View File

@@ -84,24 +84,30 @@ protected:
&this->getRangeSplitter());
}
//! Perfroms processing of generated mesh. Generates surface nodes and inserts them into structure.
virtual void postProcessMesh(BRepMesh_Delaun& theMesher) Standard_OVERRIDE
//! Performs processing of generated mesh. Generates surface nodes and inserts them into structure.
virtual void postProcessMesh (BRepMesh_Delaun& theMesher,
const Message_ProgressRange& theRange) Standard_OVERRIDE
{
InsertionBaseClass::postProcessMesh(theMesher);
if (!theRange.More())
{
return;
}
InsertionBaseClass::postProcessMesh (theMesher, Message_ProgressRange()); // shouldn't be range passed here?
if (!myIsPreProcessSurfaceNodes)
{
const Handle(IMeshData::ListOfPnt2d) aSurfaceNodes =
this->getRangeSplitter().GenerateSurfaceNodes(this->getParameters());
insertNodes(aSurfaceNodes, theMesher);
insertNodes(aSurfaceNodes, theMesher, theRange);
}
}
//! Inserts nodes into mesh.
Standard_Boolean insertNodes(
const Handle(IMeshData::ListOfPnt2d)& theNodes,
BRepMesh_Delaun& theMesher)
BRepMesh_Delaun& theMesher,
const Message_ProgressRange& theRange)
{
if (theNodes.IsNull() || theNodes->IsEmpty())
{
@@ -120,7 +126,11 @@ protected:
}
}
theMesher.AddVertices(aVertexIndexes);
theMesher.AddVertices (aVertexIndexes, theRange);
if (!theRange.More())
{
return Standard_False;
}
return !aVertexIndexes.IsEmpty();
}

View File

@@ -18,6 +18,7 @@
#include <Standard_Type.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Transient.hxx>
#include <Message_ProgressRange.hxx>
//! This is a common interface for meshing algorithms
//! instantiated by Mesh Factory and implemented by plugins.
@@ -46,7 +47,7 @@ public:
}
//! Compute triangulation for set shape.
virtual void Perform() = 0;
virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) = 0;
DEFINE_STANDARD_RTTIEXT(BRepMesh_DiscretRoot,Standard_Transient)

View File

@@ -85,8 +85,10 @@ Handle(IMeshTools_CurveTessellator) BRepMesh_EdgeDiscret::CreateEdgeTessellation
//=======================================================================
Standard_Boolean BRepMesh_EdgeDiscret::performInternal (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
{
(void )theRange;
myModel = theModel;
myParameters = theParameters;

View File

@@ -75,7 +75,8 @@ protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle (IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:

View File

@@ -39,13 +39,46 @@ BRepMesh_FaceDiscret::~BRepMesh_FaceDiscret()
{
}
//! Auxiliary functor for parallel processing of Faces.
class BRepMesh_FaceDiscret::FaceListFunctor
{
public:
FaceListFunctor (BRepMesh_FaceDiscret* theAlgo,
const Message_ProgressRange& theRange)
: myAlgo (theAlgo),
myScope (theRange, "Face Discret", theAlgo->myModel->FacesNb())
{
myRanges.reserve (theAlgo->myModel->FacesNb());
for (Standard_Integer aFaceIter = 0; aFaceIter < theAlgo->myModel->FacesNb(); ++aFaceIter)
{
myRanges.push_back (myScope.Next());
}
}
void operator() (const Standard_Integer theFaceIndex) const
{
if (!myScope.More())
{
return;
}
Message_ProgressScope aFaceScope(myRanges[theFaceIndex], NULL, 1);
myAlgo->process(theFaceIndex, aFaceScope.Next());
}
private:
mutable BRepMesh_FaceDiscret* myAlgo;
Message_ProgressScope myScope;
std::vector<Message_ProgressRange> myRanges;
};
//=======================================================================
// Function: Perform
// Purpose :
//=======================================================================
Standard_Boolean BRepMesh_FaceDiscret::performInternal(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
{
myModel = theModel;
myParameters = theParameters;
@@ -54,7 +87,12 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
return Standard_False;
}
OSD_Parallel::For(0, myModel->FacesNb(), *this, !(myParameters.InParallel && myModel->FacesNb() > 1));
FaceListFunctor aFunctor(this, theRange);
OSD_Parallel::For(0, myModel->FacesNb(), aFunctor, !(myParameters.InParallel && myModel->FacesNb() > 1));
if (!theRange.More())
{
return Standard_False;
}
myModel.Nullify(); // Do not hold link to model.
return Standard_True;
@@ -64,7 +102,8 @@ Standard_Boolean BRepMesh_FaceDiscret::performInternal(
// Function: process
// Purpose :
//=======================================================================
void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex,
const Message_ProgressRange& theRange) const
{
const IMeshData::IFaceHandle& aDFace = myModel->GetFace(theFaceIndex);
if (aDFace->IsSet(IMeshData_Failure) ||
@@ -86,7 +125,12 @@ void BRepMesh_FaceDiscret::process(const Standard_Integer theFaceIndex) const
return;
}
aMeshingAlgo->Perform(aDFace, myParameters);
if (!theRange.More())
{
aDFace->SetStatus (IMeshData_UserBreak);
return;
}
aMeshingAlgo->Perform(aDFace, myParameters, theRange);
}
catch (Standard_Failure const&)
{

View File

@@ -20,6 +20,7 @@
#include <IMeshTools_Parameters.hxx>
#include <IMeshData_Types.hxx>
#include <IMeshTools_MeshAlgoFactory.hxx>
#include <NCollection_Array1.hxx>
//! Class implements functionality starting triangulation of model's faces.
//! Each face is processed separately and can be executed in parallel mode.
@@ -36,11 +37,6 @@ public:
//! Destructor.
Standard_EXPORT virtual ~BRepMesh_FaceDiscret();
//! Functor API to discretize the given edge.
inline void operator() (const Standard_Integer theFaceIndex) const {
process(theFaceIndex);
}
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_FaceDiscret, IMeshTools_ModelAlgo)
protected:
@@ -48,12 +44,17 @@ protected:
//! Performs processing of faces of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:
//! Checks existing discretization of the face and updates data model.
void process(const Standard_Integer theFaceIndex) const;
void process (const Standard_Integer theFaceIndex,
const Message_ProgressRange& theRange) const;
private:
class FaceListFunctor;
private:

View File

@@ -66,11 +66,12 @@ BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh( const TopoDS_Shape& theSh
//=======================================================================
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh(
const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
: myParameters(theParameters)
{
myShape = theShape;
Perform();
Perform(theRange);
}
//=======================================================================
@@ -85,17 +86,17 @@ BRepMesh_IncrementalMesh::~BRepMesh_IncrementalMesh()
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform()
void BRepMesh_IncrementalMesh::Perform(const Message_ProgressRange& theRange)
{
Handle(BRepMesh_Context) aContext = new BRepMesh_Context;
Perform (aContext);
Handle(BRepMesh_Context) aContext = new BRepMesh_Context (myParameters.MeshAlgo);
Perform (aContext, theRange);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext)
void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theContext, const Message_ProgressRange& theRange)
{
initParameters();
@@ -103,9 +104,14 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
theContext->ChangeParameters() = myParameters;
theContext->ChangeParameters().CleanModel = Standard_False;
Message_ProgressScope aPS(theRange, "Perform incmesh", 10);
IMeshTools_MeshBuilder aIncMesh(theContext);
aIncMesh.Perform();
aIncMesh.Perform(aPS.Next(9));
if (!aPS.More())
{
myStatus = IMeshData_UserBreak;
return;
}
myStatus = IMeshData_NoError;
const Handle(IMeshData_Model)& aModel = theContext->GetModel();
if (!aModel.IsNull())
@@ -122,7 +128,7 @@ void BRepMesh_IncrementalMesh::Perform(const Handle(IMeshTools_Context)& theCont
}
}
}
aPS.Next(1);
setDone();
}

View File

@@ -50,13 +50,15 @@ public: //! @name mesher API
//! @param theShape shape to be meshed.
//! @param theParameters - parameters of meshing
Standard_EXPORT BRepMesh_IncrementalMesh(const TopoDS_Shape& theShape,
const IMeshTools_Parameters& theParameters);
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange = Message_ProgressRange());
//! Performs meshing ot the shape.
Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
Standard_EXPORT virtual void Perform(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
//! Performs meshing using custom context;
Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext);
Standard_EXPORT void Perform(const Handle(IMeshTools_Context)& theContext,
const Message_ProgressRange& theRange = Message_ProgressRange());
public: //! @name accessing to parameters.

View File

@@ -22,7 +22,7 @@
#include <IMeshTools_MeshAlgoFactory.hxx>
//! Default implementation of IMeshTools_MeshAlgoFactory providing algorithms
//! of different compexity depending on type of target surface.
//! of different complexity depending on type of target surface.
class BRepMesh_MeshAlgoFactory : public IMeshTools_MeshAlgoFactory
{
public:

View File

@@ -117,8 +117,10 @@ BRepMesh_ModelHealer::~BRepMesh_ModelHealer()
//=======================================================================
Standard_Boolean BRepMesh_ModelHealer::performInternal(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters)
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange)
{
(void )theRange;
myModel = theModel;
myParameters = theParameters;
if (myModel.IsNull())

View File

@@ -61,7 +61,8 @@ protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange) Standard_OVERRIDE;
private:

View File

@@ -179,8 +179,10 @@ BRepMesh_ModelPostProcessor::~BRepMesh_ModelPostProcessor()
//=======================================================================
Standard_Boolean BRepMesh_ModelPostProcessor::performInternal(
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& /*theParameters*/)
const IMeshTools_Parameters& /*theParameters*/,
const Message_ProgressRange& theRange)
{
(void )theRange;
if (theModel.IsNull())
{
return Standard_False;

View File

@@ -39,7 +39,8 @@ protected:
//! Performs processing of edges of the given model.
Standard_EXPORT virtual Standard_Boolean performInternal (
const Handle(IMeshData_Model)& theModel,
const IMeshTools_Parameters& theParameters) Standard_OVERRIDE;
const IMeshTools_Parameters& theParameters,
const Message_ProgressRange& theRange) Standard_OVERRIDE;
};
#endif

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