From: mzn Date: Tue, 6 Dec 2016 08:48:25 +0000 (+0300) Subject: Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7 X-Git-Tag: Salome_8_3_Hydro_1_1rc1~22^2~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=58bb6b7459bebeeb089c9ed486c4683a8bae7288;hp=a0f46af000e5038df100106897aa04901ad59e49;p=modules%2Fhydro.git Initial merge of branch 'BR_HYDRO_IMPS_2016' into BR_PORTING_OCCT_7 --- diff --git a/CMake/UsePyQt4EXT.cmake b/CMake/UsePyQt4EXT.cmake index b6b0f5a5..e846b9cb 100644 --- a/CMake/UsePyQt4EXT.cmake +++ b/CMake/UsePyQt4EXT.cmake @@ -45,10 +45,10 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) FOREACH(_input ${ARGN}) SET(_output) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPycmodule.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPycmodule.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Application.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Application.cc) @@ -72,7 +72,7 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_AltitudeObject.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_AltitudeObject.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_ObstacleAltitude.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_ObstacleAltitude.cc) @@ -126,7 +126,7 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Stream.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Stream.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Zone.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_Zone.cc) @@ -147,7 +147,7 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_SplitShapesGroup.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_SplitShapesGroup.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyTCollection_AsciiString.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyTCollection_AsciiString.cc) @@ -162,13 +162,13 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100Handle_HYDROData_Entity.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100Handle_HYDROData_Entity.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100gp_XY.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100gp_XY.cc) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100gp_XYZ.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100gp_XYZ.cc) - + LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc) @@ -180,13 +180,13 @@ MACRO(PYQT4_WRAP_SIP_EXT outfiles) LIST(APPEND _output ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_LandCoverMap.cc) SET(${outfiles} ${${outfiles}} ${CMAKE_CURRENT_BINARY_DIR}/sipHYDROPyHYDROData_LandCoverMap.cc) - + ADD_CUSTOM_COMMAND( OUTPUT ${_output} COMMAND ${SIP_EXECUTABLE} ${PYQT_SIPFLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${_input} MAIN_DEPENDENCY ${_input} ) - + ENDFOREACH() ENDMACRO(PYQT4_WRAP_SIP_EXT) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14494116..12e36c5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) -INCLUDE(CMakeDependentOption) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) PROJECT(SalomeHYDRO C CXX) +INCLUDE(CMakeDependentOption) # Ensure a proper linker behavior: CMAKE_POLICY(SET CMP0003 NEW) @@ -87,7 +87,7 @@ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/adm/cmake") # User options # ============ -# (some options may have already been defined in KERNEL) +# (some options may have already been defined in KERNEL) OPTION(SALOME_BUILD_DOC "Generate HYDRO documentation" ON) OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON) @@ -103,6 +103,7 @@ OPTION(SALOME_BUILD_TESTS "Build HYDRO tests" ON) # Mandatory products: +#FIND_PACKAGE(SalomePython REQUIRED) FIND_PACKAGE(SalomePythonInterp REQUIRED) FIND_PACKAGE(SalomePythonLibs REQUIRED) FIND_PACKAGE(SalomeCAS REQUIRED) @@ -114,14 +115,14 @@ FIND_PACKAGE(SalomeOmniORB REQUIRED) IF(SALOME_BUILD_TESTS) ENABLE_TESTING() FIND_PACKAGE(SalomeCppUnit) - SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS) + SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS) ENDIF() IF(SALOME_BUILD_DOC) IF(SALOME_USE_MPI) FIND_PACKAGE(SalomeMPI) # needed for doc generation by Sphinx SALOME_LOG_OPTIONAL_PACKAGE(MPI SALOME_BUILD_DOC) - ENDIF() + ENDIF() FIND_PACKAGE(SalomeDoxygen) FIND_PACKAGE(SalomeSphinx) SALOME_LOG_OPTIONAL_PACKAGE(Doxygen SALOME_BUILD_DOC) @@ -137,21 +138,21 @@ FIND_PACKAGE(SalomeSIP REQUIRED) # should come after Python and before PyQt4 # Qt IF(NOT SALOME_GUI_BUILD_WITH_QT5) FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork QtTest) - SET(QT_ROOT_DIR "${QT4_ROOT_DIR}") + SET(QT_ROOT_DIR "${QTDIR}") SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt4 PyQt4) ELSE() FIND_PACKAGE(SalomeQt5 REQUIRED) - SET(QT_ROOT_DIR "${QT5_ROOT_DIR}") + SET(QT_ROOT_DIR "${QTDIR}") SALOME_CONFIGURE_PREPARE(HYDROData HYDROGUI HYDROPy Qt5 PyQt5) ENDIF() # PyQt IF(NOT SALOME_GUI_BUILD_WITH_QT5) FIND_PACKAGE(SalomePyQt4 REQUIRED) - SET(PYQT_ROOT_DIR "${PYQT4_ROOT_DIR}") + SET(PYQT_ROOT_DIR "${PYQT_ROOT_DIR}") ELSE() FIND_PACKAGE(SalomePyQt5 REQUIRED) - SET(PYQT_ROOT_DIR "${PYQT5_ROOT_DIR}") + SET(PYQT_ROOT_DIR "${PYQT_ROOT_DIR}") ENDIF() # Detection summary: @@ -163,17 +164,17 @@ SET(SALOME_INSTALL_BINS "${SALOME_INSTALL_BINS}" CACHE PATH "Install path: SALOM SET(SALOME_INSTALL_LIBS "${SALOME_INSTALL_LIBS}" CACHE PATH "Install path: SALOME libs") SET(SALOME_INSTALL_IDLS "${SALOME_INSTALL_IDLS}" CACHE PATH "Install path: SALOME IDL files") SET(SALOME_INSTALL_HEADERS "${SALOME_INSTALL_HEADERS}" CACHE PATH "Install path: SALOME headers") -SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH +SET(SALOME_INSTALL_SCRIPT_SCRIPTS "${SALOME_INSTALL_SCRIPT_SCRIPTS}" CACHE PATH "Install path: SALOME scripts") -SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH +SET(SALOME_INSTALL_SCRIPT_DATA "${SALOME_INSTALL_SCRIPT_DATA}" CACHE PATH "Install path: SALOME script data") -SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH +SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH "Install path: SALOME Python scripts") SET(SALOME_INSTALL_PYTHON "${SALOME_INSTALL_PYTHON}" CACHE PATH "Install path: SALOME Python stuff") -SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH +SET(SALOME_INSTALL_PYTHON_SHARED "${SALOME_INSTALL_PYTHON_SHARED}" CACHE PATH "Install path: SALOME Python shared modules") -SET(SALOME_INSTALL_CMAKE_LOCAL adm/cmake CACHE PATH - "Install path: local SALOME CMake files") +SET(SALOME_INSTALL_CMAKE_LOCAL adm/cmake CACHE PATH + "Install path: local SALOME CMake files") SET(SALOME_INSTALL_AMCONFIG_LOCAL adm/unix CACHE PATH "Install path: local SALOME config files (obsolete, to be removed)") @@ -181,9 +182,9 @@ SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation") # Specific to HYDRO: -SET(SALOME_HYDRO_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hydro" CACHE PATH +SET(SALOME_HYDRO_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/hydro" CACHE PATH "Install path: SALOME HYDRO specific data") -SET(SALOME_HYDRO_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/hydro" CACHE PATH +SET(SALOME_HYDRO_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/hydro" CACHE PATH "Install path: SALOME HYDRO scripts") SET(SALOME_HYDRO_INSTALL_SAMPLES share/salome/hydrosamples CACHE PATH "Install path: SALOME HYDRO samples") @@ -193,7 +194,7 @@ MARK_AS_ADVANCED( SALOME_HYDRO_INSTALL_SAMPLES ) -# Sources +# Sources # ======== ADD_SUBDIRECTORY (src/shapelib) ADD_SUBDIRECTORY (src/HYDROData) @@ -217,7 +218,7 @@ INCLUDE(CMakePackageConfigHelpers) # List of targets in this project we want to make visible to the rest of the world. # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" -SET(_${PROJECT_NAME}_exposed_targets +SET(_${PROJECT_NAME}_exposed_targets shapelib HYDROData HYDROPy ) @@ -226,8 +227,8 @@ IF(SALOME_BUILD_TESTS) ENDIF(SALOME_BUILD_TESTS) IF(SALOME_BUILD_GUI) - LIST(APPEND _${PROJECT_NAME}_exposed_targets - HYDROGUI + LIST(APPEND _${PROJECT_NAME}_exposed_targets + HYDROGUI ) ENDIF(SALOME_BUILD_GUI) @@ -242,31 +243,31 @@ EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets} SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}") SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}") SET(SIP_ROOT_DIR "${SIP_ROOT_DIR}") -SET(QT4_ROOT_DIR "${QT4_ROOT_DIR}") -SET(PYQT4_ROOT_DIR "${PYQT4_ROOT_DIR}") +SET(QTDIR "${QTDIR}") +SET(PYQT_ROOT_DIR "${PYQT_ROOT_DIR}") SET(CAS_ROOT_DIR "${CAS_ROOT_DIR}") - + SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") -CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in +CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX - KERNEL_ROOT_DIR GUI_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR CAS_ROOT_DIR) + KERNEL_ROOT_DIR GUI_ROOT_DIR SIP_ROOT_DIR QTDIR PYQT_ROOT_DIR CAS_ROOT_DIR) # - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?): -# Get the relative path of the include directory so +# Get the relative path of the include directory so # we can register it in the generated configuration files: #SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}") -#CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in +#CONFIGURE_PACKAGE_CONFIG_FILE(adm_local/cmake_files/${PROJECT_NAME}Config.cmake.in # ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake # INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" -# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX +# PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX # KERNEL_ROOT_DIR GUI_ROOT_DIR SIP_ROOT_DIR QT4_ROOT_DIR PYQT4_ROOT_DIR EXPAT_ROOT_DIR QSCINTILLA_ROOT_DIR) WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${${PROJECT_NAME_UC}_VERSION} COMPATIBILITY AnyNewerVersion) - + # Install the CMake configuration files: INSTALL(FILES "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" @@ -274,7 +275,7 @@ INSTALL(FILES DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}") # Install the export set for use with the install-tree -INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" +INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}" FILE ${PROJECT_NAME}Targets.cmake) diff --git a/doc/salome/CMakeLists.txt b/doc/salome/CMakeLists.txt index 2a1bc39a..a466cf9e 100644 --- a/doc/salome/CMakeLists.txt +++ b/doc/salome/CMakeLists.txt @@ -20,7 +20,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -ADD_SUBDIRECTORY(gui) +#ADD_SUBDIRECTORY(gui) ADD_SUBDIRECTORY(examples) -ADD_SUBDIRECTORY(tutorial) -ADD_SUBDIRECTORY(tui) +#ADD_SUBDIRECTORY(tutorial) +#ADD_SUBDIRECTORY(tui) diff --git a/doc/salome/examples/h008_simpleCase.py b/doc/salome/examples/h008_simpleCase.py index 3779bc97..fb2bb073 100644 --- a/doc/salome/examples/h008_simpleCase.py +++ b/doc/salome/examples/h008_simpleCase.py @@ -5,9 +5,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -66,7 +66,7 @@ Case_1.Update() Case_1_entry = Case_1.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -83,7 +83,8 @@ Case_1_geom = salome.IDToObject( str( Case_1_entry ) ) print "Geom shape:", Case_1_geom print "Geom shape name:", Case_1_geom.GetName() +#controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918) controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521) - + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h009_normalCaseManual.py b/doc/salome/examples/h009_normalCaseManual.py index f44f63b2..5cf5c72f 100644 --- a/doc/salome/examples/h009_normalCaseManual.py +++ b/doc/salome/examples/h009_normalCaseManual.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -294,7 +294,7 @@ garonne_1_riveGauche.SetName("garonne_1_riveGauche") garonne_1_entry = garonne_1.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -326,6 +326,8 @@ geompy.addToStudyInFather( HYDRO_garonne_1, litMineur, 'litMineur' ) geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' ) controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) diff --git a/doc/salome/examples/h010_normalCaseManualMesh.py b/doc/salome/examples/h010_normalCaseManualMesh.py index 4b205db5..db0e6ff5 100644 --- a/doc/salome/examples/h010_normalCaseManualMesh.py +++ b/doc/salome/examples/h010_normalCaseManualMesh.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -294,7 +294,7 @@ garonne_1_riveGauche.SetName("garonne_1_riveGauche") garonne_1_entry = garonne_1.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -311,7 +311,7 @@ HYDRO_garonne_1 = salome.IDToObject( str( garonne_1_entry ) ) print "Geom shape:", HYDRO_garonne_1 print "Geom shape name:", HYDRO_garonne_1.GetName() -# --- manual definition: geometrical faces +# --- manual definition: geometrical faces [riveGauche,litMineur,riveDroite] = geompy.ExtractShapes(HYDRO_garonne_1, geompy.ShapeType["FACE"], True) # --- manual definition: useful groups of edges @@ -343,13 +343,22 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomain # --- basic properties control: edges length, surfaces controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) - #---------------------- -# --- Meshing +# --- Meshing #---------------------- +med_file = r'/tmp/garonne_1.med' + +try: + os.remove(med_file) +except OSError: + pass + + import SMESH, SALOMEDS from salome.smesh import smeshBuilder from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats @@ -416,8 +425,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) garonne_1.SetAutoColor( 1 ) -garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) +#controlMeshStats(garonne_1, 1763, 180, 3360) +#controlSubMeshStats(litMineur_2, 48) +#controlSubMeshStats(riveDroite_1, 1360) +#controlSubMeshStats(riveGauche_1, 1952) controlMeshStats(garonne_1, 3888, 475, 7597) controlSubMeshStats(litMineur_2, 2384) controlSubMeshStats(riveDroite_1, 2342) diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index 071974fb..647a8b20 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -294,7 +294,7 @@ garonne_1_riveGauche.SetName("garonne_1_riveGauche") garonne_1_entry = garonne_1.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -311,7 +311,7 @@ HYDRO_garonne_1 = salome.IDToObject( str( garonne_1_entry ) ) print "Geom shape:", HYDRO_garonne_1 print "Geom shape name:", HYDRO_garonne_1.GetName() -# --- manual definition: geometrical faces +# --- manual definition: geometrical faces [riveGauche,litMineur,riveDroite] = geompy.ExtractShapes(HYDRO_garonne_1, geompy.ShapeType["FACE"], True) # --- manual definition: useful groups of edges @@ -342,14 +342,24 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordGaucheDomaine, 'bordGaucheDomain geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomaine' ) # --- basic properties control: edges length, surfaces + controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) #---------------------- -# --- Meshing +# --- Meshing #---------------------- +med_file = r'/tmp/garonne_1.med' +try: + os.remove(med_file) +except OSError: + pass + + import SMESH, SALOMEDS from salome.smesh import smeshBuilder from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats @@ -416,8 +426,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) garonne_1.SetAutoColor( 1 ) -garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) +#controlMeshStats(garonne_1, 1763, 180, 3360) +#controlSubMeshStats(litMineur_2, 48) +#controlSubMeshStats(riveDroite_1, 1360) +#controlSubMeshStats(riveGauche_1, 1952) controlMeshStats(garonne_1, 3888, 475, 7597) controlSubMeshStats(litMineur_2, 2384) controlSubMeshStats(riveDroite_1, 2342) @@ -427,7 +441,7 @@ if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) #---------------------- -# --- Z interpolation with HYDRO +# --- Z interpolation with HYDRO #---------------------- from salome.hydrotools.interpolZ import interpolZ, createZfield2 @@ -437,14 +451,14 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'garonne_1' # --- med file 2D(x,y) of the case produced by SMESH -fichierMaillage = '/tmp/garonne_1.med' +fichierMaillage = med_file # --- dictionary [med group name] = region name dicoGroupeRegion= dict(litMineur = 'garonne_1_litMineur', riveDroite = 'garonne_1_riveDroite', riveGauche = 'garonne_1_riveGauche', ) -# --- value to use for Z when the node is not in a region (used to detect problems) +# --- value to use for Z when the node is not in a region (used to detect problems) zUndef = 90 # --- Z interpolation on the bathymety/altimetry on the mesh nodes diff --git a/doc/salome/examples/h012_caseDigueManual.py b/doc/salome/examples/h012_caseDigueManual.py index 7bb8be11..b4d120dc 100644 --- a/doc/salome/examples/h012_caseDigueManual.py +++ b/doc/salome/examples/h012_caseDigueManual.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -372,7 +372,7 @@ garonne_2_digue.SetName("garonne_2_digue") garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -395,8 +395,12 @@ geompy.addToStudyInFather( HYDRO_garonne_2, digue, 'digue' ) geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' ) geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' ) +#controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +#controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py index 234958df..c19c290c 100644 --- a/doc/salome/examples/h013_caseDigueManualMesh.py +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -372,7 +372,7 @@ garonne_2_digue.SetName("garonne_2_digue") garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -403,7 +403,7 @@ SectionsDigue = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) geompy.UnionIDs(SectionsDigue, [46, 50]) geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) -# --- recreate subshapes already exported from HYDRO to get access from Python +# --- recreate subshapes already exported from HYDRO to get access from Python #garonne_2_domaineEtendu_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_domaineEtendu_Outer, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37]) #garonne_2_digue_Left_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) @@ -417,13 +417,17 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48]) +#controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +#controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) #---------------------- -# --- Meshing +# --- Meshing #---------------------- import SMESH, SALOMEDS @@ -506,9 +510,22 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE) #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE) SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) + +med_file = r'/tmp/garonne_2.med' + +try: + os.remove(med_file) +except OSError: + pass + garonne_2.SetAutoColor( 1 ) -garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) +#controlMeshStats(garonne_2, 5247, 717, 10075) +#controlSubMeshStats(litMineur_2, 2384) +#controlSubMeshStats(riveDroite_1, 2348) +#controlSubMeshStats(riveGauche_1, 5343) +#controlSubMeshStats(digue_1, 0) controlMeshStats(garonne_2, 6190, 691, 12201) controlSubMeshStats(litMineur_2, 2384) controlSubMeshStats(riveDroite_1, 2400) diff --git a/doc/salome/examples/h014_caseDigueManualInterpolZ.py b/doc/salome/examples/h014_caseDigueManualInterpolZ.py index ec45d249..c5782efd 100644 --- a/doc/salome/examples/h014_caseDigueManualInterpolZ.py +++ b/doc/salome/examples/h014_caseDigueManualInterpolZ.py @@ -8,9 +8,9 @@ import salome salome.salome_init() theStudy = salome.myStudy - + #---------------------- -# --- HYDRO +# --- HYDRO #---------------------- from HYDROPy import * @@ -372,7 +372,7 @@ garonne_2_digue.SetName("garonne_2_digue") garonne_2_entry = garonne_2.Export( theStudy._get_StudyId() ) #---------------------- -# --- Geometry +# --- Geometry #---------------------- # Get geometry shape and print debug information @@ -403,7 +403,7 @@ SectionsDigue = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) geompy.UnionIDs(SectionsDigue, [46, 50]) geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) -# --- recreate subshapes already exported from HYDRO to get access from Python +# --- recreate subshapes already exported from HYDRO to get access from Python #garonne_2_domaineEtendu_Outer = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_domaineEtendu_Outer, [4, 11, 17, 24, 26, 28, 14, 19, 20, 22, 31, 39, 41, 33, 35, 37]) #garonne_2_digue_Left_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) @@ -417,13 +417,17 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48]) +#controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +#controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +#controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +#controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) #---------------------- -# --- Meshing +# --- Meshing #---------------------- import SMESH, SALOMEDS @@ -506,9 +510,23 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE) #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE) SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) + +med_file = r'/tmp/garonne_2.med' + +try: + os.remove(med_file) +except OSError: + pass + + garonne_2.SetAutoColor( 1 ) -garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) +#controlMeshStats(garonne_2, 5247, 717, 10075) +#controlSubMeshStats(litMineur_2, 2384) +#controlSubMeshStats(riveDroite_1, 2348) +#controlSubMeshStats(riveGauche_1, 5343) +#controlSubMeshStats(digue_1, 0) controlMeshStats(garonne_2, 6190, 691, 12201) controlSubMeshStats(litMineur_2, 2384) controlSubMeshStats(riveDroite_1, 2400) @@ -519,7 +537,7 @@ if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) #---------------------- -# --- Z interpolation with HYDRO +# --- Z interpolation with HYDRO #---------------------- from salome.hydrotools.interpolZ import interpolZ, createZfield2 @@ -529,7 +547,7 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'garonne_2' # --- med file 2D(x,y) of the case produced by SMESH -fichierMaillage = '/tmp/garonne_2.med' +fichierMaillage = med_file # --- dictionary [med group name] = region name dicoGroupeRegion= dict(litMineur = 'garonne_2_litMineur', @@ -537,7 +555,7 @@ dicoGroupeRegion= dict(litMineur = 'garonne_2_litMineur', riveGauche = 'garonne_2_riveGauche', digue = 'garonne_2_digue', ) -# --- value to use for Z when the node is not in a region (used to detect problems) +# --- value to use for Z when the node is not in a region (used to detect problems) zUndef = 90 # --- Z interpolation on the bathymety/altimetry on the mesh nodes diff --git a/doc/salome/examples/h016_pilesPontManualMesh.py b/doc/salome/examples/h016_pilesPontManualMesh.py index 35a4e795..f47928f9 100644 --- a/doc/salome/examples/h016_pilesPontManualMesh.py +++ b/doc/salome/examples/h016_pilesPontManualMesh.py @@ -1123,7 +1123,12 @@ geompy.addToStudyInFather( HYDRO_casGaronne_1, bordGauche, 'bordGauche' ) geompy.addToStudyInFather( HYDRO_casGaronne_1, piles, 'piles' ) # --- basic properties control: edges length, surfaces -controlGeomProps(geompy, riveGauche, 29149.1353799, 35949580.6716) +#controlGeomProps(geompy, riveGauche, 29149.1353799, 35950762.8967) +#controlGeomProps(geompy, litMineur_aval, 7965.23431497, 938890.904721) +#controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.0787789) +#controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2548509.17447) +#controlGeomProps(geompy, riveDroite, 32012.2241814, 26188706.2202) +ontrolGeomProps(geompy, riveGauche, 29149.1353799, 35949580.6716) controlGeomProps(geompy, litMineur_aval, 7965.23431497, 935955.786347) controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.016847) controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2531409.65041) @@ -1218,9 +1223,23 @@ smesh.SetName(nbseg_litMineur_aval, 'nbseg_litMineur_aval') smesh.SetName(nbseg_litMineur_amont, 'nbseg_litMineur_amont') smesh.SetName(sections_1, 'sections') -casGaronne_1.SetAutoColor( 1 ) -casGaronne_1.ExportMED( r'/tmp/casGaronne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +med_file = r'/tmp/casGaronne_1.med' + +try: + os.remove(med_file) +except OSError: + pass + +casGaronne_1.SetAutoColor( 1 ) +casGaronne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) + +#controlMeshStats(casGaronne_1, 7040, 746, 13871) +#controlSubMeshStats(litMineur_pont_2, 204) +#controlSubMeshStats(litMineur_amont_2, 3000) +#controlSubMeshStats(litMineur_aval_2, 2000) +#controlSubMeshStats(riveDroite_1, 4040) +#controlSubMeshStats(riveGauche_1, 4627) controlMeshStats(casGaronne_1, 6985, 745, 13761) controlSubMeshStats(litMineur_pont_2, 185) controlSubMeshStats(litMineur_amont_2, 3000) diff --git a/doc/salome/examples/h017_interpolationLineaire.py b/doc/salome/examples/h017_interpolationLineaire.py index 63073d54..47ccfa5b 100644 --- a/doc/salome/examples/h017_interpolationLineaire.py +++ b/doc/salome/examples/h017_interpolationLineaire.py @@ -316,8 +316,17 @@ isDone = relief.Compute() domaine_1 = relief.GroupOnGeom(domaine,'domaine',SMESH.FACE) domaine_2 = relief.GroupOnGeom(domaine,'domaine',SMESH.NODE) smesh.SetName(relief, 'relief') + +med_file = r'/tmp/relief.med' + +try: + os.remove(med_file) +except OSError: + pass + + try: - relief.ExportMED( r'/tmp/relief.med', 0, SMESH.MED_V2_2, 1, None ,1) + relief.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) except: print 'ExportToMEDX() failed. Invalid file name?' @@ -344,7 +353,7 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'etude' # --- fichier med 2D(x,y) du cas, produit par SMESH -fichierMaillage = '/tmp/relief.med' +fichierMaillage = med_file # --- dictionnaire: (clé = nom de groupe med, valeur= nom de région) dicoGroupeRegion= dict(domaine = 'etude_Reg_1', diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index 52048bcc..e831498a 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -62,6 +62,8 @@ set(PROJECT_HEADERS HYDROData_SinusX.h HYDROData_ShapeFile.h HYDROData_LandCoverMap.h + HYDROData_LCM_FaceClassifier.h + HYDROData_DTM.h ) set(PROJECT_SOURCES @@ -122,6 +124,8 @@ set(PROJECT_SOURCES HYDROData_SinusX.cxx HYDROData_ShapeFile.cxx HYDROData_LandCoverMap.cxx + HYDROData_LCM_FaceClassifier.cxx + HYDROData_DTM.cxx ) add_definitions( diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 45123472..3ed80c06 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -20,6 +20,7 @@ #include "HYDROData_Document.h" #include "HYDROData_Tool.h" #include "HYDROData_PolylineXY.h" +#include "HYDROData_QuadtreeNode.hxx" #include #include @@ -27,6 +28,7 @@ #include #include #include +#include #include #include @@ -34,12 +36,15 @@ #include #include #include +#include +#ifndef LIGHT_MODE #include #include #include #include #include +#endif #include @@ -53,12 +58,36 @@ #define _DEVDEBUG_ #include "HYDRO_trace.hxx" +const int BLOCK_SIZE = 1000; + IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Bathymetry, HYDROData_IAltitudeObject) //HYDROData_QuadtreeNode* HYDROData_Bathymetry::myQuadtree = 0; + std::map HYDROData_Bathymetry::myQuadtrees; + +#ifndef LIGHT_MODE std::map HYDROData_Bathymetry::myDelaunay2D; +#endif + +inline double sqr( double x ) +{ + return x*x; +} +HYDROData_Bathymetry::AltitudePoint::AltitudePoint( double x, double y, double z ) +{ + X=x; Y=y; Z=z; +} + +double HYDROData_Bathymetry::AltitudePoint::SquareDistance( const HYDROData_Bathymetry::AltitudePoint& p ) const +{ + double d = 0; + d += sqr( X - p.X ); + d += sqr( Y - p.Y ); + d += sqr( Z - p.Z ); + return d; +} HYDROData_Bathymetry::HYDROData_Bathymetry() : HYDROData_IAltitudeObject() @@ -89,25 +118,25 @@ QStringList HYDROData_Bathymetry::DumpToPython( const QString& thePyScriptPath, return aResList; } -void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints ) +void HYDROData_Bathymetry::SetAltitudePoints( const HYDROData_Bathymetry::AltitudePoints& thePoints ) { RemoveAltitudePoints(); - if ( thePoints.IsEmpty() ) + if ( thePoints.empty() ) return; // Save coordinates Handle(TDataStd_RealArray) aCoordsArray = - TDataStd_RealArray::Set( myLab.FindChild( DataTag_AltitudePoints ), 0, thePoints.Length() * 3 - 1 ); + TDataStd_RealArray::Set( myLab.FindChild( DataTag_AltitudePoints ), 0, thePoints.size() * 3 - 1 ); - AltitudePoints::Iterator anIter( thePoints ); - for ( int i = 0 ; anIter.More(); ++i, anIter.Next() ) + HYDROData_Bathymetry::AltitudePoints::const_iterator anIter = thePoints.begin(), aLast = thePoints.end(); + for ( int i = 0 ; anIter!=aLast; ++i, ++anIter ) { - const AltitudePoint& aPoint = anIter.Value(); + const HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; - aCoordsArray->SetValue( i * 3, aPoint.X() ); - aCoordsArray->SetValue( i * 3 + 1, aPoint.Y() ); - aCoordsArray->SetValue( i * 3 + 2, aPoint.Z() ); + aCoordsArray->SetValue( i * 3, aPoint.X ); + aCoordsArray->SetValue( i * 3 + 1, aPoint.Y ); + aCoordsArray->SetValue( i * 3 + 2, aPoint.Z ); } Changed( Geom_Z ); @@ -115,7 +144,7 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints ) HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(bool IsConvertToGlobal) const { - AltitudePoints aPoints; + HYDROData_Bathymetry::AltitudePoints aPoints; TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false ); if ( aLabel.IsNull() ) @@ -126,19 +155,21 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(boo return aPoints; Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab ); + int q = ( aCoordsArray->Upper() - aCoordsArray->Lower() + 1 ) / 3; + aPoints.reserve( q ); for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; ) { if ( i + 3 > n + 1 ) break; - AltitudePoint aPoint; - aPoint.SetX( aCoordsArray->Value( i++ ) ); - aPoint.SetY( aCoordsArray->Value( i++ ) ); - aPoint.SetZ( aCoordsArray->Value( i++ ) ); + HYDROData_Bathymetry::AltitudePoint aPoint; + aPoint.X = aCoordsArray->Value( i++ ); + aPoint.Y = aCoordsArray->Value( i++ ); + aPoint.Z = aCoordsArray->Value( i++ ); if( IsConvertToGlobal ) - aDoc->Transform( aPoint, false ); - aPoints.Append( aPoint ); + aDoc->Transform( aPoint.X, aPoint.Y, aPoint.Z, false ); + aPoints.push_back( aPoint ); } return aPoints; @@ -155,7 +186,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const // if (myQuadtree->isEmpty() ) if (myQuadtrees.find(labkey) == myQuadtrees.end()) { - DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey); + //DEBTRACE("GetQuadtreeNodes init " << this << " " << labkey); HYDROData_QuadtreeNode* aQuadtree = new HYDROData_QuadtreeNode(0, 30, 5, 0.); myQuadtrees[labkey] = aQuadtree; TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false); @@ -181,7 +212,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const index++; aListOfNodes->push_back(aPoint); } - DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute"); + //DEBTRACE(" GetQuadtreeNodes call setNodesAndCompute"); aQuadtree->setNodesAndCompute(aListOfNodes); return aQuadtree; } @@ -189,6 +220,7 @@ HYDROData_QuadtreeNode* HYDROData_Bathymetry::GetQuadtreeNodes() const return myQuadtrees[labkey]; } +#ifndef LIGHT_MODE vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const { TDF_Label aLabel = myLab.FindChild(DataTag_AltitudePoints, false); @@ -199,7 +231,7 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const //DEBTRACE("GetVtkDelaunay2D this labkey altkey "<SetPoints(points); - DEBTRACE("Number of Points: "<< points->GetNumberOfPoints()); + //DEBTRACE("Number of Points: "<< points->GetNumberOfPoints()); vtkDelaunay2D* delaunay2D = vtkDelaunay2D::New(); delaunay2D->SetInputData(profile); @@ -236,7 +268,7 @@ vtkPolyData* HYDROData_Bathymetry::GetVtkDelaunay2D() const return myDelaunay2D[labkey]; } - +#endif void HYDROData_Bathymetry::RemoveAltitudePoints() { TDF_Label aLabel = myLab.FindChild( DataTag_AltitudePoints, false ); @@ -247,66 +279,66 @@ void HYDROData_Bathymetry::RemoveAltitudePoints() } } -void interpolateAltitudeForPoints( const gp_XY& thePoint, +void interpolateAltitudeForPoints( const gp_XY& thePoint, const HYDROData_Bathymetry::AltitudePoint& theFirstPoint, const HYDROData_Bathymetry::AltitudePoint& theSecPoint, HYDROData_Bathymetry::AltitudePoint& theResPoint, - const bool& theIsVertical ) + const bool& theIsVertical ) { double aCoordX = thePoint.X(); double aCoordY = thePoint.Y(); if ( theIsVertical ) { - aCoordX = theFirstPoint.X(); + aCoordX = theFirstPoint.X; - if ( !ValuesEquals( theFirstPoint.X(), theSecPoint.X() ) ) + if ( !ValuesEquals( theFirstPoint.X, theSecPoint.X ) ) { // Recalculate X coordinate by equation of line from two points - aCoordX = ( ( ( thePoint.Y() - theFirstPoint.Y() ) * ( theSecPoint.X() - theFirstPoint.X() ) ) / - ( theSecPoint.Y() - theFirstPoint.Y() ) ) + theFirstPoint.X(); + aCoordX = ( ( ( thePoint.Y() - theFirstPoint.Y ) * ( theSecPoint.X - theFirstPoint.X ) ) / + ( theSecPoint.Y - theFirstPoint.Y ) ) + theFirstPoint.X; } } else { - aCoordY = theFirstPoint.Y(); + aCoordY = theFirstPoint.Y; - if ( !ValuesEquals( theFirstPoint.Y(), theSecPoint.Y() ) ) + if ( !ValuesEquals( theFirstPoint.Y, theSecPoint.Y ) ) { // Recalculate y by equation of line from two points - aCoordY = ( ( ( thePoint.X() - theFirstPoint.X() ) * ( theSecPoint.Y() - theFirstPoint.Y() ) ) / - ( theSecPoint.X() - theFirstPoint.X() ) ) + theFirstPoint.Y(); + aCoordY = ( ( ( thePoint.X() - theFirstPoint.X ) * ( theSecPoint.Y - theFirstPoint.Y ) ) / + ( theSecPoint.X - theFirstPoint.X ) ) + theFirstPoint.Y; } } - theResPoint.SetX( aCoordX ); - theResPoint.SetY( aCoordY ); + theResPoint.X = aCoordX; + theResPoint.Y = aCoordY; // Calculate coefficient for interpolation - double aLength = Sqrt( Pow( theSecPoint.Y() - theFirstPoint.Y(), 2 ) + - Pow( theSecPoint.X() - theFirstPoint.X(), 2 ) ); + double aLength = Sqrt( Pow( theSecPoint.Y - theFirstPoint.Y, 2 ) + + Pow( theSecPoint.X - theFirstPoint.X, 2 ) ); double aInterCoeff = 0; if ( aLength != 0 ) - aInterCoeff = ( theSecPoint.Z() - theFirstPoint.Z() ) / aLength; + aInterCoeff = ( theSecPoint.Z - theFirstPoint.Z ) / aLength; - double aNewLength = Sqrt( Pow( theResPoint.Y() - theFirstPoint.Y(), 2 ) + - Pow( theResPoint.X() - theFirstPoint.X(), 2 ) ); + double aNewLength = Sqrt( Pow( theResPoint.Y - theFirstPoint.Y, 2 ) + + Pow( theResPoint.X - theFirstPoint.X, 2 ) ); // Calculate interpolated value - double aResVal = theFirstPoint.Z() + aInterCoeff * aNewLength; + double aResVal = theFirstPoint.Z + aInterCoeff * aNewLength; - theResPoint.SetZ( aResVal ); + theResPoint.Z = aResVal; } - +#ifndef LIGHT_MODE bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* triangle, double& z) { int nbPts = triangle->GetNumberOfIds(); if (nbPts != 3) { - DEBTRACE("not a triangle ?"); + //DEBTRACE("not a triangle ?"); return false; } vtkIdType s[3]; @@ -326,7 +358,7 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t double det = (v[1][1]-v[2][1])*(v[0][0]-v[2][0]) + (v[2][0]-v[1][0])*(v[0][1]-v[2][1]); if (det == 0) { - DEBTRACE("flat triangle ?"); + //DEBTRACE("flat triangle ?"); return false; } @@ -341,17 +373,18 @@ bool interpolZtriangle(const gp_XY& point, vtkPolyData* delaunay2D, vtkIdList* t double l2 = 1 -l0 -l1; //DEBTRACE("l0, l1, l2: " << l0 << " " << l1 << " " << l2); - if ((l0>=0) and (l0<=1) and (l1>=0) and (l1<=1) and (l2>=0) and (l2<=1)) + if ((l0>=0) && (l0<=1) && (l1>=0) && (l1<=1) && (l2>=0) && (l2<=1)) { z = l0*v[0][2] + l1*v[1][2] + l2*v[2][2]; return true; } return false; } +#endif double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const { - DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod); + //DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod); double anInvalidAltitude = GetInvalidAltitude(); double aResAltitude = anInvalidAltitude; @@ -360,7 +393,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM HYDROData_QuadtreeNode* aQuadtree = GetQuadtreeNodes(); if (!aQuadtree) { - DEBTRACE(" no Quadtree"); + //DEBTRACE(" no Quadtree"); return aResAltitude; } @@ -369,13 +402,13 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM while (dist2nodes.size() == 0) { aQuadtree->setPrecision(aQuadtree->getPrecision() *2); - DEBTRACE("adjust precision to: " << aQuadtree->getPrecision()); + //DEBTRACE("adjust precision to: " << aQuadtree->getPrecision()); aQuadtree->NodesAround(thePoint, dist2nodes, aQuadtree->getPrecision()); } std::map::const_iterator it = dist2nodes.begin(); aResAltitude = it->second->Z(); int nodeIndex = it->second->getIndex(); - DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex); + //DEBTRACE(" number of points found: " << dist2nodes.size() << " nearest z: " << aResAltitude << " point index: " << nodeIndex); // --- for coarse bathymetry clouds (when the TELEMAC mesh is more refined than the bathymetry cloud) // interpolation is required. @@ -386,6 +419,8 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM bool isBathyInterpolRequired = false; if (theMethod) isBathyInterpolRequired =true; + +#ifndef LIGHT_MODE if (isBathyInterpolRequired) { vtkPolyData* aDelaunay2D = GetVtkDelaunay2D(); @@ -395,7 +430,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theM points->Allocate(64); aDelaunay2D->GetPointCells(nodeIndex, cells); vtkIdType nbCells = cells->GetNumberOfIds(); - DEBTRACE(" triangles on nearest point: " << nbCells); + //DEBTRACE(" triangles on nearest point: " << nbCells); bool isInside = false; for (int i=0; iSetValue(i, TCollection_ExtendedString(Val)); + i++; + } +} + TCollection_AsciiString HYDROData_Bathymetry::GetFilePath() const { TCollection_AsciiString aRes; @@ -430,10 +482,52 @@ TCollection_AsciiString HYDROData_Bathymetry::GetFilePath() const if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) aRes = anAsciiStr->Get(); } + else + { + aLabel = myLab.FindChild( DataTag_FilePaths, false ); + if ( !aLabel.IsNull() ) + { + Handle(TDataStd_ExtStringArray) anExtStrArr; + if ( aLabel.FindAttribute( TDataStd_ExtStringArray::GetID(), anExtStrArr ) ) + aRes = anExtStrArr->Value(1); //try take the first; convert extstring to asciistring + } + } return aRes; } +QStringList HYDROData_Bathymetry::GetFilePaths() const +{ + QStringList aResL; + + TDF_Label aLabel = myLab.FindChild( DataTag_FilePaths, false ); + if ( !aLabel.IsNull() ) + { + Handle(TDataStd_ExtStringArray) anExtStrArr; + if ( aLabel.FindAttribute( TDataStd_ExtStringArray::GetID(), anExtStrArr ) ) + { + for (int i = anExtStrArr->Lower(); i <= anExtStrArr->Upper(); i++ ) + { + Standard_ExtString str = anExtStrArr->Value(i).ToExtString(); + TCollection_AsciiString aText (str); + aResL << QString(aText.ToCString()); + } + } + } + else //backward compatibility + { + TDF_Label anOldLabel = myLab.FindChild( DataTag_FilePath, false ); + if ( !anOldLabel.IsNull() ) + { + Handle(TDataStd_AsciiString) anAsciiStr; + if ( anOldLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) + aResL << QString(anAsciiStr->Get().ToCString()); + } + } + + return aResL; +} + void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted, const bool theIsUpdate ) { @@ -449,15 +543,15 @@ void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted, return; // Update altitude points - AltitudePoints anAltitudePoints = GetAltitudePoints(); - if ( anAltitudePoints.IsEmpty() ) + HYDROData_Bathymetry::AltitudePoints anAltitudePoints = GetAltitudePoints(); + if ( anAltitudePoints.empty() ) return; - AltitudePoints::Iterator anIter( anAltitudePoints ); - for ( ; anIter.More(); anIter.Next() ) + HYDROData_Bathymetry::AltitudePoints::iterator anIter = anAltitudePoints.begin(), aLast = anAltitudePoints.end(); + for ( ; anIter!=aLast; ++anIter ) { - AltitudePoint& aPoint = anIter.ChangeValue(); - aPoint.SetZ( aPoint.Z() * -1 ); + HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; + aPoint.Z *= -1; } SetAltitudePoints( anAltitudePoints ); @@ -478,50 +572,63 @@ bool HYDROData_Bathymetry::IsAltitudesInverted() const return aRes; } -bool HYDROData_Bathymetry::ImportFromFile( const TCollection_AsciiString& theFileName ) +bool HYDROData_Bathymetry::ImportFromFile( const QString& theFileName ) { - // Try to open the file - QFile aFile( theFileName.ToCString() ); - if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) - return false; + return ImportFromFiles(QStringList(theFileName)); +} - bool aRes = false; +bool HYDROData_Bathymetry::ImportFromFiles( const QStringList& theFileNames ) +{ + AltitudePoints AllPoints; + bool Stat = false; - QString aFileSuf = QFileInfo( aFile ).suffix().toLower(); + foreach (QString theFileName, theFileNames) + { + // Try to open the file + QFile aFile( theFileName ); + if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) + continue; - AltitudePoints aPoints; + QString aFileSuf = QFileInfo( aFile ).suffix().toLower(); - // Try to import the file - if ( aFileSuf == "xyz" ) - aRes = importFromXYZFile( aFile, aPoints ); - else if ( aFileSuf == "asc" ) - aRes = importFromASCFile( aFile, aPoints ); + HYDROData_Bathymetry::AltitudePoints aPoints; - // Close the file - aFile.close(); - + // Try to import the file + if ( aFileSuf == "xyz" ) + Stat = importFromXYZFile( aFile, aPoints ); + else if ( aFileSuf == "asc" ) + Stat = importFromASCFile( aFile, aPoints ); + + if (!Stat) + continue; //ignore this points + + // Close the file + aFile.close(); + + AllPoints.insert(AllPoints.end(), aPoints.begin(), aPoints.end()); + } // Convert from global to local CS Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab ); - AltitudePoints::Iterator anIter( aPoints ); - for ( ; anIter.More(); anIter.Next() ) + HYDROData_Bathymetry::AltitudePoints::iterator anIter = AllPoints.begin(), aLast = AllPoints.end(); + for ( ; anIter!=aLast; ++anIter ) { - AltitudePoint& aPoint = anIter.ChangeValue(); - aDoc->Transform( aPoint, true ); + HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; + aDoc->Transform( aPoint.X, aPoint.Y, aPoint.Z, true ); } - if ( aRes ) + if ( Stat ) { // Update file path and altitude points of this Bathymetry - SetFilePath( theFileName ); - SetAltitudePoints( aPoints ); + SetFilePaths (theFileNames ); + SetAltitudePoints( AllPoints ); } - return aRes && !aPoints.IsEmpty(); + return Stat && !AllPoints.empty(); } bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, - AltitudePoints& thePoints ) const + HYDROData_Bathymetry::AltitudePoints& thePoints ) const { if ( !theFile.isOpen() ) return false; @@ -547,7 +654,7 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, if ( aValues.length() < 3 ) return false; - AltitudePoint aPoint; + HYDROData_Bathymetry::AltitudePoint aPoint; QString anX = aValues.value( 0 ); QString anY = aValues.value( 1 ); @@ -555,23 +662,26 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, bool isXOk = false, isYOk = false, isZOk = false; - aPoint.SetX( anX.toDouble( &isXOk ) ); - aPoint.SetY( anY.toDouble( &isYOk ) ); - aPoint.SetZ( aZ.toDouble( &isZOk ) ); + aPoint.X = anX.toDouble( &isXOk ); + aPoint.Y = anY.toDouble( &isYOk ); + aPoint.Z = aZ.toDouble( &isZOk ); if ( !isXOk || !isYOk || !isZOk ) return false; - if ( HYDROData_Tool::IsNan( aPoint.X() ) || HYDROData_Tool::IsInf( aPoint.X() ) || - HYDROData_Tool::IsNan( aPoint.Y() ) || HYDROData_Tool::IsInf( aPoint.Y() ) || - HYDROData_Tool::IsNan( aPoint.Z() ) || HYDROData_Tool::IsInf( aPoint.Z() ) ) + if ( HYDROData_Tool::IsNan( aPoint.X ) || HYDROData_Tool::IsInf( aPoint.X ) || + HYDROData_Tool::IsNan( aPoint.Y ) || HYDROData_Tool::IsInf( aPoint.Y ) || + HYDROData_Tool::IsNan( aPoint.Z ) || HYDROData_Tool::IsInf( aPoint.Z ) ) return false; // Invert the z value if requested if ( anIsAltitudesInverted ) - aPoint.SetZ( -aPoint.Z() ); + aPoint.Z = -aPoint.Z; - thePoints.Append( aPoint ); + if( thePoints.size()>=thePoints.capacity() ) + thePoints.reserve( thePoints.size()+BLOCK_SIZE ); + + thePoints.push_back( aPoint ); } #ifdef _TIMER @@ -584,7 +694,7 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, } bool HYDROData_Bathymetry::importFromASCFile( QFile& theFile, - AltitudePoints& thePoints ) const + HYDROData_Bathymetry::AltitudePoints& thePoints ) const { if ( !theFile.isOpen() ) return false; @@ -655,23 +765,23 @@ bool HYDROData_Bathymetry::importFromASCFile( QFile& theFile, { if (aStrList[j].toDouble() != aNoDataValue) { - AltitudePoint aPoint; - aPoint.SetX(anXllCorner + aCellSize*(j + 0.5)); - aPoint.SetY(anYllCorner + aCellSize*(aNRows - i + 0.5)); - aPoint.SetZ(aStrList[j].toDouble()); + HYDROData_Bathymetry::AltitudePoint aPoint; + aPoint.X = anXllCorner + aCellSize*(j + 0.5); + aPoint.Y = anYllCorner + aCellSize*(aNRows - i + 0.5); + aPoint.Z = aStrList[j].toDouble(); if ( anIsAltitudesInverted ) - aPoint.SetZ( -aPoint.Z() ); + aPoint.Z = -aPoint.Z; - thePoints.Append(aPoint); + if( thePoints.size()>=thePoints.capacity() ) + thePoints.reserve( thePoints.size()+BLOCK_SIZE ); + thePoints.push_back(aPoint); } } i++; - } return true; - } @@ -691,14 +801,14 @@ Handle(HYDROData_PolylineXY) HYDROData_Bathymetry::CreateBoundaryPolyline() cons double Xmin = 0.0, Xmax = 0.0, Ymin = 0.0, Ymax = 0.0; bool isFirst = true; - AltitudePoints aPoints = GetAltitudePoints(); + HYDROData_Bathymetry::AltitudePoints aPoints = GetAltitudePoints(); - AltitudePoints::Iterator anIter( aPoints ); - for ( ; anIter.More(); anIter.Next() ) + HYDROData_Bathymetry::AltitudePoints::const_iterator anIter = aPoints.begin(), aLast = aPoints.end(); + for ( ; anIter!=aLast; ++anIter ) { - const AltitudePoint& aPoint = anIter.Value(); + const HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; - double x = aPoint.X(), y = aPoint.Y(); + double x = aPoint.X, y = aPoint.Y; if( isFirst || xXmax ) @@ -726,12 +836,14 @@ Handle(HYDROData_PolylineXY) HYDROData_Bathymetry::CreateBoundaryPolyline() cons void HYDROData_Bathymetry::UpdateLocalCS( double theDx, double theDy ) { gp_XYZ aDelta( theDx, theDy, 0 ); - AltitudePoints aPoints = GetAltitudePoints(); - AltitudePoints::Iterator anIter( aPoints ); - for ( int i = 0 ; anIter.More(); ++i, anIter.Next() ) + HYDROData_Bathymetry::AltitudePoints aPoints = GetAltitudePoints(); + HYDROData_Bathymetry::AltitudePoints::iterator anIter = aPoints.begin(), aLast = aPoints.end(); + for ( int i = 0; anIter!=aLast; ++i, ++anIter ) { - AltitudePoint& aPoint = anIter.ChangeValue(); - aPoint += aDelta; + HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; + aPoint.X += aDelta.X(); + aPoint.Y += aDelta.Y(); + aPoint.Z += aDelta.Z(); } SetAltitudePoints( aPoints ); } diff --git a/src/HYDROData/HYDROData_Bathymetry.h b/src/HYDROData/HYDROData_Bathymetry.h index 39ac30b1..60568473 100644 --- a/src/HYDROData/HYDROData_Bathymetry.h +++ b/src/HYDROData/HYDROData_Bathymetry.h @@ -20,15 +20,15 @@ #define HYDROData_Bathymetry_HeaderFile #include "HYDROData_IAltitudeObject.h" -#include "HYDROData_QuadtreeNode.hxx" -#include -#include +#include class QFile; class gp_XYZ; class gp_XY; class HYDROData_PolylineXY; - +class HYDROData_QuadtreeNode; +class vtkPolyData; +class vtkIdList; /**\class HYDROData_Bathymetry @@ -39,9 +39,16 @@ class HYDROData_PolylineXY; class HYDROData_Bathymetry : public HYDROData_IAltitudeObject { public: + struct HYDRODATA_EXPORT AltitudePoint + { + AltitudePoint( double x=0, double y=0, double z=0 ); + double X; + double Y; + double Z; - typedef gp_XYZ AltitudePoint; - typedef NCollection_Sequence AltitudePoints; + double SquareDistance( const AltitudePoint& ) const; + }; + typedef std::vector AltitudePoints; protected: @@ -53,6 +60,7 @@ protected: DataTag_First = HYDROData_IAltitudeObject::DataTag_First + 100, ///< first tag, to reserve DataTag_AltitudePoints, ///< altitude points, array of reals DataTag_FilePath, ///< bathymetry imported file path + DataTag_FilePaths, ///< bathymetry imported file paths DataTag_AltitudesInverted, ///< flag to invert z values }; @@ -87,8 +95,10 @@ public: HYDRODATA_EXPORT virtual AltitudePoints GetAltitudePoints(bool IsConvertToGlobal = false) const; HYDRODATA_EXPORT virtual HYDROData_QuadtreeNode* GetQuadtreeNodes() const; +#ifndef LIGHT_MODE HYDRODATA_EXPORT virtual vtkPolyData* GetVtkDelaunay2D() const; //HYDRODATA_EXPORT bool interpolZtriangle(const gp_XY& point, vtkIdList* triangle, double* z); +#endif /** * Remove all altitude points. @@ -112,11 +122,15 @@ public: */ HYDRODATA_EXPORT void SetFilePath( const TCollection_AsciiString& theFilePath ); + HYDRODATA_EXPORT void SetFilePaths( const QStringList& theFilePaths ); + /** * Returns uploaded bathymetry file path */ HYDRODATA_EXPORT TCollection_AsciiString GetFilePath() const; + HYDRODATA_EXPORT QStringList GetFilePaths() const; + /** * Set flag indicating needs to invert altitude values * \param theIsInverted new invert value @@ -136,7 +150,9 @@ public: * \param theFileName the path to file * \return \c true if file has been successfully read */ - HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName ); + HYDRODATA_EXPORT virtual bool ImportFromFiles( const QStringList& theFileNames ); + + HYDRODATA_EXPORT virtual bool ImportFromFile( const QString& theFileName ); HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) CreateBoundaryPolyline() const; @@ -150,8 +166,9 @@ private: bool importFromXYZFile( QFile& theFile, AltitudePoints& thePoints ) const; static std::map myQuadtrees; +#ifndef LIGHT_MODE static std::map myDelaunay2D; - +#endif bool importFromASCFile( QFile& theFile, AltitudePoints& thePoints ) const; diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 9bea6264..f1b7a564 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -77,8 +77,10 @@ #define EXPORT_NAME "HYDRO_" + GetName() +#ifndef LIGHT_MODE #include #include +#endif #define _DEVDEBUG_ #include "HYDRO_trace.hxx" @@ -168,6 +170,12 @@ QStringList HYDROData_CalculationCase::DumpToPython( const QString& thePyS Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline(); setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBoundaryPolyline, "SetBoundaryPolyline" ); + Handle(HYDROData_StricklerTable) aStricklerTable = GetStricklerTable(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aStricklerTable, "SetStricklerTable" ); + + Handle(HYDROData_LandCoverMap) aLandCoverMap = GetLandCoverMap(); + setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aLandCoverMap, "SetLandCoverMap" ); + if( aMode==AUTOMATIC ) DumpRulesToPython( aCalculName, aResList ); @@ -279,19 +287,23 @@ void HYDROData_CalculationCase::Update() HYDROData_SplitToZonesTool::SplitDataList aZonesList, anEdgesList; Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline(); + + HYDROData_SequenceOfObjects InterPolys = GetInterPolyObjects(); + HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); if ( !aGeomObjects.IsEmpty() ) { HYDROData_SequenceOfObjects aGeomGroups = GetGeometryGroups(); HYDROData_SplitToZonesTool::SplitDataList aSplitObjects = - HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline ); + HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline, InterPolys ); if ( !aSplitObjects.isEmpty() ) { HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitObjects ); while( anIter.hasNext() ) { const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Zone ) aZonesList.append( aSplitData ); - else if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Edge ) + else if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Edge || + aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_IntEdge) anEdgesList.append( aSplitData ); } } @@ -448,6 +460,12 @@ void HYDROData_CalculationCase::CreateEdgeGroupsDef( const Handle(HYDROData_Docu continue; aSplitGroup->AddShape( aSplitData.Shape ); + + TopTools_SequenceOfShape theShapes; + aSplitGroup->GetShapes(theShapes); + + if (aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_IntEdge) + aSplitGroup->SetInternal(true); } } @@ -899,6 +917,20 @@ double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& return aCoeff; } +std::vector HYDROData_CalculationCase::GetStricklerCoefficientForPoints(const std::vector& thePoints, + double DefValue, bool UseMax ) const +{ + Handle( HYDROData_LandCoverMap ) aLCM = GetLandCoverMap(); + Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable(); + std::vector theCoeffs; + if( aLCM.IsNull() || aTable.IsNull() ) + return theCoeffs; + + aLCM->ClassifyPoints(thePoints, aTable, theCoeffs, DefValue, UseMax ); + + return theCoeffs; +} + Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const { Handle(HYDROData_Region) aResRegion; @@ -1013,7 +1045,8 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId ); QString aGeomObjEntry, anErrorMsg; - bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg ); + QString statMess; + bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg, statMess ); return isOK ? aGeomObjEntry : QString(); #endif } @@ -1022,13 +1055,15 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, - QString& theErrorMsg ) const + QString& theErrorMsg, + QString& statMess) const { HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs; // Get groups definitions HYDROData_SequenceOfObjects aSplitGroups = GetSplitGroups(); + TopTools_SequenceOfShape IntSh; //internal edges HYDROData_SequenceOfObjects::Iterator anIter( aSplitGroups ); for ( ; anIter.More(); anIter.Next() ) { @@ -1044,13 +1079,23 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, aGroup->GetShapes( aGroupDef.Shapes ); aSeqOfGroupsDefs.Append( aGroupDef ); + + Handle(HYDROData_SplitShapesGroup) aSSGroup = Handle(HYDROData_SplitShapesGroup)::DownCast( anIter.Value() ); + TopTools_SequenceOfShape dummy; + if (!aSSGroup.IsNull()) + if (aSSGroup->GetInternal()) + { + aSSGroup->GetShapes(dummy); + IntSh.Append(dummy); + } + } // Get faces bool isAllNotSubmersible = true; - TopTools_ListOfShape aFaces; HYDROData_SequenceOfObjects aCaseRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions ); + NCollection_IndexedDataMap aShToNames; for ( ; aRegionIter.More(); aRegionIter.Next() ) { Handle(HYDROData_Region) aRegion = @@ -1061,8 +1106,8 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, if ( isAllNotSubmersible ) isAllNotSubmersible = false; - TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs ); - aFaces.Append( aRegionShape ); + TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs, &IntSh ); + aShToNames.Add( aRegionShape, aRegion->GetName() ); } bool aRes = false; @@ -1072,20 +1117,22 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, } else if ( isAllNotSubmersible ) { theErrorMsg = QString("there are no submersible regions."); } else { - aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );; + aRes = Export( theGeomEngine, theStudy, aShToNames, aSeqOfGroupsDefs, theGeomObjEntry );; } if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() ) { QString aTelemacFileName = GetName() + ".telemac"; - aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable() ); + aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable(), statMess ); + if (!aRes) + theErrorMsg = QString( "The export to TELEMAC %1 failed" ).arg( aTelemacFileName ); } return aRes; } bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - const TopTools_ListOfShape& theFaces, + const NCollection_IndexedDataMap& aShToName, const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs, QString& theGeomObjEntry ) const { @@ -1096,34 +1143,32 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var TCollection_AsciiString aNam("Sh_"); int i=1; #endif - TopTools_ListIteratorOfListOfShape aFaceIter( theFaces ); - for ( ; aFaceIter.More(); aFaceIter.Next() ) + TopTools_DataMapOfShapeListOfShape SH2M; + for ( int i = 1; i <= aShToName.Extent(); i++ ) { - TopoDS_Shape aShape = aFaceIter.Value(); + const TopoDS_Shape& aShape = aShToName.FindKey(i); if ( aShape.IsNull() ) continue; - - if ( aShape.ShapeType() == TopAbs_FACE ) + + SH2M.Bind(aShape, TopTools_ListOfShape()); + TopTools_ListOfShape& LM = SH2M.ChangeFind(aShape); + if ( aShape.ShapeType() == TopAbs_FACE || aShape.ShapeType() == TopAbs_SHELL ) { aSewing.Add( aShape ); -#ifdef DEB_CALCULATION - TCollection_AsciiString aName = aNam + ++i + ".brep"; - BRepTools::Write(aShape ,aName.ToCString()); -#endif + LM.Append(aShape); } - else + else if (aShape.ShapeType() == TopAbs_COMPOUND) { -#ifdef DEB_CALCULATION - int j = 1; -#endif - TopExp_Explorer anExp( aShape, TopAbs_FACE ); - for (; anExp.More(); anExp.Next() ) { + TopExp_Explorer anExp( aShape, TopAbs_SHELL ); + for (; anExp.More(); anExp.Next() ) + { aSewing.Add( anExp.Current() ); -#ifdef DEB_CALCULATION - - TCollection_AsciiString aName = aNam + i + "_" + ++j + ".brep"; - BRepTools::Write(anExp.Current() ,aName.ToCString()); -#endif + LM.Append(anExp.Current()); + } + anExp.Init( aShape, TopAbs_FACE, TopAbs_SHELL ); + { + aSewing.Add( anExp.Current() ); + LM.Append(anExp.Current()); } } } // faces iterator @@ -1131,6 +1176,24 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var aSewing.Perform(); TopoDS_Shape aSewedShape = aSewing.SewedShape(); + NCollection_IndexedDataMap aFacesToNameModif; + + for ( int i = 1; i <= aShToName.Extent(); i++ ) + { + const TopoDS_Shape& CurShape = aShToName.FindKey(i); + const QString& Qstr = aShToName.FindFromIndex(i); + const TopTools_ListOfShape& LM = SH2M(CurShape); + for (TopTools_ListIteratorOfListOfShape it(LM); it.More(); it.Next()) + { + const TopoDS_Shape& csh = it.Value(); + if (aSewing.IsModified(csh)) + aFacesToNameModif.Add(aSewing.Modified(csh), Qstr); + else + aFacesToNameModif.Add(csh, Qstr); + } + } + + // If the sewed shape is empty - return false if ( aSewedShape.IsNull() || !TopoDS_Iterator( aSewedShape ).More() ) return false; @@ -1141,7 +1204,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var // Publish the sewed shape QString aName = EXPORT_NAME; GEOM::GEOM_Object_ptr aMainShape = - HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry ); + HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( theGeomEngine, theStudy, aSewedShape, aFacesToNameModif, aName, theGeomObjEntry ); if ( aMainShape->_is_nil() ) return false; @@ -1376,3 +1439,34 @@ bool HYDROData_CalculationCase::GetRule( int theIndex, return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex, theObject1, thePriority, theObject2, theMergeType ); } + +bool HYDROData_CalculationCase::AddInterPoly( const Handle(HYDROData_PolylineXY)& theInterPolyline ) +{ + HYDROData_CalculationCase::DataTag aDataTag = DataTag_InterPoly; + + if ( HasReference( theInterPolyline, aDataTag ) ) + return false; + + AddReferenceObject( theInterPolyline, aDataTag ); + + Changed( Geom_2d ); + + return true; +} + +HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetInterPolyObjects() const +{ + return GetReferenceObjects( DataTag_InterPoly ); +} + +void HYDROData_CalculationCase::RemoveInterPolyObject( const Handle(HYDROData_PolylineXY)& theInterPolyline ) +{ + if ( theInterPolyline.IsNull() ) + return; + + RemoveReferenceObject( theInterPolyline->Label(), DataTag_InterPoly ); + +} + + + diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index af03f951..4ee079d6 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef WIN32 #pragma warning ( disable: 4251 ) @@ -92,6 +93,7 @@ public: DataTag_CustomRules, ///< custom rules DataTag_AssignmentMode, ///< assignment mode DataTag_StricklerTable, ///< reference Strickler table + DataTag_InterPoly, ///< intersection polyline DataTag_LandCover_Obsolete, ///< reference land covers DataTag_CustomLandCoverRules_Obsolete, ///< custom rules for land covers priority @@ -269,6 +271,12 @@ public: */ HYDRODATA_EXPORT virtual void RemoveSplitGroups(); + HYDRODATA_EXPORT virtual bool AddInterPoly( const Handle(HYDROData_PolylineXY)& theInterPolyline ); + + HYDRODATA_EXPORT virtual void RemoveInterPolyObject( const Handle(HYDROData_PolylineXY)& theInterPolyline ); + + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetInterPolyObjects() const; + /** * Exports the calculation case data (shell and groups) to GEOM module. * \param theStudyId the id of the study where the GEOM module should be used for export @@ -288,7 +296,8 @@ public: HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, - QString& theErrorMsg ) const; + QString& theErrorMsg, + QString& statMess) const; #endif public: @@ -328,6 +337,10 @@ public: */ HYDRODATA_EXPORT double GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const; + HYDRODATA_EXPORT std::vector GetStricklerCoefficientForPoints(const std::vector& thePoints, + double DefValue, + bool UseMax ) const; + /** * Returns altitudes for given points on given region. * \param thePoints the points to examine @@ -423,7 +436,7 @@ private: #ifndef LIGHT_MODE bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - const TopTools_ListOfShape& theFaces, + const NCollection_IndexedDataMap& aFacesToName, const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs, QString& theGeomObjEntry ) const; #endif diff --git a/src/HYDROData/HYDROData_Channel.cxx b/src/HYDROData/HYDROData_Channel.cxx index d9ccf4a8..526589c5 100644 --- a/src/HYDROData/HYDROData_Channel.cxx +++ b/src/HYDROData/HYDROData_Channel.cxx @@ -280,22 +280,26 @@ bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& // Create presentation HYDROData_Stream::PrsDefinition aPrs; Handle(TopTools_HArray1OfShape) anArrOf2DProfiles; // we don't need 2D profiles for channel/digue presentation - bool aRes = HYDROData_Stream::CreatePresentations( anArrayOfFPnt, anArrayOfLPnt, - anArrOfProfiles, anArrOf2DProfiles, aPrs ); - if ( aRes ) { - thePrs.myPrs3D = aPrs.myPrs3D; - thePrs.myPrs2D = TopoDS::Face( aPrs.myPrs2D ); - BRepBuilderAPI_MakeWire aMakeWire( aPrs.myLeftBank ) ; - thePrs.myLeftBank = aMakeWire.Wire(); - aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myRightBank ); - thePrs.myRightBank = aMakeWire.Wire(); - aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myInlet ); - thePrs.myInlet = aMakeWire.Wire(); - aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myOutlet ); - thePrs.myOutlet = aMakeWire.Wire(); - } - return aRes; + HYDROData_Stream::CreatePresentations( anArrayOfFPnt, anArrayOfLPnt, anArrOfProfiles, aPrs ); + thePrs.myInlet = aPrs.myInlet; + thePrs.myOutlet = aPrs.myOutlet; + thePrs.myLeftBank = aPrs.myLeftBank; + thePrs.myRightBank = aPrs.myRightBank; + thePrs.myPrs2D = TopoDS::Face(aPrs.myPrs2D); + thePrs.myPrs3D = aPrs.myPrs3D; + + //thePrs.myPrs2D = TopoDS::Face( aPrs.myPrs2D ); + //BRepBuilderAPI_MakeWire aMakeWire( aPrs.myLeftBank ) ; + //thePrs.myLeftBank = aMakeWire.Wire(); + //aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myRightBank ); + //thePrs.myRightBank = aMakeWire.Wire(); + //aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myInlet ); + //thePrs.myInlet = aMakeWire.Wire(); + //aMakeWire = BRepBuilderAPI_MakeWire( aPrs.myOutlet ); + //thePrs.myOutlet = aMakeWire.Wire(); + + return true; } void HYDROData_Channel::Update() @@ -325,9 +329,9 @@ void HYDROData_Channel::Update() TopTools_SequenceOfShape anOutletEdges; HYDROData_ShapesTool::ExploreShapeToShapes( aResultPrs.myOutlet, TopAbs_EDGE, anOutletEdges ); - + + RemoveGroupObjects(); QString aLeftGroupName = GetName() + "_Left_Bank"; - Handle(HYDROData_ShapesGroup) aLeftGroup = createGroupObject(); aLeftGroup->SetName( aLeftGroupName ); aLeftGroup->SetShapes( aLeftBankEdges ); @@ -450,7 +454,7 @@ void HYDROData_Channel::RemoveProfile() ObjectKind HYDROData_Channel::getAltitudeObjectType() const { - DEBTRACE("HYDROData_Channel::getAltitudeObjectType"); + //DEBTRACE("HYDROData_Channel::getAltitudeObjectType"); return KIND_CHANNEL_ALTITUDE; //return KIND_STREAM_ALTITUDE; } diff --git a/src/HYDROData/HYDROData_DTM.cxx b/src/HYDROData/HYDROData_DTM.cxx new file mode 100644 index 00000000..76962d9b --- /dev/null +++ b/src/HYDROData/HYDROData_DTM.cxx @@ -0,0 +1,1025 @@ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//@MZN zzz IMPLEMENT_STANDARD_HANDLE( HYDROData_DTM, HYDROData_Bathymetry ) +//@MZN zzz IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry ) + +HYDROData_DTM::CurveUZ::CurveUZ( double theXCurv, const gp_Vec2d& theProfileDir, double theDeltaZ ) + : myXcurv( theXCurv ), myProfileDir( theProfileDir ), myDeltaZ( theDeltaZ ) +{ +} + +HYDROData_DTM::CurveUZ::~CurveUZ() +{ +} + +double HYDROData_DTM::CurveUZ::Xcurv() const +{ + return myXcurv; +} + +gp_Vec2d HYDROData_DTM::CurveUZ::ProfileDir() const +{ + return myProfileDir; +} + +double HYDROData_DTM::CurveUZ::DeltaZ() const +{ + return myDeltaZ; +} + +HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) const +{ + HYDROData_DTM::CurveUZ res( Xcurv() + c.Xcurv(), ProfileDir() + c.ProfileDir(), DeltaZ() + c.DeltaZ() ); + size_t n = size(), n1 = c.size(); + if( n!=n1 ) + { + std::cout << "Warning: different number of points in curves: " << n << ", " << n1 << std::endl; + } + res.reserve( n ); + for( int i=0; i& main_profiles) +{ + TopTools_IndexedMapOfOrientedShape ll; + TopoDS_Wire LWire, RWire; + PointToWire(left, LWire); + PointToWire(right, RWire); + if (!LWire.IsNull()) + ll.Add(LWire.Oriented(TopAbs_FORWARD)); + + for (int k = 0; k < main_profiles.size(); k++) + { + TopoDS_Wire W; + PointToWire(main_profiles[k], W); + TopAbs_Orientation Ori = TopAbs_INTERNAL; + if (k == 0 || k == main_profiles.size() - 1) + Ori = TopAbs_FORWARD; + ll.Add(W.Oriented(Ori)); + } + + if (!RWire.IsNull()) + ll.Add(RWire.Oriented(TopAbs_FORWARD)); + //yes, add subshapes in this order (left + profiles + right) + //otherwise the projected wire will be non-manifold + + return ll; +} + + +void HYDROData_DTM::Update() +{ + AltitudePoints points; + TopoDS_Shape Out3dPres; + TopoDS_Shape Out2dPres; + TopoDS_Shape OutLeftB; + TopoDS_Shape OutRightB; + TopoDS_Shape OutInlet; + TopoDS_Shape OutOutlet; + + HYDROData_SequenceOfObjects objs = GetProfiles(); + double ddz = GetDDZ(); + double step = GetSpatialStep(); + std::set InvInd; + bool WireIntersections; //__TODO + CreateProfilesFromDTM( objs, ddz, step, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, true, true, InvInd, -1, WireIntersections ); + SetAltitudePoints( points ); + + SetShape( DataTag_LeftBankShape, OutLeftB); + SetShape( DataTag_RightBankShape, OutRightB); + SetShape( DataTag_InletShape, OutInlet); + SetShape( DataTag_OutletShape, OutOutlet ); + SetShape( DataTag_3DShape, Out3dPres ); + SetShape( DataTag_2DShape, Out2dPres ); + + HYDROData_Bathymetry::Update(); +} + +void HYDROData_DTM::GetPresentationShapes( TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet ) +{ + //without update! + OutLeftB = GetShape( DataTag_LeftBankShape); + OutRightB = GetShape( DataTag_RightBankShape); + OutInlet = GetShape( DataTag_InletShape); + OutOutlet = GetShape( DataTag_OutletShape ); + Out3dPres = GetShape( DataTag_3DShape ); + Out2dPres = GetShape( DataTag_2DShape ); +} +void HYDROData_DTM::CreateProfilesFromDTM (const HYDROData_SequenceOfObjects& InpProfiles, + double ddz, + double step, + AltitudePoints& points, + TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet, + bool Create3dPres, + bool Create2dPres, + std::set& InvInd, + int thePntsLimit, + bool& WireIntersections) +{ + int aLower = InpProfiles.Lower(), anUpper = InpProfiles.Upper(); + size_t n = anUpper - aLower + 1; + + std::vector profiles; + profiles.reserve( n ); + for( int i=aLower; i<=anUpper; i++ ) + { + Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( InpProfiles.Value( i ) ); + if( !aProfile.IsNull() ) + profiles.push_back( aProfile ); + } + const double EPS = 1E-3; + AltitudePoints left; + AltitudePoints right; + std::vector main_profiles; + + if( thePntsLimit > 0 ) + { + int aNbPoints = EstimateNbPoints( profiles, ddz, step ); + if( aNbPoints < 0 || aNbPoints > thePntsLimit ) + return; + } + + if( ddz>EPS && step>EPS ) + CreateProfiles(profiles, ddz, step, left, right, points, main_profiles, + Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet, Create3dPres, Create2dPres, InvInd, WireIntersections ); +} + +void HYDROData_DTM::ProjWireOnPlane(const TopoDS_Shape& inpWire, const Handle(Geom_Plane)& RefPlane, + TopTools_DataMapOfShapeListOfShape* E2PE) +{ + BRep_Builder BB; + + //project shape (edges) on planar face + TopoDS_Face F; + BB.MakeFace(F, RefPlane, Precision::Confusion()); + BRepAlgo_NormalProjection nproj(F); + nproj.Add(inpWire); + nproj.SetDefaultParams(); + nproj.Build(); + if(!nproj.IsDone()) + return; + + TopoDS_Shape projRes = nproj.Projection(); + + // unite all vertexes/edges from projected result + BOPAlgo_Builder anAlgo; + TopExp_Explorer exp(projRes, TopAbs_EDGE); + for (;exp.More(); exp.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); + if (E.Orientation() != TopAbs_INTERNAL) + anAlgo.AddArgument(E); + } + anAlgo.Perform(); + int stat = anAlgo.ErrorStatus(); + TopoDS_Shape projResConn = anAlgo.Shape(); + + // make wire => vertexes and edges should be untouched after this operation! + exp.Init(projResConn, TopAbs_EDGE); + //TopTools_ListOfShape llE; + //TopoDS_Wire RW; + //BRepLib_MakeWire WM; + + //for (;exp.More();exp.Next()) + // llE.Append(exp.Current()); + // + //WM.Add(llE); + //outWire = WM.Wire(); + + //outWire.Orientation(inpWire.Orientation()); //take from the original wire + + //history mode: edge to projected edges + if (E2PE) + { + TopExp_Explorer ex(inpWire, TopAbs_EDGE); + for (;ex.More();ex.Next()) + { + const TopoDS_Edge& CE = TopoDS::Edge(ex.Current()); + TopTools_ListOfShape NEL; + const TopTools_ListOfShape& LS = nproj.Generated(CE); + TopTools_ListIteratorOfListOfShape it(LS); + for (;it.More();it.Next()) + { + const TopoDS_Shape& PCE = it.Value(); + TopTools_ListOfShape PLS = anAlgo.Modified(PCE); + if (PLS.IsEmpty()) + PLS.Append(PCE); + TopTools_ListIteratorOfListOfShape itp(PLS); + for (;itp.More();itp.Next()) + NEL.Append(itp.Value()); + } + + E2PE->Bind(CE, NEL); + } + } +} +#include +bool HYDROData_DTM::Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF, + TopTools_SequenceOfShape* Boundr, std::set ind ) +{ + //ind : set of indices (starts with 0). index == number of boundary (inlet, outlet, etc..) + //in compound cmp. + //if Boundr is not null => this method will return sequence of boundary wires (inlet, outlet...) + + Handle(Geom_Plane) refpl = new Geom_Plane(gp_Pnt(0,0,0), gp_Dir(0,0,1)); + TopTools_DataMapOfShapeListOfShape E2PE; + ProjWireOnPlane(cmp, refpl, &E2PE); + TopTools_ListOfShape ELL; + + TopoDS_Iterator it(cmp); + int i = 0; + for (;it.More(); it.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(it.Value()); + if (W.Orientation() != TopAbs_INTERNAL) + { + TopoDS_Wire PW; + TopExp_Explorer ex(W, TopAbs_EDGE); + TopTools_ListOfShape LEpW; + TopTools_ListOfShape LEpWDummy; + for (;ex.More();ex.Next()) + { + const TopoDS_Edge& CE = TopoDS::Edge(ex.Current()); + TopTools_ListOfShape LS = E2PE.Find(CE); + LEpW.Append(LS); + } + + if (ind.count(i) != 0) + { + BRepLib_MakeWire WM; + WM.Add(LEpW); + const TopoDS_Wire& WMW = WM.Wire(); + //assume that wire is a straight line, + //take first and last vertex and make simple edge (RE) + TopoDS_Vertex VF, VL; + TopExp::Vertices(WMW, VF, VL); + TopoDS_Edge RE = BRepLib_MakeEdge(VF, VL).Edge(); + if (RE.IsNull()) + { + LEpWDummy = LEpW; //LEpW will be nullified after appending to ELL + ELL.Append(LEpW); + } + else + { + LEpWDummy.Append(RE); + ELL.Append(RE); + } + //TODO: in the new version of OCCT, USD can process separate wires + //ShapeUpgrade_UnifySameDomain USD(WMW, 1U, 0U, 1U); //concat bsplines + //USD.Build(); + //const TopoDS_Shape& RSU = USD.Shape(); + //TopExp_Explorer exp(RSU, TopAbs_EDGE); + //TopTools_ListOfShape DummyL; + //for (;it.More();it.Next()) + // DummyL.Append(it.Value()); + //if (DummyL.Extent() == 1) + // ELL.Append(DummyL.First()); //if one edge => accept this result + //else + // ELL.Append(LEpW); //else put 'as is' + } + else + { + LEpWDummy = LEpW; + ELL.Append(LEpW); + } + + if (Boundr) + { + //make inlet, outlet, left/tight banks [wires] + //shouldn't change topology of the edges + BRepLib_MakeWire IWM; + IWM.Add(LEpWDummy); + Boundr->Append(IWM.Wire()); + } + } + i++; + } + + //make primary wire + BRepLib_MakeWire WME; + WME.Add(ELL); + + const TopoDS_Wire& resW = WME.Wire(); + BRepBuilderAPI_MakeFace mf(refpl, resW, true); //check inside is true by def + outF = mf.Face(); + + ShapeAnalysis_Wire WA(resW, outF, Precision::Confusion()); + bool res = WA.CheckSelfIntersection(); //TODO check that this return false if OK + return res; + + ///!!! the internal wires cant be added with 'internal' ori. + // it's possible to do with brep builder yet the result will not be correct! + // more proper way is to use BOP operation here. + /*for (int i = 1; i <= IntW.Extent(); i++) + { + TopoDS_Wire outIW; + const TopoDS_Wire& W = TopoDS::Wire(IntW(i)); + ProjWireOnPlane(W, refpl, outIW); + BB.Add(outF, outIW); + }*/ +} + +void HYDROData_DTM::CreateProfiles(const std::vector& theProfiles, + double theDDZ, + double theSpatialStep, + AltitudePoints& theOutLeft, + AltitudePoints& theOutRight, + AltitudePoints& theOutPoints, + std::vector& theOutMainProfiles, + TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet, + bool Create3dPres, + bool Create2dPres, + std::set& InvInd, + bool& WireIntersections) +{ + if (theProfiles.empty()) + return; + theOutPoints = Interpolate( theProfiles, theDDZ, theSpatialStep, theOutLeft, theOutRight, theOutMainProfiles, InvInd ); + //note that if Create3dPres is false => Create2dPres flag is meaningless! + if (Create3dPres) + { + TopTools_IndexedMapOfOrientedShape ll = Create3DShape( theOutLeft, theOutRight, theOutMainProfiles); + + if (ll.IsEmpty()) + return; + BRep_Builder BB; + TopoDS_Compound cmp; + BB.MakeCompound(cmp); + for (int i = 1; i <= ll.Extent(); i++) + BB.Add(cmp, ll(i)); + + Out3dPres = cmp; + + //same order as in HYDROData_DTM::Update() + OutLeftB = ll(1); + OutRightB = ll(ll.Extent()); + OutInlet = ll(2); + OutOutlet = ll(ll.Extent() - 1); + + if (Create2dPres) + { + TopoDS_Face outF; + WireIntersections = Get2dFaceFrom3dPres(cmp, outF); //__TODO + Out2dPres = outF; + }; + } +} + + + + +void HYDROData_DTM::GetProperties( const Handle(HYDROData_Profile)& theProfile, + gp_Pnt& theLowestPoint, gp_Vec2d& theDir, + bool isNormalDir, + double& theZMin, double& theZMax ) +{ + theLowestPoint = theProfile->GetBottomPoint(); + + gp_XY aLeft, aRight; + theProfile->GetLeftPoint( aLeft, true, true ); + theProfile->GetRightPoint( aRight, true, true ); + double x = aRight.X()-aLeft.X(); + double y = aRight.Y()-aLeft.Y(); + if( isNormalDir ) + theDir = gp_Vec2d( -y, x ); + else + theDir = gp_Vec2d( x, y ); + + HYDROData_Profile::ProfilePoints points = theProfile->GetProfilePoints(); + int lo = points.Lower(); + int up = points.Upper(); + theZMin = std::numeric_limits::max(); + theZMax = -theZMin; + for( int i=lo; i<=up; i++ ) + { + double z = points.Value( i ).Z(); + if( z>theZMax ) + theZMax = z; + if( ztheUMax ) + theUMax = u; + return gp_Pnt2d( u, z ); +} + +Handle(TColgp_HArray1OfPnt2d) To2D( const TColgp_Array1OfPnt& thePoints, + const gp_Trsf& theTr, + double& theUMin, double& theUMax ) +{ + int low = thePoints.Lower(), up = thePoints.Upper(); + Handle(TColgp_HArray1OfPnt2d) points = new TColgp_HArray1OfPnt2d( low, up ); + for( int i=low; i<=up; i++ ) + points->SetValue( i, To2D( thePoints.Value( i ), theTr, theUMin, theUMax ) ); + return points; +} + +Handle(Geom2d_Curve) CurveTo2D( const Handle(Geom_Curve)& theCurve, + Standard_Real theFirst, Standard_Real theLast, + const gp_Trsf& theTr, + double& theUMin, double& theUMax ) +{ + if( theCurve->IsKind( STANDARD_TYPE( Geom_Line ) ) ) + { + gp_Pnt aFirstPnt, aLastPnt; + theCurve->D0( theFirst, aFirstPnt ); + theCurve->D0( theLast, aLastPnt ); + + gp_Pnt2d + aFirst2d = To2D( aFirstPnt, theTr, theUMin, theUMax ), + aLast2d = To2D( aLastPnt, theTr, theUMin, theUMax ); + + gp_Vec2d dir( aFirst2d, aLast2d ); + Handle(Geom2d_Line) aLine2d = new Geom2d_Line( aFirst2d, gp_Dir2d( dir.X(), dir.Y() ) ); + return new Geom2d_TrimmedCurve( aLine2d, 0, aLast2d.Distance( aFirst2d ) ); + } + + if( theCurve->IsKind( STANDARD_TYPE( Geom_BSplineCurve ) ) ) + { + Handle(Geom_BSplineCurve) aSpline = Handle(Geom_BSplineCurve)::DownCast( theCurve ); + + Handle(TColgp_HArray1OfPnt2d) poles = To2D( aSpline->Poles(), theTr, theUMin, theUMax ); + const TColStd_Array1OfReal& knots = aSpline->Knots(); + const TColStd_Array1OfInteger& multiplicities = aSpline->Multiplicities(); + int aDegree = aSpline->Degree(); + + return new Geom2d_BSplineCurve( poles->Array1(), knots, multiplicities, aDegree ); + } + + return Handle(Geom2d_Curve)(); +} + +Handle(Geom2d_BSplineCurve) HYDROData_DTM::CreateHydraulicAxis( + const std::vector& theProfiles, + std::vector& theDistances ) +{ + size_t n = theProfiles.size(); + Handle(Geom2d_BSplineCurve) aResult; + + Handle(TColgp_HArray1OfPnt2d) points = new TColgp_HArray1OfPnt2d( 1, (int)n ); + TColgp_Array1OfVec2d tangents( 1, (int)n ); + Handle(TColStd_HArray1OfBoolean) flags = new TColStd_HArray1OfBoolean( 1, (int)n ); + + for( size_t i = 1; i <= n; i++ ) + { + Handle(HYDROData_Profile) aProfile = theProfiles[i-1]; + aProfile->Update(); + + gp_Pnt aLowest; + gp_Vec2d aTangent; + double zmin, zmax; + GetProperties( aProfile, aLowest, aTangent, true, zmin, zmax ); + aTangent.Normalize(); + + points->SetValue( (int)i, gp_Pnt2d( aLowest.X(), aLowest.Y() ) ); + tangents.SetValue( (int)i, aTangent ); + flags->SetValue( (int)i, Standard_True ); + } + + Geom2dAPI_Interpolate anInterpolator( points, Standard_False, Standard_False ); + anInterpolator.Load( tangents, flags ); + anInterpolator.Perform(); + if( anInterpolator.IsDone() ) + { + aResult = anInterpolator.Curve(); + + //fill the distances vector + Geom2dAdaptor_Curve anAdaptor( aResult ); + + theDistances.clear(); + theDistances.reserve( n ); + Standard_Real aParamFirst = anAdaptor.FirstParameter(), aParamLast = anAdaptor.LastParameter(); + for( size_t i = 1; i <= n; i++ ) + { + gp_Pnt2d aPnt = points->Value( (Standard_Integer)i ); + Geom2dAPI_ProjectPointOnCurve aProject( aPnt, aResult ); + Standard_Real aParam = aProject.LowerDistanceParameter(); + double aDistance = GCPnts_AbscissaPoint::Length( anAdaptor, aParamFirst, aParam ); + theDistances.push_back( aDistance ); + } + } + return aResult; +} + +std::vector HYDROData_DTM::ProfileToParametric( + const Handle(HYDROData_Profile)& theProfile, + double& theUMin, double& theUMax, gp_Vec2d& theDir ) +{ + std::vector curves; + + // Transformation of the coordinate systems + gp_Pnt aLowest; + double zmin, zmax; + GetProperties( theProfile, aLowest, theDir, false, zmin, zmax ); + + gp_Ax3 aStd3d( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( 1, 0, 0 ) ); + gp_Ax3 aLocal( gp_Pnt( aLowest.X(), aLowest.Y(), 0 ), gp_Dir( 0, 0, 1 ), gp_Dir( theDir.X(), theDir.Y(), 0 ) ); + + gp_Trsf aTransf; + aTransf.SetTransformation( aStd3d, aLocal ); + + // Iteration via edges + TopoDS_Wire aWire = TopoDS::Wire( theProfile->GetShape3D() ); + TopExp_Explorer anExp( aWire, TopAbs_EDGE ); + for( ; anExp.More(); anExp.Next() ) + { + // Extract an edge from wire + TopoDS_Edge anEdge = TopoDS::Edge( anExp.Current() ); + + // Extract a curve corresponding to the edge + TopLoc_Location aLoc; + Standard_Real aFirst, aLast; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve( anEdge, aLoc, aFirst, aLast ); + + // Convert the curve to 2d CS + Handle(Geom2d_Curve) aCurve2d = CurveTo2D( aCurve, aFirst, aLast, aTransf, theUMin, theUMax ); + if( !aCurve2d.IsNull() ) + curves.push_back( aCurve2d ); + } + return curves; +} + + +bool CalcMidWidth( const std::set& intersections, double& theMid, double& theWid ) +{ + double umin = std::numeric_limits::max(), + umax = -umin; + + size_t n = intersections.size(); + if( n <= 0 ) + return false; + + std::set::const_iterator it = intersections.begin(), last = intersections.end(); + for( ; it!=last; it++ ) + { + double u = *it; + if( uumax ) + umax = u; + } + theMid = ( umin+umax )/2; + theWid = umax-umin; + return true; +} + +void HYDROData_DTM::ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile, + double theXCurv, double theMinZ, double theMaxZ, double theDDZ, + CurveUZ& theMidPointCurve, + CurveUZ& theWidthCurve, + int& intersection_nb, + double theTolerance) +{ + double aDblMax = std::numeric_limits::max(), + aUMin = aDblMax, + aUMax = -aUMin, + aVMax = 1000000; + + gp_Vec2d aProfileDir; + std::vector curves = ProfileToParametric( theProfile, aUMin, aUMax, aProfileDir ); + size_t n = curves.size(); + + if( n==0 ) + return; + + // we add the "virtual" vertical lines to simulate the intersection with profile + gp_Pnt2d aFirst, aLast; + curves[0]->D0( curves[0]->FirstParameter(), aFirst ); + curves[n-1]->D0( curves[n-1]->LastParameter(), aLast ); + Handle(Geom2d_Line) aV1 = new Geom2d_Line( aFirst, gp_Dir2d( 0, 1 ) ); + Handle(Geom2d_TrimmedCurve) aT1 = new Geom2d_TrimmedCurve( aV1, 0.0, aVMax ); + + Handle(Geom2d_Line) aV2 = new Geom2d_Line( aLast, gp_Dir2d( 0, 1 ) ); + Handle(Geom2d_TrimmedCurve) aT2 = new Geom2d_TrimmedCurve( aV2, 0.0, aVMax ); + + curves.push_back( aT1 ); + curves.push_back( aT2 ); + + int psize = ( int )( ( theMaxZ-theMinZ ) / theDDZ + 1 ); + theMidPointCurve = CurveUZ( theXCurv, aProfileDir, theMinZ ); + theMidPointCurve.reserve( psize ); + theWidthCurve = CurveUZ( theXCurv, aProfileDir, theMinZ ); + theWidthCurve.reserve( psize ); + + n = curves.size(); + // for each discrete value of z we search intersection with profile + for( double z1 = theMinZ; z1 <= theMaxZ; z1 += theDDZ ) + { + Handle(Geom2d_Line) aLine = new Geom2d_Line( gp_Pnt2d( 0, z1 ), gp_Dir2d( 1, 0 ) ); + std::set intersections; + for( size_t i = 0; i < n; i++ ) + { + Handle(Geom2d_Curve) aCurve = curves[i]; + Geom2dAPI_InterCurveCurve anIntersect( aCurve, aLine, theTolerance ); + for( int k=1, m=anIntersect.NbPoints(); k<=m; k++ ) + intersections.insert( anIntersect.Point( k ).X() ); + } + + intersection_nb = intersections.size(); + if( intersection_nb >= 1 ) + { + double u_mid, u_wid; + if( !CalcMidWidth( intersections, u_mid, u_wid ) ) + continue; + + double z = z1 - theMinZ; + PointUZ p_mid; + p_mid.U = u_mid; + p_mid.Z = z; + theMidPointCurve.push_back( p_mid ); + + PointUZ p_wid; + p_wid.U = u_wid; + p_wid.Z = z; + theWidthCurve.push_back( p_wid ); + } + } +} + +void HYDROData_DTM::Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, + int theNbSteps, std::vector& theInterpolation, + bool isAddSecond ) +{ + theInterpolation.clear(); + int d = isAddSecond ? 2 : 1; + theInterpolation.reserve( theNbSteps+d ); + double dt = 1.0 / double( theNbSteps + 1 ); + double t = dt; + theInterpolation.push_back( theCurveA ); + for( int i=0; i +void HYDROData_DTM::CurveTo3D( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis, + const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve, + AltitudePoints& thePoints ) +{ + Geom2dAdaptor_Curve anAdaptor( theHydraulicAxis ); + TopoDS_Edge E2d = BRepLib_MakeEdge2d(theHydraulicAxis).Edge(); + GCPnts_AbscissaPoint ap( anAdaptor, theMidCurve.Xcurv(), anAdaptor.FirstParameter() ); + double aParam = ap.Parameter(); + + gp_Pnt2d point; + anAdaptor.D0( aParam, point ); + gp_Vec2d profile_dir = theMidCurve.ProfileDir(); + //gp_Dir tangent_n( -profile_dir.Y(), profile_dir.X(), dz ); + profile_dir.Normalize(); + + size_t n = theMidCurve.size(); + std::map sorted_points; + for( size_t i=0; i::const_iterator it = sorted_points.begin(), last = sorted_points.end(); + for( ; it!=last; it++ ) + if( thePoints.empty() || thePoints.back().SquareDistance( it->second ) > EPS ) + thePoints.push_back( it->second ); +} + +inline double max( double a, double b ) +{ + if( a>b ) + return a; + else + return b; +} + +inline double min( double a, double b ) +{ + if( a + +std::vector HYDROData_DTM::Interpolate + ( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis, + const Handle(HYDROData_Profile)& theProfileA, + double theXCurvA, + const Handle(HYDROData_Profile)& theProfileB, + double theXCurvB, + double theDDZ, int theNbSteps, bool isAddSecond, + int& inter_nb_1, int& inter_nb_2) +{ + double zminA, zmaxA, zminB, zmaxB; + gp_Pnt lowestA, lowestB; + gp_Vec2d dirA, dirB; + + GetProperties( theProfileA, lowestA, dirA, false, zminA, zmaxA ); + GetProperties( theProfileB, lowestB, dirB, false, zminB, zmaxB ); + + + double hmax = max( zmaxA-zminA, zmaxB-zminB ); + + //double dz = zminB - zminA; + //double zmin = min( zminA, zminB ); + //double zmax = max( zmaxA, zmaxB ); + + CurveUZ midA(0, gp_Vec2d(), 0), midB(0, gp_Vec2d(), 0); + CurveUZ widA(0, gp_Vec2d(), 0), widB(0, gp_Vec2d(), 0); + + ProfileDiscretization( theProfileA, theXCurvA, zminA, zminA+hmax, theDDZ, midA, widA, inter_nb_1 ); + ProfileDiscretization( theProfileB, theXCurvB, zminB, zminB+hmax, theDDZ, midB, widB, inter_nb_2 ); + + std::vector mid, wid; + Interpolate( midA, midB, theNbSteps, mid, isAddSecond ); + Interpolate( widA, widB, theNbSteps, wid, isAddSecond ); + + size_t p = mid.size(); + size_t q = p>0 ? 2*mid[0].size() : 1; + std::vector points; + points.resize( p ); + + for( size_t i=0; i& theProfiles, + double theDDZ, double theSpatialStep, + AltitudePoints& theLeft, + AltitudePoints& theRight, + std::vector& theMainProfiles, + std::set& invalInd) +{ + AltitudePoints points; + size_t n = theProfiles.size(); + if( n<=1 ) + return points; + + std::vector distances; + Handle(Geom2d_BSplineCurve) aHydraulicAxis = CreateHydraulicAxis( theProfiles, distances ); + if( aHydraulicAxis.IsNull() ) + return points; + + theMainProfiles.reserve( n ); + + for( size_t i=0, n1=n-1; i local_points = Interpolate( aHydraulicAxis, theProfiles[i], distances[i], + theProfiles[i+1], distances[i+1], theDDZ, aNbSteps, isAddSecond, inter_nb_1, inter_nb_2 ); + int lps = local_points.size(); + + if (inter_nb_1 > 2) + invalInd.insert(i); + + if (inter_nb_2 > 2) + invalInd.insert(i+1); + + // 2. Put all points into the global container + for( size_t j=0; j& theProfiles, + double theDDZ, double theSpatialStep ) +{ + size_t n = theProfiles.size(); + if( n<=1 ) + return 0; + if( theDDZ<1E-6 || theSpatialStep<1E-6 ) + return 1 << 20; + + std::vector distances; + Handle(Geom2d_BSplineCurve) aHydraulicAxis = CreateHydraulicAxis( theProfiles, distances ); + if( aHydraulicAxis.IsNull() ) + return 0; + + double aCompleteDistance = distances[n-1]; + int aNbSteps = int( aCompleteDistance / theSpatialStep ) + 1; + gp_Pnt aLowest; + gp_Vec2d aDir; + double aZMin, aZMax; + GetProperties( theProfiles[0], aLowest, aDir, true, aZMin, aZMax ); + int aNbZSteps = (aZMax-aZMin)/theDDZ; + + if( aNbSteps > ( 1<<16 ) || aNbZSteps > ( 1<<16 ) ) + return 1 << 20; + + return aNbSteps * aNbZSteps; +} diff --git a/src/HYDROData/HYDROData_DTM.h b/src/HYDROData/HYDROData_DTM.h new file mode 100644 index 00000000..844e4e89 --- /dev/null +++ b/src/HYDROData/HYDROData_DTM.h @@ -0,0 +1,222 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HYDROData_DTM_HeaderFile +#define HYDROData_DTM_HeaderFile + +#include "HYDROData_Bathymetry.h" +#include "HYDROData_Profile.h" + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +class gp_Pnt; +class gp_Vec2d; +class TopoDS_Edge; +class TopoDS_Wire; +class TopoDS_Face; +class TopoDS_Compound; + + +/**\class HYDROData_DTM + * \brief Class that represents the Digital Terrain Model + */ +class HYDROData_DTM : public HYDROData_Bathymetry +{ +protected: + /** + * Enumeration of tags corresponding to the persistent object parameters. + */ + enum DataTag + { + DataTag_First = HYDROData_Bathymetry::DataTag_First + 100, ///< first tag, to reserve + DataTag_Profiles, + DataTag_DDZ, + DataTag_SpatialStep, + DataTag_LeftBankShape, + DataTag_RightBankShape, + DataTag_InletShape, + DataTag_OutletShape, + DataTag_3DShape, + DataTag_2DShape + }; + +public: + DEFINE_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry ); + + HYDRODATA_EXPORT HYDROData_SequenceOfObjects GetProfiles() const; + HYDRODATA_EXPORT void SetProfiles( const HYDROData_SequenceOfObjects& ); + + HYDRODATA_EXPORT double GetDDZ() const; + HYDRODATA_EXPORT void SetDDZ( double ); + + HYDRODATA_EXPORT double GetSpatialStep() const; + HYDRODATA_EXPORT void SetSpatialStep( double ); + + HYDRODATA_EXPORT virtual void Update(); + +public: + struct PointUZ + { + PointUZ( double u=0, double z=0 ) { U=u; Z=z; } + double U; + double Z; + }; + class CurveUZ : public std::vector + { + public: + CurveUZ( double theXcurv, const gp_Vec2d& theProfileDir, double theDeltaZ ); + ~CurveUZ(); + + double Xcurv() const; + gp_Vec2d ProfileDir() const; + double DeltaZ() const; + + CurveUZ operator + ( const CurveUZ& ) const; + CurveUZ operator * ( double ) const; + + private: + double myXcurv; + gp_Vec2d myProfileDir; + double myDeltaZ; + }; + +protected: + friend class HYDROData_Stream; + friend class HYDROData_Iterator; + friend class test_HYDROData_DTM; + + HYDRODATA_EXPORT HYDROData_DTM(); + virtual HYDRODATA_EXPORT ~HYDROData_DTM(); + + static Handle(Geom2d_BSplineCurve) CreateHydraulicAxis( + const std::vector& theProfiles, + std::vector& theDistances ); + + static std::vector ProfileToParametric( const Handle(HYDROData_Profile)& theProfile, + double& theUMin, double& theUMax, + gp_Vec2d& theDir ); + + static void GetProperties( const Handle(HYDROData_Profile)& theProfile, + gp_Pnt& theLowestPoint, gp_Vec2d& theDir, + bool isNormalDir, + double& theZMin, double& theZMax ); + + static void ProfileDiscretization( const Handle(HYDROData_Profile)& theProfile, + double theXCurv, double theMinZ, double theMaxZ, double theDDZ, + CurveUZ& theMidPointCurve, + CurveUZ& theWidthCurve, + int& intersection_nb, + double theTolerance = 1E-6 ); + + static void CurveTo3D( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis, + const CurveUZ& theMidCurve, const CurveUZ& theWidthCurve, + AltitudePoints& thePoints ); + + static void Interpolate( const CurveUZ& theCurveA, const CurveUZ& theCurveB, + int theNbSteps, std::vector& theInterpolation, + bool isAddSecond ); + + static std::vector Interpolate + ( const Handle(Geom2d_BSplineCurve)& theHydraulicAxis, + const Handle(HYDROData_Profile)& theProfileA, + double theXCurvA, + const Handle(HYDROData_Profile)& theProfileB, + double theXCurvB, + double theDDZ, int theNbSteps, bool isAddSecond, + int& inter_nb_1, int& inter_nb_2 ); + + static AltitudePoints Interpolate( const std::vector& theProfiles, + double theDDZ, double theSpatialStep, + AltitudePoints& theLeft, + AltitudePoints& theRight, + std::vector& theMainProfiles, + std::set& invalInd ); + + static void PointToWire(const AltitudePoints& pnts, TopoDS_Wire& W ); + + static void ProjWireOnPlane(const TopoDS_Shape& inpWire, const Handle(Geom_Plane)& RefPlane, + TopTools_DataMapOfShapeListOfShape* E2PE); + + static TopTools_IndexedMapOfOrientedShape Create3DShape(const AltitudePoints& left, + const AltitudePoints& right, + const std::vector& main_profiles); + + static void CreateProfiles(const std::vector& theProfiles, + double theDDZ, + double theSpatialStep, + AltitudePoints& theOutLeft, + AltitudePoints& theOutRight, + AltitudePoints& theOutPoints, + std::vector& theOutMainProfiles, + TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet, + bool Create3dPres, + bool Create2dPres, + std::set& InvInd, + bool& WireIntersections); + + static bool Get2dFaceFrom3dPres(const TopoDS_Compound& cmp, TopoDS_Face& outF, + TopTools_SequenceOfShape* Boundr = NULL, std::set ind = std::set() ); + + static int EstimateNbPoints( const std::vector& theProfiles, + double theDDZ, double theSpatialStep ); + + void GetPresentationShapes( TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet ); +public: + + HYDRODATA_EXPORT static void CreateProfilesFromDTM ( const HYDROData_SequenceOfObjects& InpProfiles, + double ddz, + double step, + AltitudePoints& points, + TopoDS_Shape& Out3dPres, + TopoDS_Shape& Out2dPres, + TopoDS_Shape& OutLeftB, + TopoDS_Shape& OutRightB, + TopoDS_Shape& OutInlet, + TopoDS_Shape& OutOutlet, + bool Create3dPres, + bool Create2dPres, + std::set& InvInd, + int thePntsLimit, + bool& WireIntersections); +}; + + + + +#endif diff --git a/src/HYDROData/HYDROData_Document.cxx b/src/HYDROData/HYDROData_Document.cxx index 56c6590f..6a8f7376 100644 --- a/src/HYDROData/HYDROData_Document.cxx +++ b/src/HYDROData/HYDROData_Document.cxx @@ -236,7 +236,7 @@ bool HYDROData_Document::DumpToPython( const QString& thePyScriptPath, { // Try to open the file QFile aFile( thePyScriptPath ); - if ( !aFile.open( QIODevice::WriteOnly ) ) + if ( !aFile.open( QIODevice::WriteOnly | QFile::Text ) ) return false; MapOfTreatedObjects aTreatedObjects; @@ -830,6 +830,11 @@ void HYDROData_Document::Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const thePnt = gp_XYZ( X, Y, Z ); } +void HYDROData_Document::Transform( double& X, double& Y, double& Z, bool IsToLocalCS ) const +{ + Transform( X, Y, IsToLocalCS ); +} + void HYDROData_Document::Transform( gp_XY& thePnt, bool IsToLocalCS ) const { double X = thePnt.X(); diff --git a/src/HYDROData/HYDROData_Document.h b/src/HYDROData/HYDROData_Document.h index 41b6a020..c342ec3b 100644 --- a/src/HYDROData/HYDROData_Document.h +++ b/src/HYDROData/HYDROData_Document.h @@ -156,6 +156,7 @@ public: HYDRODATA_EXPORT void Transform( gp_Pnt& thePnt, bool IsToLocalCS ) const; HYDRODATA_EXPORT void Transform( gp_XYZ& thePnt, bool IsToLocalCS ) const; HYDRODATA_EXPORT void Transform( gp_XY& thePnt, bool IsToLocalCS ) const; + HYDRODATA_EXPORT void Transform( double& X, double& Y, double& Z, bool IsToLocalCS ) const; public: diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index c5193f91..e5baa747 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -655,7 +655,7 @@ QStringList HYDROData_Entity::dumpObjectCreation( MapOfTreatedObjects& theTreate QString HYDROData_Entity::getPyTypeID() const { - DEBTRACE("HYDROData_Entity::getPyTypeID " << GetKind()); + //DEBTRACE("HYDROData_Entity::getPyTypeID " << GetKind()); switch( GetKind() ) { case KIND_IMAGE: return "KIND_IMAGE"; @@ -821,3 +821,22 @@ double HYDROData_Entity::GetDouble( int theTag, double theDefValue ) const return anAttr->Get(); } + +void HYDROData_Entity::SetInteger( int theTag, int theValue ) +{ + Handle(TDataStd_Integer) anAttr; + TDF_Label aLabel = myLab.FindChild( theTag ); + if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) ) + aLabel.AddAttribute( anAttr = new TDataStd_Integer() ); + anAttr->Set( theValue ); +} + +int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const +{ + Handle(TDataStd_Integer) anAttr; + TDF_Label aLabel = myLab.FindChild( theTag ); + if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) ) + return 0; + + return anAttr->Get(); +} diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 3cfa0bc7..d82b3d7b 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -66,6 +66,7 @@ const ObjectKind KIND_STRICKLER_TABLE = 26; const ObjectKind KIND_LAND_COVER_OBSOLETE = 27; const ObjectKind KIND_CHANNEL_ALTITUDE = 28; const ObjectKind KIND_LAND_COVER_MAP = 29; +const ObjectKind KIND_DTM = 30; const ObjectKind KIND_LAST = KIND_LAND_COVER_MAP; class MapOfTreatedObjects : public QMap @@ -451,6 +452,10 @@ protected: void SetDouble( int theTag, double theValue ); double GetDouble( int theTag, double theDefValue = 0.0 ) const; + void SetInteger( int theTag, int theValue ); + int GetInteger( int theTag, int theDefValue = 0 ) const; + + int GetGeomChangeFlag() const; protected: diff --git a/src/HYDROData/HYDROData_GeomTool.cxx b/src/HYDROData/HYDROData_GeomTool.cxx index 7517677a..3d54e13f 100644 --- a/src/HYDROData/HYDROData_GeomTool.cxx +++ b/src/HYDROData/HYDROData_GeomTool.cxx @@ -23,6 +23,7 @@ #include #include +#include #ifdef WIN32 #pragma warning ( disable: 4251 ) @@ -31,11 +32,15 @@ #include #include +#include +#include + #ifdef WIN32 #pragma warning ( default: 4251 ) #endif #include +#include #include static int _argc = 0; @@ -155,6 +160,49 @@ GEOM::GEOM_Object_ptr HYDROData_GeomTool::publishShapeInGEOM( return aGeomObj._retn(); } + +GEOM::GEOM_Object_ptr HYDROData_GeomTool::ExplodeShapeInGEOMandPublish( GEOM::GEOM_Gen_var theGeomEngine, + SALOMEDS::Study_ptr theStudy, + const TopoDS_Shape& theShape, + const NCollection_IndexedDataMap& aFacesToNameModif, + const QString& theName, + QString& theGeomObjEntry) +{ + GEOM::GEOM_Object_ptr aGeomObj = HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, theShape, theName, theGeomObjEntry ); + + GEOM::GEOM_IShapesOperations_var anExpOp = theGeomEngine->GetIShapesOperations( theStudy->StudyId() ); + GEOM::ListOfGO* aFc = anExpOp->MakeExplode(aGeomObj, TopAbs_FACE, false); + + TopTools_MapOfShape mapShape; + + NCollection_IndexedDataMap aFF2N; + for (int i = 1; i <= aFacesToNameModif.Extent(); i++) + { + TopExp_Explorer exp (aFacesToNameModif.FindKey(i), TopAbs_FACE); + for (;exp.More(); exp.Next()) + aFF2N.Add(exp.Current(), aFacesToNameModif.FindFromIndex(i)); + } + + TopExp_Explorer exp (theShape, TopAbs_FACE); + QVector Names; + for (; exp.More(); exp.Next()) + { + const TopoDS_Shape& csh = exp.Current(); + if (mapShape.Add(csh)) + { + //listShape.Append(csh); + QString Qstr = aFF2N.FindFromKey(csh); + Names.push_back(Qstr); + } + } + + for (size_t i = 0; i < aFc->length(); i++) + GEOMBase::PublishSubObject(aFc->operator[](i), Names[i]); + + return aGeomObj; +} + + GEOM::GEOM_Object_ptr HYDROData_GeomTool::createFaceInGEOM( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, const int theWidth, diff --git a/src/HYDROData/HYDROData_GeomTool.h b/src/HYDROData/HYDROData_GeomTool.h index 278e6caf..17d48314 100644 --- a/src/HYDROData/HYDROData_GeomTool.h +++ b/src/HYDROData/HYDROData_GeomTool.h @@ -20,6 +20,8 @@ #define HYDROData_GeomTool_HeaderFile #include "HYDROData.h" +#include +#include #ifdef WIN32 #pragma warning ( disable: 4251 ) @@ -113,6 +115,13 @@ public: GEOM::GEOM_Object_ptr theGeomObj, const QString& theName ); + static GEOM::GEOM_Object_ptr ExplodeShapeInGEOMandPublish( GEOM::GEOM_Gen_var theGeomEngine, + SALOMEDS::Study_ptr theStudy, + const TopoDS_Shape& theShape, + const NCollection_IndexedDataMap& aShToNameModif, + const QString& theName, + QString& theGeomObjEntry); + }; #endif diff --git a/src/HYDROData/HYDROData_ImmersibleZone.cxx b/src/HYDROData/HYDROData_ImmersibleZone.cxx index abdfd184..75d6eb91 100644 --- a/src/HYDROData/HYDROData_ImmersibleZone.cxx +++ b/src/HYDROData/HYDROData_ImmersibleZone.cxx @@ -122,7 +122,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape() const TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_PolylineXY)& aPolyline ) { - DEBTRACE("generateTopShape"); + //DEBTRACE("generateTopShape"); TopoDS_Face aResultFace = TopoDS_Face(); // --- result: default = null face if (!aPolyline.IsNull()) @@ -137,7 +137,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ if (!aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE) { // --- only one wire: try to make a face - DEBTRACE("one wire: try to build a face"); + //DEBTRACE("one wire: try to build a face"); const TopoDS_Wire& aPolylineWire = TopoDS::Wire(aPolylineShape); if (!aPolylineWire.IsNull()) { @@ -145,7 +145,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ aMakeFace.Build(); if (aMakeFace.IsDone()) { - DEBTRACE(" a face with the only wire given"); + //DEBTRACE(" a face with the only wire given"); aResultFace = aMakeFace.Face(); } } @@ -156,14 +156,14 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape; Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape; TopExp_Explorer anExp(aPolylineShape, TopAbs_WIRE); - DEBTRACE("list of wires ?"); + //DEBTRACE("list of wires ?"); for (; anExp.More(); anExp.Next()) { if (!anExp.Current().IsNull()) { const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current()); aWiresList.Append(aWire); - DEBTRACE(" append wire"); + //DEBTRACE(" append wire"); TopExp_Explorer it2(aWire, TopAbs_EDGE); for (; it2.More(); it2.Next()) aSeqEdges->Append(it2.Current()); @@ -174,7 +174,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ if (aSeqEdges->Length() > 1) { - DEBTRACE("try to connect all the edges together, build a unique wire and a face"); + //DEBTRACE("try to connect all the edges together, build a unique wire and a face"); // --- try to create one wire by connecting edges with a distance tolerance (no necessity of sharing points) ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, 1E-5, Standard_False, aSeqWires); @@ -188,7 +188,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ aMakeFace.Build(); if (aMakeFace.IsDone()) { - DEBTRACE(" a face from all the wires connected"); + //DEBTRACE(" a face from all the wires connected"); aResultFace = aMakeFace.Face(); } } @@ -197,7 +197,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ if (aResultFace.IsNull()) { - DEBTRACE("try to make a face with the first wire of the list and other wires as restrictions"); + //DEBTRACE("try to make a face with the first wire of the list and other wires as restrictions"); // --- try to make a face with the first wire of the list and other wires as restrictions BRepAlgo_FaceRestrictor aFR; TopoDS_Face aRefFace; @@ -206,7 +206,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ aMakeFace.Build(); if (aMakeFace.IsDone()) { - DEBTRACE(" a face with first wire"); + //DEBTRACE(" a face with first wire"); aRefFace = aMakeFace.Face(); } if (!aRefFace.IsNull()) @@ -225,7 +225,7 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ { for (; aFR.More(); aFR.Next()) { - DEBTRACE(" a restricted face"); + //DEBTRACE(" a restricted face"); aResultFace = aFR.Current(); break; } @@ -238,15 +238,17 @@ TopoDS_Shape HYDROData_ImmersibleZone::generateTopShape( const Handle(HYDROData_ if (aResultFace.IsNull()) return aResultFace; - DEBTRACE("check the face"); + //DEBTRACE("check the face"); BRepCheck_Analyzer anAnalyzer(aResultFace); if (anAnalyzer.IsValid() && aResultFace.ShapeType() == TopAbs_FACE) - { - DEBTRACE("face OK"); - return aResultFace; - } + { + //DEBTRACE("face OK"); + return aResultFace; + } else - DEBTRACE("bad face"); + { + //DEBTRACE("bad face"); + } return TopoDS_Face(); } diff --git a/src/HYDROData/HYDROData_Iterator.cxx b/src/HYDROData/HYDROData_Iterator.cxx index 09c6dee2..8382162a 100644 --- a/src/HYDROData/HYDROData_Iterator.cxx +++ b/src/HYDROData/HYDROData_Iterator.cxx @@ -44,6 +44,7 @@ #include "HYDROData_VisualState.h" #include "HYDROData_Zone.h" #include "HYDROData_StricklerTable.h" +#include "HYDROData_DTM.h" #include #include @@ -160,6 +161,7 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel ) case KIND_LAND_COVER_OBSOLETE: break; case KIND_CHANNEL_ALTITUDE: aResult = new HYDROData_ChannelAltitude(); break; case KIND_LAND_COVER_MAP: aResult = new HYDROData_LandCoverMap(); break; + case KIND_DTM: aResult = new HYDROData_DTM(); break; default: break; } diff --git a/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx b/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx new file mode 100644 index 00000000..b2c7a11a --- /dev/null +++ b/src/HYDROData/HYDROData_LCM_FaceClassifier.cxx @@ -0,0 +1,136 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include "HYDROData_LCM_FaceClassifier.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Standard_Integer& theObj) +{ + if (theObj > myMapF2Class2d.Extent()) + return Standard_False; + + const TopoDS_Face& f = TopoDS::Face(myMapF2Class2d.FindKey(theObj)); + if(f.IsNull()) + return Standard_False; + + BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f); + + TopLoc_Location L; + Handle(Geom_Surface) C = BRep_Tool::Surface(f, L); + Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation())); + Standard_Real u, v; + ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v); + + TopAbs_State aState = class2d->Perform( gp_Pnt2d(u, v), Standard_False ); + + if (aState == TopAbs_IN) + { + myResFaces.Append(f); + myStop = 1; //no more faces includes this point; quit + return Standard_True; + } + else if (aState == TopAbs_ON) + { + myResFaces.Append(f); + return Standard_True; + } + + return Standard_False; + +} + +void HYDROData_LCM_FaceClassifier::Classify( const std::vector& thePoints, + std::vector >& theTypes, + std::vector >* theFaces) const +{ + HYDROData_LandCoverMap::Explorer anIt( *myLCM ); + HYDROData_MapOfFaceToStricklerType aMapF2ST; + TopTools_IndexedMapOfShape aFaces; + for( ; anIt.More(); anIt.Next() ) + { + const TopoDS_Face& F = anIt.Face(); + aMapF2ST.Add(F, anIt.StricklerType()); + aFaces.Add(F); + } + + HYDROData_FaceClassifier_BndBoxTree aTree; + NCollection_UBTreeFiller aTreeFiller (aTree); + NCollection_IndexedDataMap aMapF2Class2d; + + int NbF = aFaces.Extent(); + std::vector fclass2dpointers; + fclass2dpointers.reserve(NbF); + + for (int i = 1; i <= NbF; i++) + { + Bnd_Box2d B; + const TopoDS_Face& F = TopoDS::Face(aFaces(i)); + BRepTools::AddUVBounds(F, B); + aTreeFiller.Add(i, B); + BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 0 ); + aMapF2Class2d.Add(F, aClass2d); + fclass2dpointers.push_back(aClass2d); + } + + aTreeFiller.Fill(); + + size_t pntsize = thePoints.size(); + theTypes.resize(pntsize); + if (theFaces) + theFaces->resize(pntsize); + + Standard_Integer aSel = 0; + for (size_t i = 0; i < pntsize; i++ ) + { + HYDROData_FaceClassifier_BndBoxTreeSelector aSelector(aMapF2Class2d); + const gp_Pnt2d& pnt2d = thePoints[i]; + aSelector.SetCurrentPoint(pnt2d); + aSel = aTree.Select(aSelector); + if (aSel > 0) + { + const NCollection_List& rf = aSelector.GetResFaces(); + NCollection_List::Iterator it(rf); + for (;it.More();it.Next()) + { + const TopoDS_Face& f = it.Value(); + QString aST = aMapF2ST.FindFromKey(f); + theTypes[i].insert(aST); + if (theFaces) + (*theFaces)[i].Add(f); + } + } + } + + for (size_t i = 0; i < fclass2dpointers.size(); i++) + delete fclass2dpointers[i]; + +} + + diff --git a/src/HYDROData/HYDROData_LCM_FaceClassifier.h b/src/HYDROData/HYDROData_LCM_FaceClassifier.h new file mode 100644 index 00000000..1a83a7ef --- /dev/null +++ b/src/HYDROData/HYDROData_LCM_FaceClassifier.h @@ -0,0 +1,103 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef HYDRODATA_LCM_FACECLASSIFIER_H +#define HYDRODATA_LCM_FACECLASSIFIER_H + +#include +#include +#include +#include + +#include "Bnd_Box2d.hxx" +#include +#include +#include +#include +#include + +class BRepTopAdaptor_FClass2d; +class HYDROData_LandCoverMap; + +typedef NCollection_UBTree HYDROData_FaceClassifier_BndBoxTree; + +class HYDROData_FaceClassifier_BndBoxTreeSelector : public HYDROData_FaceClassifier_BndBoxTree::Selector +{ +public: + HYDROData_FaceClassifier_BndBoxTreeSelector(const NCollection_IndexedDataMap& theMapOfShape) + : HYDROData_FaceClassifier_BndBoxTreeSelector::Selector(), myMapF2Class2d (theMapOfShape) + {} + + Standard_Boolean Reject (const Bnd_Box2d& theBox) const + { + return (theBox.IsOut (myP)); + } + + Standard_Boolean Accept (const Standard_Integer& theObj); + + const NCollection_List& GetResFaces () const + { + return myResFaces; + } + + const TopoDS_Face& GetFirstFace() const + { + if (!myResFaces.IsEmpty()) + return myResFaces.First(); + else + TopoDS_Face(); + } + + void SetCurrentPoint (const gp_Pnt2d& theP) + { + myP = theP; + } + +private: + HYDROData_FaceClassifier_BndBoxTreeSelector(const HYDROData_FaceClassifier_BndBoxTreeSelector& ); + HYDROData_FaceClassifier_BndBoxTreeSelector& operator=(const HYDROData_FaceClassifier_BndBoxTreeSelector& ); + +private: + const NCollection_IndexedDataMap& myMapF2Class2d; + gp_Pnt2d myP; + NCollection_List myResFaces; +}; + +class HYDRODATA_EXPORT HYDROData_LCM_FaceClassifier +{ + +public: + + HYDROData_LCM_FaceClassifier(const HYDROData_LandCoverMap* const theLCM) : myLCM(theLCM) + {}; + + ~HYDROData_LCM_FaceClassifier() + {}; + + void Classify( const std::vector& thePoints, + std::vector >& theTypes, + std::vector >* theFaces) const; + + +private: + const HYDROData_LandCoverMap* const myLCM; + +}; + + +#endif diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index fe76bd40..55e51656 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include @@ -365,7 +367,8 @@ bool EdgeDiscretization( const TopoDS_Edge& theEdge, */ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName, double theDeflection, - const Handle(HYDROData_StricklerTable)& theTable ) const + const Handle(HYDROData_StricklerTable)& theTable, + QString& statMessage) const { TopoDS_Shape aLandCoverMapShape = GetShape(); TopTools_ListOfShape aListOfFaces; @@ -416,7 +419,19 @@ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName, QFile aFile( theFileName ); if( !aFile.open( QFile::WriteOnly | QFile::Text ) ) - return false; + { + QString homeFilePath = QDir::home().absoluteFilePath( theFileName ); + aFile.setFileName(homeFilePath); + if (aFile.open( QFile::WriteOnly | QFile::Text ) ) + statMessage = "Telemac file have been exported to the home directory: " + homeFilePath; + else + return false; + } + else + { + QString absFilePath = QDir::current().absoluteFilePath( theFileName ); + statMessage = "Telemac file have been exported to the current directory: " + absFilePath; + } QTextStream aStream( &aFile ); aStream << "# nodes\n"; @@ -1256,3 +1271,38 @@ void HYDROData_LandCoverMap::UpdateLocalCS( double theDx, double theDy ) TopoDS_Shape aLocatedShape = HYDROData_ShapesTool::Translated( aShape, theDx, theDy, 0 ); SetShape( aLocatedShape ); } + +void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints, std::vector >& theTypes ) const +{ + HYDROData_LCM_FaceClassifier FC(this); + FC.Classify(thePoints, theTypes, NULL); +} + +void HYDROData_LandCoverMap::ClassifyPoints( const std::vector& thePoints, + Handle(HYDROData_StricklerTable) theTable, + std::vector& theCoeffs, double DefValue, bool UseMax ) const +{ + std::vector > Types; + HYDROData_LCM_FaceClassifier FC(this); + FC.Classify(thePoints, Types, NULL); + theCoeffs.resize(thePoints.size()); + for (size_t i = 0; i < Types.size(); i++) + { + const std::set& SStr = Types[i]; + if (SStr.empty()) + theCoeffs[i] = DefValue; + else + { + std::set::const_iterator it; + std::vector C1; + for (it = SStr.begin(); it != SStr.end(); ++it) + C1.push_back(theTable->Get( *it, DefValue )); + double Val; + if (UseMax) + Val = *(std::max_element( C1.begin(), C1.end() ) ); + else + Val = *(std::min_element( C1.begin(), C1.end() ) ); + theCoeffs[i] = Val; + } + } +} diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index 7abf5e12..e00eaebd 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -25,6 +25,8 @@ #include #include #include +#include +#include class HYDROData_StricklerTable; #include @@ -36,7 +38,7 @@ class TopoDS_Wire; class TopoDS_Iterator; class HYDROData_PolylineXY; class HYDROData_Object; -class gp_Pnt2d; +class gp_XY; class HYDROData_LandCoverMap : public HYDROData_Entity { @@ -106,7 +108,8 @@ public: HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName, double theDeflection, - const Handle(HYDROData_StricklerTable)& theTable ) const; + const Handle(HYDROData_StricklerTable)& theTable, + QString& statMessage) const; HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType ); HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType ); @@ -146,6 +149,12 @@ public: HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy ); + HYDRODATA_EXPORT void ClassifyPoints( const std::vector& thePoints, std::vector >& theTypes ) const; + + HYDRODATA_EXPORT void ClassifyPoints( const std::vector& thePoints, + Handle(HYDROData_StricklerTable) theTable, + std::vector& theCoeffs, double DefValue, bool UseMax ) const; + protected: void SetShape( const TopoDS_Shape& ); diff --git a/src/HYDROData/HYDROData_Object.cxx b/src/HYDROData/HYDROData_Object.cxx index 01543c41..bf73726b 100644 --- a/src/HYDROData/HYDROData_Object.cxx +++ b/src/HYDROData/HYDROData_Object.cxx @@ -312,7 +312,7 @@ void HYDROData_Object::checkAndSetAltitudeObject() Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); ObjectKind anAltitudeObjectType = getAltitudeObjectType(); - DEBTRACE("HYDROData_Object::checkAndSetAltitudeObject anAltitudeObjectType="<< anAltitudeObjectType); + //DEBTRACE("HYDROData_Object::checkAndSetAltitudeObject anAltitudeObjectType="<< anAltitudeObjectType); if ( anAltitudeObjectType == KIND_UNKNOWN ) return; // No need to create altitude object @@ -327,7 +327,7 @@ void HYDROData_Object::checkAndSetAltitudeObject() HYDROData_Iterator::CreateObject( aChildLabel, anAltitudeObjectType ) ); QString anAltitudePref = GetName() + "_Altitude"; - DEBTRACE("anAltitudePref " << anAltitudePref.toStdString()); + //DEBTRACE("anAltitudePref " << anAltitudePref.toStdString()); QString anAltitudeName = HYDROData_Tool::GenerateObjectName( aDocument, anAltitudePref ); anAltitudeObject->SetName( anAltitudeName ); diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index c311866a..d36f5fa1 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -216,7 +216,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD for (int aPSI = 0; aPSI < aPSCount; ++aPSI) { HYDROData_TopoCurve aCurve; - DEBTRACE("Initialize curve " << aPSI); + //DEBTRACE("Initialize curve " << aPSI); if (!aCurve.Initialize(aCurves[aPSI])) { continue; @@ -236,11 +236,11 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD aSplitCurves.end(); for (int iw=0; aCIt != aLastCIt; ++aCIt, iw++) { - std::stringstream brepName; + /*std::stringstream brepName; brepName << "theSplitWire_"; brepName << iw; brepName << ".brep"; - BRepTools::Write(aCIt->Wire() , brepName.str().c_str() ); + BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );*/ aResult.push_back(aCIt->Wire()); } } @@ -308,7 +308,7 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume const QColor& theColor = theOldPolyline->GetWireColor(); int n = theShapes.size(); - DEBTRACE("theShapes.size() "<< n); + //DEBTRACE("theShapes.size() "<< n); int anIndex = 1; for( int i=0; i 0); - DEBTRACE("nb sections: " << theSectTypes.Size()); + //DEBTRACE("nb sections: " << theSectTypes.Size()); HYDROData_PolylineXY::SectionType prevSectType = HYDROData_PolylineXY::SECTION_SPLINE;; HYDROData_PolylineXY::PointsList prevPointList; bool isPrevClosed = true; @@ -381,7 +381,7 @@ bool convertEdgesToSections( const TopoDS_Edge& } bool isNewSection = !isPrevious || isPrevClosed || anIsEdgeClosed || prevSectType != aSectionType; - DEBTRACE(isNewSection <<": " << !isPrevious << " " << isPrevClosed << " " << anIsEdgeClosed << " " << (prevSectType != aSectionType)); + //DEBTRACE(isNewSection <<": " << !isPrevious << " " << isPrevClosed << " " << anIsEdgeClosed << " " << (prevSectType != aSectionType)); HYDROData_PolylineXY::PointsList aPointsList; if (!isNewSection) @@ -391,7 +391,7 @@ bool convertEdgesToSections( const TopoDS_Edge& if( aSectionType == HYDROData_PolylineXY::SECTION_POLYLINE ) { - DEBTRACE("SECTION_POLYLINE"); + //DEBTRACE("SECTION_POLYLINE"); Handle(Geom_Line) aGeomLine = Handle(Geom_Line)::DownCast( anEdgeGeomCurve ); gp_Pnt aFirstPoint, aLastPoint; @@ -403,27 +403,27 @@ bool convertEdgesToSections( const TopoDS_Edge& { if (aSectFirstPoint == prevPointList.Last()) { - DEBTRACE("points shared: a");//aPointsList.Append( aSectFirstPoint ); + //DEBTRACE("points shared: a");//aPointsList.Append( aSectFirstPoint ); aPointsList.Append( aSectLastPoint ); } else if (aSectLastPoint == prevPointList.Last()) { - DEBTRACE("points shared: b");//aPointsList.Append( aSectLastPoint ); + //DEBTRACE("points shared: b");//aPointsList.Append( aSectLastPoint ); aPointsList.Append( aSectFirstPoint ); } else if (aSectFirstPoint == prevPointList.First()) { - DEBTRACE("points shared: c");//aPointsList.Prepend( aSectFirstPoint ); + //DEBTRACE("points shared: c");//aPointsList.Prepend( aSectFirstPoint ); aPointsList.Prepend( aSectLastPoint ); } else if (aSectLastPoint == prevPointList.First()) { - DEBTRACE("points shared: d");//aPointsList.Prepend( aSectLastPoint ); + //DEBTRACE("points shared: d");//aPointsList.Prepend( aSectLastPoint ); aPointsList.Prepend( aSectFirstPoint ); } else { - DEBTRACE("no point shared") + //DEBTRACE("no point shared") isNewSection = true; // no point shared, new section aPointsList.Clear(); aPointsList.Append( aSectFirstPoint ); @@ -432,14 +432,14 @@ bool convertEdgesToSections( const TopoDS_Edge& } else { - DEBTRACE("new section"); + //DEBTRACE("new section"); aPointsList.Append( aSectFirstPoint ); aPointsList.Append( aSectLastPoint ); } } else // aSectionType == HYDROData_PolylineXY::SECTION_SPLINE { - DEBTRACE("SECTION_SPLINE"); + //DEBTRACE("SECTION_SPLINE"); isNewSection = true; aPointsList.Clear(); @@ -464,8 +464,8 @@ bool convertEdgesToSections( const TopoDS_Edge& gp_Pnt endPts[] = {gp_Pnt(aPointsList.First().X(),aPointsList.First().Y(), 0), gp_Pnt(aPointsList.Last().X(),aPointsList.Last().Y(), 0) }; - DEBTRACE("curve start: "<< endPts[0].X() << " " << endPts[0].Y()); - DEBTRACE("curve end: "<< endPts[1].X() << " " << endPts[1].Y()); + //DEBTRACE("curve start: "<< endPts[0].X() << " " << endPts[0].Y()); + //DEBTRACE("curve end: "<< endPts[1].X() << " " << endPts[1].Y()); } else // --- split of a previous polyline: try to retrieve old sets of points and add intersection points { @@ -474,18 +474,18 @@ bool convertEdgesToSections( const TopoDS_Edge& double midPar = (anAdaptorCurve.LastParameter() + anAdaptorCurve.FirstParameter())/2; gp_Pnt midPnt; anAdaptorCurve.D0(midPar, midPnt); - DEBTRACE("curve first point: " << aEndPs[0].X() << " " << aEndPs[0].Y() << " " << aEndPs[0].Z()); - DEBTRACE("curve last point: " << aEndPs[1].X() << " " << aEndPs[1].Y() << " " << aEndPs[1].Z()); - DEBTRACE("curve mid point: " << midPnt.X() << " " << midPnt.Y() << " " << midPnt.Z()); + //DEBTRACE("curve first point: " << aEndPs[0].X() << " " << aEndPs[0].Y() << " " << aEndPs[0].Z()); + //DEBTRACE("curve last point: " << aEndPs[1].X() << " " << aEndPs[1].Y() << " " << aEndPs[1].Z()); + //DEBTRACE("curve mid point: " << midPnt.X() << " " << midPnt.Y() << " " << midPnt.Z()); std::vector aCurves; HYDROData_PolylineOperator::GetWires(theOldPolyline, aCurves); int nbSections = theOldPolyline->NbSections(); - DEBTRACE("nbSections: "<< nbSections << ", nbCurves: " << aCurves.size() ); + //DEBTRACE("nbSections: "<< nbSections << ", nbCurves: " << aCurves.size() ); for (int isec = 0; isec < nbSections; isec++) { - DEBTRACE("section: "<< isec); + //DEBTRACE("section: "<< isec); bool isOldSectionclosed = theOldPolyline->IsClosedSection(isec); TopoDS_Wire aWire = aCurves[isec]; // we suppose sections and wires are in the same order TopExp_Explorer anExp(aWire, TopAbs_EDGE); @@ -493,18 +493,18 @@ bool convertEdgesToSections( const TopoDS_Edge& BRepAdaptor_Curve adaptorOldCurve(anEdge); double pfirst = adaptorOldCurve.FirstParameter(); double plast = adaptorOldCurve.LastParameter(); - DEBTRACE("previous curve first last : "<< pfirst << " " << plast); + //DEBTRACE("previous curve first last : "<< pfirst << " " << plast); double p[3] = {-1, -1}; double d0= ProjectPointToCurve(aEndPs[0].XYZ(), adaptorOldCurve,p[0]); double d1= ProjectPointToCurve(aEndPs[1].XYZ(), adaptorOldCurve,p[1]); double d2= ProjectPointToCurve(midPnt.XYZ(), adaptorOldCurve, p[2]); - DEBTRACE("d0: "< pmax) @@ -516,32 +516,32 @@ bool convertEdgesToSections( const TopoDS_Edge& } else // old section closed: check if we use first or last points... { - if((pmin < pmax) and((abs(pmin - pfirst)> 1.e-3) and (abs(pmax - plast) >1.e-3))) // internal points forward + if((pmin < pmax) && ((abs(pmin - pfirst)> 1.e-3) && (abs(pmax - plast) >1.e-3))) // internal points forward forward = true; - else if ((pmin > pmax) and((abs(pmin - plast)> 1.e-3) and (abs(pmax - pfirst) >1.e-3))) // internal points reverse + else if ((pmin > pmax) && ((abs(pmin - plast)> 1.e-3) && (abs(pmax - pfirst) >1.e-3))) // internal points reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((abs(pmin - plast) <1.e-3) and (p[2] < pmax)) // forward, replace pmin par pfirst + else if ((abs(pmin - plast) <1.e-3) && (p[2] < pmax)) // forward, replace pmin par pfirst pmin = pfirst; - else if ((abs(pmin - plast) <1.e-3) and (p[2] > pmax)) // reverse + else if ((abs(pmin - plast) <1.e-3) && (p[2] > pmax)) // reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((abs(pmax - pfirst) <1.e-3) and (p[2] < pmin)) // reverse + else if ((abs(pmax - pfirst) <1.e-3) && (p[2] < pmin)) // reverse { pmin = p[1]; pmax = p[0]; forward = false; } - else if ((abs(pmax - pfirst) <1.e-3) and (p[2] > pmin)) // forward, replace pmax par plast + else if ((abs(pmax - pfirst) <1.e-3) && (p[2] > pmin)) // forward, replace pmax par plast pmax = plast; } - DEBTRACE("forward: "<< forward << " pmin " << pmin << " pmax " << pmax); + //DEBTRACE("forward: "<< forward << " pmin " << pmin << " pmax " << pmax); HYDROData_PolylineXY::Point aFirstPoint, aLastPoint; if (forward) { @@ -557,7 +557,7 @@ bool convertEdgesToSections( const TopoDS_Edge& HYDROData_PolylineXY::PointsList aSectPoints = theOldPolyline->GetPoints(isec, false); int nbPoints = aSectPoints.Length(); - DEBTRACE("nbPoints " << nbPoints); + //DEBTRACE("nbPoints " << nbPoints); if (forward) for (int i=1; i<=nbPoints; i++) { @@ -565,9 +565,9 @@ bool convertEdgesToSections( const TopoDS_Edge& gp_XYZ p(aPoint.X(), aPoint.Y(), 0); double param =-1; double d = ProjectPointToCurve(p, adaptorOldCurve, param); - if ((param > pmin) and (param < pmax)) + if ((param > pmin) && (param < pmax)) { - DEBTRACE("param: " << param); + //DEBTRACE("param: " << param); aPointsList.Append(aPoint); } } @@ -578,9 +578,9 @@ bool convertEdgesToSections( const TopoDS_Edge& gp_XYZ p(aPoint.X(), aPoint.Y(), 0); double param =-1; double d = ProjectPointToCurve(p, adaptorOldCurve, param); - if ((param > pmin) and (param < pmax)) + if ((param > pmin) && (param < pmax)) { - DEBTRACE("param: " << param); + //DEBTRACE("param: " << param); aPointsList.Append(aPoint); } } @@ -598,7 +598,7 @@ bool convertEdgesToSections( const TopoDS_Edge& TCollection_AsciiString aSectName = getUniqueSectionName( theSectNames ); if (isNewSection) { - DEBTRACE("isNewSection"); + //DEBTRACE("isNewSection"); theSectNames.Append( aSectName ); theSectTypes.Append( aSectionType ); theSectClosures.Append( anIsEdgeClosed ); @@ -606,7 +606,7 @@ bool convertEdgesToSections( const TopoDS_Edge& } else { - DEBTRACE("sameSection"); + //DEBTRACE("sameSection"); theSectPoints.SetValue(theSectPoints.Length(), aPointsList); } @@ -619,13 +619,13 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape, bool IsClosureAllowed, double theDeviation ) { - DEBTRACE("ImportShape"); + //DEBTRACE("ImportShape"); if ( theShape.IsNull() ) return false; - std::string brepName = this->GetName().toStdString(); - brepName += ".brep"; - BRepTools::Write( theShape, brepName.c_str() ); + //std::string brepName = this->GetName().toStdString(); + //brepName += ".brep"; + //BRepTools::Write( theShape, brepName.c_str() ); RemoveSections(); @@ -638,7 +638,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape, if ( theShape.ShapeType() == TopAbs_EDGE ) { - DEBTRACE("TopAbs_EDGE"); + //DEBTRACE("TopAbs_EDGE"); TopoDS_Edge anEdge = TopoDS::Edge( theShape ); // anIsCanBeImported = convertEdgeToSection( anEdge, aSectNames, aSectTypes, // aSectClosures, aSectPoints, true, IsInterpolationAllowed, theDeviation ); @@ -648,7 +648,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape, } else if ( theShape.ShapeType() == TopAbs_WIRE ) { - DEBTRACE("TopAbs_WIRE"); + //DEBTRACE("TopAbs_WIRE"); TopTools_SequenceOfShape anEdges; HYDROData_ShapesTool::ExploreShapeToShapes( theShape, TopAbs_EDGE, anEdges ); diff --git a/src/HYDROData/HYDROData_Profile.cxx b/src/HYDROData/HYDROData_Profile.cxx index 6308af14..99412519 100644 --- a/src/HYDROData/HYDROData_Profile.cxx +++ b/src/HYDROData/HYDROData_Profile.cxx @@ -35,6 +35,9 @@ #include #include #include +#include +#include +#include #include #include @@ -476,7 +479,8 @@ TCollection_AsciiString HYDROData_Profile::GetFilePath() const int HYDROData_Profile::ImportFromFile( const Handle(HYDROData_Document)& theDoc, const TCollection_AsciiString& theFileName, - NCollection_Sequence& theBadProfilesIds ) + NCollection_Sequence& theBadProfilesIds, + bool isToProject ) { if ( theDoc.IsNull() || theFileName.IsEmpty() ) return 0; @@ -499,7 +503,7 @@ int HYDROData_Profile::ImportFromFile( const Handle(HYDROData_Document)& theDoc, aNewProfile = Handle(HYDROData_Profile)::DownCast( theDoc->CreateObject( KIND_PROFILE ) ); bool anIsRead = false; - if ( aNewProfile->ImportFromFile( aFile, &anIsRead ) ) + if ( aNewProfile->ImportFromFile( aFile, isToProject, &anIsRead ) ) { aCreatedProfiles.Append( aNewProfile ); aNewProfile.Nullify(); @@ -532,10 +536,11 @@ int HYDROData_Profile::ImportFromFile( const Handle(HYDROData_Document)& theDoc, } bool HYDROData_Profile::ImportFromFile( const TCollection_AsciiString& theFileName, - bool* theIsRead ) + bool isToProject, + bool* isNotEmpty ) { - if ( theIsRead ) - *theIsRead = false; + if( isNotEmpty ) + *isNotEmpty = false; // Try to open the file OSD_File aFile( theFileName ); @@ -546,7 +551,7 @@ bool HYDROData_Profile::ImportFromFile( const TCollection_AsciiString& theFileNa if ( !aFile.IsOpen() ) return false; - bool aRes = ImportFromFile( aFile, theIsRead ); + bool aRes = ImportFromFile( aFile, isToProject, isNotEmpty ); // Close the file aFile.Close(); @@ -561,10 +566,11 @@ bool HYDROData_Profile::ImportFromFile( const TCollection_AsciiString& theFileNa } bool HYDROData_Profile::ImportFromFile( OSD_File& theFile, - bool* theIsRead ) + bool isToProject, + bool* isNotEmpty ) { - if ( theIsRead ) - *theIsRead = false; + if( isNotEmpty ) + *isNotEmpty = false; if ( !theFile.IsOpen() ) return false; @@ -594,8 +600,8 @@ bool HYDROData_Profile::ImportFromFile( OSD_File& theFile, } // Set flag of read status to true - if ( theIsRead ) - *theIsRead = true; + if( isNotEmpty ) + *isNotEmpty = true; TCollection_AsciiString aValX = aLine.Token( " \t", 1 ); TCollection_AsciiString aValY = aLine.Token( " \t", 2 ); @@ -663,6 +669,8 @@ bool HYDROData_Profile::ImportFromFile( OSD_File& theFile, } else if ( anIsGeoref ) { + if( isToProject ) + ProjectProfilePoints( aPointsXYZ ); SetProfilePoints( aPointsXYZ, true ); } @@ -777,4 +785,21 @@ HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint() const } return aMiddlePoint; - } \ No newline at end of file + } + +void HYDROData_Profile::ProjectProfilePoints( ProfilePoints& thePoints ) +{ + int low = thePoints.Lower(), up = thePoints.Upper(); + gp_Pnt aFirst = thePoints.Value( low ); + gp_Pnt aLast = thePoints.Value( up ); + gp_Vec d( aFirst, aLast ); + gp_Vec n( d.Y(), -d.X(), 0 ); + + Handle(Geom_Plane) aPlane = new Geom_Plane( aFirst, gp_Dir( n ) ); + for( int i=low; i<=up; i++ ) + { + gp_XYZ p = thePoints.Value( i ); + gp_Pnt pp = GeomAPI_ProjectPointOnSurf( p, aPlane ); + thePoints.SetValue( i, pp.XYZ() ); + } +} diff --git a/src/HYDROData/HYDROData_Profile.h b/src/HYDROData/HYDROData_Profile.h index 1809a02c..198cb241 100644 --- a/src/HYDROData/HYDROData_Profile.h +++ b/src/HYDROData/HYDROData_Profile.h @@ -20,7 +20,6 @@ #define HYDROData_Profile_HeaderFile #include "HYDROData_Object.h" - #include "HYDROData_ProfileUZ.h" class gp_XYZ; @@ -225,7 +224,8 @@ public: */ HYDRODATA_EXPORT static int ImportFromFile( const Handle(HYDROData_Document)& theDoc, const TCollection_AsciiString& theFileName, - NCollection_Sequence& theBadProfilesIds ); + NCollection_Sequence& theBadProfilesIds, + bool isToProject = true ); /** * Imports Profile data from file. @@ -234,7 +234,8 @@ public: * \return \c true if file has been successfully read */ HYDRODATA_EXPORT virtual bool ImportFromFile( const TCollection_AsciiString& theFileName, - bool* theIsRead = 0 ); + bool isToProject = true, + bool* isNotEmpty = 0 ); /** * Imports Profile data from file. @@ -243,7 +244,8 @@ public: * \return \c true if file has been successfully read */ HYDRODATA_EXPORT virtual bool ImportFromFile( OSD_File& theFile, - bool* theIsRead = 0 ); + bool isToProject = true, + bool* isNotEmpty = 0 ); protected: /** @@ -254,6 +256,8 @@ protected: TopoDS_Shape CreateProfileWire( bool canUseDefaultPoints ) const; + static void ProjectProfilePoints( ProfilePoints& thePoints ); + protected: friend class HYDROData_Iterator; diff --git a/src/HYDROData/HYDROData_QuadtreeNode.cxx b/src/HYDROData/HYDROData_QuadtreeNode.cxx index 547b8a47..11fe12cd 100644 --- a/src/HYDROData/HYDROData_QuadtreeNode.cxx +++ b/src/HYDROData/HYDROData_QuadtreeNode.cxx @@ -49,12 +49,12 @@ HYDROData_QuadtreeNode::HYDROData_QuadtreeNode(Nodes_3D* theNodes, const double minBoxSize) : HYDROData_Quadtree(new Limit(maxLevel, minBoxSize, maxNbNodes)), myNodes(theNodes), myPrecision(0.25) { - DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor"); + //DEBTRACE("---------------------------- HYDROData_QuadtreeNode root constructor"); if (myNodes) { - DEBTRACE(" --- start compute"); + //DEBTRACE(" --- start compute"); compute(); - DEBTRACE(" --- end compute"); + //DEBTRACE(" --- end compute"); } } @@ -88,11 +88,11 @@ void HYDROData_QuadtreeNode::setNodesAndCompute(Nodes_3D* theNodes) myNodes = theNodes; if (myNodes) { - DEBTRACE(" --- start compute"); + //DEBTRACE(" --- start compute"); compute(); - DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight()); - DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y()); - DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y()); + //DEBTRACE(" --- end compute : children & height " << this->nbChildren() << " " << this->getHeight()); + //DEBTRACE("Bounding box min: " << this->myBox->CornerMin().X() << " " << this->myBox->CornerMin().Y()); + //DEBTRACE("Bounding box max: " << this->myBox->CornerMax().X() << " " << this->myBox->CornerMax().Y()); } } diff --git a/src/HYDROData/HYDROData_QuadtreeNode.hxx b/src/HYDROData/HYDROData_QuadtreeNode.hxx index 6ec99f76..6ea6f186 100644 --- a/src/HYDROData/HYDROData_QuadtreeNode.hxx +++ b/src/HYDROData/HYDROData_QuadtreeNode.hxx @@ -106,7 +106,7 @@ public: bool isEmpty() const { return myChildren == 0; } inline double getPrecision() {return myPrecision; } - inline double setPrecision(double precision) {myPrecision = precision; } + inline void setPrecision(double precision) {myPrecision = precision; } protected: diff --git a/src/HYDROData/HYDROData_Region.cxx b/src/HYDROData/HYDROData_Region.cxx index f74956ce..0f47ed2a 100644 --- a/src/HYDROData/HYDROData_Region.cxx +++ b/src/HYDROData/HYDROData_Region.cxx @@ -38,6 +38,7 @@ #include #include + #include #include @@ -46,6 +47,10 @@ #include #include +#include "Geom_Plane.hxx" +#include "gp_Pln.hxx" +#include "BRepTools_ReShape.hxx" + //#define DEB_GET_REGION_SHAPE IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Region, HYDROData_Entity) @@ -238,7 +243,9 @@ void getUsedGroups( const TopoDS_Shape& theShape, } } -TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups ) const + + +TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups, const TopTools_SequenceOfShape* IntSh ) const { HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroups; HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfUsedGroups; @@ -259,6 +266,9 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* HYDROData_SequenceOfObjects aZones = GetZones(); HYDROData_SequenceOfObjects::Iterator aZoneIter( aZones ); + TopTools_IndexedMapOfShape AllE; + TopTools_IndexedMapOfShape IE; //int edges + for ( ; aZoneIter.More(); aZoneIter.Next() ) { Handle(HYDROData_Zone) aZone = @@ -272,19 +282,25 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* TopoDS_Face aZoneFace = TopoDS::Face( aZoneShape ); aRegionFacesList.Append( aZoneFace ); - + TopExp::MapShapes(aZoneFace, TopAbs_EDGE, AllE); // collect all edges getUsedGroups( aZoneFace, aSeqOfGroups, aSeqOfUsedGroups ); } // zones iterator + + for (int i = 1; i <= IntSh->Length(); i++) + { + const TopoDS_Shape& CS = (*IntSh)(i); + if (AllE.Contains(CS)) + IE.Add(CS); + } if ( aRegionFacesList.IsEmpty() ) return aResShape; - // The unite region face TopoDS_Face aRegionFace; if ( aRegionFacesList.Extent() == 1 ) { - aRegionFace = TopoDS::Face( aRegionFacesList.First() ); + aResShape = TopoDS::Face( aRegionFacesList.First() ); } else { @@ -311,6 +327,35 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* } aFuseShape = aFuse.Shape(); + + //update history of internal edges + TopTools_IndexedMapOfShape DIE; + TopTools_ListOfShape newSh1, newSh2; + for (int i = 1; i <= IE.Extent(); i++) + { + const TopoDS_Shape& CSH = IE(i); + newSh1.Clear(); + newSh2.Clear(); + newSh1 = aFuse.Modified(CSH); + if (newSh1.IsEmpty()) + { + newSh2 = aFuse.Generated(CSH); + if (newSh2.IsEmpty()) + DIE.Add(CSH); + else + for (TopTools_ListIteratorOfListOfShape lt(newSh2); lt.More(); lt.Next()) + if (!lt.Value().IsNull()) + DIE.Add(lt.Value()); + } + else + { + for (TopTools_ListIteratorOfListOfShape lt(newSh1); lt.More(); lt.Next()) + if (!lt.Value().IsNull()) + DIE.Add(lt.Value()); + } + } + IE = DIE; + //update groups HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &aFuse ); } // faces iterator @@ -318,73 +363,86 @@ TopoDS_Shape HYDROData_Region::GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Fused face edges:", aFuseShape, TopAbs_EDGE ); #endif - // Check the result of fuse operation - if ( !aFuseShape.IsNull() ) + BRep_Builder BB; + TopoDS_Face DF; + if (!IE.IsEmpty()) { - ShapeUpgrade_UnifySameDomain anUnifier( aFuseShape ); - anUnifier.Build(); + //add dummy face to existing shell + //this face contains all internal edges + //USD algo will skip such edges and will not perform unifying through them + //(more than 2 faces are connected to one edge + non same domain surfaces) + TopoDS_Wire DW; + Handle_Geom_Plane DPl = new Geom_Plane(gp_Pln (gp_Pnt(0,0,0), gp_Dir(0,1,0))); //non same domain with the main surf + BB.MakeFace(DF, DPl, Precision::Confusion()); + BB.MakeWire(DW); + for (int i = 1; i <= IE.Extent(); i++) + BB.Add(DW, IE(i)); + BB.Add(DF, DW); + BB.Add(aFuseShape, DF); + } - const TopoDS_Shape& anUnitedShape = anUnifier.Shape(); + ShapeUpgrade_UnifySameDomain unif( aFuseShape ); + unif.Build(); + TopoDS_Shape anUnitedShape; + const TopoDS_Shape& out = unif.Shape(); - TopTools_SequenceOfShape aShapeFaces; - HYDROData_ShapesTool::ExploreShapeToShapes( anUnitedShape, TopAbs_FACE, aShapeFaces ); - if ( aShapeFaces.Length() == 1 ) - { - aRegionFace = TopoDS::Face( aShapeFaces.Value( 1 ) ); + HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &unif ); -#ifdef DEB_GET_REGION_SHAPE - HYDROData_ShapesTool::DumpShapeSubShapes( std::cout, "Result face edges:", aRegionFace, TopAbs_EDGE ); -#endif + if (!IE.IsEmpty()) + { + //remove dummy face from shell; shell becomes valid + const TopoDS_Shape& NDF = unif.Generated(DF); + BRepTools_ReShape ReShaper; + ReShaper.Remove(NDF); + anUnitedShape = ReShaper.Apply(out); + HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &ReShaper ); + } + else + anUnitedShape = out; - HYDROData_ShapesGroup::GroupDefinition::Update( &aSeqOfUsedGroups, &anUnifier ); + TopTools_SequenceOfShape aShapeFaces; + HYDROData_ShapesTool::ExploreShapeToShapes( anUnitedShape, TopAbs_FACE, aShapeFaces ); + if ( aShapeFaces.Length() == 1 ) //it should be either face or compound of faces (?) + { + const TopoDS_Face& CF = TopoDS::Face( aShapeFaces.Value( 1 )); + aResShape = CF; + } + else + { + TopTools_SequenceOfShape aShapeShells; + HYDROData_ShapesTool::ExploreShapeToShapes( anUnitedShape, TopAbs_SHELL, aShapeShells ); + if (aShapeShells.Length() == 1) + aResShape = TopoDS::Shell(aShapeShells(1)); + else + aResShape = anUnitedShape; + } - // Update the sequence of groups - if ( theSeqOfGroups ) + // Update the sequence of groups + if ( theSeqOfGroups ) + { + HYDROData_ShapesGroup::SeqOfGroupsDefs::Iterator aUsedIter( aSeqOfUsedGroups ); + for ( ; aUsedIter.More(); aUsedIter.Next() ) + { + const HYDROData_ShapesGroup::GroupDefinition& aUsedGroupDef = aUsedIter.Value(); + if ( aUsedGroupDef.Shapes.IsEmpty() ) + continue; + + HYDROData_ShapesGroup::SeqOfGroupsDefs::Iterator anOriIter( aSeqOfGroups ); + for ( ; anOriIter.More(); anOriIter.Next() ) { - HYDROData_ShapesGroup::SeqOfGroupsDefs::Iterator aUsedIter( aSeqOfUsedGroups ); - for ( ; aUsedIter.More(); aUsedIter.Next() ) - { - const HYDROData_ShapesGroup::GroupDefinition& aUsedGroupDef = aUsedIter.Value(); - if ( aUsedGroupDef.Shapes.IsEmpty() ) - continue; - - HYDROData_ShapesGroup::SeqOfGroupsDefs::Iterator anOriIter( aSeqOfGroups ); - for ( ; anOriIter.More(); anOriIter.Next() ) - { - HYDROData_ShapesGroup::GroupDefinition& anOriGroupDef = anOriIter.ChangeValue(); - if ( anOriGroupDef.Name != aUsedGroupDef.Name ) - continue; - - HYDROData_ShapesTool::AddShapes( anOriGroupDef.Shapes, aUsedGroupDef.Shapes ); - break; - } - } - - *theSeqOfGroups = aSeqOfGroups; + HYDROData_ShapesGroup::GroupDefinition& anOriGroupDef = anOriIter.ChangeValue(); + if ( anOriGroupDef.Name != aUsedGroupDef.Name ) + continue; + + HYDROData_ShapesTool::AddShapes( anOriGroupDef.Shapes, aUsedGroupDef.Shapes ); + break; } } - } - } - if ( !aRegionFace.IsNull() ) - { - // result shape is a face - aResShape = aRegionFace; + *theSeqOfGroups = aSeqOfGroups; + } } - else - { - // result shape is a shell - TopoDS_Shell aShell; - BRep_Builder aBuilder; - aBuilder.MakeShell( aShell ); - TopTools_ListIteratorOfListOfShape aFaceIter( aRegionFacesList ); - for ( ; aFaceIter.More(); aFaceIter.Next() ) - aBuilder.Add( aShell, aFaceIter.Value() ); - - aResShape = aShell; - } - return aResShape; } diff --git a/src/HYDROData/HYDROData_Region.h b/src/HYDROData/HYDROData_Region.h index e7fcfeab..205e546e 100644 --- a/src/HYDROData/HYDROData_Region.h +++ b/src/HYDROData/HYDROData_Region.h @@ -110,7 +110,8 @@ public: * - a shell if the zones faces can't be united into one face * \return shape as TopoDS_Shape */ - HYDRODATA_EXPORT virtual TopoDS_Shape GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups = 0 ) const; + HYDRODATA_EXPORT virtual TopoDS_Shape GetShape( HYDROData_ShapesGroup::SeqOfGroupsDefs* theSeqOfGroups = 0, + const TopTools_SequenceOfShape* IntSh = NULL ) const; HYDRODATA_EXPORT bool IsSubmersible() const; diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index b928ce8d..2a38a86d 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -379,7 +379,8 @@ bool HYDROData_ShapeFile::Parse(SHPHandle theHandle, ShapeType theType, int& the mySHPObjects.clear(); SHPGetInfo( theHandle, NULL, &aShapeType, NULL, NULL ); theShapeTypeOfFile = aShapeType; - bool ToRead = (theType == ShapeType_Polyline && (aShapeType == 3 || aShapeType == 13 || aShapeType == 23)) || + bool ToRead = (theType == ShapeType_Polyline && + (aShapeType == 3 || aShapeType == 13 || aShapeType == 23 || aShapeType == 5)) || (theType == ShapeType_Polygon && aShapeType == 5); if (ToRead) { @@ -562,7 +563,7 @@ void HYDROData_ShapeFile::Free() void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, - int theInd, NCollection_Sequence& theEntities) + int theInd, NCollection_Sequence& theEntities, bool bReadAsPolyline) { Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) ); @@ -577,19 +578,28 @@ void HYDROData_ShapeFile::ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, else EndIndex = anObj->nVertices; - bool IsClosed = false; HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; - if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] && - anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] ) + if (!bReadAsPolyline) { - IsClosed = true; - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); + bool IsClosed = false; + if (anObj->padfX[StartIndex] == anObj->padfX[EndIndex - 1] && + anObj->padfY[StartIndex] == anObj->padfY[EndIndex - 1] ) + { + IsClosed = true; + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); + } + else + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false); + + if (IsClosed) + EndIndex--; } else - aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, false); - - if (IsClosed) + { + //polygon; contours always closed + aPolylineXY->AddSection( TCollection_AsciiString( ("poly_section_" + QString::number(i)).data()->toLatin1()), aSectType, true); EndIndex--; + } for ( int k = StartIndex; k < EndIndex ; k++ ) { HYDROData_PolylineXY::Point aSectPoint = gp_XY(anObj->padfX[k], anObj->padfY[k]); @@ -647,7 +657,11 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, HYDROData_PolylineXY::Point aSectPoint = gp_XY(anObj->padfX[k], anObj->padfY[k]); theDocument->Transform(aSectPoint, true); aPolylineXY->AddPoint( i, aSectPoint ); - aAPoints.Append(gp_XYZ (aSectPoint.X(), aSectPoint.Y(), anObj->padfZ[k])); + HYDROData_Bathymetry::AltitudePoint p; + p.X = aSectPoint.X(); + p.Y = aSectPoint.Y(); + p.Z = anObj->padfZ[k]; + aAPoints.push_back(p); } } @@ -675,7 +689,21 @@ void HYDROData_ShapeFile::ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, } - +void HYDROData_ShapeFile::GetFreeIndices(std::vector& theAllowedIndexes, QString strName, size_t theObjsSize, + QStringList theExistingNames, QString theBaseFileName) +{ + int anInd = 0; + for (;theAllowedIndexes.size() < theObjsSize;) + { + if (!theExistingNames.contains(theBaseFileName + strName + QString::number(anInd))) + { + theAllowedIndexes.push_back(anInd); + anInd++; + } + else + anInd++; + } +} int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, const QString& theFileName, NCollection_Sequence& theEntities, int& theShapeTypeOfFile) @@ -702,21 +730,12 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, return 0; if (aHSHP->nShapeType == 3 || aHSHP->nShapeType == 23) { - anInd = 0; - for (;anAllowedIndexes.size() < mySHPObjects.size();) - { - if (!anExistingNames.contains(aBaseFileName + "_PolyXY_" + QString::number(anInd))) - { - anAllowedIndexes.push_back(anInd); - anInd++; - } - else - anInd++; - } - + size_t anObjsSize = mySHPObjects.size(); + GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName); + for (size_t i = 0; i < mySHPObjects.size(); i++ ) { - ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities); + ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities, false); } aStat = 1; } @@ -736,9 +755,23 @@ int HYDROData_ShapeFile::ImportPolylines(Handle(HYDROData_Document) theDocument, anInd++; } for (size_t i = 0; i < mySHPObjects.size(); i++ ) + { ReadSHPPoly3D(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities); + } aStat = 1; } + else if (aHSHP->nShapeType == 5) + { + //import polygon's contours as polylines + size_t anObjsSize = mySHPObjects.size(); + GetFreeIndices(anAllowedIndexes, "_PolyXY_", anObjsSize, anExistingNames, aBaseFileName); + + for (size_t i = 0; i < mySHPObjects.size(); i++ ) + { + ReadSHPPolyXY(theDocument, mySHPObjects[i], aBaseFileName, anAllowedIndexes[i], theEntities, true); + } + aStat = 2; + } else { aStat = 0; diff --git a/src/HYDROData/HYDROData_ShapeFile.h b/src/HYDROData/HYDROData_ShapeFile.h index 10dec110..41f2200f 100644 --- a/src/HYDROData/HYDROData_ShapeFile.h +++ b/src/HYDROData/HYDROData_ShapeFile.h @@ -19,12 +19,17 @@ #ifndef HYDRODATA_SHAPEFILE_H #define HYDRODATA_SHAPEFILE_H -#include -#include -#include #include "HYDROData.h" + +#include + #include +#include + +#include + + //extern "C" { #include //}; @@ -118,7 +123,8 @@ public: //Import Polyline void ReadSHPPolyXY(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, - int theInd, NCollection_Sequence& theEntities); + int theInd, NCollection_Sequence& theEntities, + bool bReadAsPolylin = false); void ReadSHPPoly3D(Handle(HYDROData_Document) theDocument, SHPObject* anObj, QString theFileName, int theInd, NCollection_Sequence& theEntities); @@ -149,6 +155,9 @@ private: int TryOpenShapeFile(QString theFileName); + void GetFreeIndices(std::vector& theAllowedIndexes, QString strName, size_t theObjsSize, + QStringList theExistingNames, QString theBaseFileName); + private: std::vector mySHPObjects; SHPHandle myHSHP; diff --git a/src/HYDROData/HYDROData_ShapesGroup.cxx b/src/HYDROData/HYDROData_ShapesGroup.cxx index 1a086b76..9db2e01c 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.cxx +++ b/src/HYDROData/HYDROData_ShapesGroup.cxx @@ -30,6 +30,7 @@ #include #include #include +#include IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ShapesGroup,HYDROData_Entity) @@ -112,6 +113,44 @@ void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* } } +void HYDROData_ShapesGroup::GroupDefinition::Update( SeqOfGroupsDefs* theGroupsDefs, + BRepTools_ReShape* theAlgo ) +{ + if ( !theGroupsDefs || !theAlgo ) + return; + + SeqOfGroupsDefs::Iterator anIter( *theGroupsDefs ); + for ( ; anIter.More(); anIter.Next() ) + { + GroupDefinition& aGroupDef = anIter.ChangeValue(); + if ( aGroupDef.Shapes.IsEmpty() ) + continue; + + TopTools_ListOfShape aShapesToAdd; + for ( int i = 1; i <= aGroupDef.Shapes.Length(); ++i ) + { + TopoDS_Shape aShape = aGroupDef.Shapes.Value( i ); + + TopoDS_Shape aGeneratedByAlgo = theAlgo->Value( aShape ); + if ( aGeneratedByAlgo.IsNull() ) + { + // Edge has been removed + aGroupDef.Shapes.Remove( i ); + --i; + } + else if ( !aShape.IsEqual( aGeneratedByAlgo ) ) + { + // Edge has been modified + aShapesToAdd.Append( aGeneratedByAlgo ); + aGroupDef.Shapes.Remove( i ); + --i; + } + } + + HYDROData_ShapesTool::AddShapes( aGroupDef.Shapes, aShapesToAdd ); + } +} + void HYDROData_ShapesGroup::GroupDefinition::Dump( std::ostream& theStream ) const { theStream << "Name: " << Name.ToCString() << "\n"; diff --git a/src/HYDROData/HYDROData_ShapesGroup.h b/src/HYDROData/HYDROData_ShapesGroup.h index 92018bf5..71c4c4be 100644 --- a/src/HYDROData/HYDROData_ShapesGroup.h +++ b/src/HYDROData/HYDROData_ShapesGroup.h @@ -27,6 +27,7 @@ class TopoDS_Shape; class BRepBuilderAPI_MakeShape; class ShapeUpgrade_UnifySameDomain; +class BRepTools_ReShape; /**\class HYDROData_ShapesGroup * \brief Class that stores/retreives the sequence of shapes. @@ -45,6 +46,10 @@ public: static void Update( NCollection_Sequence* theGroupsDefs, ShapeUpgrade_UnifySameDomain* theAlgo ); + static void Update( NCollection_Sequence* theGroupsDefs, + BRepTools_ReShape* theAlgo ); + + void Dump( std::ostream& theStream ) const; static void Dump( std::ostream& theStream, diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx index 8bee17ad..a18d59eb 100644 --- a/src/HYDROData/HYDROData_SinusX.cxx +++ b/src/HYDROData/HYDROData_SinusX.cxx @@ -124,11 +124,17 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec { Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( theDocument->CreateObject( KIND_BATHYMETRY ) ); HYDROData_Bathymetry::AltitudePoints aAPoints; - for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++) + size_t n = myCurveBlocks[i].myXYZPoints.size(); + aAPoints.reserve( n ); + for (size_t j = 0; j < n; j++) { gp_XYZ aLocalPoint = gp_XYZ (myCurveBlocks[i].myXYZPoints[j]); theDocument->Transform(aLocalPoint, true); - aAPoints.Append(aLocalPoint); + HYDROData_Bathymetry::AltitudePoint p; + p.X = aLocalPoint.X(); + p.Y = aLocalPoint.Y(); + p.Z = aLocalPoint.Z(); + aAPoints.push_back(p); } aBath->SetAltitudePoints(aAPoints); @@ -367,10 +373,10 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_SequenceGetName() << "\n"; aTextStream << "CP 0 0\n"; aTextStream << "CP 0\n"; - for (int j = anXYZPoints.Lower(); j <= anXYZPoints.Upper(); j++) - aTextStream << " " << QString::number(anXYZPoints(j).X(), 'f', 3) - << " " << QString::number(anXYZPoints(j).Y(), 'f', 3) - << " " << QString::number(anXYZPoints(j).Z(), 'f', 3) << "\n"; + for (size_t j = 0, m = anXYZPoints.size(); j < m; j++) + aTextStream << " " << QString::number(anXYZPoints[j].X, 'f', 3) + << " " << QString::number(anXYZPoints[j].Y, 'f', 3) + << " " << QString::number(anXYZPoints[j].Z, 'f', 3) << "\n"; } else if (anEnt->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) )) { diff --git a/src/HYDROData/HYDROData_SplitShapesGroup.cxx b/src/HYDROData/HYDROData_SplitShapesGroup.cxx index 090473fd..674f9f0f 100644 --- a/src/HYDROData/HYDROData_SplitShapesGroup.cxx +++ b/src/HYDROData/HYDROData_SplitShapesGroup.cxx @@ -29,4 +29,13 @@ HYDROData_SplitShapesGroup::~HYDROData_SplitShapesGroup() { } +void HYDROData_SplitShapesGroup::SetInternal(bool flag) +{ + SetInteger(DataTag_InternalEdge, (int)flag); +} + +bool HYDROData_SplitShapesGroup::GetInternal() const +{ + return (bool)GetInteger(DataTag_InternalEdge); +} diff --git a/src/HYDROData/HYDROData_SplitShapesGroup.h b/src/HYDROData/HYDROData_SplitShapesGroup.h index 8cd00a8d..25043388 100644 --- a/src/HYDROData/HYDROData_SplitShapesGroup.h +++ b/src/HYDROData/HYDROData_SplitShapesGroup.h @@ -32,7 +32,8 @@ protected: */ enum DataTag { - DataTag_First = HYDROData_ShapesGroup::DataTag_First + 100 ///< first tag, to reserve + DataTag_First = HYDROData_ShapesGroup::DataTag_First + 100, ///< first tag, to reserve + DataTag_InternalEdge }; public: @@ -43,6 +44,9 @@ public: */ HYDRODATA_EXPORT virtual const ObjectKind GetKind() const { return KIND_SPLIT_GROUP; } + void SetInternal(bool flag); + bool GetInternal() const; + protected: friend class HYDROData_Iterator; diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index ba3359c2..182c6178 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -34,12 +34,17 @@ #include #include #include +#include #include #include #include #include #include +#include +#include +#include + //#define DEB_SPLIT_TO_ZONES 1 //#define DEB_SPLIT_TO_ZONES_CHECK_PARTITION 1 #if (defined (DEB_SPLIT_TO_ZONES) || defined(DEB_SPLIT_TO_ZONES_CHECK_PARTITION)) @@ -130,11 +135,16 @@ Standard_Integer HYDROData_SplitToZonesTool::SplitFaces(const TopoDS_Compound& t HYDROData_SplitToZonesTool::SplitDataList HYDROData_SplitToZonesTool::Split( const HYDROData_SequenceOfObjects& theObjectList, const HYDROData_SequenceOfObjects& theGroupsList, - const Handle(HYDROData_PolylineXY)& thePolyline ) + const Handle(HYDROData_PolylineXY)& thePolyline, + const HYDROData_SequenceOfObjects& InterPolys) { +#ifndef NDEBUG DEBTRACE("Split"); +#endif SplitDataList anOutputSplitDataList; - if(theObjectList.IsEmpty()) return anOutputSplitDataList; + NCollection_DataMap OutNE; + if(theObjectList.IsEmpty()) + return anOutputSplitDataList; // Preparation. // Collect the object shapes to split. InputDataList will contain elements which will hold shape & name_of_shape. SplitDataList anInputSplitDataList; @@ -210,14 +220,69 @@ HYDROData_SplitToZonesTool::SplitDataList // If only one shape is given we don't split it // algorithm just returns the unpacked input data bool limplus1Object(false); - if(theObjectList.Size() == 1 ) { - if(thePolyline.IsNull()) { - anOutputSplitDataList.append(anInputSplitDataList); + if(theObjectList.Size() == 1 ) + { + if(thePolyline.IsNull()) + { + //anOutputSplitDataList.append(anInputSplitDataList); + SplitData SD = anInputSplitDataList.at(0); + TopTools_ListOfShape newshs; + TopTools_IndexedDataMapOfShapeListOfShape OutOrSh2M; + CutFaceByEdges(SD.Face(), newshs, InterPolys, &OutNE, &OutOrSh2M); + for (TopTools_ListIteratorOfListOfShape it(newshs); it.More(); it.Next()) + { + SplitData NSD = SD; + NSD.Shape = it.Value(); + anOutputSplitDataList.append(NSD); + } + + NCollection_DataMap::Iterator spit(OutNE); + for (;spit.More();spit.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(spit.Key()); + if (E.IsNull()) + continue; + SplitData SDI(SplitData::Data_IntEdge, E, spit.Value()->GetName()); + anOutputSplitDataList.append(SDI); + } + if(!theGroupsList.IsEmpty() ) - anOutputSplitDataList.append(anInputGroupList); + { + SplitDataList ModifInpGroupList; + SplitDataListIterator it(anInputGroupList); + while( it.hasNext() ) + { + const SplitData& SData = it.next(); + if (SData.Type != SplitData::Data_Edge) + ModifInpGroupList.append(SData); //add as is + const TopoDS_Shape& SData_sh = SData.Shape; + const TopTools_ListOfShape& modif_ls = OutOrSh2M.FindFromKey(SData_sh); + if (modif_ls.IsEmpty()) + ModifInpGroupList.append(SData); //non modified + else + { + TopTools_ListIteratorOfListOfShape itl_modif(modif_ls); + for (;itl_modif.More();itl_modif.Next()) + { + const TopoDS_Shape& CSH = itl_modif.Value(); + if (CSH.ShapeType() == TopAbs_EDGE) + { + SplitData NewSData; + NewSData.ObjectNames = SData.ObjectNames; + NewSData.Type = SData.Type; + NewSData.Shape = CSH; + ModifInpGroupList.append(NewSData); + } + } + } + + } + anOutputSplitDataList.append(ModifInpGroupList); + } return anOutputSplitDataList; - } else - limplus1Object = true;// size =1 && hasLimits + } + else + limplus1Object = true;// size =1 && hasLimits } HYDROData_DataMapOfShapeListOfString aDM3; if(!anInputGroupList.isEmpty()) {// Old edge ==> List_Of_Names @@ -309,8 +374,10 @@ HYDROData_SplitToZonesTool::SplitDataList for (int j =1;exp.More();exp.Next(),j++) { aList.Clear(); Standard_Boolean foundE(Standard_False); - const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current()); + const TopTools_ListOfShape& aListM = splitTool.Modified(exp.Current()); +#ifndef NDEBUG DEBTRACE("NB_EDGE_M = " << aListM.Extent()); +#endif if(aListM.Extent()) foundE = Standard_True; it.Initialize(aListM); for(int k=1;it.More();it.Next(),k++) { @@ -388,7 +455,9 @@ HYDROData_SplitToZonesTool::SplitDataList const TopoDS_Shape& aFace = exp.Current(); if(!aFace.IsNull()) { const TopTools_ListOfShape& aListOfNew = mkCom.Modified(aFace); +#ifndef NDEBUG DEBTRACE("Modified: " << aListOfNew.Extent()); +#endif if(!aListOfNew.IsEmpty()) { aDM4.Add(aFace, aListOfNew); #ifdef DEB_SPLIT_TO_ZONES @@ -547,6 +616,18 @@ HYDROData_SplitToZonesTool::SplitDataList } } } + + AddInternalEdges(aDM2, InterPolys, &OutNE); + NCollection_DataMap::Iterator spit(OutNE); + for (;spit.More();spit.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(spit.Key()); + if (E.IsNull()) + continue; + SplitData SDI(SplitData::Data_IntEdge, E, spit.Value()->GetName()); + anOutputSplitDataList.append(SDI); + } + // Step 4. Fill output structure. #ifdef DEB_SPLIT_TO_ZONES TCollection_AsciiString aNam4 ("SC_"); @@ -609,6 +690,156 @@ HYDROData_SplitToZonesTool::SplitDataList { HYDROData_SequenceOfObjects aGeomGroups; Handle(HYDROData_PolylineXY) aPolyline; + HYDROData_SequenceOfObjects InterPolys; + + return Split( theObjectList, aGeomGroups, aPolyline, InterPolys ); +} + +void HYDROData_SplitToZonesTool::AddInternalEdges(HYDROData_DataMapOfShapeListOfShape& DM, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE) +{ + + HYDROData_SequenceOfObjects::Iterator it(thePolylines); + TopTools_ListOfShape Wires; + NCollection_DataMap W2P; + for (;it.More();it.Next()) + { + Handle(HYDROData_PolylineXY) P = Handle(HYDROData_PolylineXY)::DownCast(it.Value()); + const TopoDS_Shape& CW = P->GetShape(); + Wires.Append(CW); + W2P.Bind(CW, P); + } + + HYDROData_DataMapOfShapeListOfShape newDM; + TopTools_IndexedDataMapOfShapeShape OutNE1; + for (int i = 1; i <= DM.Extent();i++) + { + const TopoDS_Shape& K = DM.FindKey(i); + const TopTools_ListOfShape& V = DM.FindFromIndex(i); + TopTools_ListOfShape out; + if (K.ShapeType() == TopAbs_FACE) + { + CutByEdges(K, Wires, out, &OutNE1, NULL); + TopTools_ListIteratorOfListOfShape it(out); + for (;it.More(); it.Next()) + { + const TopoDS_Shape& NF = it.Value(); + if (!NF.IsNull()) + newDM.Add(NF, V); + } + } + else + newDM.Add(K, V); // ignore edges, wires... + } + + for (int i = 1; i <= OutNE1.Extent(); i++) + OutNE->Bind(OutNE1.FindKey(i), W2P(OutNE1.FindFromIndex(i))); + + DM = newDM; +} + +void HYDROData_SplitToZonesTool::CutFaceByEdges(const TopoDS_Face& in, + TopTools_ListOfShape& out, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE, + TopTools_IndexedDataMapOfShapeListOfShape* OutOrSh2M) +{ + + HYDROData_SequenceOfObjects::Iterator it(thePolylines); + TopTools_ListOfShape Wires; + NCollection_DataMap W2P; + for (;it.More();it.Next()) + { + Handle(HYDROData_PolylineXY) P = Handle(HYDROData_PolylineXY)::DownCast(it.Value()); + const TopoDS_Shape& CW = P->GetShape(); + Wires.Append(CW); + W2P.Bind(CW, P); + } + + TopTools_IndexedDataMapOfShapeShape OutNE1; + CutByEdges(in, Wires, out, &OutNE1, OutOrSh2M); + + for (int i = 1; i <= OutNE1.Extent(); i++) + OutNE->Bind(OutNE1.FindKey(i), W2P(OutNE1.FindFromIndex(i))); + +} + +int HYDROData_SplitToZonesTool::CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW, + TopTools_ListOfShape& outShs, + TopTools_IndexedDataMapOfShapeShape* OutNE, + TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH) +{ + int anError; + if (InSh.IsNull()) + return -1; + if (InW.IsEmpty()) + { + outShs.Clear(); + outShs.Append(InSh); + return 0; + } + TopTools_ListIteratorOfListOfShape anIt; + BOPAlgo_Builder anAlgo; + anAlgo.AddArgument(InSh); + + anIt.Initialize( InW ); + for( ; anIt.More(); anIt.Next() ) + anAlgo.AddArgument( anIt.Value() ); + + anAlgo.Perform(); + anError = anAlgo.ErrorStatus(); + if (anError) + return anError; + + outShs = anAlgo.Modified( InSh ); + if (outShs.IsEmpty()) + outShs.Append(InSh); + + if (OutNE) + { + TopTools_IndexedDataMapOfShapeShape NonFOutNE; + anIt.Initialize( InW ); + for( ; anIt.More(); anIt.Next() ) + { + const TopoDS_Shape& OSH = anIt.Value(); + TopExp_Explorer exp(OSH, TopAbs_EDGE); + for (;exp.More();exp.Next()) + { + const TopoDS_Edge& OE = TopoDS::Edge(exp.Current()); + const TopTools_ListOfShape& ls = anAlgo.Modified(OE); + TopTools_ListIteratorOfListOfShape itls(ls); + for (;itls.More();itls.Next()) + NonFOutNE.Add(itls.Value(), OSH); + } + } + + //filter edges; if face contain an edge => keep it + TopTools_IndexedMapOfShape AllEdges; //edges from output shape + for (anIt.Initialize(outShs); anIt.More();anIt.Next()) + TopExp::MapShapes(anIt.Value(), TopAbs_EDGE, AllEdges); + + for (int i = 1; i <= NonFOutNE.Extent(); i++) + { + const TopoDS_Shape& CE = NonFOutNE.FindKey(i); + const TopoDS_Shape& V = NonFOutNE.FindFromIndex(i); + if (AllEdges.Contains(CE)) + OutNE->Add(CE, V); + } + } + + //map all sub-shapes from the original InSh to modified shapes + if (OInSH2MSH) + { + TopTools_IndexedMapOfShape allSh; + TopExp::MapShapes(InSh, allSh); + for(int i = 1; i <= allSh.Extent(); i++ ) + { + const TopoDS_Shape& or_sh = allSh(i); + const TopTools_ListOfShape& ls = anAlgo.Modified(or_sh); + OInSH2MSH->Add(or_sh, ls); + } + } - return Split( theObjectList, aGeomGroups, aPolyline ); + return 0; } diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.h b/src/HYDROData/HYDROData_SplitToZonesTool.h index c5545978..2e3b8711 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.h +++ b/src/HYDROData/HYDROData_SplitToZonesTool.h @@ -30,9 +30,11 @@ #include #include #include -#include +#include +#include #include #include +#include class HYDROData_PolylineXY; @@ -50,7 +52,8 @@ public: { Data_None, Data_Zone, - Data_Edge + Data_Edge, + Data_IntEdge }; TopoDS_Shape Shape; @@ -87,10 +90,26 @@ public: static SplitDataList Split( const HYDROData_SequenceOfObjects& theObjectList, const HYDROData_SequenceOfObjects& theGroupsList, - const Handle(HYDROData_PolylineXY)& thePolyline ); + const Handle(HYDROData_PolylineXY)& thePolyline, + const HYDROData_SequenceOfObjects& InterPolys ); static SplitDataList Split( const HYDROData_SequenceOfObjects& theObjectList ); + static void AddInternalEdges(HYDROData_DataMapOfShapeListOfShape& DM, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE); + + static void CutFaceByEdges(const TopoDS_Face& in, + TopTools_ListOfShape& out, + const HYDROData_SequenceOfObjects& thePolylines, + NCollection_DataMap* OutNE, + TopTools_IndexedDataMapOfShapeListOfShape* OutOrSh2M); + + static int CutByEdges(const TopoDS_Shape& InSh, const TopTools_ListOfShape& InW, + TopTools_ListOfShape& outShs, + TopTools_IndexedDataMapOfShapeShape* OutNE2OE, + TopTools_IndexedDataMapOfShapeListOfShape* OInSH2MSH); + static void SetFileNames(const QString& theNameBefore, const QString& theNameAfter); private: diff --git a/src/HYDROData/HYDROData_Stream.cxx b/src/HYDROData/HYDROData_Stream.cxx index 518753aa..3ecb3e77 100644 --- a/src/HYDROData/HYDROData_Stream.cxx +++ b/src/HYDROData/HYDROData_Stream.cxx @@ -27,6 +27,8 @@ #include "HYDROData_IAltitudeObject.h" #include "HYDROData_IProfilesInterpolator.h" #include "HYDROData_Tool.h" +#include "HYDROData_DTM.h" +#include #include @@ -73,6 +75,10 @@ #include #include +#include +#include +#include +#include #include #include @@ -86,6 +92,8 @@ #include #endif +#include + typedef NCollection_DataMap HYDROData_DataMapOfRealOfHDProfile; IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Stream,HYDROData_NaturalObject) @@ -122,6 +130,11 @@ QStringList HYDROData_Stream::DumpToPython( const QString& thePyScriptPath setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBottomPolyline, "SetBottomPolyline" ); } + QString aDDZs = QString::number( GetDDZ(), 'f', 3 ); + QString aSSteps = QString::number( GetSpatialStep(), 'f', 3 ); + aResList << QString( "%1.SetDDZ( %2 )" ).arg( aName ).arg( aDDZs ); + aResList << QString( "%1.SetSpatialStep( %2 )" ).arg( aName ).arg( aSSteps ); + aResList << QString( "" ); aResList << QString( "%1.Update()" ).arg( aName ); aResList << QString( "" ); @@ -156,7 +169,8 @@ Handle(Geom_BSplineCurve) HYDROData_Stream::buildInterpolationCurve( void HYDROData_Stream::Update() { - updateProfilesOrder(); + if (!GetHydraulicAxis().IsNull()) + updateProfilesOrder(); // Update bottom polyline if exists const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline(); @@ -170,7 +184,11 @@ void HYDROData_Stream::Update() } } - UpdatePrs(); + Handle(HYDROData_DTM) dtm = DTM(); + dtm->Update(); + UpdatePrs( dtm ); + + HYDROData_NaturalObject::Update(); } bool HYDROData_Stream::IsHas2dPrs() const @@ -178,64 +196,58 @@ bool HYDROData_Stream::IsHas2dPrs() const return true; } -bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis, - const HYDROData_SequenceOfObjects& theProfiles, - PrsDefinition& thePrs ) +bool HYDROData_Stream::CreatePresentations( const Handle(HYDROData_DTM)& theDTM, + PrsDefinition& thePrs ) { - if ( theHydAxis.IsNull() || theProfiles.Length() < 2 ) + if ( theDTM.IsNull() ) + return false; + + HYDROData_SequenceOfObjects profiles = theDTM->GetProfiles(); + if( profiles.Length() < 2 ) return false; - Handle(TColgp_HArray1OfPnt) anArrayOfFPnt = new TColgp_HArray1OfPnt(1, theProfiles.Length()); - Handle(TColgp_HArray1OfPnt) anArrayOfLPnt = new TColgp_HArray1OfPnt(1, theProfiles.Length()); - Handle(TopTools_HArray1OfShape) anArrOfProfiles = new TopTools_HArray1OfShape(1, theProfiles.Length()); - Handle(TopTools_HArray1OfShape) anArrOf2DProfiles = new TopTools_HArray1OfShape(1, theProfiles.Length()); + TopoDS_Shape Out3dPres; + TopoDS_Shape Out2dPres; + TopoDS_Shape OutLeftB; + TopoDS_Shape OutRightB; + TopoDS_Shape OutInlet; + TopoDS_Shape OutOutlet; + + theDTM->GetPresentationShapes(Out3dPres, Out2dPres, OutLeftB, OutRightB, OutInlet, OutOutlet); + + thePrs.myInlet = TopoDS::Wire(OutInlet); + thePrs.myOutlet = TopoDS::Wire(OutOutlet); + thePrs.myLeftBank = TopoDS::Wire(OutLeftB); + thePrs.myRightBank = TopoDS::Wire(OutRightB); + thePrs.myPrs2D = Out2dPres; + thePrs.myPrs3D = Out3dPres; + /*std::vector profiles3d; + profiles3d.reserve(profiles.Length()); // Pre-processing - HYDROData_SequenceOfObjects::Iterator anIter( theProfiles ); + HYDROData_SequenceOfObjects::Iterator anIter( profiles ); for (int i=1 ; anIter.More(); anIter.Next(),i++ ) { Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( anIter.Value() ); - if ( aProfile.IsNull() ) - continue; - const TopoDS_Shape& aProf3d = aProfile->GetShape3D(); - gp_XY aPnt1, aPnt2; - if ( !aProfile->GetLeftPoint( aPnt1, false ) || !aProfile->GetRightPoint( aPnt2, false ) ) + if ( aProfile.IsNull() ) continue; - anArrOfProfiles->SetValue(i,aProfile->GetShape3D());//aProfile->GetTopShape(); - anArrOf2DProfiles->SetValue(i,aProfile->GetTopShape()); + const TopoDS_Shape& aProfileShape = aProfile->GetShape3D(); + //TopExp_Explorer exp(aProfileShape, TopAbs_EDGE); + profiles3d.push_back( TopoDS::Wire(aProfileShape) ); + }*/ - gp_Pnt aCurFP, aCurLP; - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(TopoDS::Wire(aProf3d), aV1, aV2); - gp_Pnt aP1 = BRep_Tool::Pnt(aV1); - if(aP1.X() == aPnt1.X() && aP1.Y() == aPnt1.Y()) - aCurFP = aP1; - else - aCurLP = aP1; - aP1 = BRep_Tool::Pnt(aV2); - if(aP1.X() == aPnt2.X() && aP1.Y() == aPnt2.Y()) - aCurLP = aP1; - else - aCurFP = aP1; - anArrayOfFPnt->SetValue(i,aCurFP); - anArrayOfLPnt->SetValue(i,aCurLP); - } - - return CreatePresentations( anArrayOfFPnt, anArrayOfLPnt, anArrOfProfiles, anArrOf2DProfiles, thePrs ); + return true; } -void HYDROData_Stream::UpdatePrs() +void HYDROData_Stream::UpdatePrs( const Handle(HYDROData_DTM)& theDTM ) { HYDROData_NaturalObject::Update(); - - Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); - HYDROData_SequenceOfObjects aRefProfiles = GetProfiles(); - + PrsDefinition aResultPrs; - if ( !CreatePresentations( aHydAxis, aRefProfiles, aResultPrs ) ) + if ( !CreatePresentations( theDTM, aResultPrs ) ) return; SetShape3D( aResultPrs.myPrs3D ); @@ -280,7 +292,7 @@ QColor HYDROData_Stream::DefaultBorderColor() const bool HYDROData_Stream::IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theHydAxis ) { if ( theHydAxis.IsNull() ) - return false; + return true; TopoDS_Shape aHydraulicShape = theHydAxis->GetShape(); if ( aHydraulicShape.IsNull() || @@ -315,6 +327,34 @@ TopoDS_Shape HYDROData_Stream::GetOutletShape() const return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 4); } +Handle(HYDROData_DTM) HYDROData_Stream::DTM() const +{ + const_cast( this )->checkAndSetAltitudeObject(); + return Handle(HYDROData_DTM)::DownCast( GetAltitudeObject() ); +} + +double HYDROData_Stream::GetDDZ() const +{ + return DTM()->GetDDZ(); +} + +void HYDROData_Stream::SetDDZ( double theDDZ ) +{ + DTM()->SetDDZ( theDDZ ); + Changed( Geom_3d ); +} + +double HYDROData_Stream::GetSpatialStep() const +{ + return DTM()->GetSpatialStep(); +} + +void HYDROData_Stream::SetSpatialStep( double theSpatialStep ) +{ + DTM()->SetSpatialStep( theSpatialStep ); + Changed( Geom_3d ); +} + bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis ) { if ( !IsValidAsAxis( theAxis ) ) @@ -364,23 +404,32 @@ bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_Profile)& theProf return HasIntersection( aHydAxis, theProfile, thePlane, theOutPar ); } +#include + bool HYDROData_Stream::HasIntersection( const Handle(HYDROData_PolylineXY)& theHydAxis, const Handle(HYDROData_Profile)& theProfile, const TopoDS_Face& thePlane, Standard_Real& theOutPar ) { - if ( theProfile.IsNull() || !IsValidAsAxis( theHydAxis ) ) + if ( theProfile.IsNull() /*|| !IsValidAsAxis( theHydAxis )*/ ) return false; + if (theHydAxis.IsNull()) + return true; //empty h_axis; its's OK + TopoDS_Wire aHydraulicWire = TopoDS::Wire( theHydAxis->GetShape() ); //guide line TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() ); - if ( aHydraulicWire.IsNull() || aProfileWire.IsNull() ) + if ( aProfileWire.IsNull() ) return false; - BRepProj_Projection aProjector (aProfileWire, thePlane, gp::OZ().Direction()); - if(!aProjector.IsDone()) + //BRepProj_Projection aProjector (aProfileWire, thePlane, gp::OZ().Direction()); + BRepAlgo_NormalProjection nproj(thePlane); + nproj.Add(aProfileWire); + nproj.SetDefaultParams(); + nproj.Build(); + if(!nproj.IsDone()) return false; - TopoDS_Shape aPrjProfile = aProjector.Shape(); + TopoDS_Shape aPrjProfile = nproj.Projection(); if(aPrjProfile.IsNull()) return false; TopoDS_Vertex aV1, aV2; @@ -471,13 +520,12 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile ) if ( theProfile.IsNull() ) return false; - Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); - if ( aHydAxis.IsNull() ) - return false; + // Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); + // if ( aHydAxis.IsNull() ) + // return false; TopoDS_Face aPlane; - if(!BuildFace(aHydAxis, aPlane)) - return false; + BuildRefFace( aPlane ); Standard_Real aPar(.0); if ( HasReference( theProfile, DataTag_Profile ) || !HasIntersection( theProfile, aPlane, aPar ) ) @@ -505,7 +553,10 @@ bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfil continue; if ( !AddProfile( aProfile ) ) + { + DTM()->SetProfiles( HYDROData_SequenceOfObjects() ); return false; + } } } else // Just store the sequence of objects as is @@ -535,6 +586,7 @@ bool HYDROData_Stream::SetProfiles( const HYDROData_SequenceOfObjects& theProfil Changed( Geom_3d ); } + DTM()->SetProfiles( GetProfiles() ); return true; } @@ -594,13 +646,13 @@ void HYDROData_Stream::RemoveProfiles() void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile, const int theBeforeIndex ) { - Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); - if ( theProfile.IsNull() || aHydAxis.IsNull() ) + //Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis(); + if ( theProfile.IsNull() ) return; - TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() ); + //TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() ); TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() ); - if ( aHydraulicWire.IsNull() || aProfileWire.IsNull() ) + if ( aProfileWire.IsNull() ) return; if ( theBeforeIndex == -1 ) @@ -609,25 +661,9 @@ void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& InsertReferenceObject( theProfile, DataTag_Profile, theBeforeIndex ); } -bool HYDROData_Stream::BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, - TopoDS_Face& thePlane ) +void HYDROData_Stream::BuildRefFace( TopoDS_Face& thePlane ) { - if ( !IsValidAsAxis( theHydAxis ) ) - return false; - - TopoDS_Wire aHydraulicWire = TopoDS::Wire( theHydAxis->GetShape() ); - - gp_Ax2 aX2(gp::XOY()); - gp_Ax3 aX3(aX2); - gp_Pln aPln(aX3); - Bnd_Box B; - BRepBndLib::Add(aHydraulicWire,B); - Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; - B.Get(axmin,aymin,azmin,axmax,aymax,azmax); - BRepBuilderAPI_MakeFace aMkr(aPln, axmin-500., axmax+500., aymin-500., aymax+500.); // to be tuned later according max/ Profile deviation - if(!aMkr.IsDone() || aMkr.Shape().IsNull()) return false; - thePlane = TopoDS::Face(aMkr.Shape()); - return true; + thePlane = BRepBuilderAPI_MakeFace(gp_Pln(gp_Pnt(0,0,0),gp_Dir(0,0,1))).Face(); } void HYDROData_Stream::updateProfilesOrder() @@ -644,8 +680,7 @@ void HYDROData_Stream::updateProfilesOrder() return; TopoDS_Face aPlane; - if ( !BuildFace( aHydAxis, aPlane ) ) - return; + BuildRefFace( aPlane ); Standard_Real aPar( .0 ); @@ -711,7 +746,7 @@ void HYDROData_Stream::updateProfilesOrder() ObjectKind HYDROData_Stream::getAltitudeObjectType() const { - return KIND_STREAM_ALTITUDE; + return KIND_DTM; } void HYDROData_Stream::setParametersArray( const QVector& theArray ) @@ -1013,155 +1048,78 @@ void HYDROData_Stream::CopyTo( const Handle(HYDROData_Entity)& theDestination, } } } - -bool HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt, +void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt, const Handle(TColgp_HArray1OfPnt) theArrayOfLPnt, const Handle(TopTools_HArray1OfShape) theArrOfProfiles, - const Handle(TopTools_HArray1OfShape) theArrOf2DProfiles, PrsDefinition& thePrs ) { - if ( theArrayOfFPnt.IsNull() || theArrayOfLPnt.IsNull() || theArrOfProfiles.IsNull() ) { - return false; - } - if ( theArrayOfFPnt->Length() != theArrayOfLPnt->Length() ) { - return false; - } - - // Construct of the 3D presentation - Handle(Geom_BSplineCurve) aBSpline = buildInterpolationCurve (theArrayOfFPnt); - if(aBSpline.IsNull()) - return false; - - TopoDS_Edge anEdgLeft, anEdgRight; - - BRepBuilderAPI_MakeEdge aMakeEdge(aBSpline); - if(aMakeEdge.IsDone()) - anEdgLeft = aMakeEdge.Edge(); - - if(anEdgLeft.IsNull()) - return false; - - aBSpline.Nullify(); - aBSpline = buildInterpolationCurve (theArrayOfLPnt); - if(aBSpline.IsNull()) - return false; - - aMakeEdge.Init(aBSpline); - if(aMakeEdge.IsDone()) - anEdgRight = aMakeEdge.Edge(); - - if(anEdgRight.IsNull()) - return false; - - BRep_Builder aBB; - TopoDS_Compound aCmp; - aBB.MakeCompound(aCmp); - for (int i=1 ; i < theArrOfProfiles->Length() +1; i++ ) - aBB.Add(aCmp, theArrOfProfiles->Value(i)); - - aBB.Add(aCmp,anEdgLeft); - aBB.Add(aCmp,anEdgRight); - BRepCheck_Analyzer aCh(aCmp); - if(aCh.IsValid()) - thePrs.myPrs3D = aCmp; -#ifdef DEB_UPDATE - else { - BRepTools::Write(aCmp, "str3d.brep"); - thePrs.myPrs3D = aCmp; + HYDROData_Bathymetry::AltitudePoints left; + for (int i = theArrayOfLPnt->Lower(); i <= theArrayOfLPnt->Upper(); i++) + { + left.push_back(HYDROData_Bathymetry::AltitudePoint(theArrayOfLPnt->Value(i).X(), + theArrayOfLPnt->Value(i).Y(), + theArrayOfLPnt->Value(i).Z())); } -#endif - // Construct the top presentation - int aNbPoints = theArrayOfFPnt->Length(); - Handle(TColgp_HArray1OfPnt) anArrayOfFPnt = new TColgp_HArray1OfPnt(1, aNbPoints); - Handle(TColgp_HArray1OfPnt) anArrayOfLPnt = new TColgp_HArray1OfPnt(1, aNbPoints); - for( int i=1; i <= aNbPoints; i++ ) { - gp_Pnt aPnt = theArrayOfFPnt->Value(i); - aPnt.SetZ(.0); // make 2d - anArrayOfFPnt->SetValue(i, aPnt); - aPnt = theArrayOfLPnt->Value(i); - aPnt.SetZ(.0); - anArrayOfLPnt->SetValue(i, aPnt); + HYDROData_Bathymetry::AltitudePoints right; + for (int i = theArrayOfFPnt->Lower(); i <= theArrayOfFPnt->Upper(); i++) + { + right.push_back(HYDROData_Bathymetry::AltitudePoint(theArrayOfFPnt->Value(i).X(), + theArrayOfFPnt->Value(i).Y(), + theArrayOfFPnt->Value(i).Z())); } - aBSpline.Nullify(); - aBSpline = buildInterpolationCurve (anArrayOfFPnt); - if(aBSpline.IsNull()) - return false; - - aMakeEdge.Init(aBSpline); - if(aMakeEdge.IsDone()) - anEdgLeft = aMakeEdge.Edge(); - - aBSpline.Nullify(); - aBSpline = buildInterpolationCurve (anArrayOfLPnt); - if(aBSpline.IsNull()) - return false; - - aMakeEdge.Init(aBSpline); - if(aMakeEdge.IsDone()) - anEdgRight = aMakeEdge.Edge(); - if(anEdgRight.IsNull()) - return false; - - BRepBuilderAPI_MakeEdge aMakeEdge2(anArrayOfFPnt->Value(1),anArrayOfLPnt->Value(1)); - TopoDS_Edge aBotEdge, aTopEdge; - if(aMakeEdge2.IsDone()) - aBotEdge = aMakeEdge2.Edge(); - - BRepBuilderAPI_MakeEdge aMakeEdge3(anArrayOfFPnt->Value(anArrayOfFPnt->Length()),anArrayOfLPnt->Value(anArrayOfLPnt->Length())); - if(aMakeEdge3.IsDone()) - aTopEdge = aMakeEdge3.Edge(); + std::vector dummy; + TopTools_IndexedMapOfOrientedShape ll = HYDROData_DTM::Create3DShape(left, right, dummy); - // Make wire for 2D presentation with updating of corresponding edges - BRepBuilderAPI_MakeWire aMakeWire; - - aMakeWire.Add( aBotEdge ); - thePrs.myInlet = aMakeWire.Edge(); - - aMakeWire.Add( anEdgLeft ); - thePrs.myLeftBank = aMakeWire.Edge(); - - aMakeWire.Add( aTopEdge ); - thePrs.myOutlet = aMakeWire.Edge(); - - aMakeWire.Add( anEdgRight ); - thePrs.myRightBank = aMakeWire.Edge(); - - TopoDS_Wire aSectProfileWire; - if(aMakeWire.IsDone()) - aSectProfileWire = aMakeWire.Wire(); - - BRepBuilderAPI_MakeFace aMakeFace( aSectProfileWire, Standard_True ); - TopoDS_Face aFace; - aMakeFace.Build(); - if( aMakeFace.IsDone() ) - aFace = aMakeFace.Face(); + TopoDS_Shape LB, RB, IL, OL; - TopoDS_Shape aPrs2D; - - if ( !theArrOf2DProfiles.IsNull() ) { - aCmp.Nullify(); - aBB.MakeCompound(aCmp); - aBB.Add(aCmp,aFace); - for(int i=1;i <= theArrOf2DProfiles->Length(); i++) - aBB.Add(aCmp, theArrOf2DProfiles->Value(i)); - - aPrs2D = aCmp; - } else { - aPrs2D = aFace; + if (!ll.IsEmpty()) + { + LB = TopoDS::Wire(ll(1)); + RB = TopoDS::Wire(ll(2)); } - aCh.Init(aPrs2D); - if(aCh.IsValid()) - thePrs.myPrs2D = aPrs2D; -#ifdef DEB_UPDATE - else { - BRepTools::Write(aPrs2D, "str2d.brep"); - thePrs.myPrs2D = aPrs2D; + IL = TopoDS::Wire(theArrOfProfiles->Value(theArrOfProfiles->Lower())); //TODO check that + OL = TopoDS::Wire(theArrOfProfiles->Value(theArrOfProfiles->Upper())); + + //make new compound so it's shapes will be in known order to build correct projection + BRep_Builder BB; + TopoDS_Compound newCmp; + BB.MakeCompound(newCmp); + BB.Add(newCmp, LB); + BB.Add(newCmp, IL); + BB.Add(newCmp, OL); + BB.Add(newCmp, RB); + + thePrs.myPrs3D = newCmp; + std::set ind; + ind.insert(1); //inlet ind + ind.insert(2); //outlet ind + + TopTools_SequenceOfShape LS; + HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D), &LS, ind ); + +#ifndef NDEBUG + TopTools_IndexedMapOfShape EE; + TopExp::MapShapes(thePrs.myPrs2D, TopAbs_EDGE, EE); + int noncontNb = 0; + for (int i = 1; i <= 4; i++) + { + TopoDS_Shape W = LS(i); + TopTools_IndexedMapOfShape EW; + TopExp::MapShapes(W, TopAbs_EDGE, EW); + for (int k = 1; k <= EW.Extent(); k++) + noncontNb += !EE.Contains(EW(k)); } + //noncontNb > 0 => some problem with edge history + assert(noncontNb == 0); #endif - return true; + thePrs.myLeftBank = TopoDS::Wire(LS(1)); + thePrs.myInlet = TopoDS::Wire(LS(2)); + thePrs.myOutlet = TopoDS::Wire(LS(3)); + thePrs.myRightBank = TopoDS::Wire(LS(4)); + } diff --git a/src/HYDROData/HYDROData_Stream.h b/src/HYDROData/HYDROData_Stream.h index ee72a164..923c23f5 100644 --- a/src/HYDROData/HYDROData_Stream.h +++ b/src/HYDROData/HYDROData_Stream.h @@ -23,9 +23,12 @@ #include #include +#include #include +#include +class HYDROData_DTM; class HYDROData_PolylineXY; class HYDROData_Polyline3D; class HYDROData_Profile; @@ -45,10 +48,10 @@ public: { TopoDS_Shape myPrs3D; TopoDS_Shape myPrs2D; - TopoDS_Edge myLeftBank; - TopoDS_Edge myRightBank; - TopoDS_Edge myInlet; - TopoDS_Edge myOutlet; + TopoDS_Wire myLeftBank; // 3d curve of the left bank + TopoDS_Wire myRightBank; // 3d curve of the right bank + TopoDS_Wire myInlet; // first (inlet) 2d profile + TopoDS_Wire myOutlet; // last (inlet) 2d profile }; protected: @@ -72,18 +75,12 @@ public: /** * Creates the presentations(2D and 3D) by given hydraulic axis and profiles. */ - HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_PolylineXY)& theHydAxis, - const HYDROData_SequenceOfObjects& theProfiles, - PrsDefinition& thePrs ); + HYDRODATA_EXPORT static bool CreatePresentations( const Handle(HYDROData_DTM)& theDTM, + PrsDefinition& thePrs ); - /** - * Creates the presentations(2D and 3D) by given first points, last points and profiles. - * If 2D profiles is null - they will not used in the presentation. - */ - HYDRODATA_EXPORT static bool CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt, + HYDRODATA_EXPORT static void CreatePresentations( const Handle(TColgp_HArray1OfPnt) theArrayOfFPnt, const Handle(TColgp_HArray1OfPnt) theArrayOfLPnt, const Handle(TopTools_HArray1OfShape) theArrOfProfiles, - const Handle(TopTools_HArray1OfShape) theArrOf2DProfiles, PrsDefinition& thePrs ); public: @@ -118,7 +115,7 @@ public: /** * Update the shape presentations of stream. */ - HYDRODATA_EXPORT virtual void UpdatePrs(); + HYDRODATA_EXPORT void UpdatePrs( const Handle(HYDROData_DTM)& ); /** * @@ -206,8 +203,7 @@ public: /** * Builds a planar face */ - HYDRODATA_EXPORT static bool BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis, - TopoDS_Face& thePlane ); + HYDRODATA_EXPORT static void BuildRefFace( TopoDS_Face& thePlane ); /** * Add new one reference profile object for stream. @@ -260,6 +256,13 @@ public: */ HYDRODATA_EXPORT virtual bool Interpolate( HYDROData_IProfilesInterpolator* theInterpolator ); + + HYDRODATA_EXPORT double GetDDZ() const; + HYDRODATA_EXPORT void SetDDZ( double theDDZ ); + + HYDRODATA_EXPORT double GetSpatialStep() const; + HYDRODATA_EXPORT void SetSpatialStep( double theSpatialStep ); + protected: /** @@ -298,9 +301,12 @@ private: void removeParameter( const int& theIndex ); -protected: + Handle(HYDROData_DTM) DTM() const; + +protected: friend class HYDROData_Iterator; + friend class test_HYDROData_Stream; /** * Creates new object in the internal data structure. Use higher level objects diff --git a/src/HYDROData/HYDROData_StreamAltitude.cxx b/src/HYDROData/HYDROData_StreamAltitude.cxx index cbd1cca0..2360eddd 100644 --- a/src/HYDROData/HYDROData_StreamAltitude.cxx +++ b/src/HYDROData/HYDROData_StreamAltitude.cxx @@ -126,7 +126,7 @@ bool IsPointBetweenEdges2( const gp_Pnt& aFirstPnt1, const gp_Pnt& aLastPnt1, double z1 = x1*ya -xa*y1; // v1^va: z component double z2 = x2*yb -xb*y2; // v2^vb: z component bool isBetween = true; - if (((z1<0) and (z2<0)) or ((z1>=0) and (z2>=0))) + if (((z1<0) && (z2<0)) || ((z1>=0) && (z2>=0))) { isBetween = false; } @@ -138,9 +138,9 @@ bool IsPointBetweenEdges2( const gp_Pnt& aFirstPnt1, const gp_Pnt& aLastPnt1, double dl1 = (aLastPnt1.X()-xg)*(aLastPnt1.X()-xg) + (aLastPnt1.Y()-yg)*(aLastPnt1.Y()-yg); double df2 = (aFirstPnt2.X()-xg)*(aFirstPnt2.X()-xg) + (aFirstPnt2.Y()-yg)*(aFirstPnt2.Y()-yg); double dl2 = (aLastPnt2.X()-xg)*(aLastPnt2.X()-xg) + (aLastPnt2.Y()-yg)*(aLastPnt2.Y()-yg); - double r2 = fmax(df1,dl1); - r2 = fmax(r2,df2); - r2 = fmax(r2,dl2); + double r2 = std::max(df1,dl1); + r2 = std::max(r2,df2); + r2 = std::max(r2,dl2); double d2 = (thePoint.X()-xg)*(thePoint.X()-xg) + (thePoint.Y()-yg)*(thePoint.Y()-yg); if (d2 > r2) isBetween = false; diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 7d133924..091b31d5 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -56,7 +56,7 @@ void HYDROData_Tool::WriteStringsToFile( QFile& theFile, return; QTextStream anOutStream( &theFile ); - anOutStream << aWriteStr << theSep << theSep; + anOutStream << aWriteStr.toUtf8() << theSep << theSep; } QString HYDROData_Tool::GenerateObjectName( const Handle(HYDROData_Document)& theDoc, diff --git a/src/HYDROData/HYDROData_TopoCurve.cxx b/src/HYDROData/HYDROData_TopoCurve.cxx index a69395d4..ffa03610 100644 --- a/src/HYDROData/HYDROData_TopoCurve.cxx +++ b/src/HYDROData/HYDROData_TopoCurve.cxx @@ -373,7 +373,7 @@ bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire) TopExp::MapShapesAndAncestors(theWire, TopAbs_VERTEX, TopAbs_EDGE, aVertexToEdges); const int aVCount = aVertexToEdges.Extent(); - DEBTRACE("initialize VCount= "<< aVCount); + //DEBTRACE("initialize VCount= "<< aVCount); if (aVCount == 0) { return false; @@ -502,7 +502,7 @@ bool HYDROData_TopoCurve::Cut( aParamI ^= 1; } const bool isClosed = IsClosed(); - DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed); + //DEBTRACE("aParamI: " << aParamI << " isClosed: "<< isClosed); if (aParamI < 0) { aEdge.Orientation(TopAbs_FORWARD); @@ -660,9 +660,9 @@ int HYDROData_TopoCurve::Intersect( const TopoDS_Wire& theWire, std::deque >& theParameters) const { - std::string brepName = "theWireToIntersect"; - brepName += ".brep"; - BRepTools::Write( theWire, brepName.c_str() ); + //std::string brepName = "theWireToIntersect"; + //brepName += ".brep"; + //BRepTools::Write( theWire, brepName.c_str() ); int aIntCount = 0; theParameters.resize(myEdges.size()); @@ -679,7 +679,7 @@ int HYDROData_TopoCurve::Intersect( aIntCount += IntersectEdge(aEdge,TopoDS::Edge(aEIt2.Current()), aParams); } } - DEBTRACE("aIntCount " << aIntCount); + //DEBTRACE("aIntCount " << aIntCount); return aIntCount; } diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index 797e5fca..134c3bd0 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -98,6 +98,13 @@ void HYDROGUI_CalculationOp::startOperation() QStringList anEntryList; HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetGeometryObjects( module() ); getNamesAndEntries( aSeq, aList, anEntryList ); + + QStringList List1; + QStringList EList1; + + //add intersection polylines + AddInterPolylinesToList(aList, anEntryList); + aPanel->setAllGeomObjects( aList, anEntryList ); // Get all polylines @@ -147,7 +154,10 @@ void HYDROGUI_CalculationOp::startOperation() aPanel->setBoundary( aPolylineName ); } - aSeq = myEditedObject->GetGeometryObjects(); + aSeq = myEditedObject->GetGeometryObjects(); + HYDROData_SequenceOfObjects anInterPolyList = myEditedObject->GetInterPolyObjects(); + aSeq.Append(anInterPolyList); + getNamesAndEntries( aSeq, aList, anEntryList ); aPanel->includeGeomObjects( aList ); @@ -171,6 +181,26 @@ void HYDROGUI_CalculationOp::startOperation() createPreview( false ); } +void HYDROGUI_CalculationOp::AddInterPolylinesToList(QStringList& theList, QStringList& theEntryList) +{ + HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY ); + Handle(HYDROData_PolylineXY) aPolylineObj; + QString aPolylineName; + for ( ; anIter.More(); anIter.Next() ) + { + aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() ); + if ( !aPolylineObj.IsNull()) + { + aPolylineName = aPolylineObj->GetName(); + if ( !aPolylineName.isEmpty() && !theList.contains(aPolylineName) ) + { + theList.append( aPolylineName ); + theEntryList.append(HYDROGUI_DataObject::dataObjectEntry( aPolylineObj )); + } + } + } +} + void HYDROGUI_CalculationOp::getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, QStringList& theNames, QStringList& theEntries ) const { @@ -510,6 +540,17 @@ void HYDROGUI_CalculationOp::onAddObjects() anAddedList.append( anObject->GetName() ); } + for (int i = 0; i < aSelectedList.length(); i++) + { + Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) ); + if ( aPoly.IsNull() ) + continue; + + if ( myEditedObject->AddInterPoly( aPoly ) ) + anAddedList.append( aPoly->GetName() ); + } + if ( !anAddedList.isEmpty() ) { aPanel->includeGeomObjects( anAddedList ); @@ -540,6 +581,17 @@ void HYDROGUI_CalculationOp::onRemoveObjects() myEditedObject->RemoveGeometryObject( anObject ); } + for (int i = 0; i < aSelectedList.length(); i++) + { + Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( + HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) ); + if ( aPoly.IsNull() ) + continue; + + setObjectVisibility( aPoly, false ); + myEditedObject->RemoveInterPolyObject ( aPoly ); + } + module()->update( UF_OCCViewer ); aPanel->excludeGeomObjects( aSelectedList ); } @@ -1156,7 +1208,9 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) else if ( !theLandCoverMap && myShowGeomObjects ) { HYDROData_SequenceOfObjects aSeqGO = myEditedObject->GetGeometryObjects(); + HYDROData_SequenceOfObjects aSeqP = myEditedObject->GetInterPolyObjects(); aSeq.Append( aSeqGO ); + aSeq.Append( aSeqP ); } Handle(HYDROData_Entity) anEntity; @@ -1184,7 +1238,8 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) } // Get a boundary polyline if any - aSeq.Append( myEditedObject->GetBoundaryPolyline() ); + if (Handle(HYDROData_PolylineXY) aBPoly = myEditedObject->GetBoundaryPolyline()) + aSeq.Append( aBPoly ); module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones ); @@ -1221,16 +1276,19 @@ void HYDROGUI_CalculationOp::createPreview( const bool theLandCoverMap ) HYDROData_SequenceOfObjects::Iterator anIter( aSeq ); for ( ; anIter.More(); anIter.Next() ) { - setObjectVisibility( anIter.Value(), true ); + const Handle(HYDROData_Entity)& ent = anIter.Value(); + if (!ent.IsNull()) + setObjectVisibility( ent, true ); } //Process the draw events for viewer QApplication::processEvents( QEventLoop::ExcludeUserInputEvents ); - if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() ) - vw->onTopView(); } module()->update( UF_OCCViewer | UF_FitAll ); + + if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() ) + vw->onTopView(); } } diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index 42599f59..90925647 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -163,6 +163,8 @@ private: bool createRegion( const QList& theZonesList ); + void AddInterPolylinesToList(QStringList& theList, QStringList& theEntryList); + bool confirmRegionsChange() const; bool confirmModeChange() const; bool confirmOrderChange() const; diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index 93467ea1..77978ee5 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -65,7 +65,7 @@ void HYDROGUI_ExportCalculationOp::commitOperation() bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, QString& theErrorMsg, - QStringList& theBrowseObjectsEntries ) + QStringList& theBrowseObjectsEntries) { // Get the selected calculation case Handle(HYDROData_CalculationCase) aCalculation = @@ -84,12 +84,13 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, dynamic_cast( module()->getApp()->activeStudy() ); // Export + myStatMess.clear(); QString anErrorMsg; if ( aStudy ) { SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() ); GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen(); QString anEntry; - if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg ) ) { + if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg, myStatMess ) ) { theUpdateFlags = UF_ObjBrowser; isOk = true; } @@ -132,7 +133,7 @@ void HYDROGUI_ExportCalculationOp::onApply() // Show message box SUIT_MessageBox::information( module()->getApp()->desktop(), tr( "EXPORT_STATUS" ), - tr( "EXPORT_FINISHED") ); + tr( "EXPORT_FINISHED") + "\n" + getStatMess() ); } else { abort(); @@ -147,3 +148,8 @@ void HYDROGUI_ExportCalculationOp::onApply() anErrorMsg ); } } + +QString HYDROGUI_ExportCalculationOp::getStatMess() +{ + return myStatMess; +} diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h index f7c0d0b3..e73883ce 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h @@ -38,6 +38,10 @@ protected: virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ); virtual void onApply(); + + QString getStatMess(); + + QString myStatMess; }; #endif \ No newline at end of file diff --git a/src/HYDROGUI/HYDROGUI_ImagePrs.cxx b/src/HYDROGUI/HYDROGUI_ImagePrs.cxx index 1a4b2bb9..9ebb95a1 100644 --- a/src/HYDROGUI/HYDROGUI_ImagePrs.cxx +++ b/src/HYDROGUI/HYDROGUI_ImagePrs.cxx @@ -102,6 +102,9 @@ void HYDROGUI_ImagePrs::Compute( const Handle(PrsMgr_PresentationManager3d)&, aPrs->Clear(); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs ); + if( myImage.IsNull() ) + return; + if ( aMode == 0 ) { Handle(Graphic3d_ArrayOfPolylines) aSegments = new Graphic3d_ArrayOfPolylines( 5 ); diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.cxx index 76ab3075..ee73bd2e 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.cxx @@ -24,36 +24,50 @@ #include #include +#include #include #include #include #include #include -#include +#include #include HYDROGUI_ImportBathymetryDlg::HYDROGUI_ImportBathymetryDlg( HYDROGUI_Module* theModule, const QString& theTitle ) -: HYDROGUI_InputPanel( theModule, theTitle ) +: HYDROGUI_InputPanel( theModule, theTitle ), myIsEdit ( false ) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); // Import bathymetry from file myFileNameGroup = new QGroupBox( tr( "IMPORT_BATHYMETRY_FROM_FILE" ) ); - QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup ); + QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAMES" ), myFileNameGroup ); - myFileName = new QLineEdit( myFileNameGroup ); - myFileName->setReadOnly( true ); + myFileNames = new QListWidget( myFileNameGroup ); + myFileNames->setSelectionMode( QAbstractItemView::ExtendedSelection); + //myFileNames->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents ); + //myFileNames->setFocusPolicy(Qt::FocusPolicy::NoFocus); - QToolButton* aBrowseBtn = new QToolButton( myFileNameGroup ); + QPushButton* aBrowseBtn = new QPushButton( myFileNameGroup ); + aBrowseBtn->setText("Add files(s)"); aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) ); - QBoxLayout* aFileNameLayout = new QHBoxLayout( myFileNameGroup ); + QPushButton* aRemoveBtn = new QPushButton( myFileNameGroup ); + aRemoveBtn->setText("Remove selected file(s)"); + + QBoxLayout* aFileNameLayout = new QVBoxLayout( myFileNameGroup ); + + myFuseIntoOne = new QCheckBox(); + myFuseIntoOne->setText("Import as one bathymetry object (fuse the geometry data)"); + myFuseIntoOne->setEnabled( false ); + aFileNameLayout->setMargin( 5 ); aFileNameLayout->setSpacing( 5 ); - aFileNameLayout->addWidget( aFileNameLabel ); - aFileNameLayout->addWidget( myFileName ); + aFileNameLayout->addWidget( aFileNameLabel ); aFileNameLayout->addWidget( aBrowseBtn ); + aFileNameLayout->addWidget( aRemoveBtn ); + aFileNameLayout->addWidget( myFileNames ); + aFileNameLayout->addWidget( myFuseIntoOne ); // Bathymetry name myObjectNameGroup = new QGroupBox( tr( "BATHYMETRY_NAME" ) ); @@ -77,6 +91,8 @@ HYDROGUI_ImportBathymetryDlg::HYDROGUI_ImportBathymetryDlg( HYDROGUI_Module* the addStretch(); connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) ); + connect( aRemoveBtn, SIGNAL( clicked() ), this, SLOT( onRemove() ) ); + connect( myFuseIntoOne, SIGNAL( stateChanged(int) ), this, SLOT( onStateChanged(int) ) ); } HYDROGUI_ImportBathymetryDlg::~HYDROGUI_ImportBathymetryDlg() @@ -85,15 +101,24 @@ HYDROGUI_ImportBathymetryDlg::~HYDROGUI_ImportBathymetryDlg() void HYDROGUI_ImportBathymetryDlg::reset() { - myFileName->clear(); + myFileNames->clear(); myObjectName->clear(); myObjectNameGroup->setEnabled( false ); + myFuseIntoOne->setEnabled( false ); +} + +void HYDROGUI_ImportBathymetryDlg::SetEditMode(bool isEdit) +{ + myIsEdit = isEdit; } void HYDROGUI_ImportBathymetryDlg::setObjectName( const QString& theName ) { myObjectName->setText( theName ); - myObjectNameGroup->setEnabled( !theName.isEmpty() || !myFileName->text().isEmpty() ); + bool ObjNameState = myObjectName->isEnabled(); + myObjectNameGroup->setEnabled( !theName.isEmpty() || myFileNames->count() > 0 ); + myObjectName->setEnabled(ObjNameState); + myFuseIntoOne->setEnabled( myFileNames->count() > 1 ); } QString HYDROGUI_ImportBathymetryDlg::getObjectName() const @@ -101,17 +126,69 @@ QString HYDROGUI_ImportBathymetryDlg::getObjectName() const return myObjectName->text(); } -void HYDROGUI_ImportBathymetryDlg::setFileName( const QString& theFileName ) +void HYDROGUI_ImportBathymetryDlg::addFileNames( const QStringList& theFileNames ) +{ + //myFileNames->clear(); + QSet exfilenames = getFileNames().toSet(); + QStringList newFileNames; + foreach (QString str, theFileNames) + if (!exfilenames.contains(str)) + newFileNames.append(str); + myFileNames->addItems( newFileNames ); + UpdateCheckBoxStates(); +} + +void HYDROGUI_ImportBathymetryDlg::removeFileNames( const QList& theFileNamesToRem ) +{ + foreach (QListWidgetItem* item, theFileNamesToRem) + delete myFileNames->takeItem(myFileNames->row(item)); + UpdateCheckBoxStates(); +} + + +void HYDROGUI_ImportBathymetryDlg::UpdateCheckBoxStates() { - myFileName->setText( theFileName ); + if (myFuseIntoOne->isChecked() || myFileNames->count() == 1 ) + { + myObjectNameGroup->setEnabled( true ); + myObjectName->setEnabled( true ); + } + else + { + myObjectNameGroup->setEnabled( false ); + myObjectName->setEnabled( false ); + } + // + if (myFileNames->count() <= 1 || myIsEdit) + myFuseIntoOne->setEnabled( false ); + else + myFuseIntoOne->setEnabled( true ); + + QString anObjectName = getObjectName().simplified(); + + QStringList aFileNames = getFileNames(); + if ( anObjectName.isEmpty() ) + { + if (!aFileNames.empty()) + { + anObjectName = aFileNames[0]; + if ( !anObjectName.isEmpty() ) + anObjectName = QFileInfo( anObjectName ).baseName(); + } + setObjectName( anObjectName ); + } - if ( !myObjectNameGroup->isEnabled() ) - myObjectNameGroup->setEnabled( !theFileName.isEmpty() ); } -QString HYDROGUI_ImportBathymetryDlg::getFileName() const +QStringList HYDROGUI_ImportBathymetryDlg::getFileNames() const { - return myFileName->text(); + QStringList stritems; + for(int i = 0; i < myFileNames->count(); ++i) + { + QListWidgetItem* item = myFileNames->item(i); + stritems << item->text(); + } + return stritems; } void HYDROGUI_ImportBathymetryDlg::setInvertAltitudes( const bool theIsInvert ) @@ -124,18 +201,60 @@ bool HYDROGUI_ImportBathymetryDlg::isInvertAltitudes() const return myInvertAltitudes->isChecked(); } +void HYDROGUI_ImportBathymetryDlg::setFuseIntoOneOptionChecked( bool isFIO ) +{ + myFuseIntoOne->setChecked( isFIO ); +} + +bool HYDROGUI_ImportBathymetryDlg::isFuseIntoOneOptionChecked() const +{ + return myFuseIntoOne->isChecked(); +} + +void HYDROGUI_ImportBathymetryDlg::setFuseIntoOneOptionEnabled(bool enabled) +{ + myFuseIntoOne->setEnabled(enabled); +} + +bool HYDROGUI_ImportBathymetryDlg::isFuseIntoOneOptionEnabled() const +{ + return myFuseIntoOne->isEnabled(); +} + void HYDROGUI_ImportBathymetryDlg::onBrowse() { QString aFilter( tr( "BATHYMETRY_FILTER" ) ); - QString aFileName = SUIT_FileDlg::getFileName( this, "", aFilter, tr( "IMPORT_BATHYMETRY_FROM_FILE" ), true ); + QStringList aFileNames = SUIT_FileDlg::getOpenFileNames( this, "", aFilter, tr( "IMPORT_BATHYMETRY_FROM_FILE" ), true ); - if( !aFileName.isEmpty() ) + if( !aFileNames.isEmpty() ) { - setFileName( aFileName ); - emit FileSelected( aFileName ); + addFileNames( aFileNames ); + emit FileSelected( aFileNames ); } } +void HYDROGUI_ImportBathymetryDlg::onRemove() +{ + QList selected = myFileNames->selectedItems(); + + removeFileNames(selected); +} +void HYDROGUI_ImportBathymetryDlg::onStateChanged (int state) +{ + if (getFileNames().count() > 1) + { + if (state == Qt::Checked) + { + myObjectName->setEnabled(true); + myObjectNameGroup->setEnabled(true); + } + else if (state == Qt::Unchecked) + { + myObjectName->setEnabled(false); + myObjectNameGroup->setEnabled(false); + } + } +} diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.h b/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.h index d854e1bb..d8443438 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.h +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryDlg.h @@ -22,10 +22,14 @@ #include "HYDROGUI_InputPanel.h" #include +#include class QGroupBox; class QLineEdit; class QCheckBox; +class QListWidget; +class QStringList; +class QListWidgetItem; class HYDROGUI_ImportBathymetryDlg : public HYDROGUI_InputPanel { @@ -40,26 +44,43 @@ public: void setObjectName( const QString& theName ); QString getObjectName() const; - void setFileName( const QString& theFileName ); - QString getFileName() const; + //void setFileNames( const QStringList& theFileName ); + QStringList getFileNames() const; + void addFileNames( const QStringList& theFileNames ); + void removeFileNames( const QList& theFileNamesToRem ); + void UpdateCheckBoxStates(); void setInvertAltitudes( const bool theIsInvert ); bool isInvertAltitudes() const; + void setFuseIntoOneOptionChecked( bool isFIO ); + bool isFuseIntoOneOptionChecked() const; + void setFuseIntoOneOptionEnabled(bool enabled); + bool isFuseIntoOneOptionEnabled() const; + + void SetEditMode(bool isEdit); + + signals: - void FileSelected( const QString& theFileName ); + void FileSelected( const QStringList& theFileName ); protected slots: void onBrowse(); + void onRemove(); + void onStateChanged (int state); private: QGroupBox* myFileNameGroup; - QLineEdit* myFileName; + QListWidget* myFileNames; QCheckBox* myInvertAltitudes; + QCheckBox* myFuseIntoOne; + QGroupBox* myObjectNameGroup; QLineEdit* myObjectName; + + bool myIsEdit; }; #endif diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx index d8b3abbc..71fd99e0 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.cxx @@ -34,6 +34,10 @@ #include #include +#include +#include +#include + HYDROGUI_ImportBathymetryOp::HYDROGUI_ImportBathymetryOp( HYDROGUI_Module* theModule, const bool theIsEdit ) @@ -57,6 +61,7 @@ void HYDROGUI_ImportBathymetryOp::startOperation() return; aPanel->reset(); + aPanel->SetEditMode(myIsEdit); if( myIsEdit ) { @@ -65,12 +70,15 @@ void HYDROGUI_ImportBathymetryOp::startOperation() if( !myEditedObject.IsNull() ) { QString aName = myEditedObject->GetName(); - QString aFileName = HYDROGUI_Tool::ToQString( myEditedObject->GetFilePath() ); + QStringList aFileNames = myEditedObject->GetFilePaths(); bool anIsAltitudesInverted = myEditedObject->IsAltitudesInverted(); + aPanel->setFuseIntoOneOptionChecked( true ); + aPanel->setObjectName( aName ); - aPanel->setFileName( aFileName ); + aPanel->addFileNames( aFileNames ); aPanel->setInvertAltitudes( anIsAltitudesInverted ); + aPanel->setFuseIntoOneOptionEnabled( false ); } } } @@ -89,7 +97,7 @@ HYDROGUI_InputPanel* HYDROGUI_ImportBathymetryOp::createInputPanel() const { HYDROGUI_InputPanel* aPanel = new HYDROGUI_ImportBathymetryDlg( module(), getName() ); - connect ( aPanel, SIGNAL( FileSelected( const QString& ) ), SLOT( onFileSelected() ) ); + connect ( aPanel, SIGNAL( FileSelected( const QStringList& ) ), SLOT( onFileSelected() ) ); return aPanel; } @@ -110,64 +118,144 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags, return false; } - QString aFileName = aPanel->getFileName().simplified(); - bool anIsInvertAltitudes = aPanel->isInvertAltitudes(); + QStringList aFileNames = aPanel->getFileNames(); - if ( aFileName.isEmpty() ) - { - theErrorMsg = tr( "INCORRECT_FILE_NAME" ); - return false; - } + QStringList DummyFileList; + foreach (QString str, aFileNames) + DummyFileList << str.simplified(); - QFileInfo aFileInfo( aFileName ); - if ( !aFileInfo.exists() || !aFileInfo.isReadable() ) + aFileNames = DummyFileList; + DummyFileList.clear(); + + if ( aFileNames.isEmpty() ) { - theErrorMsg = tr( "FILE_NOT_EXISTS_OR_CANT_BE_READ" ).arg( aFileName ); + theErrorMsg = tr( "EMPTY_FILENAMES" ); return false; } - if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anObjectName ) ) + QString inexistWarn; + + foreach (QString aFileName, aFileNames ) { - // check that there are no other objects with the same name in the document - Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), anObjectName ); - if( !anObject.IsNull() ) + QFileInfo aFileInfo( aFileName ); + if ( !aFileInfo.exists() || !aFileInfo.isReadable() ) { - theErrorMsg = tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( anObjectName ); - return false; + inexistWarn += "\n" + aFileName; + continue; } + DummyFileList << aFileName; } - Handle(HYDROData_Bathymetry) aBathymetryObj; + if (!inexistWarn.isNull()) + SUIT_MessageBox::warning( module()->getApp()->desktop(), + tr( "BATHYMETRY_IMPORT_WARNING" ), "Can't read the next files:" + inexistWarn ); + + aFileNames = DummyFileList; + + bool isFuseIntoOneOption = aPanel->isFuseIntoOneOptionChecked(); + bool anIsInvertAltitudes = aPanel->isInvertAltitudes(); + + QString replacemWarn; + QString UnreadFilesWarn; + if ( myIsEdit ) { - aBathymetryObj = myEditedObject; + //edit already existing bath + if (myEditedObject.IsNull()) + return false; + QStringList anOldFileNames = myEditedObject->GetFilePaths(); + //bool anIsInvertAltitudes = aPanel->isInvertAltitudes(); + //myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, false ); + if ( aFileNames.toSet() != anOldFileNames.toSet() ) + { + myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, true ); + if ( !myEditedObject->ImportFromFiles( aFileNames ) ) + { + theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILE" ).arg( aFileNames.join("\n") ); + return false; + } + } + else if ( anIsInvertAltitudes != myEditedObject->IsAltitudesInverted() ) + myEditedObject->SetAltitudesInverted( anIsInvertAltitudes, true ); + + myEditedObject->SetName( anObjectName ); + myEditedObject->Update(); } else { - aBathymetryObj = - Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); - } - if ( aBathymetryObj.IsNull() ) - return false; - - QString anOldFileName = HYDROGUI_Tool::ToQString( aBathymetryObj->GetFilePath() ); - if ( aFileName != anOldFileName ) - { - aBathymetryObj->SetAltitudesInverted( anIsInvertAltitudes, false ); - if ( !aBathymetryObj->ImportFromFile( HYDROGUI_Tool::ToAsciiString( aFileName ) ) ) + //create the new one + if (isFuseIntoOneOption) { - theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILE" ).arg( aFileName ); - return false; + Handle(HYDROData_Bathymetry) aBathymetryObj = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); + if ( aBathymetryObj.IsNull() ) + return false; + aBathymetryObj->SetAltitudesInverted( anIsInvertAltitudes, false ); + if ( !aBathymetryObj->ImportFromFiles( aFileNames ) ) + { + theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILE" ).arg( aFileNames.join("\n") ); + return false; + } + + QString aNewObjName; + if (CheckNameExistingBathy(anObjectName, aNewObjName)) + { + aBathymetryObj->SetName( aNewObjName ); + replacemWarn += "\n'" + anObjectName + "' => '" + aNewObjName + "'"; + } + else + aBathymetryObj->SetName( anObjectName ); + + aBathymetryObj->SetName( anObjectName ); + aBathymetryObj->Update(); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aBathymetryObj ); + theBrowseObjectsEntries.append( anEntry ); + } + else //myedit off + non-fuse => import separate files + { + bool AtLeastOneWasImported = false; + foreach (QString filename, aFileNames) + { + Handle(HYDROData_Bathymetry) aBathymetryObj = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); + if ( aBathymetryObj.IsNull() ) + continue; + aBathymetryObj->SetAltitudesInverted( anIsInvertAltitudes, false ); + if ( !aBathymetryObj->ImportFromFiles( QStringList(filename) ) ) + { + UnreadFilesWarn += "\n" + filename; + continue; + } + + QString anObjectName = QFileInfo( filename ).baseName(); + QString aNewObjName; + if (CheckNameExistingBathy(anObjectName, aNewObjName)) + { + aBathymetryObj->SetName( aNewObjName ); + replacemWarn += "\n'" + anObjectName + "' => '" + aNewObjName + "'"; + } + else + aBathymetryObj->SetName( anObjectName ); + + AtLeastOneWasImported = true; + aBathymetryObj->Update(); + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aBathymetryObj ); + theBrowseObjectsEntries.append( anEntry ); + } + if (!AtLeastOneWasImported) + { + theErrorMsg = tr( "BAD_IMPORTED_BATHYMETRY_FILES" ).arg( aFileNames.join("\n") ); + return false; + } } } - else if ( anIsInvertAltitudes != aBathymetryObj->IsAltitudesInverted() ) - { - aBathymetryObj->SetAltitudesInverted( anIsInvertAltitudes ); - } - aBathymetryObj->SetName( anObjectName ); + if (!UnreadFilesWarn.isNull()) + SUIT_MessageBox::warning( module()->getApp()->desktop(), + tr( "BATHYMETRY_IMPORT_WARNING" ), "The next files cannot be imported:" + UnreadFilesWarn ); + - aBathymetryObj->Update(); + if (!replacemWarn.isNull()) + SUIT_MessageBox::warning( module()->getApp()->desktop(), + tr( "BATHYMETRY_IMPORT_WARNING" ), "The next objects names are already exist in the document; so the new objects was renamed:" + replacemWarn ); // Activate VTK viewer and show the bathymetry SUIT_ViewManager* aVTKMgr = 0; @@ -185,30 +273,12 @@ bool HYDROGUI_ImportBathymetryOp::processApply( int& theUpdateFlags, } } - /* - // If there is no VTK viewer yet then create a new one - if ( !aVTKMgr ) - { - aVTKMgr = module()->getApp()->createViewManager( SVTK_Viewer::Type() ); - } - // Set the bathymetry visible in the VTK viewer - if ( aVTKMgr ) - { - module()->setObjectVisible( (size_t)aVTKMgr->getViewModel(), aBathymetryObj, true ); - }*/ - theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | - UF_VTKViewer | UF_VTK_Forced; - - if( !myIsEdit ) - { - QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aBathymetryObj ); - theBrowseObjectsEntries.append( anEntry ); - } + UF_VTKViewer | UF_VTK_Forced; return true; } - + void HYDROGUI_ImportBathymetryOp::onFileSelected() { HYDROGUI_ImportBathymetryDlg* aPanel = @@ -216,20 +286,19 @@ void HYDROGUI_ImportBathymetryOp::onFileSelected() if ( !aPanel ) return; - QString anObjectName = aPanel->getObjectName().simplified(); - //if ( anObjectName.isEmpty() ) - { - anObjectName = aPanel->getFileName(); - if ( !anObjectName.isEmpty() ) { - anObjectName = QFileInfo( anObjectName ).baseName(); - } + aPanel->UpdateCheckBoxStates(); +} - if ( anObjectName.isEmpty() ) { - anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_BATHYMETRY_NAME" ) ); - } - aPanel->setObjectName( anObjectName ); +bool HYDROGUI_ImportBathymetryOp::CheckNameExistingBathy(const QString& InpName, QString& OutputName) +{ + Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( module(), InpName ); + if (anObject.IsNull()) + return false; + else + { + OutputName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_BATHYMETRY_NAME" ) ); + return true; } } - diff --git a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h index fe214c34..57a7e95d 100644 --- a/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportBathymetryOp.h @@ -42,6 +42,8 @@ protected: virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ); + bool CheckNameExistingBathy(const QString& InpName, QString& OutputName); + protected slots: void onFileSelected(); diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index 82b8f24a..e7faee11 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -94,6 +94,12 @@ void HYDROGUI_ImportPolylineOp::onApply() int aStat = anImporter.ImportPolylines(doc(), aFileName, theEntities, aShapeTypeOfFile ); if (aStat == 1) UpdateView(theEntities); + else if (aStat == 2) + { + UpdateView(theEntities); + SUIT_MessageBox::information(module()->getApp()->desktop(), + tr( "IMPORT_POLYLINE" ), "Contour of the polygon(s) have been imported as polyline(s)"); + } else { QString aMess = "Cannot import content of this file as polyline;\n"; @@ -111,7 +117,7 @@ void HYDROGUI_ImportPolylineOp::onApply() { commitDocOperation(); commit(); - module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init ); + module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init | UF_OCCViewer ); } else abort(); diff --git a/src/HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx b/src/HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx index 5685a5f2..73e755e7 100644 --- a/src/HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_LandCoverMapPrs.cxx @@ -31,8 +31,8 @@ const Quantity_Color EDGES_COLOR = Quantity_NOC_SLATEGRAY; const int HILIGHT_ISO_NB = 10; -IMPLEMENT_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape ) -IMPLEMENT_STANDARD_RTTIEXT( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape ) +//@MZN zzz IMPLEMENT_STANDARD_HANDLE( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape ) +//@MZN zzz IMPLEMENT_STANDARD_RTTIEXT( HYDROGUI_LandCoverMapPrs, AIS_ColoredShape ) HYDROGUI_LandCoverMapPrs::HYDROGUI_LandCoverMapPrs( const Handle(HYDROData_LandCoverMap)& theMap ) : AIS_ColoredShape( theMap->GetShape() ) diff --git a/src/HYDROGUI/HYDROGUI_ListModel.cxx b/src/HYDROGUI/HYDROGUI_ListModel.cxx index 79f46d95..a452d2b3 100644 --- a/src/HYDROGUI/HYDROGUI_ListModel.cxx +++ b/src/HYDROGUI/HYDROGUI_ListModel.cxx @@ -60,6 +60,24 @@ HYDROGUI_ListModel::~HYDROGUI_ListModel() { } +void HYDROGUI_ListModel::setBackgroundColor(int theInd, QColor theColor) +{ + myColoredRow[theInd] = theColor; +} + +void HYDROGUI_ListModel::clearAllBackgroundColors() +{ + myColoredRow.clear(); +} + +QColor HYDROGUI_ListModel::getBackgroundColor(int theInd) const +{ + if (myColoredRow.count( theInd )) + return myColoredRow[theInd]; + else + return QColor(); +} + /** */ QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const @@ -79,6 +97,16 @@ QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) co return QVariant(); } break; + case Qt::BackgroundRole: + { + if( aColumn==0 && aRow >=0 && aRow < myObjects.count() && myColoredRow.contains(aRow)) + { + QBrush aBackgr(myColoredRow[aRow]); + return aBackgr; + } + else + return QVariant(); + } case Qt::DecorationRole: { diff --git a/src/HYDROGUI/HYDROGUI_ListModel.h b/src/HYDROGUI/HYDROGUI_ListModel.h index 8d19b52f..f8246036 100644 --- a/src/HYDROGUI/HYDROGUI_ListModel.h +++ b/src/HYDROGUI/HYDROGUI_ListModel.h @@ -23,6 +23,8 @@ #include #include #include +#include +#include const int HYDROGUI_VisibleRole = Qt::UserRole + 1; const int HYDROGUI_EntryRole = Qt::UserRole + 2; @@ -76,6 +78,10 @@ public: void undoLastMove(); + void setBackgroundColor(int theInd, const QColor theColor); + QColor getBackgroundColor(int theInd) const; + void clearAllBackgroundColors (); + protected: bool isObjectVisible( int theIndex ) const; bool isDragAndDropAllowed( const QList& theItems, const int theDropItem ) const; @@ -85,6 +91,7 @@ private: Object2VisibleList myObjects, myPrevObjects; QPixmap myEmpty, myEye; + QMap myColoredRow; bool myIsDecorationEnabled; }; diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index cd5a630b..38090fe5 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -1821,7 +1821,7 @@ void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis ); - update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) ); + update( UF_OCCViewer | UF_VTKViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) ); } Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const diff --git a/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx b/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx index c17903a3..a6ef3229 100644 --- a/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx +++ b/src/HYDROGUI/HYDROGUI_OrderedListWidget.cxx @@ -137,6 +137,31 @@ void HYDROGUI_OrderedListWidget::setObjects( const HYDROGUI_ListModel::Object2Vi } } +void HYDROGUI_OrderedListWidget::setBackgroundColor (int theInd, QColor theColor) +{ + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + aModel->setBackgroundColor( theInd, theColor ); + } +} + +void HYDROGUI_OrderedListWidget::clearAllBackgroundColors () +{ + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + aModel->clearAllBackgroundColors( ); + } +} + + + QColor HYDROGUI_OrderedListWidget::getBackgroundColor (int theInd) const + { + HYDROGUI_ListModel* aModel = getSourceModel(); + if( aModel ) { + return aModel->getBackgroundColor( theInd ); + } + } + /** Returns the ordered list of objects. @return the list of objects diff --git a/src/HYDROGUI/HYDROGUI_OrderedListWidget.h b/src/HYDROGUI/HYDROGUI_OrderedListWidget.h index d0ac1262..7b1feab7 100644 --- a/src/HYDROGUI/HYDROGUI_OrderedListWidget.h +++ b/src/HYDROGUI/HYDROGUI_OrderedListWidget.h @@ -58,6 +58,10 @@ public: QStringList getSelectedNames() const; QStringList getAllNames() const; + void setBackgroundColor (int theInd, QColor theColor); + QColor getBackgroundColor (int theInd) const; + void clearAllBackgroundColors (); + void undoLastMove(); signals: diff --git a/src/HYDROGUI/HYDROGUI_Polyline.cxx b/src/HYDROGUI/HYDROGUI_Polyline.cxx index 6091415e..b9a7a2aa 100644 --- a/src/HYDROGUI/HYDROGUI_Polyline.cxx +++ b/src/HYDROGUI/HYDROGUI_Polyline.cxx @@ -86,10 +86,20 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth ); TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE ); + Bnd_Box BB; + BRepBndLib::AddClose(myshape, BB); + double xmin, xmax, ymin, ymax, zmin, zmax; + double devCoeff = 0.05; + if (!BB.IsVoid()) + { + BB.Get(xmin, ymin, zmin, xmax, ymax, zmax); //ignore Z coord + double minSide = Min(Abs(xmax - xmin), Abs(ymax - ymin)); + devCoeff = minSide > 50 ? 0.05 : minSide / 3000; + } for ( ; Exp1.More(); Exp1.Next() ) { TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() ); - Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 ); + Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, devCoeff ); if( !anArray.IsNull() ) { aGroup->SetPrimitivesAspect( anAspect ); @@ -153,7 +163,8 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre gp_Pnt aPnt1 = C->Value (aMaxRatioStep); gp_Vec aDir; - if (!UseD1) { + if (!UseD1) + { GCPnts_AbscissaPoint aAbsPoint(aAdC, -aArrLen, aMaxRatioStep); double aParam = aAbsPoint.Parameter(); gp_Pnt aPnt2 = C->Value (aParam); @@ -161,7 +172,8 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre D.Subtract (aPnt2.XYZ()); aDir = D; } - else + + if (UseD1 || aDir.IsEqual (gp_Vec(0,0,0), Precision::Confusion(), Precision::Angular())) C->D1(aMaxRatioStep, aPnt1, aDir); if ( anEdge.Orientation() == TopAbs_REVERSED ) diff --git a/src/HYDROGUI/HYDROGUI_Shape.cxx b/src/HYDROGUI/HYDROGUI_Shape.cxx index f6bc47ae..c34f2cc9 100644 --- a/src/HYDROGUI/HYDROGUI_Shape.cxx +++ b/src/HYDROGUI/HYDROGUI_Shape.cxx @@ -507,7 +507,7 @@ Handle(AIS_InteractiveObject) HYDROGUI_Shape::createShape() const void HYDROGUI_Shape::buildShape() { // Erase previously created shape - erase(); + erase(false); myShape = createShape(); if( myShape.IsNull() ) diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index 72150112..a88b5069 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -37,7 +37,7 @@ HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* HYDROGUI_ShapeBathymetry::~HYDROGUI_ShapeBathymetry() { - myDisplayer->SetToUpdateColorScale(); + setToUpdateColorScale( true ); } void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivateSelection ) @@ -48,7 +48,7 @@ void HYDROGUI_ShapeBathymetry::update( bool theIsUpdateViewer, bool isDeactivate Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( getObject() ); - if ( !aBath.IsNull() ) + if ( !aBath.IsNull() && !aBath->GetAltitudePoints().empty()) { buildShape(); updateShape( false, false ); @@ -70,14 +70,14 @@ Handle(AIS_InteractiveObject) HYDROGUI_ShapeBathymetry::createShape() const aPntCloud->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_WHITE, 2.0)); const HYDROData_Bathymetry::AltitudePoints& aBathPoints = aBath->GetAltitudePoints(); - int aLower = aBathPoints.Lower(); - int anUpper = aBathPoints.Upper(); + int aLower = 0; + int anUpper = (int)aBathPoints.size()-1; HYDROGUI_ShapeBathymetry* aThat = const_cast( this ); aThat->myCoords = new TColgp_HArray1OfPnt( aLower, anUpper ); aThat->myColors = new Quantity_HArray1OfColor( aLower, anUpper ); for( int i=aLower; i<=anUpper; i++ ) - aThat->myCoords->SetValue( i, aBathPoints.Value( i ) ); + aThat->myCoords->SetValue( i, gp_Pnt( aBathPoints[i].X, aBathPoints[i].Y, aBathPoints[i].Z ) ); } return aPntCloud; @@ -104,6 +104,8 @@ void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const void HYDROGUI_ShapeBathymetry::UpdateWithColorScale( const Handle(AIS_ColorScale)& theColorScale ) { + if (!myCoords) + return; for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ ) { double z = myCoords->Value( i ).Z(); @@ -122,8 +124,7 @@ void HYDROGUI_ShapeBathymetry::setVisible( const bool theState, bool isShown = getContext()->IsDisplayed( getAISObject() ); bool isChanged = ( isShown != theState ); HYDROGUI_Shape::setVisible( theState, theIsUpdateViewer ); - if( isChanged ) - myDisplayer->SetToUpdateColorScale(); + setToUpdateColorScale( isChanged ); } void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer ) @@ -131,8 +132,7 @@ void HYDROGUI_ShapeBathymetry::displayShape( const bool theIsUpdateViewer ) bool isShown = getContext()->IsDisplayed( getAISObject() ); bool isChanged = ( !isShown ); HYDROGUI_Shape::displayShape( theIsUpdateViewer ); - if( isChanged ) - myDisplayer->SetToUpdateColorScale(); + setToUpdateColorScale( isChanged ); } void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer ) @@ -140,8 +140,7 @@ void HYDROGUI_ShapeBathymetry::display( const bool theIsUpdateViewer ) bool isShown = getContext()->IsDisplayed( getAISObject() ); bool isChanged = ( !isShown ); HYDROGUI_Shape::display( theIsUpdateViewer ); - if( isChanged ) - myDisplayer->SetToUpdateColorScale(); + setToUpdateColorScale( isChanged ); } void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer ) @@ -149,6 +148,13 @@ void HYDROGUI_ShapeBathymetry::erase( const bool theIsUpdateViewer ) bool isShown = getContext()->IsDisplayed( getAISObject() ); bool isChanged = ( isShown ); HYDROGUI_Shape::erase( theIsUpdateViewer ); - if( isChanged ) + setToUpdateColorScale( isChanged ); +} + +void HYDROGUI_ShapeBathymetry::setToUpdateColorScale( bool isChanged ) +{ +#ifndef LIGHT_MODE + if( isChanged && myDisplayer ) myDisplayer->SetToUpdateColorScale(); +#endif } diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h index 459acd58..c736c60f 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h @@ -51,6 +51,8 @@ protected: virtual Handle(AIS_InteractiveObject) createShape() const; virtual void displayShape( const bool theIsUpdateViewer ); + void setToUpdateColorScale( bool isChanged ); + private: HYDROGUI_OCCDisplayer* myDisplayer; Handle(TColgp_HArray1OfPnt) myCoords; diff --git a/src/HYDROGUI/HYDROGUI_StreamDlg.cxx b/src/HYDROGUI/HYDROGUI_StreamDlg.cxx index 591e175e..a07c5fe7 100644 --- a/src/HYDROGUI/HYDROGUI_StreamDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_StreamDlg.cxx @@ -17,16 +17,16 @@ // #include "HYDROGUI_StreamDlg.h" - #include "HYDROGUI_ListSelector.h" -#include "HYDROGUI_Module.h" #include "HYDROGUI_OrderedListWidget.h" -#include "HYDROGUI_Tool2.h" - #include -#include -#include +#ifndef LIGHT_MODE + #include "HYDROGUI_Module.h" + #include "HYDROGUI_Tool2.h" + #include + #include +#endif #include #include @@ -35,6 +35,8 @@ #include #include #include +#include +#include HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QString& theTitle ) : HYDROGUI_InputPanel( theModule, theTitle ) @@ -55,9 +57,25 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin myAxes = new QComboBox( aParamGroup ); myAxes->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - QBoxLayout* anAxisLayout = new QHBoxLayout(); - anAxisLayout->addWidget( new QLabel( tr( "STREAM_HYDRAULIC_AXIS" ) ) ); - anAxisLayout->addWidget( myAxes ); + myDDZ = new QDoubleSpinBox( aParamGroup ); + myDDZ->setRange( 0.01, 100 ); + myDDZ->setSingleStep( 0.1 ); + myDDZ->setValue( 0.1 ); + myDDZ->setDecimals( 2 ); + mySpatialStep = new QDoubleSpinBox( aParamGroup ); + mySpatialStep->setRange( 0.1, 100 ); + mySpatialStep->setSingleStep( 0.1 ); + mySpatialStep->setValue( 1 ); + mySpatialStep->setDecimals( 2 ); + + QGridLayout* aParam1Layout = new QGridLayout(); + aParam1Layout->setMargin( 0 ); + aParam1Layout->addWidget( new QLabel( tr( "STREAM_HYDRAULIC_AXIS" ) ), 0, 0 ); + aParam1Layout->addWidget( myAxes, 0, 1 ); + aParam1Layout->addWidget( new QLabel( tr( "STREAM_DDZ" ) ), 1, 0 ); + aParam1Layout->addWidget( myDDZ, 1, 1 ); + aParam1Layout->addWidget( new QLabel( tr( "STREAM_SPATIAL_STEP" ) ), 2, 0 ); + aParam1Layout->addWidget( mySpatialStep, 2, 1 ); myProfiles = new HYDROGUI_OrderedListWidget( aParamGroup, 0 ); myProfiles->setHiddenObjectsShown(true); @@ -77,29 +95,43 @@ HYDROGUI_StreamDlg::HYDROGUI_StreamDlg( HYDROGUI_Module* theModule, const QStrin QBoxLayout* aParamLayout = new QVBoxLayout(); aParamLayout->setMargin( 5 ); aParamLayout->setSpacing( 5 ); - aParamLayout->addLayout( anAxisLayout ); + aParamLayout->addLayout( aParam1Layout ); aParamLayout->addWidget( myProfiles ); aParamLayout->addLayout( aButtonsLayout ); - + aParamGroup->setLayout( aParamLayout ); + // Warnings + QGroupBox* aWarnGroup = new QGroupBox( tr( "STREAM_WARNINGS" ), mainFrame() ); + myWarnText = new QTextEdit(); + myWarnText->setReadOnly(true); + QBoxLayout* aWarnLayout = new QVBoxLayout(); + aWarnLayout->addWidget( myWarnText ); + aWarnGroup->setLayout( aWarnLayout ); + // Common addWidget( myObjectNameGroup ); addWidget( aParamGroup ); + addWidget( aWarnGroup ); addStretch(); // Create selector if ( module() ) { HYDROGUI_ListSelector* aListSelector = +#ifdef LIGHT_MODE + new HYDROGUI_ListSelector( myProfiles, 0 ); +#else new HYDROGUI_ListSelector( myProfiles, module()->getApp()->selectionMgr() ); +#endif aListSelector->setAutoBlock( true ); } // Connect signals and slots - connect( myAxes, SIGNAL( currentIndexChanged( const QString & ) ), - this, SIGNAL( AxisChanged( const QString& ) ) ); + connect( myAxes, SIGNAL( currentIndexChanged( const QString & ) ), this, SIGNAL( AxisChanged( const QString& ) ) ); connect( myAddButton, SIGNAL( clicked() ), this, SIGNAL( AddProfiles() ) ); connect( myRemoveButton, SIGNAL( clicked() ), this, SLOT( onRemoveProfiles() ) ); + connect( myDDZ, SIGNAL( valueChanged (double) ), this, SLOT (onDDZValueChanged(double))); + connect( mySpatialStep, SIGNAL( valueChanged (double) ), this, SLOT (onSSValueChanged(double))); } HYDROGUI_StreamDlg::~HYDROGUI_StreamDlg() @@ -114,8 +146,8 @@ void HYDROGUI_StreamDlg::reset() myAxes->clear(); myProfiles->setObjects( HYDROGUI_ListModel::Object2VisibleList() ); - myAddButton->setEnabled( false ); - myRemoveButton->setEnabled( false ); + myAddButton->setEnabled( true ); + myRemoveButton->setEnabled( true ); blockSignals( isBlocked ); } @@ -148,7 +180,7 @@ void HYDROGUI_StreamDlg::setAxisName( const QString& theName ) if ( aNewId != myAxes->currentIndex() ) { myAxes->setCurrentIndex( aNewId ); } - myAddButton->setEnabled( myAxes->currentIndex() > -1 ); + //myAddButton->setEnabled( myAxes->currentIndex() > -1 ); blockSignals( isBlocked ); } @@ -165,16 +197,21 @@ void HYDROGUI_StreamDlg::setProfiles( const QStringList& theProfiles ) myProfiles->setUpdatesEnabled( false ); HYDROGUI_ListModel::Object2VisibleList aProfiles; - foreach ( const QString& aProfileName, theProfiles ) { +#ifndef LIGHT_MODE + foreach ( const QString& aProfileName, theProfiles ) + { Handle(HYDROData_Profile) anObject = Handle(HYDROData_Profile)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), aProfileName ) ); - if ( !anObject.IsNull() ) { + if ( !anObject.IsNull() ) + { aProfiles.append( HYDROGUI_ListModel::Object2Visible( anObject, true ) ); } } +#endif myProfiles->setObjects( aProfiles ); + myRemoveButton->setEnabled( myProfiles->getObjects().count() > 0 ); myProfiles->setUpdatesEnabled( true ); @@ -188,3 +225,60 @@ void HYDROGUI_StreamDlg::onRemoveProfiles() emit RemoveProfiles( aSelectedProfiles ); } + +void HYDROGUI_StreamDlg::onDDZValueChanged(double d) +{ + emit DDZValueChanged( d ); +} + +void HYDROGUI_StreamDlg::onSSValueChanged(double d) +{ + emit SSValueChanged( d ); +} + + +void HYDROGUI_StreamDlg::setDDZ( const double theDDZ ) +{ + myDDZ->setValue( theDDZ ); +} + +double HYDROGUI_StreamDlg::getDDZ() const +{ + return myDDZ->value(); +} + +void HYDROGUI_StreamDlg::setSpatialStep( const double theSpatialStep ) +{ + mySpatialStep->setValue( theSpatialStep ); +} + +double HYDROGUI_StreamDlg::getSpatialStep() const +{ + return mySpatialStep->value(); +} + +void HYDROGUI_StreamDlg::setBackgroundColorForProfileList (int theInd, QColor theColor) +{ + myProfiles->setBackgroundColor(theInd, theColor); +} + +QColor HYDROGUI_StreamDlg::getBackgroundColorForProfileList (int theInd) const +{ + return myProfiles->getBackgroundColor(theInd); +} + +void HYDROGUI_StreamDlg::clearAllBackgroundColorsForProfileList () +{ + myProfiles->clearAllBackgroundColors(); +} + +void HYDROGUI_StreamDlg::addWarning( const QString& theWarnMess ) +{ + myWarnText->append( theWarnMess ); +} + +void HYDROGUI_StreamDlg::clearWarnings() +{ + myWarnText->clear(); +} + diff --git a/src/HYDROGUI/HYDROGUI_StreamDlg.h b/src/HYDROGUI/HYDROGUI_StreamDlg.h index a9679f4e..3d49be1b 100644 --- a/src/HYDROGUI/HYDROGUI_StreamDlg.h +++ b/src/HYDROGUI/HYDROGUI_StreamDlg.h @@ -28,6 +28,8 @@ class QGroupBox; class QLineEdit; class QListWidget; class QPushButton; +class QDoubleSpinBox; +class QTextEdit; class HYDROGUI_StreamDlg : public HYDROGUI_InputPanel { @@ -49,22 +51,43 @@ public: void setProfiles( const QStringList& theProfiles ); + void setDDZ( const double ); + double getDDZ() const; + + void setSpatialStep( const double ); + double getSpatialStep() const; + + void addWarning( const QString& theWarnMess ); + void clearWarnings(); + + void setBackgroundColorForProfileList (int theInd, QColor theColor); + QColor getBackgroundColorForProfileList (int theInd) const; + void clearAllBackgroundColorsForProfileList (); + signals: void AddProfiles(); void RemoveProfiles( const QStringList& ); void AxisChanged( const QString& ); + void DDZValueChanged (double d); + void SSValueChanged (double d); private slots: void onRemoveProfiles(); + void onDDZValueChanged(double d); + void onSSValueChanged(double d); private: - QGroupBox* myObjectNameGroup; - QLineEdit* myObjectName; + QGroupBox* myObjectNameGroup; + QLineEdit* myObjectName; + QDoubleSpinBox* myDDZ; + QDoubleSpinBox* mySpatialStep; QComboBox* myAxes; HYDROGUI_OrderedListWidget* myProfiles; QPushButton* myRemoveButton; QPushButton* myAddButton; + QTextEdit* myWarnText; + }; #endif diff --git a/src/HYDROGUI/HYDROGUI_StreamOp.cxx b/src/HYDROGUI/HYDROGUI_StreamOp.cxx index ca1f6e5d..2a178d83 100755 --- a/src/HYDROGUI/HYDROGUI_StreamOp.cxx +++ b/src/HYDROGUI/HYDROGUI_StreamOp.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,9 @@ #include #include +#include +#include + #include #include @@ -115,32 +119,33 @@ void HYDROGUI_StreamOp::startOperation() // Hydraulic axis Handle(HYDROData_PolylineXY) aHydraulicAxis = myEditedObject->GetHydraulicAxis(); + + TopoDS_Face aPlane; + HYDROData_Stream::BuildRefFace( aPlane ) ; if ( !aHydraulicAxis.IsNull() ) - { myHydAxis = aHydraulicAxis->GetName(); - TopoDS_Face aPlane; - if ( HYDROData_Stream::BuildFace( aHydraulicAxis, aPlane ) ) + // Stream profiles + HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles(); + for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i ) + { + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) ); + if ( aProfile.IsNull() ) + continue; + + QString aProfileName = aProfile->GetName(); + myProfiles << aProfileName; + + if (!aHydraulicAxis.IsNull()) { - // Stream profiles - HYDROData_SequenceOfObjects aStreamProfiles = myEditedObject->GetProfiles(); - for ( int i = 1, n = aStreamProfiles.Length(); i <= n; ++i ) - { - Handle(HYDROData_Profile) aProfile = - Handle(HYDROData_Profile)::DownCast( aStreamProfiles.Value( i ) ); - if ( aProfile.IsNull() ) - continue; - - QString aProfileName = aProfile->GetName(); - - Standard_Real aProfilePar = 0.0; - HYDROData_Stream::HasIntersection( aHydraulicAxis, aProfile, aPlane, aProfilePar ); - - myProfiles << aProfileName; - myProfileParams << aProfilePar; - } + Standard_Real aProfilePar = 0.0; + HYDROData_Stream::HasIntersection( aHydraulicAxis, aProfile, aPlane, aProfilePar ); + myProfileParams << aProfilePar; } - } + + } + } } @@ -151,6 +156,12 @@ void HYDROGUI_StreamOp::startOperation() // set the existing 2D polylines names to the panel aPanel->setAxisNames( HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_POLYLINEXY ) ); + if (myIsEdit) + { + aPanel->setDDZ( myEditedObject->GetDDZ() ); + aPanel->setSpatialStep( myEditedObject->GetSpatialStep() ); + } + // synchronize the panel state with the edited object state updatePanelData(); @@ -180,9 +191,63 @@ HYDROGUI_InputPanel* HYDROGUI_StreamOp::createInputPanel() const connect( aPanel, SIGNAL( AxisChanged( const QString& ) ), this, SLOT( onAxisChanged( const QString& ) ) ); + connect( aPanel, SIGNAL( DDZValueChanged( double ) ), this, SLOT( onDDZValueChanged( double ) ) ); + connect( aPanel, SIGNAL( SSValueChanged( double ) ), this, SLOT( onSSValueChanged( double ) ) ); return aPanel; } +void HYDROGUI_StreamOp::apply() +{ + QApplication::setOverrideCursor( Qt::WaitCursor ); + + startDocOperation(); + + int anUpdateFlags = 0; + QString anErrorMsg; + + bool aResult = false; + QStringList aBrowseObjectsEntries; + + try + { + aResult = processApply( anUpdateFlags, anErrorMsg, aBrowseObjectsEntries ); + } + catch ( Standard_Failure ) + { + Handle(Standard_Failure) aFailure = Standard_Failure::Caught(); + anErrorMsg = aFailure->GetMessageString(); + aResult = false; + } + catch ( ... ) + { + aResult = false; + } + + QApplication::restoreOverrideCursor(); + + if ( aResult ) + { + module()->update( anUpdateFlags ); + commitDocOperation(); + commit(); + browseObjects( aBrowseObjectsEntries ); + } + else + { + myEditedObject->Remove(); + module()->setObjectRemoved( myEditedObject ); + + if ( isToAbortOnApply() ) + abortDocOperation(); + + abort(); + SUIT_MessageBox::critical( module()->getApp()->desktop(), + tr( "CREATE_STREAM_ERROR" ), + anErrorMsg ); + + } +} + bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ) @@ -213,14 +278,13 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags, if ( myEditedObject.IsNull() ) // Create new data model object myEditedObject = Handle(HYDROData_Stream)::DownCast( doc()->CreateObject( KIND_STREAM ) ); - // Check if the axis is set Handle(HYDROData_PolylineXY) aHydAxis = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) ); - if ( aHydAxis.IsNull() ) - { - theErrorMsg = tr( "AXIS_NOT_DEFINED" ); - return false; - } + //if ( aHydAxis.IsNull() ) + //{ + // theErrorMsg = tr( "AXIS_NOT_DEFINED" ); + // return false; + //} // Check if at least 2 profiles is set HYDROData_SequenceOfObjects aRefProfiles; @@ -240,11 +304,19 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags, return false; } - // Set the object name + bool ToOrder = true; + + if (aHydAxis.IsNull()) + ToOrder = false; + + myEditedObject->SetProfiles (aRefProfiles, ToOrder) ; myEditedObject->SetName( anObjectName ); - myEditedObject->SetHydraulicAxis( aHydAxis ); + if (!aHydAxis.IsNull()) + myEditedObject->SetHydraulicAxis( aHydAxis ); myEditedObject->SetProfiles( aRefProfiles, false ); + myEditedObject->SetDDZ( aPanel->getDDZ() ); + myEditedObject->SetSpatialStep( aPanel->getSpatialStep() ); if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) ) myEditedObject->Update(); @@ -313,7 +385,9 @@ void HYDROGUI_StreamOp::createPreview() HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) ); HYDROData_SequenceOfObjects aRefProfiles; - for ( int i = 0; i < myProfiles.length(); ++i ) + //std::vector aRefProfiles; + int plen = myProfiles.length(); + for ( int i = 0; i < plen; ++i ) { QString aProfileName = myProfiles.value( i ); @@ -324,11 +398,46 @@ void HYDROGUI_StreamOp::createPreview() } HYDROData_Stream::PrsDefinition aPrsDef; - if ( !HYDROData_Stream::CreatePresentations( aHydAxis, aRefProfiles, aPrsDef ) ) - { - erasePreview(); - return; - } + + TopoDS_Shape Out3dPres; + TopoDS_Shape Out2dPres; + TopoDS_Shape OutLeftB; + TopoDS_Shape OutRightB; + TopoDS_Shape OutInlet; + TopoDS_Shape OutOutlet; + + HYDROGUI_StreamDlg* aPanel = ::qobject_cast( inputPanel() ); + double ddz = aPanel->getDDZ(); + double ss = aPanel->getSpatialStep(); + + std::set InvInd; + +#ifdef _DEBUG + const int MAX_POINTS_IN_PREVIEW = 50000; +#else + const int MAX_POINTS_IN_PREVIEW = 500000; +#endif + + HYDROData_Bathymetry::AltitudePoints points; + + bool WireIntersections = false; + HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB, + OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, WireIntersections ); + + aPanel->clearAllBackgroundColorsForProfileList(); + for (std::set::const_iterator it = InvInd.begin(); it != InvInd.end(); it++) + aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow)); + + aPrsDef.myInlet = TopoDS::Wire(OutInlet); + aPrsDef.myOutlet = TopoDS::Wire(OutOutlet); + aPrsDef.myLeftBank = TopoDS::Wire(OutLeftB); + aPrsDef.myRightBank = TopoDS::Wire(OutRightB); + if (!WireIntersections) + aPrsDef.myPrs2D = Out2dPres; + aPrsDef.myPrs3D = Out3dPres; + + if (WireIntersections) + aPanel->addWarning(tr("STREAM_SELF_INTERSECTIONS")); myPreviewPrs->setShape( aPrsDef.myPrs2D ); } @@ -346,12 +455,11 @@ void HYDROGUI_StreamOp::onAddProfiles() { Handle(HYDROData_PolylineXY) aHydAxis = Handle(HYDROData_PolylineXY)::DownCast( HYDROGUI_Tool::FindObjectByName( module(), myHydAxis, KIND_POLYLINEXY ) ); - if ( aHydAxis.IsNull() ) - return; + //if ( aHydAxis.IsNull() ) + // return; TopoDS_Face aPlane; - if ( !HYDROData_Stream::BuildFace( aHydAxis, aPlane ) ) - return; + HYDROData_Stream::BuildRefFace( aPlane ); // Get the current profiles list QStringList aCurrentProfiles = myProfiles; @@ -393,6 +501,7 @@ void HYDROGUI_StreamOp::onAddProfiles() else { // Insert profile in correct place + // if hidr axis is null => the params (myProfileParams) will be igrored. So ordering will be the same as in the aSelectedProfiles insertProfileInToOrder( aProfileName, aProfilePar, myProfiles, myProfileParams ); aVerifiedProfiles << aProfileName; } @@ -467,6 +576,16 @@ void HYDROGUI_StreamOp::onRemoveProfiles( const QStringList& theProfilesToRemove } } +void HYDROGUI_StreamOp::onDDZValueChanged( double d ) +{ + createPreview(); +} + +void HYDROGUI_StreamOp::onSSValueChanged( double d ) +{ + createPreview(); +} + void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis ) { // Get axis object @@ -475,15 +594,15 @@ void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis ) // Prepare data for intersection check TopoDS_Face aPlane; - if ( !HYDROData_Stream::BuildFace( aNewAxis, aPlane ) ) - { - SUIT_MessageBox::critical( module()->getApp()->desktop(), - tr( "BAD_SELECTED_POLYLINE_TLT" ), - tr( "BAD_SELECTED_POLYLINE_MSG" ).arg( theNewAxis ) ); - // To restore the old axis - updatePanelData(); - return; - } + HYDROData_Stream::BuildRefFace( aPlane ); + //{ + // SUIT_MessageBox::critical( module()->getApp()->desktop(), + // tr( "BAD_SELECTED_POLYLINE_TLT" ), + // tr( "BAD_SELECTED_POLYLINE_MSG" ).arg( theNewAxis ) ); + // // To restore the old axis + // updatePanelData(); + // return; + //} QStringList aNewProfiles; QList aNewProfileParams; diff --git a/src/HYDROGUI/HYDROGUI_StreamOp.h b/src/HYDROGUI/HYDROGUI_StreamOp.h index 277bb0a8..5e3a9160 100755 --- a/src/HYDROGUI/HYDROGUI_StreamOp.h +++ b/src/HYDROGUI/HYDROGUI_StreamOp.h @@ -47,10 +47,14 @@ protected: virtual bool isToAbortOnApply() const { return false; } + virtual void apply(); + private slots: void onAddProfiles(); void onRemoveProfiles( const QStringList& ); void onAxisChanged( const QString& ); + void onDDZValueChanged( double d ); + void onSSValueChanged( double d ); private: void createPreview(); diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx index 8b6103c5..6833acec 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx @@ -71,7 +71,7 @@ void HYDROGUI_VTKPrsBathymetry::compute() if ( !aBathymetry.IsNull() ) { HYDROData_Bathymetry::AltitudePoints anAltPoints = aBathymetry->GetAltitudePoints(); - int aNbPoints = anAltPoints.Length(); + int aNbPoints = anAltPoints.size(); HYDROData_Bathymetry::AltitudePoint anAltPnt; vtkPoints* aPoints = vtkPoints::New(); @@ -87,15 +87,15 @@ void HYDROGUI_VTKPrsBathymetry::compute() double aZ; int anInvalidZ = InvalidZValue(); - for (int i = 1; i <= aNbPoints; i++ ) + for (int i = 0; i < aNbPoints; i++ ) { - anAltPnt = anAltPoints.Value( i ); - aZ = anAltPnt.Z(); + anAltPnt = anAltPoints[i]; + aZ = anAltPnt.Z; if ( ValuesLessEquals( aZ, anInvalidZ ) ) { aZ = Z_MAX; // If Z value is invalid then use Z_MAX } - aPoints->InsertPoint( i - 1, anAltPnt.X(), anAltPnt.Y(), aZ ); + aPoints->InsertPoint( i - 1, anAltPnt.X, anAltPnt.Y, aZ ); aVertex->GetPointIds()->SetId( 0, i - 1 ); aVertexGrid->InsertNextCell( aVertex->GetCellType(), aVertex->GetPointIds()); aZValues->InsertNextValue( aZ ); diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 7b3a26b1..e19e9fad 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -141,9 +141,14 @@ does not exist or you have not enough permissions to open it. The object name must not be an empty string value. - INCORRECT_FILE_NAME - The file name must not be an empty string value. + EMPTY_FILENAMES + Files list is empty + + BATHYMETRY_IMPORT_WARNING + Import of bahemetry - warning + + INSUFFICIENT_INPUT_DATA Insufficient input data @@ -245,6 +250,14 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) STREAM_PROFILES Profiles + + STREAM_WARNINGS + Stream Warnings + + + STREAM_SELF_INTERSECTIONS + Warning: intersection(s) of banks/profiles are found + PREF_TAB_GENERAL General @@ -587,8 +600,8 @@ Do you want to continue? Bathymetry name - FILE_NAME - File name + FILE_NAMES + File names IMPORT_BATHYMETRY_FROM_FILE @@ -619,7 +632,13 @@ Do you want to continue? '%1' file cannot be correctly imported for a Bathymetry definition. - + + BAD_IMPORTED_BATHYMETRY_FILES + '%1' +All files cannot be correctly imported for a Bathymetry definition. + + + HYDROGUI_ImportImageDlg @@ -2661,6 +2680,15 @@ file cannot be correctly imported for an Obstacle definition. STREAM_HYDRAULIC_AXIS Hydraulic axis + + STREAM_DDZ + Stream ddz + + + STREAM_SPATIAL_STEP + Stream spatial step + + ADD Add @@ -2674,6 +2702,10 @@ file cannot be correctly imported for an Obstacle definition. HYDROGUI_StreamOp + CREATE_STREAM_ERROR + Stream creation error + + CREATE_STREAM Create stream diff --git a/src/HYDROPy/CAS/vector.sip b/src/HYDROPy/CAS/vector.sip new file mode 100644 index 00000000..d3823364 --- /dev/null +++ b/src/HYDROPy/CAS/vector.sip @@ -0,0 +1,296 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +%ExportedHeaderCode +#include +%End + +// std::vector is implemented as a Python list. +template +%MappedType std::vector +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) + return NULL; + + // Set the list elements. + for ( int i = 0, n = sipCpp->size(); i < n; ++i ) + { + TYPE* t = new TYPE( (*sipCpp)[i] ); + + PyObject* pobj; + if ( ( pobj = sipConvertFromNewType( t, sipType_TYPE, sipTransferObj ) ) == NULL ) + { + Py_DECREF( l ); + delete t; + + return NULL; + } + + PyList_SET_ITEM( l, i, pobj ); + } + + return l; +%End + +%ConvertToTypeCode + SIP_SSIZE_T len; + + // Check the type if that is all that is required. + if (sipIsErr == NULL) + { + if (!PySequence_Check(sipPy) || (len = PySequence_Size(sipPy)) < 0) + return 0; + + for (SIP_SSIZE_T i = 0; i < len; ++i) + { + PyObject *itm = PySequence_ITEM(sipPy, i); + bool ok = (itm && sipCanConvertToType(itm, sipType_TYPE, SIP_NOT_NONE)); + + Py_XDECREF(itm); + + if (!ok) + return 0; + } + + return 1; + } + + std::vector *aSeq = new std::vector; + len = PySequence_Size(sipPy); + aSeq->reserve( len ); + + for (SIP_SSIZE_T i = 0; i < len; ++i) + { + PyObject *itm = PySequence_ITEM(sipPy, i); + int state; + TYPE *t = reinterpret_cast(sipConvertToType(itm, sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); + + Py_DECREF(itm); + + if (*sipIsErr) + { + sipReleaseType(t, sipType_TYPE, state); + + delete aSeq; + return 0; + } + + aSeq->push_back(*t); + + sipReleaseType(t, sipType_TYPE, state); + } + + *sipCppPtr = aSeq; + + return sipGetState(sipTransferObj); +%End +}; + +// std::vector is implemented as a Python list of floats. +%MappedType std::vector +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) + return NULL; + + // Set the list elements. + for ( int i = 0, n = sipCpp->size(); i < n; ++i ) + { + PyObject *pobj; + if ( ( pobj = PyFloat_FromDouble( (*sipCpp)[i] ) ) == NULL ) + { + Py_DECREF(l); + + return NULL; + } + + PyList_SET_ITEM( l, i, pobj ); + } + + return l; +%End + +%ConvertToTypeCode + // Check the type if that is all that is required. + if ( sipIsErr == NULL ) + return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 ); + + std::vector *aSeq = new std::vector; + + SIP_SSIZE_T len = PySequence_Size(sipPy); + aSeq->reserve( len ); + for ( SIP_SSIZE_T i = 0; i < len; ++i ) + { + PyObject *itm = PySequence_ITEM( sipPy, i ); + if ( !itm ) + { + delete aSeq; + *sipIsErr = 1; + + return 0; + } + + aSeq->push_back( PyFloat_AsDouble( itm ) ); + + Py_DECREF( itm ); + } + + *sipCppPtr = aSeq; + + return sipGetState( sipTransferObj ); +%End +}; + +// std::vector is implemented as a Python list of integers. +%MappedType std::vector +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) + return NULL; + + // Set the list elements. + for ( int i = 0, n = sipCpp->size(); i < n; ++i ) + { + PyObject *pobj; + if ( ( pobj = SIPLong_FromLong( (*sipCpp)[i] ) ) == NULL ) + { + Py_DECREF(l); + + return NULL; + } + + PyList_SET_ITEM( l, i, pobj ); + } + + return l; +%End + +%ConvertToTypeCode + // Check the type if that is all that is required. + if ( sipIsErr == NULL ) + return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 ); + + std::vector *aSeq = new std::vector; + + SIP_SSIZE_T len = PySequence_Size(sipPy); + aSeq->reserve( len ); + for ( SIP_SSIZE_T i = 0; i < len; ++i ) + { + PyObject *itm = PySequence_ITEM( sipPy, i ); + if ( !itm ) + { + delete aSeq; + *sipIsErr = 1; + + return 0; + } + + aSeq->push_back( SIPLong_AsLong( itm ) ); + + Py_DECREF( itm ); + } + + *sipCppPtr = aSeq; + + return sipGetState( sipTransferObj ); +%End +}; + +// std::vector is implemented as a Python list of integers. +%MappedType std::vector +{ +%TypeHeaderCode +#include +%End + +%ConvertFromTypeCode + // Create the list. + PyObject *l; + + if ( ( l = PyList_New( sipCpp->size() ) ) == NULL ) + return NULL; + + // Set the list elements. + for ( int i = 0, n = sipCpp->size(); i < n; ++i ) + { + PyObject *pobj; + if ( ( pobj = SIPLong_FromLong( (*sipCpp)[i] ) ) == NULL ) + { + Py_DECREF(l); + + return NULL; + } + + PyList_SET_ITEM( l, i, pobj ); + } + + return l; +%End + +%ConvertToTypeCode + // Check the type if that is all that is required. + if ( sipIsErr == NULL ) + return ( PySequence_Check( sipPy) && PySequence_Size( sipPy ) >= 0 ); + + std::vector *aSeq = new std::vector; + + SIP_SSIZE_T len = PySequence_Size(sipPy); + aSeq->reserve( len ); + for ( SIP_SSIZE_T i = 0; i < len; ++i ) + { + PyObject *itm = PySequence_ITEM( sipPy, i ); + if ( !itm ) + { + delete aSeq; + *sipIsErr = 1; + + return 0; + } + + aSeq->push_back( SIPLong_AsLong( itm ) != 0 ); + + Py_DECREF( itm ); + } + + *sipCppPtr = aSeq; + + return sipGetState( sipTransferObj ); +%End +}; \ No newline at end of file diff --git a/src/HYDROPy/CMakeLists.txt b/src/HYDROPy/CMakeLists.txt index 7a28b970..80464125 100644 --- a/src/HYDROPy/CMakeLists.txt +++ b/src/HYDROPy/CMakeLists.txt @@ -1,8 +1,6 @@ include(../../CMake/Common.cmake) INCLUDE(UsePyQt) -# --- options --- - # additional include directories INCLUDE_DIRECTORIES( ${CAS_INCLUDE_DIRS} @@ -25,76 +23,76 @@ ADD_DEFINITIONS( SET(_link_LIBRARIES ${PYTHON_LIBRARIES} HYDROData -) +) # --- resources --- # sip files / to be processed by sip -SET(_sip_files +SET(_sip_input_file HYDROData.sip - HYDROData_AltitudeObject.sip - HYDROData_Application.sip - HYDROData_ArtificialObject.sip - HYDROData_Bathymetry.sip - HYDROData_CalculationCase.sip - HYDROData_Channel.sip - HYDROData_Confluence.sip - HYDROData_Digue.sip - HYDROData_Document.sip - HYDROData_Entity.sip - HYDROData_IAltitudeObject.sip - HYDROData_IInterpolator.sip - HYDROData_Image.sip - HYDROData_ImmersibleZone.sip - HYDROData_IPolyline.sip - HYDROData_IProfilesInterpolator.sip - HYDROData_LandCoverMap.sip - HYDROData_NaturalObject.sip - HYDROData_Object.sip - HYDROData_ObstacleAltitude.sip - HYDROData_Obstacle.sip - HYDROData_Polyline3D.sip - HYDROData_PolylineXY.sip - HYDROData_Profile.sip - HYDROData_ProfileUZ.sip - HYDROData_Region.sip - HYDROData_River.sip - HYDROData_SequenceOfObjects.sip - HYDROData_ShapesGroup.sip - HYDROData_SplitShapesGroup.sip - HYDROData_StreamAltitude.sip - HYDROData_Stream.sip - HYDROData_StricklerTable.sip - HYDROData_Zone.sip - CAS/gp_XY.sip - CAS/gp_XYZ.sip - CAS/NCollection_Sequence.sip - CAS/TCollection_AsciiString.sip ) SET(_add_SOURCES - sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc + sipHYDROPycmodule.cc sipHYDROPyNCollection_Sequence0600opencascadehandle0100HYDROData_Entity.cc - sipHYDROPyNCollection_Sequence0100TCollection_AsciiString.cc + sipHYDROPygp_XYZ.cc + sipHYDROPyHYDROData_AltitudeObject.cc + sipHYDROPyHYDROData_Application.cc + sipHYDROPyHYDROData_ArtificialObject.cc + sipHYDROPyHYDROData_BathymetryAltitudePoint.cc + sipHYDROPyHYDROData_Bathymetry.cc + sipHYDROPyHYDROData_CalculationCase.cc + sipHYDROPyHYDROData_Channel.cc + sipHYDROPyHYDROData_Confluence.cc + sipHYDROPyHYDROData_Digue.cc + sipHYDROPyHYDROData_Document.cc + sipHYDROPyHYDROData_Entity.cc + sipHYDROPyHYDROData_IAltitudeObject.cc + sipHYDROPyHYDROData_IInterpolator.cc + sipHYDROPyHYDROData_Image.cc + sipHYDROPyHYDROData_ImmersibleZone.cc + sipHYDROPyHYDROData_IPolyline.cc + sipHYDROPyHYDROData_IProfilesInterpolator.cc + sipHYDROPyHYDROData_LandCoverMap.cc + sipHYDROPyHYDROData_NaturalObject.cc + sipHYDROPyHYDROData_Object.cc + sipHYDROPyHYDROData_ObstacleAltitude.cc + sipHYDROPyHYDROData_Obstacle.cc + sipHYDROPyHYDROData_Polyline3D.cc + sipHYDROPyHYDROData_PolylineXY.cc + sipHYDROPyHYDROData_Profile.cc + sipHYDROPyHYDROData_ProfileUZ.cc + sipHYDROPyHYDROData_Region.cc + sipHYDROPyHYDROData_River.cc + sipHYDROPyHYDROData_ShapesGroup.cc + sipHYDROPyHYDROData_SplitShapesGroup.cc + sipHYDROPyHYDROData_StreamAltitude.cc + sipHYDROPyHYDROData_Stream.cc + sipHYDROPyHYDROData_StricklerTable.cc + sipHYDROPyHYDROData_Zone.cc sipHYDROPyNCollection_Sequence0100gp_XY.cc sipHYDROPyNCollection_Sequence0100gp_XYZ.cc + sipHYDROPyNCollection_Sequence0100Handle_HYDROData_Entity.cc + sipHYDROPyNCollection_Sequence0100HYDROData_IPolylineSectionType.cc + sipHYDROPyNCollection_Sequence0100TCollection_AsciiString.cc sipHYDROPyNCollection_Sequence1800.cc sipHYDROPyNCollection_Sequence2400.cc sipHYDROPyNCollection_Sequence2600.cc + sipHYDROPystdvector0100HYDROData_BathymetryAltitudePoint.cc + sipHYDROPystdvector1800.cc + sipHYDROPystdvector2400.cc + sipHYDROPystdvector2600.cc sipHYDROPyTCollection_AsciiString.cc ) -# --- sources --- - # sources / sip wrappings PYQT_WRAP_SIP(_sip_SOURCES ${_sip_files} SOURCES ${_add_SOURCES}) # sources / to compile SET(HYDROPy_SOURCES ${_sip_SOURCES}) -# --- rules --- - ADD_LIBRARY(HYDROPy ${HYDROPy_SOURCES}) + TARGET_LINK_LIBRARIES(HYDROPy ${_link_LIBRARIES}) INSTALL(TARGETS HYDROPy EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/src/HYDROPy/HYDROData.sip b/src/HYDROPy/HYDROData.sip index 0039c21a..9038f640 100644 --- a/src/HYDROPy/HYDROData.sip +++ b/src/HYDROPy/HYDROData.sip @@ -46,6 +46,7 @@ %Include CAS/gp_XY.sip %Include CAS/gp_XYZ.sip %Include CAS/NCollection_Sequence.sip +%Include CAS/vector.sip %Include CAS/TCollection_AsciiString.sip %Include HYDROData_AltitudeObject.sip diff --git a/src/HYDROPy/HYDROData_Bathymetry.sip b/src/HYDROPy/HYDROData_Bathymetry.sip index e2302918..0c78ace3 100644 --- a/src/HYDROPy/HYDROData_Bathymetry.sip +++ b/src/HYDROPy/HYDROData_Bathymetry.sip @@ -35,8 +35,14 @@ class HYDROData_Bathymetry : public HYDROData_IAltitudeObject } %End - typedef gp_XYZ AltitudePoint; - typedef NCollection_Sequence AltitudePoints; +public: + struct AltitudePoint + { + double X; + double Y; + double Z; + }; + typedef std::vector AltitudePoints; %TypeHeaderCode @@ -53,7 +59,8 @@ public: void SetAltitudesInverted( const bool theIsInverted, const bool theIsUpdate = true ); bool IsAltitudesInverted() const; - bool ImportFromFile( const TCollection_AsciiString& theFileName ); + bool ImportFromFiles( const QStringList& theFileNames ); + bool ImportFromFile( const QString& theFileName ); protected: HYDROData_Bathymetry(); diff --git a/src/HYDROPy/HYDROData_CalculationCase.sip b/src/HYDROPy/HYDROData_CalculationCase.sip index cc6dbe86..74bc249a 100644 --- a/src/HYDROPy/HYDROData_CalculationCase.sip +++ b/src/HYDROPy/HYDROData_CalculationCase.sip @@ -215,7 +215,38 @@ public: * Remove reference boundary polyline object from calculation case. */ void RemoveBoundaryPolyline(); + + void SetLandCoverMap( HYDROData_LandCoverMap theLandCoverMap ) [void ( const Handle_HYDROData_LandCoverMap& )]; + %MethodCode + Handle(HYDROData_LandCoverMap) aRef = + Handle(HYDROData_LandCoverMap)::DownCast( createHandle( a0 ) ); + if ( !aRef.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + if ( sipSelfWasArg ) { + sipCpp->HYDROData_CalculationCase::SetLandCoverMap( aRef ); + } else { + sipCpp->SetLandCoverMap( aRef ); + } + Py_END_ALLOW_THREADS + } + %End + void SetStricklerTable( HYDROData_StricklerTable theStricklerTable ) [void ( const Handle_HYDROData_StricklerTable& )]; + %MethodCode + Handle(HYDROData_StricklerTable) aRef = + Handle(HYDROData_StricklerTable)::DownCast( createHandle( a0 ) ); + if ( !aRef.IsNull() ) + { + Py_BEGIN_ALLOW_THREADS + if ( sipSelfWasArg ) { + sipCpp->HYDROData_CalculationCase::SetStricklerTable( aRef ); + } else { + sipCpp->SetStricklerTable( aRef ); + } + Py_END_ALLOW_THREADS + } + %End /** * Add new one child region for calculation case. @@ -426,6 +457,28 @@ public: sipRes = new NCollection_Sequence( aRes ); %End + std::vector GetStricklerCoefficientForPoints( const NCollection_Sequence& theCoordsX, + const NCollection_Sequence& theCoordsY, + double DefValue, + bool UseMax ) const + [std::vector ( const NCollection_Sequence&, double, bool)]; + %MethodCode + std::vector aPnts; + int aLen = qMin( a0->Length(), a1->Length() ); + for ( int i = 1; i <= aLen; ++i ) + { + gp_XY aPnt( a0->Value( i ), a1->Value( i ) ); + aPnts.push_back( aPnt ); + } + std::vector aRes; + Py_BEGIN_ALLOW_THREADS + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetStricklerCoefficientForPoints( aPnts, a2, a3 ) : + sipCpp->GetStricklerCoefficientForPoints( aPnts, a2, a3 ); + Py_END_ALLOW_THREADS + sipRes = new std::vector( aRes ); + %End + + /** * Returns altitudes for given points on given zone. * \param thePoints the points to examine diff --git a/src/HYDROPy/HYDROData_LandCoverMap.sip b/src/HYDROPy/HYDROData_LandCoverMap.sip index 7b5da210..7f9d1542 100644 --- a/src/HYDROPy/HYDROData_LandCoverMap.sip +++ b/src/HYDROPy/HYDROData_LandCoverMap.sip @@ -75,8 +75,9 @@ public: if ( !aRef.IsNull() ) { Py_BEGIN_ALLOW_THREADS - sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef ): - sipCpp->ExportTelemac( *a0, a1, aRef ); + QString messStat; + sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef, messStat ): + sipCpp->ExportTelemac( *a0, a1, aRef, messStat ); Py_END_ALLOW_THREADS } %End diff --git a/src/HYDROPy/HYDROData_Profile.sip b/src/HYDROPy/HYDROData_Profile.sip index c5b91a60..e67faaea 100644 --- a/src/HYDROPy/HYDROData_Profile.sip +++ b/src/HYDROPy/HYDROData_Profile.sip @@ -172,13 +172,14 @@ public: */ static int ImportFromFile( HYDROData_Document theDoc, const TCollection_AsciiString& theFileName, - NCollection_Sequence& theBadProfilesIds ) + NCollection_Sequence& theBadProfilesIds, + bool isToProject = true ) [int ( const opencascade::handle&, const TCollection_AsciiString&, NCollection_Sequence& )]; %MethodCode Py_BEGIN_ALLOW_THREADS - sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, *a2 ); + sipRes = HYDROData_Profile::ImportFromFile( a0, *a1, *a2, a3 ); Py_END_ALLOW_THREADS %End @@ -189,7 +190,8 @@ public: * \return \c true if file has been successfully read */ virtual bool ImportFromFile( const TCollection_AsciiString& theFileName, - bool* theIsRead = 0 ); + bool isToProject = true, + bool* isNotEmpty = 0 ); protected: /** diff --git a/src/HYDROPy/HYDROData_Stream.sip b/src/HYDROPy/HYDROData_Stream.sip index 9461c8e5..7963b776 100644 --- a/src/HYDROPy/HYDROData_Stream.sip +++ b/src/HYDROPy/HYDROData_Stream.sip @@ -27,11 +27,6 @@ class HYDROData_Stream : public HYDROData_NaturalObject %End public: - /** - * Update the shape presentations of stream. - */ - void UpdatePrs(); - /** * Returns default filling color for new stream. */ diff --git a/src/HYDROTools/CMakeLists.txt b/src/HYDROTools/CMakeLists.txt index f0515068..cceff83c 100644 --- a/src/HYDROTools/CMakeLists.txt +++ b/src/HYDROTools/CMakeLists.txt @@ -23,6 +23,7 @@ SET(PYFILES __init__.py controls.py interpolZ.py + interpolS.py ) # --- rules --- diff --git a/src/HYDROTools/interpolS.py b/src/HYDROTools/interpolS.py new file mode 100644 index 00000000..000df600 --- /dev/null +++ b/src/HYDROTools/interpolS.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +import os +import sys +import shutil + +import salome + +from med import medfile +from med import medmesh +from med import medfield +from med import medenum + +import HYDROPy + +# Get current study id +salome.salome_init() +theStudy = salome.myStudy +theStudyId = salome.myStudyId + +"""Bad parameters exception""" +class BadParamsError(ValueError): + pass + +""" +Creates MED file with scalar field associated with the mesh of the calculation case. +The scalar value associated with the mesh node is the Strickler coefficient of the land cover containing the node. +case_name: calculation case name in the study +med_file_name: path to input MED file with mesh on nodes +output_file_name: path to output MED file with +med_field_name: field name +""" +def assignStrickler(case_name, med_file_name, output_file_name, med_field_name='FRICTION'): + # Check calculation case + doc = HYDROPy.HYDROData_Document.Document( theStudyId ) + case = doc.FindObjectByName(case_name) + if case is None: + raise BadParamsError("Calculation case '%s' not found" % case_name) + + # Check input MED file + if not os.path.exists(med_file_name): + raise BadParamsError("Input file '%s' not exists" % med_file_name) + + # Copy input file to the output path, if the output path is empty - use the input path for the output + file_path = med_file_name + if output_file_name and (output_file_name != file_path): + shutil.copyfile(med_file_name, output_file_name) + file_path = output_file_name + + # Open input MED file + fid = medfile.MEDfileOpen(file_path, medenum.MED_ACC_RDEXT) + + # Get mesh info + mesh_name, sdim, mdim, meshtype, desc, dtunit, sort, nstep, repere, axisname, axisunit = medmesh.MEDmeshInfo(fid, 1) + + nb_nodes, chgt, trsf = medmesh.MEDmeshnEntity(fid, mesh_name, medenum.MED_NO_DT, medenum.MED_NO_IT, + medenum.MED_NODE, medenum.MED_NONE, + medenum.MED_COORDINATE, medenum.MED_NO_CMODE) + + + # Create field + if nb_nodes > 0: + # Get node coordinates + coords = medfile.MEDFLOAT(nb_nodes*sdim) + medmesh.MEDmeshNodeCoordinateRd(fid, mesh_name, medenum.MED_NO_DT, medenum.MED_NO_IT, + medenum.MED_FULL_INTERLACE, coords) + + # Get list of Strickler coefficient values for the nodes + values = [] + x_coords = coords[0::sdim] + y_coords = coords[1::sdim] + values = case.GetStricklerCoefficientForPoints(x_coords, y_coords, 0.0, True) + + # Write the values to the field + if len(values) > 0: + values = medfile.MEDFLOAT(values) + + comp = "strickler coeff " + medfield.MEDfieldCr(fid, med_field_name, medfile.MED_FLOAT64, + 1, comp, '', '', mesh_name) + + medfield.MEDfieldValueWr(fid, med_field_name, medenum.MED_NO_DT, medenum.MED_NO_IT, 0.0, + medenum.MED_NODE, medenum.MED_NONE, + medenum.MED_FULL_INTERLACE, medenum.MED_ALL_CONSTITUENT, len(values), values) + + print "MED field '%s' on %s nodes has been created." % (med_field_name, nb_nodes) + + # close MED file + medfile.MEDfileClose(fid) \ No newline at end of file diff --git a/src/HYDRO_tests/CMakeLists.txt b/src/HYDRO_tests/CMakeLists.txt index 4eb4bde3..041a55d0 100644 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@ -19,7 +19,11 @@ set(PROJECT_HEADERS test_HYDROGUI_ListModel.h test_HYDROGUI_Shape.h test_HYDROGUI_LandCoverMapDlg.h + test_HYDROData_CalcCase.h + test_HYDROData_Stream.h + test_Dependencies.h + test_HYDROData_DTM.h TestShape.h TestViewer.h @@ -27,7 +31,7 @@ set(PROJECT_HEADERS TestLib_Runner.h ) -set(PROJECT_SOURCES +set(PROJECT_SOURCES test_HYDROData_Bathymetry.cxx test_HYDROData_Channel.cxx test_HYDROData_Document.cxx @@ -41,9 +45,12 @@ set(PROJECT_SOURCES test_HYDROData_Profile.cxx test_HYDROData_ShapeFile.cxx test_HYDROData_StricklerTable.cxx + test_HYDROData_DTM.cxx test_HYDROGUI_ListModel.cxx test_HYDROGUI_Shape.cxx test_HYDROGUI_LandCoverMapDlg.cxx + test_HYDROData_CalcCase.cxx + test_HYDROData_Stream.cxx test_Dependencies.cxx TestShape.cxx @@ -52,15 +59,13 @@ set(PROJECT_SOURCES TestLib_Runner.cxx ) -add_definitions( - -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC -) +add_definitions( -DLIGHT_MODE -DHYDRODATA_STATIC -DHYDROGUI_STATIC ) IF( ${WIN32} ) - add_definitions( -DWNT ) + add_definitions( -DWNT -D__WIN32__ -D__x86__ -D_WIN64 -D_WIN32_WINNT=0x0400 -D__NT__ -D__OSVERSION__=4 ) ENDIF() -SET( CPPUNIT_INCLUDES $ENV{cppUNIT_ROOT}/include ) +SET( CPPUNIT_INCLUDES $ENV{CPPUNIT_ROOT}/include ) SET( CAS_INCLUDES $ENV{CASROOT}/inc ) SET( QT_INCLUDES $ENV{QT5_ROOT_DIR}/include $ENV{QT5_ROOT_DIR}/include/QtCore $ENV{QT5_ROOT_DIR}/include/QtGui $ENV{QT5_ROOT_DIR}/include/QtTest ) SET( KERNEL_INCLUDES $ENV{KERNEL_ROOT_DIR}/include/salome ) @@ -81,7 +86,7 @@ ELSE() SET( QT_LIBRARIES QtCore QtGui QtTest ) ENDIF() -link_directories( $ENV{cppUNIT_ROOT}/lib ) +link_directories( $ENV{CPPUNIT_ROOT}/lib ) IF( ${WIN32} ) SET( CPPUNIT_LIBRARIES cppunitd ) ELSE() @@ -90,7 +95,7 @@ ENDIF() link_directories( $ENV{KERNEL_ROOT_DIR}/lib/salome $ENV{GUI_ROOT_DIR}/lib/salome $ENV{GEOM_ROOT_DIR}/lib/salome ) SET( GUI_LIBRARIES ImageComposer qtx suit LightApp CAM OCCViewer ) -SET( GEOM_LIBRARIES CurveCreator ) +SET( GEOM_LIBRARIES CurveCreator GEOMUtils GEOMUtils ) include_directories( ${CAS_INCLUDES} @@ -107,10 +112,6 @@ include_directories( source_group( "External files" FILES ${EXTERNAL_FILES} ) add_executable( HYDROData_tests ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${EXTERNAL_FILES} ${PROJECT_MOC_HEADERS} ) -target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib HYDROData) - -IF( ${WIN32} ) - add_custom_command( TARGET HYDROData_tests POST_BUILD COMMAND $(TargetPath) COMMENT "Running tests" ) -ENDIF() +target_link_libraries( HYDROData_tests ${GUI_LIBRARIES} ${GEOM_LIBRARIES} ${CAS_LIBRARIES} ${QT_LIBRARIES} ${CPPUNIT_LIBRARIES} shapelib HYDROData ) INSTALL(TARGETS HYDROData_tests EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS}) diff --git a/src/HYDRO_tests/ExternalFiles.cmake b/src/HYDRO_tests/ExternalFiles.cmake index 79f07699..b093912a 100644 --- a/src/HYDRO_tests/ExternalFiles.cmake +++ b/src/HYDRO_tests/ExternalFiles.cmake @@ -10,6 +10,7 @@ set( EXTERNAL_FILES ../HYDROData/HYDROData_BSplineOperation.cxx ../HYDROData/HYDROData_CalculationCase.cxx ../HYDROData/HYDROData_Channel.cxx + ../HYDROData/HYDROData_ChannelAltitude.cxx ../HYDROData/HYDROData_Confluence.cxx ../HYDROData/HYDROData_Digue.cxx ../HYDROData/HYDROData_Document.cxx @@ -55,6 +56,10 @@ set( EXTERNAL_FILES ../HYDROData/HYDROData_SinusX.cxx ../HYDROData/HYDROData_ShapeFile.cxx ../HYDROData/HYDROData_LandCoverMap.cxx + ../HYDROData/HYDROData_Quadtree.cxx + ../HYDROData/HYDROData_QuadtreeNode.cxx + ../HYDROData/HYDROData_LCM_FaceClassifier.cxx + ../HYDROData/HYDROData_DTM.cxx ../HYDROGUI/HYDROGUI_ListModel.cxx ../HYDROGUI/HYDROGUI_DataObject.cxx @@ -63,15 +68,23 @@ set( EXTERNAL_FILES ../HYDROGUI/HYDROGUI_Polyline.cxx ../HYDROGUI/HYDROGUI_AISShape.cxx ../HYDROGUI/HYDROGUI_Shape.cxx + ../HYDROGUI/HYDROGUI_ShapeBathymetry.cxx + ../HYDROGUI/HYDROGUI_BathymetryPrs.cxx ../HYDROGUI/HYDROGUI_InputPanel.cxx ../HYDROGUI/HYDROGUI_StricklerTableDlg.cxx ../HYDROGUI/HYDROGUI_LineEditDoubleValidator.cxx ../HYDROGUI/HYDROGUI_Tool.cxx + ../HYDROGUI/HYDROGUI_StreamDlg.cxx + ../HYDROGUI/HYDROGUI_ListSelector.cxx + ../HYDROGUI/HYDROGUI_OrderedListWidget.cxx ) set( MOC_HEADERS ../HYDROGUI/HYDROGUI_InputPanel.h ../HYDROGUI/HYDROGUI_StricklerTableDlg.h + ../HYDROGUI/HYDROGUI_StreamDlg.h + ../HYDROGUI/HYDROGUI_ListSelector.h + ../HYDROGUI/HYDROGUI_OrderedListWidget.h ) QT_WRAP_MOC( PROJECT_MOC_HEADERS ${MOC_HEADERS} ) diff --git a/src/HYDRO_tests/TestShape.cxx b/src/HYDRO_tests/TestShape.cxx index 3cf4ea20..70ce0866 100644 --- a/src/HYDRO_tests/TestShape.cxx +++ b/src/HYDRO_tests/TestShape.cxx @@ -27,7 +27,7 @@ #include #include -TopoDS_Edge Edge( const QList& theXYList, bool isClosed ) +TopoDS_Edge Edge2d( const QList& theXYList, bool isClosed ) { int n = theXYList.size()/2; Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n ); @@ -50,14 +50,48 @@ TopoDS_Edge Edge( const QList& theXYList, bool isClosed ) return TopoDS_Edge(); } -TopoDS_Wire Wire( const QList& theXYList, bool isClosed ) +TopoDS_Wire Wire2d( const QList& theXYList, bool isClosed ) { - return BRepBuilderAPI_MakeWire( Edge( theXYList, isClosed ) ).Wire(); + return BRepBuilderAPI_MakeWire( Edge2d( theXYList, isClosed ) ).Wire(); } -TopoDS_Face Face( const QList& theXYList ) +TopoDS_Edge Edge3d( const QList& theXYZList, bool isClosed ) { - return BRepBuilderAPI_MakeFace( Wire( theXYList, true ), Standard_True ).Face(); + int n = theXYZList.size()/3; + Handle(TColgp_HArray1OfPnt) aPointsArray = new TColgp_HArray1OfPnt( 1, n ); + for( int i=1; i<=n; i++ ) + { + double x = theXYZList[3*i-3]; + double y = theXYZList[3*i-2]; + double z = theXYZList[3*i-1]; + gp_Pnt aPnt( x, y, z ); + aPointsArray->SetValue( i, aPnt ); + } + GeomAPI_Interpolate anInterpolator( aPointsArray, isClosed, 1E-3 ); + anInterpolator.Perform(); + bool aResult = anInterpolator.IsDone() == Standard_True; + if( aResult ) + { + Handle( Geom_BSplineCurve ) aCurve = anInterpolator.Curve(); + return BRepBuilderAPI_MakeEdge( aCurve ).Edge(); + } + else + return TopoDS_Edge(); +} + +TopoDS_Wire Wire3d( const QList& theXYZList, bool isClosed ) +{ + return BRepBuilderAPI_MakeWire( Edge3d( theXYZList, isClosed ) ).Wire(); +} + +TopoDS_Face Face2d( const QList& theXYList ) +{ + return BRepBuilderAPI_MakeFace( Wire2d( theXYList, true ), Standard_True ).Face(); +} + +TopoDS_Face Face3d( const QList& theXYZList ) +{ + return BRepBuilderAPI_MakeFace( Wire3d( theXYZList, true ), Standard_True ).Face(); } TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius ) diff --git a/src/HYDRO_tests/TestShape.h b/src/HYDRO_tests/TestShape.h index b1e12378..470d3049 100644 --- a/src/HYDRO_tests/TestShape.h +++ b/src/HYDRO_tests/TestShape.h @@ -25,8 +25,14 @@ class TopoDS_Wire; class TopoDS_Face; class gp_Pnt; -TopoDS_Edge Edge( const QList& theXYList, bool isClosed = false ); -TopoDS_Wire Wire( const QList& theXYList, bool isClosed = false ); +TopoDS_Edge Edge2d( const QList& theXYList, bool isClosed = false ); +TopoDS_Wire Wire2d( const QList& theXYList, bool isClosed = false ); + +TopoDS_Edge Edge3d( const QList& theXYZList, bool isClosed = false ); +TopoDS_Wire Wire3d( const QList& theXYZList, bool isClosed = false ); + + TopoDS_Wire WireCirc( const gp_Pnt& theCenter, double theRadius ); -TopoDS_Face Face( const QList& theXYList ); +TopoDS_Face Face2d( const QList& theXYList ); +TopoDS_Face Face3d( const QList& theXYZList ); diff --git a/src/HYDRO_tests/TestViewer.cxx b/src/HYDRO_tests/TestViewer.cxx index c5e8e513..144545e1 100644 --- a/src/HYDRO_tests/TestViewer.cxx +++ b/src/HYDRO_tests/TestViewer.cxx @@ -256,11 +256,18 @@ bool AreImagesEqual( const QImage& theImage1, const QImage& theImage2, double th return true; } -bool TestViewer::AssertImages( QString& theMessage ) +bool TestViewer::AssertImages( QString& theMessage, const QImage* theImage, const char* theCase ) { - QImage anActualImage = viewWindow()->dumpView(); + QImage anActualImage; + if( theImage ) + anActualImage = *theImage; + else + anActualImage = viewWindow()->dumpView(); - QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; + if( theCase ) + myKey = theCase; + + QString anExpectedRefFilePath = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; anExpectedRefFilePath += "/" + myKey + ".png"; QImage anExpectedRefImage; anExpectedRefImage.load( anExpectedRefFilePath ); @@ -285,6 +292,8 @@ bool TestViewer::AssertImages( QString& theMessage ) QString aDiffFilePath = QDir::tempPath() + "/" + myKey + "_diff.png"; aDiff.save( aDiffFilePath ); + anExpectedRefImage.save( QDir::tempPath() + "/" + myKey + "_1.png"); + return false; } @@ -332,6 +341,11 @@ void TestViewer::showColorScale( bool isShow ) } } +bool TestViewer::ColorScaleIsDisplayed() +{ + return context()->IsDisplayed( colorScale() ); +} + void TestViewer::select( int theViewX, int theViewY ) { Handle(V3d_View) aView = myViewWindow->getViewPort()->getView(); diff --git a/src/HYDRO_tests/TestViewer.h b/src/HYDRO_tests/TestViewer.h index de076a1e..c27e5d36 100644 --- a/src/HYDRO_tests/TestViewer.h +++ b/src/HYDRO_tests/TestViewer.h @@ -26,6 +26,7 @@ class OCCViewer_ViewWindow; class TopoDS_Shape; class QString; class QColor; +class QImage; class AIS_InteractiveObject; class AIS_ColorScale; @@ -42,11 +43,12 @@ public: int theMode, int theSelectionMode, bool isFitAll, const char* theKey ); static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const QColor& theColor ); static void show( const TopoDS_Shape& theShape, int theMode, bool isFitAll, const char* theKey ); - static bool AssertImages( QString& theMessage ); + static bool AssertImages( QString& theMessage, const QImage* = 0, const char* theCase = 0 ); static QColor GetColor(int i); static Handle(AIS_ColorScale) colorScale(); static void showColorScale( bool ); + static bool ColorScaleIsDisplayed(); static void select( int theViewX, int theViewY ); @@ -73,6 +75,17 @@ private: } \ } \ +#define CPPUNIT_ASSERT_IMAGES2( theImage, theCase ) \ + { \ + QString aMessage; \ + if( !TestViewer::AssertImages( aMessage, theImage, theCase ) ) \ + { \ + TestViewer::showColorScale( false ); \ + std::string aMessageStl = aMessage.toStdString(); \ + CPPUNIT_FAIL( aMessageStl.c_str() ); \ + } \ + } \ + #define CPPUNIT_ASSERT_SCRIPTS_EQUAL( theBaseName, \ isExpectedUtf8, \ isActualUtf8, \ diff --git a/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png b/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png index db50aef8..d58c9fb8 100644 Binary files a/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png and b/src/HYDRO_tests/reference_data/CLC06-cut_1_res.png differ diff --git a/src/HYDRO_tests/reference_data/CMakeLists.txt b/src/HYDRO_tests/reference_data/CMakeLists.txt index e1b18f95..1f1f86e7 100644 --- a/src/HYDRO_tests/reference_data/CMakeLists.txt +++ b/src/HYDRO_tests/reference_data/CMakeLists.txt @@ -102,9 +102,23 @@ SET(REFERENCE_DATA t1.dbf test_LCM.dbf test.telemac + r2.brep + p1.brep + p2.brep + p3.brep + cc_int_w_1.png + cc_int_w_2.png + cc_int_w_3.png + StreamDlg.png + Profiles.xyz + profiles1.xyz + DTM_1.png + DTM_2.png + stream_dtm_2d.png + stream_dtm_3d.png ) # Application tests -SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_SCRIPT_SCRIPTS}/test) +SET(TEST_INSTALL_DIRECTORY ${SALOME_INSTALL_BINS}/test) INSTALL(FILES ${REFERENCE_DATA} DESTINATION ${TEST_INSTALL_DIRECTORY}) diff --git a/src/HYDRO_tests/reference_data/Channel.png b/src/HYDRO_tests/reference_data/Channel.png index 4f8b7d18..028435ec 100644 Binary files a/src/HYDRO_tests/reference_data/Channel.png and b/src/HYDRO_tests/reference_data/Channel.png differ diff --git a/src/HYDRO_tests/reference_data/DTM_1.png b/src/HYDRO_tests/reference_data/DTM_1.png new file mode 100644 index 00000000..1353db09 Binary files /dev/null and b/src/HYDRO_tests/reference_data/DTM_1.png differ diff --git a/src/HYDRO_tests/reference_data/DTM_2.png b/src/HYDRO_tests/reference_data/DTM_2.png new file mode 100644 index 00000000..612a4be5 Binary files /dev/null and b/src/HYDRO_tests/reference_data/DTM_2.png differ diff --git a/src/HYDRO_tests/reference_data/Extraction_Channel.png b/src/HYDRO_tests/reference_data/Extraction_Channel.png index 67cc84e4..9ef6188a 100644 Binary files a/src/HYDRO_tests/reference_data/Extraction_Channel.png and b/src/HYDRO_tests/reference_data/Extraction_Channel.png differ diff --git a/src/HYDRO_tests/reference_data/Extraction_ImmZone.png b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png index d0e58c01..9e919787 100644 Binary files a/src/HYDRO_tests/reference_data/Extraction_ImmZone.png and b/src/HYDRO_tests/reference_data/Extraction_ImmZone.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_copied.png b/src/HYDRO_tests/reference_data/LCM_copied.png index 4494edf5..f02db52f 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_copied.png and b/src/HYDRO_tests/reference_data/LCM_copied.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_split_2a.png b/src/HYDRO_tests/reference_data/LCM_split_2a.png index b725e864..4a7e4419 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_split_2a.png and b/src/HYDRO_tests/reference_data/LCM_split_2a.png differ diff --git a/src/HYDRO_tests/reference_data/LCM_split_2b.png b/src/HYDRO_tests/reference_data/LCM_split_2b.png index bdcd3ad9..e85c19ac 100644 Binary files a/src/HYDRO_tests/reference_data/LCM_split_2b.png and b/src/HYDRO_tests/reference_data/LCM_split_2b.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png index 462d62c4..fa0e260c 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Add_2_Objects.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png index 565bbef1..7288a5f8 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png index 6028686b..4f6daf9a 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Merge_2.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png index 434e98ea..03b73fbe 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png and b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByCoeff.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png index 28b79a46..f940570f 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png and b/src/HYDRO_tests/reference_data/LandCoverMap_PrsByTypes.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png index ee5f9f94..dce48726 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Remove_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png index 95b07bef..877688be 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_1.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png index f955b137..b34f6477 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_2.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png b/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png index a5b80362..98c5e924 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png and b/src/HYDRO_tests/reference_data/LandCoverMap_Split_Polyline.png differ diff --git a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png index 69335a2e..e9ac5eec 100644 Binary files a/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png and b/src/HYDRO_tests/reference_data/LandCoverMap_TransparentPrs.png differ diff --git a/src/HYDRO_tests/reference_data/LandCover_Triangles.png b/src/HYDRO_tests/reference_data/LandCover_Triangles.png index a8fa3c1f..b015ee5d 100644 Binary files a/src/HYDRO_tests/reference_data/LandCover_Triangles.png and b/src/HYDRO_tests/reference_data/LandCover_Triangles.png differ diff --git a/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png b/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png index bb59e232..175785eb 100644 Binary files a/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png and b/src/HYDRO_tests/reference_data/LandCover_Triangles_Split.png differ diff --git a/src/HYDRO_tests/reference_data/Merge_Polylines.png b/src/HYDRO_tests/reference_data/Merge_Polylines.png index baed02ce..46e68bed 100644 Binary files a/src/HYDRO_tests/reference_data/Merge_Polylines.png and b/src/HYDRO_tests/reference_data/Merge_Polylines.png differ diff --git a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png index 519f94a1..34154fd5 100644 Binary files a/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png and b/src/HYDRO_tests/reference_data/NLD_water_areas_dcw.png differ diff --git a/src/HYDRO_tests/reference_data/Polyline_Presentation.png b/src/HYDRO_tests/reference_data/Polyline_Presentation.png index 938f6f62..1a4f14fd 100644 Binary files a/src/HYDRO_tests/reference_data/Polyline_Presentation.png and b/src/HYDRO_tests/reference_data/Polyline_Presentation.png differ diff --git a/src/HYDRO_tests/reference_data/Profiles.xyz b/src/HYDRO_tests/reference_data/Profiles.xyz new file mode 100644 index 00000000..85aa520d --- /dev/null +++ b/src/HYDRO_tests/reference_data/Profiles.xyz @@ -0,0 +1,2389 @@ +0 5 25.186 +0 4.8 22.4152 +0 4.6 22.0804 +0 4.4 18.64 +0 4.2 17.7015 +0 4 16.0973 +0 3.8 15.0256 +0 3.6 13.0578 +0 3.4 10.9882 +0 3.2 10.6674 +0 3 9.17477 +0 2.8 7.3185 +0 2.6 5.78745 +0 2.4 6.55082 +0 2.2 3.90972 +0 2 4.43752 +0 1.8 3.07365 +0 1.6 3.54517 +0 1.4 1.25062 +0 1.2 2.43956 +0 1 1.01945 +0 0.8 0.702071 +0 0.6 1.20222 +0 0.4 -0.411726 +0 0.2 -0.382054 +0 -1.77636e-15 0.926717 +0 -0.2 -0.685734 +0 -0.4 1.12641 +0 -0.6 -0.55669 +0 -0.8 1.42399 +0 -1 0.272547 +0 -1.2 0.5743 +0 -1.4 2.59022 +0 -1.6 3.472 +0 -1.8 2.56885 +0 -2 4.44473 +0 -2.2 4.49208 +0 -2.4 6.47593 +0 -2.6 5.84307 +0 -2.8 7.78878 +0 -3 9.69446 +0 -3.2 10.0741 +0 -3.4 10.6878 +0 -3.6 13.7355 +0 -3.8 13.8832 +0 -4 16.7794 +0 -4.2 16.8504 +0 -4.4 18.8078 +0 -4.6 22.1592 +0 -4.8 22.8232 +0 -5 24.198 + +10 5 24.6382 +10 4.8 22.2936 +10 4.6 20.4262 +10 4.4 19.1647 +10 4.2 17.2705 +10 4 15.2053 +10 3.8 15.4349 +10 3.6 12.1812 +10 3.4 10.5601 +10 3.2 9.24304 +10 3 9.86394 +10 2.8 7.77967 +10 2.6 7.74912 +10 2.4 5.99654 +10 2.2 3.89767 +10 2 4.87817 +10 1.8 2.24931 +10 1.6 3.41122 +10 1.4 0.96022 +10 1.2 1.0197 +10 1 1.04439 +10 0.8 0.818657 +10 0.6 -0.61448 +10 0.4 0.784803 +10 0.2 -0.760123 +10 -1.77636e-15 0.750689 +10 -0.2 0.180105 +10 -0.4 0.318771 +10 -0.6 -0.423334 +10 -0.8 1.60857 +10 -1 0.81276 +10 -1.2 0.782445 +10 -1.4 1.18741 +10 -1.6 1.61172 +10 -1.8 3.1852 +10 -2 4.22591 +10 -2.2 5.64512 +10 -2.4 6.65672 +10 -2.6 5.96376 +10 -2.8 8.83066 +10 -3 9.74678 +10 -3.2 9.3544 +10 -3.4 12.3609 +10 -3.6 12.4069 +10 -3.8 13.6231 +10 -4 16.0381 +10 -4.2 16.9327 +10 -4.4 20.2372 +10 -4.6 20.3078 +10 -4.8 23.9337 +10 -5 25.7797 + +20 5 24.4913 +20 4.8 23.0775 +20 4.6 20.16 +20 4.4 20.0758 +20 4.2 17.4029 +20 4 15.8173 +20 3.8 14.6499 +20 3.6 13.9308 +20 3.4 10.9384 +20 3.2 9.26779 +20 3 8.70101 +20 2.8 8.83385 +20 2.6 7.71371 +20 2.4 5.23796 +20 2.2 5.642 +20 2 3.57144 +20 1.8 3.48665 +20 1.6 2.77046 +20 1.4 2.41224 +20 1.2 2.198 +20 1 0.0277354 +20 0.8 1.61434 +20 0.6 1.33114 +20 0.4 -0.839987 +20 0.2 0.562631 +20 -1.77636e-15 -0.758455 +20 -0.2 0.778388 +20 -0.4 1.15573 +20 -0.6 1.10957 +20 -0.8 1.6397 +20 -1 1.99462 +20 -1.2 1.3886 +20 -1.4 1.18691 +20 -1.6 1.85946 +20 -1.8 2.24123 +20 -2 4.07075 +20 -2.2 5.13588 +20 -2.4 6.56157 +20 -2.6 5.85177 +20 -2.8 8.6756 +20 -3 8.4777 +20 -3.2 9.77132 +20 -3.4 10.5704 +20 -3.6 13.9119 +20 -3.8 15.4349 +20 -4 16.663 +20 -4.2 16.684 +20 -4.4 20.0736 +20 -4.6 20.4917 +20 -4.8 22.1857 +20 -5 25.9988 + +30 5 25.9642 +30 4.8 22.2908 +30 4.6 20.4563 +30 4.4 20.2964 +30 4.2 17.2263 +30 4 16.1583 +30 3.8 14.4766 +30 3.6 13.9579 +30 3.4 12.2376 +30 3.2 9.56467 +30 3 9.75025 +30 2.8 7.23988 +30 2.6 7.72353 +30 2.4 6.37671 +30 2.2 5.22097 +30 2 3.77828 +30 1.8 2.38578 +30 1.6 2.08517 +30 1.4 2.88036 +30 1.2 1.10019 +30 1 1.8565 +30 0.8 1.28474 +30 0.6 0.806407 +30 0.4 0.457232 +30 0.2 0.413362 +30 -1.77636e-15 -0.968896 +30 -0.2 0.715395 +30 -0.4 -0.435054 +30 -0.6 -0.256824 +30 -0.8 -0.0358615 +30 -1 1.98632 +30 -1.2 0.667447 +30 -1.4 2.57412 +30 -1.6 3.2019 +30 -1.8 2.97937 +30 -2 3.29298 +30 -2.2 4.26857 +30 -2.4 5.24514 +30 -2.6 5.91731 +30 -2.8 8.67166 +30 -3 9.73266 +30 -3.2 9.54886 +30 -3.4 11.8379 +30 -3.6 13.8729 +30 -3.8 13.5535 +30 -4 16.0689 +30 -4.2 16.834 +30 -4.4 20.2647 +30 -4.6 20.4392 +30 -4.8 23.5095 +30 -5 24.0012 + +40 5 24.763 +40 4.8 22.0416 +40 4.6 22.1597 +40 4.4 18.363 +40 4.2 17.2293 +40 4 15.2651 +40 3.8 15.2411 +40 3.6 13.9236 +40 3.4 12.4755 +40 3.2 9.24078 +40 3 9.90814 +40 2.8 8.67616 +40 2.6 6.12431 +40 2.4 6.57273 +40 2.2 4.11302 +40 2 4.82156 +40 1.8 2.61869 +40 1.6 1.56069 +40 1.4 1.00081 +40 1.2 0.923696 +40 1 1.53034 +40 0.8 -0.211931 +40 0.6 -0.262163 +40 0.4 -0.161622 +40 0.2 -0.516712 +40 -1.77636e-15 0.992768 +40 -0.2 -0.0302711 +40 -0.4 1.152 +40 -0.6 -0.460614 +40 -0.8 -0.28607 +40 -1 0.302644 +40 -1.2 0.567026 +40 -1.4 1.21583 +40 -1.6 1.76458 +40 -1.8 2.30587 +40 -2 3.17373 +40 -2.2 5.57188 +40 -2.4 5.58603 +40 -2.6 6.83705 +40 -2.8 6.98423 +40 -3 8.0772 +40 -3.2 10.3369 +40 -3.4 12.0062 +40 -3.6 12.5322 +40 -3.8 13.7432 +40 -4 15.5879 +40 -4.2 16.6461 +40 -4.4 20.2289 +40 -4.6 20.4696 +40 -4.8 23.9933 +40 -5 24.1773 + +45.8333 6.7031 24.1436 +45.9337 6.49314 22.064 +46.0341 6.28319 20.8568 +46.1345 6.07323 18.8164 +46.2349 5.86328 16.7977 +46.3353 5.65332 15.2911 +46.4358 5.44336 13.7248 +46.5362 5.23341 12.2817 +46.6366 5.02345 12.4233 +46.737 4.81349 9.8777 +46.8374 4.60354 9.38148 +46.9378 4.39358 8.79903 +47.0382 4.18362 6.80165 +47.1387 3.97367 6.05392 +47.2391 3.76371 4.73138 +47.3395 3.55375 4.74354 +47.4399 3.3438 3.75993 +47.5403 3.13384 3.4587 +47.6407 2.92388 1.24968 +47.7411 2.71393 1.85302 +47.8416 2.50397 1.41212 +47.942 2.29401 0.0789631 +48.0424 2.08406 1.34679 +48.1428 1.8741 0.781431 +48.2432 1.66414 -0.69985 +48.3436 1.45419 -0.956297 +48.444 1.24423 0.681575 +48.5444 1.03428 -0.348158 +48.6449 0.824319 1.31153 +48.7453 0.614362 1.57367 +48.8457 0.404406 1.70734 +48.9461 0.194449 0.847007 +49.0465 -0.015507 2.92118 +49.1469 -0.225464 1.79215 +49.2473 -0.43542 2.46772 +49.3478 -0.645377 3.24241 +49.4482 -0.855333 5.68189 +49.5486 -1.06529 5.2858 +49.649 -1.27525 5.80317 +49.7494 -1.4852 8.64501 +49.8498 -1.69516 9.14937 +49.9502 -1.90512 9.78927 +50.0507 -2.11507 10.606 +50.1511 -2.32503 13.6807 +50.2515 -2.53499 14.6701 +50.3519 -2.74494 16.5864 +50.4523 -2.9549 17.0184 +50.5527 -3.16485 19.829 +50.6531 -3.37481 21.1088 +50.7536 -3.58477 23.738 +50.854 -3.79472 24.0023 + +50.854 11.2674 24.0461 +50.9726 11.0894 22.9002 +51.0913 10.9114 22.0891 +51.21 10.7334 19.8429 +51.3287 10.5553 17.4621 +51.4473 10.3773 15.2276 +51.566 10.1993 15.028 +51.6847 10.0213 12.8437 +51.8033 9.84332 10.647 +51.922 9.66531 9.51884 +52.0407 9.48731 9.47412 +52.1594 9.3093 7.47691 +52.278 9.13129 7.4156 +52.3967 8.95329 6.1237 +52.5154 8.77528 5.83873 +52.634 8.59727 4.96792 +52.7527 8.41927 2.57537 +52.8714 8.24126 3.09502 +52.99 8.06325 1.76582 +53.1087 7.88525 0.498112 +53.2274 7.70724 0.0802341 +53.3461 7.52923 -0.332819 +53.4647 7.35123 0.351149 +53.5834 7.17322 -0.657403 +53.7021 6.99521 0.547821 +53.8207 6.81721 -0.565362 +53.9394 6.6392 0.634763 +54.0581 6.46119 1.12128 +54.1768 6.28319 0.638576 +54.2954 6.10518 0.81003 +54.4141 5.92717 0.414329 +54.5328 5.74917 1.12548 +54.6514 5.57116 2.94034 +54.7701 5.39315 2.00714 +54.8888 5.21515 3.17105 +55.0075 5.03714 3.38299 +55.1261 4.85914 4.02362 +55.2448 4.68113 6.48633 +55.3635 4.50312 7.61502 +55.4821 4.32512 7.35906 +55.6008 4.14711 8.79998 +55.7195 3.9691 9.49424 +55.8382 3.7911 10.7431 +55.9568 3.61309 13.4414 +56.0755 3.43508 14.9249 +56.1942 3.25708 15.0231 +56.3128 3.07907 16.6978 +56.4315 2.90106 18.448 +56.5502 2.72306 22.1363 +56.6689 2.54505 23.0567 +56.7875 2.36704 25.6377 + +52.6797 16.5163 24.7897 +52.8805 16.393 23.1551 +53.0813 16.2698 20.5742 +53.2822 16.1466 18.8841 +53.483 16.0233 16.6401 +53.6838 15.9001 15.955 +53.8846 15.7769 15.3696 +54.0855 15.6536 13.909 +54.2863 15.5304 11.0869 +54.4871 15.4072 11.206 +54.688 15.2839 9.58765 +54.8888 15.1607 7.75031 +55.0896 15.0375 7.74931 +55.2904 14.9142 5.95599 +55.4913 14.791 4.62707 +55.6921 14.6678 4.70802 +55.8929 14.5445 4.1675 +56.0938 14.4213 3.55711 +56.2946 14.298 2.89591 +56.4954 14.1748 1.85063 +56.6962 14.0516 0.00807524 +56.8971 13.9283 1.63152 +57.0979 13.8051 0.730312 +57.2987 13.6819 -0.79889 +57.4996 13.5586 0.429393 +57.7004 13.4354 0.638851 +57.9012 13.3122 0.989045 +58.102 13.1889 -0.651691 +58.3029 13.0657 1.32579 +58.5037 12.9425 -0.269924 +58.7045 12.8192 0.0838526 +58.9053 12.696 0.632887 +59.1062 12.5728 1.06242 +59.307 12.4495 2.0533 +59.5078 12.3263 2.57044 +59.7087 12.203 4.32996 +59.9095 12.0798 4.00866 +60.1103 11.9566 5.5688 +60.3111 11.8333 5.99834 +60.512 11.7101 7.76256 +60.7128 11.5869 8.0012 +60.9136 11.4636 11.2087 +61.1145 11.3404 11.8812 +61.3153 11.2172 12.4463 +61.5161 11.0939 14.7532 +61.7169 10.9707 15.5904 +61.9178 10.8475 18.3048 +62.1186 10.7242 19.8674 +62.3194 10.601 21.386 +62.5202 10.4778 22.2129 +62.7211 10.3545 25.7402 + +55.19 23.8191 25.4205 +55.3909 23.6959 23.9764 +55.5917 23.5726 21.8046 +55.7925 23.4494 20.3508 +55.9933 23.3262 18.61 +56.1942 23.2029 16.9751 +56.395 23.0797 15.4148 +56.5958 22.9565 12.4158 +56.7967 22.8332 11.9725 +56.9975 22.71 11.2366 +57.1983 22.5868 9.99792 +57.3991 22.4635 8.67537 +57.6 22.3403 7.71696 +57.8008 22.2171 6.00724 +58.0016 22.0938 5.72556 +58.2024 21.9706 3.4175 +58.4033 21.8474 2.60375 +58.6041 21.7241 2.05267 +58.8049 21.6009 1.6324 +59.0058 21.4776 2.16851 +59.2066 21.3544 1.9941 +59.4074 21.2312 1.51202 +59.6082 21.1079 1.06877 +59.8091 20.9847 0.837282 +60.0099 20.8615 -0.893418 +60.2107 20.7382 0.769623 +60.4116 20.615 0.920716 +60.6124 20.4918 0.918396 +60.8132 20.3685 0.842024 +61.014 20.2453 0.302489 +61.2149 20.1221 1.54994 +61.4157 19.9988 0.58067 +61.6165 19.8756 1.63852 +61.8174 19.7524 3.22393 +62.0182 19.6291 2.56463 +62.219 19.5059 3.00531 +62.4198 19.3826 5.22995 +62.6207 19.2594 6.23539 +62.8215 19.1362 6.13058 +63.0223 19.0129 8.25096 +63.2231 18.8897 9.33657 +63.424 18.7665 9.58848 +63.6248 18.6432 12.3624 +63.8256 18.52 13.2721 +64.0265 18.3968 14.3842 +64.2273 18.2735 15.8874 +64.4281 18.1503 18.3833 +64.6289 18.0271 18.9248 +64.8298 17.9038 20.4448 +65.0306 17.7806 22.5903 +65.2314 17.6574 25.3159 + +58.385 31.8066 25.9955 +58.5813 31.6468 23.5557 +58.7775 31.4871 22.1591 +58.9738 31.3273 20.1702 +59.1701 31.1676 18.5965 +59.3663 31.0078 16.9398 +59.5626 30.8481 14.2988 +59.7589 30.6883 12.1875 +59.9551 30.5286 11.2491 +60.1514 30.3688 10.8483 +60.3477 30.2091 8.00008 +60.5439 30.0494 6.86488 +60.7402 29.8896 7.22703 +60.9364 29.7299 5.59006 +61.1327 29.5701 5.82763 +61.329 29.4104 4.66873 +61.5252 29.2506 2.87089 +61.7215 29.0909 3.50469 +61.9178 28.9311 1.03578 +62.114 28.7714 2.11588 +62.3103 28.6116 1.8418 +62.5066 28.4519 -0.358399 +62.7028 28.2921 1.02296 +62.8991 28.1324 -0.708159 +63.0953 27.9726 -0.780441 +63.2916 27.8129 -0.877532 +63.4879 27.6531 1.03561 +63.6841 27.4934 -0.47697 +63.8804 27.3336 1.21656 +64.0767 27.1739 0.593589 +64.2729 27.0141 1.5666 +64.4692 26.8544 0.749255 +64.6655 26.6946 2.81094 +64.8617 26.5349 3.54805 +65.058 26.3751 2.27436 +65.2542 26.2154 3.40374 +65.4505 26.0556 5.51584 +65.6468 25.8959 5.1237 +65.843 25.7361 6.97813 +66.0393 25.5764 7.37978 +66.2356 25.4166 8.25672 +66.4318 25.2569 9.82585 +66.6281 25.0971 11.5856 +66.8244 24.9374 11.9622 +67.0206 24.7776 13.4404 +67.2169 24.6179 15.0872 +67.4131 24.4581 16.7352 +67.6094 24.2984 18.52 +67.8057 24.1386 21.9225 +68.0019 23.9789 22.0631 +68.1982 23.8191 24.0495 + +65.9161 38.653 25.9864 +66.0986 38.4294 22.7529 +66.2812 38.2057 21.8507 +66.4638 37.9821 18.43 +66.6464 37.7584 17.5366 +66.8289 37.5348 16.9977 +67.0115 37.3111 15.1407 +67.1941 37.0875 12.4753 +67.3766 36.8638 12.5576 +67.5592 36.6402 11.2041 +67.7418 36.4165 8.20292 +67.9243 36.1929 8.55389 +68.1069 35.9692 6.12154 +68.2895 35.7456 5.29908 +68.4721 35.5219 5.18688 +68.6546 35.2983 3.31063 +68.8372 35.0746 4.07204 +69.0198 34.851 2.66467 +69.2023 34.6273 1.62155 +69.3849 34.4037 0.447388 +69.5675 34.18 0.0164394 +69.7501 33.9564 -0.337887 +69.9326 33.7327 1.1701 +70.1152 33.5091 0.549004 +70.2978 33.2854 0.283644 +70.4803 33.0618 0.86096 +70.6629 32.8381 0.532596 +70.8455 32.6145 1.03004 +71.0281 32.3908 0.190535 +71.2106 32.1672 -0.17716 +71.3932 31.9435 0.692549 +71.5758 31.7199 2.30446 +71.7583 31.4962 1.84285 +71.9409 31.2726 2.50556 +72.1235 31.0489 3.9735 +72.306 30.8253 3.05459 +72.4886 30.6016 5.64178 +72.6712 30.378 4.7608 +72.8538 30.1543 6.38994 +73.0363 29.9307 8.06685 +73.2189 29.707 8.05667 +73.4015 29.4834 11.2309 +73.584 29.2597 12.5211 +73.7666 29.0361 12.5727 +73.9492 28.8124 14.5722 +74.1318 28.5888 15.0009 +74.3143 28.3651 16.8088 +74.4969 28.1415 18.3716 +74.6795 27.9178 20.3844 +74.862 27.6942 22.0859 +75.0446 27.4705 24.465 + +76.8703 41.848 24.6269 +76.9844 41.5787 22.0884 +77.0985 41.3094 20.9903 +77.2126 41.0401 18.4196 +77.3268 40.7708 17.791 +77.4409 40.5015 15.0551 +77.555 40.2322 14.0177 +77.6691 39.9629 13.5619 +77.7832 39.6937 12.4466 +77.8973 39.4244 9.39819 +78.0114 39.1551 9.33743 +78.1255 38.8858 6.85472 +78.2396 38.6165 7.74936 +78.3537 38.3472 6.63866 +78.4678 38.0779 5.71293 +78.5819 37.8086 3.07655 +78.696 37.5393 2.81067 +78.8101 37.27 3.50872 +78.9242 37.0007 1.84743 +79.0384 36.7314 1.06955 +79.1525 36.4622 1.29735 +79.2666 36.1929 0.781747 +79.3807 35.9236 -0.50795 +79.4948 35.6543 0.214709 +79.6089 35.385 -0.85328 +79.723 35.1157 -0.906076 +79.8371 34.8464 -0.480316 +79.9512 34.5771 1.11689 +80.0653 34.3078 1.29702 +80.1794 34.0385 -0.359121 +80.2935 33.7692 1.54387 +80.4076 33.4999 1.07815 +80.5217 33.2306 1.76892 +80.6358 32.9614 3.55945 +80.75 32.6921 4.22074 +80.8641 32.4228 3.53268 +80.9782 32.1535 5.79395 +81.0923 31.8842 4.86707 +81.2064 31.6149 5.89562 +81.3205 31.3456 8.29033 +81.4346 31.0763 9.88641 +81.5487 30.807 9.55766 +81.6628 30.5377 10.7866 +81.7769 30.2684 13.9582 +81.891 29.9991 15.3875 +82.0051 29.7299 15.2035 +82.1192 29.4606 16.8197 +82.2333 29.1913 19.4386 +82.3474 28.922 20.1878 +82.4616 28.6527 23.1918 +82.5757 28.3834 24.6881 + +92.8453 40.0223 25.1213 +92.827 39.753 23.0849 +92.8088 39.4837 20.5172 +92.7905 39.2144 20.1498 +92.7722 38.9451 18.1692 +92.754 38.6758 16.8978 +92.7357 38.4065 13.6622 +92.7175 38.1372 12.6546 +92.6992 37.8679 11.7862 +92.681 37.5987 9.82071 +92.6627 37.3294 9.36126 +92.6444 37.0601 8.67629 +92.6262 36.7908 6.49121 +92.6079 36.5215 5.37983 +92.5897 36.2522 5.63674 +92.5714 35.9829 4.24724 +92.5532 35.7136 3.73144 +92.5349 35.4443 3.49576 +92.5166 35.175 2.04105 +92.4984 34.9057 0.963867 +92.4801 34.6364 0.123018 +92.4619 34.3672 1.48723 +92.4436 34.0979 -0.570548 +92.4254 33.8286 0.634861 +92.4071 33.5593 0.820428 +92.3888 33.29 -0.974317 +92.3706 33.0207 -0.932693 +92.3523 32.7514 -0.830865 +92.3341 32.4821 0.910949 +92.3158 32.2128 0.00158997 +92.2976 31.9435 1.64423 +92.2793 31.6742 1.23694 +92.261 31.4049 1.97903 +92.2428 31.1356 1.98067 +92.2245 30.8664 2.32687 +92.2063 30.5971 4.7457 +92.188 30.3278 5.66029 +92.1698 30.0585 6.35547 +92.1515 29.7892 6.12445 +92.1332 29.5199 7.36413 +92.115 29.2506 8.11893 +92.0967 28.9813 10.9616 +92.0785 28.712 12.0676 +92.0602 28.4427 13.9519 +92.042 28.1734 14.4851 +92.0237 27.9041 15.0053 +92.0054 27.6349 17.6295 +91.9872 27.3656 19.0138 +91.9689 27.0963 21.637 +91.9507 26.827 22.0435 +91.9324 26.5577 25.5945 + +106.082 35.6862 25.6686 +105.936 35.4124 23.8428 +105.79 35.1385 22.1542 +105.643 34.8647 19.1403 +105.497 34.5908 17.3462 +105.351 34.3169 16.3284 +105.205 34.0431 14.1422 +105.059 33.7692 13.3133 +104.913 33.4954 11.0543 +104.767 33.2215 9.97809 +104.621 32.9477 8.14864 +104.475 32.6738 8.07839 +104.329 32.4 5.89875 +104.183 32.1261 5.65377 +104.037 31.8522 3.91624 +103.891 31.5784 3.84771 +103.745 31.3045 4.2045 +103.599 31.0307 3.52588 +103.453 30.7568 1.44504 +103.307 30.483 2.43283 +103.161 30.2091 1.96681 +103.014 29.9352 1.61488 +102.868 29.6614 0.280181 +102.722 29.3875 0.588128 +102.576 29.1137 0.93701 +102.43 28.8398 -0.069369 +102.284 28.566 0.621887 +102.138 28.2921 0.202436 +101.992 28.0182 1.09851 +101.846 27.7444 0.534822 +101.7 27.4705 0.821254 +101.554 27.1967 1.44229 +101.408 26.9228 2.81549 +101.262 26.649 1.82587 +101.116 26.3751 4.02047 +100.97 26.1013 4.97453 +100.824 25.8274 4.97202 +100.678 25.5535 6.76 +100.532 25.2797 7.73972 +100.385 25.0058 7.62005 +100.239 24.732 8.84037 +100.093 24.4581 11.1097 +99.9473 24.1843 12.5573 +99.8012 23.9104 11.963 +99.6552 23.6365 13.549 +99.5091 23.3627 15.0002 +99.3631 23.0888 18.6256 +99.217 22.815 20.0753 +99.0709 22.5411 21.6803 +98.9249 22.2673 23.9371 +98.7788 21.9934 25.0351 + +119.774 29.9809 25.9992 +119.519 29.6796 22.2347 +119.263 29.3784 20.168 +119.008 29.0772 20.3452 +118.752 28.7759 18.2475 +118.496 28.4747 16.6628 +118.241 28.1734 13.4913 +117.985 27.8722 12.6043 +117.73 27.571 11.8825 +117.474 27.2697 9.25678 +117.218 26.9685 8.72122 +116.963 26.6672 7.82459 +116.707 26.366 6.99455 +116.452 26.0647 5.38888 +116.196 25.7635 5.40394 +115.94 25.4623 4.70898 +115.685 25.161 2.46695 +115.429 24.8598 3.54404 +115.174 24.5585 1.95067 +114.918 24.2573 2.37354 +114.662 23.956 1.99978 +114.407 23.6548 1.41465 +114.151 23.3536 -0.37981 +113.896 23.0523 0.590606 +113.64 22.7511 0.964347 +113.384 22.4498 0.714518 +113.129 22.1486 -0.486855 +112.873 21.8474 0.828953 +112.618 21.5461 1.35281 +112.362 21.2449 -0.290051 +112.106 20.9436 1.95661 +111.851 20.6424 2.03692 +111.595 20.3411 1.48453 +111.34 20.0399 1.56502 +111.084 19.7387 3.29429 +110.829 19.4374 3.32952 +110.573 19.1362 5.68087 +110.317 18.8349 6.73062 +110.062 18.5337 7.75883 +109.806 18.2325 7.76219 +109.551 17.9312 8.78872 +109.295 17.63 9.25856 +109.039 17.3287 10.7146 +108.784 17.0275 13.3549 +108.528 16.7262 15.0988 +108.273 16.425 16.0505 +108.017 16.1238 16.9359 +107.761 15.8225 20.354 +107.506 15.5213 20.7332 +107.25 15.22 22.6668 +106.995 14.9188 24.0027 + +133.239 26.7859 25.2611 +132.888 26.366 22.3692 +132.536 25.9461 22.155 +132.185 25.5262 19.6981 +131.833 25.1062 16.6755 +131.482 24.6863 15.5817 +131.13 24.2664 15.3139 +130.779 23.8465 13.5701 +130.427 23.4266 11.5664 +130.076 23.0067 11.0298 +129.725 22.5868 9.8371 +129.373 22.1669 7.58606 +129.022 21.7469 5.97554 +128.67 21.327 6.07483 +128.319 20.9071 4.858 +127.967 20.4872 3.0002 +127.616 20.0673 2.88633 +127.264 19.6474 2.58577 +126.913 19.2275 0.973624 +126.562 18.8075 0.488295 +126.21 18.3876 1.79663 +125.859 17.9677 0.462322 +125.507 17.5478 1.29961 +125.156 17.1279 1.02538 +124.804 16.708 -0.828906 +124.453 16.2881 0.997749 +124.101 15.8682 -0.623995 +123.75 15.4482 0.763155 +123.399 15.0283 1.13442 +123.047 14.6084 0.0717325 +122.696 14.1885 1.70211 +122.344 13.7686 2.1237 +121.993 13.3487 1.45447 +121.641 12.9288 1.5984 +121.29 12.5089 3.69969 +120.938 12.0889 3.09079 +120.587 11.669 5.73896 +120.235 11.2491 6.49839 +119.884 10.8292 7.70844 +119.533 10.4093 7.77658 +119.181 9.98938 9.37353 +118.83 9.56946 9.25512 +118.478 9.14955 12.3153 +118.127 8.72964 13.3572 +117.775 8.30972 15.312 +117.424 7.88981 16.3148 +117.072 7.4699 17.1727 +116.721 7.04998 20.1115 +116.37 6.63007 21.3009 +116.018 6.21016 24.0394 +115.667 5.79025 25.7085 + +150.812 20.1677 24.0382 +150.305 19.6702 22.9627 +149.798 19.1727 22.1004 +149.292 18.6752 18.4008 +148.785 18.1777 18.3777 +148.278 17.6802 16.4265 +147.772 17.1827 14.0455 +147.265 16.6852 12.0264 +146.758 16.1877 11.6551 +146.252 15.6902 9.33828 +145.745 15.1926 8.17304 +145.239 14.6951 8.749 +144.732 14.1976 6.36363 +144.225 13.7001 4.8986 +143.719 13.2026 5.81271 +143.212 12.7051 4.4531 +142.705 12.2076 2.25629 +142.199 11.7101 2.42843 +141.692 11.2126 1.05142 +141.185 10.7151 0.440079 +140.679 10.2176 1.97423 +140.172 9.72008 0.455574 +139.666 9.22258 0.911779 +139.159 8.72507 0.0865118 +138.652 8.22757 0.470279 +138.146 7.73006 0.328938 +137.639 7.23256 0.197492 +137.132 6.73505 1.00021 +136.626 6.23754 -0.437482 +136.119 5.74004 1.36768 +135.613 5.24253 0.0466833 +135.106 4.74503 0.720573 +134.599 4.24752 0.962795 +134.093 3.75002 1.97374 +133.586 3.25251 2.79672 +133.079 2.75501 4.06261 +132.573 2.2575 4.15172 +132.066 1.75999 4.78989 +131.559 1.26249 6.24035 +131.053 0.764983 8.29321 +130.546 0.267477 9.99283 +130.04 -0.230028 10.7693 +129.533 -0.727534 10.9446 +129.026 -1.22504 13.3715 +128.52 -1.72255 13.6337 +128.013 -2.22005 16.0593 +127.506 -2.71756 17.8339 +127 -3.21506 20.2067 +126.493 -3.71257 20.1643 +125.986 -4.21007 24.0232 +125.48 -4.70758 24.6287 + +163.591 13.7777 25.8568 +163.039 13.2437 22.1548 +162.487 12.7097 20.6636 +161.935 12.1757 19.758 +161.382 11.6416 17.964 +160.83 11.1076 15.0824 +160.278 10.5736 14.5206 +159.726 10.0396 13.9517 +159.173 9.50556 11.5586 +158.621 8.97154 11.0552 +158.069 8.43752 8.39081 +157.516 7.9035 8.74599 +156.964 7.36948 6.27092 +156.412 6.83546 5.4215 +155.86 6.30144 4.26647 +155.307 5.76742 3.55578 +154.755 5.2334 3.61788 +154.203 4.69938 1.74864 +153.65 4.16536 2.54991 +153.098 3.63134 2.34516 +152.546 3.09732 1.69768 +151.994 2.5633 1.43445 +151.441 2.02928 -0.396625 +150.889 1.49526 1.12316 +150.337 0.961243 -0.94693 +149.785 0.427223 0.286402 +149.232 -0.106796 1.03989 +148.68 -0.640816 0.926593 +148.128 -1.17484 0.945549 +147.575 -1.70886 0.604572 +147.023 -2.24288 1.03326 +146.471 -2.77689 1.11775 +145.919 -3.31091 0.993479 +145.366 -3.84493 2.96657 +144.814 -4.37895 4.15658 +144.262 -4.91297 4.71978 +143.71 -5.44699 3.85086 +143.157 -5.98101 4.79189 +142.605 -6.51503 7.7449 +142.053 -7.04905 8.6258 +141.5 -7.58307 8.87861 +140.948 -8.11709 9.76543 +140.396 -8.65111 10.5613 +139.844 -9.18513 13.3954 +139.291 -9.71915 14.1587 +138.739 -10.2532 16.2117 +138.187 -10.7872 18.6293 +137.634 -11.3212 19.5363 +137.082 -11.8552 22.1541 +136.53 -12.3893 23.1017 +135.978 -12.9233 24.2914 + +183.446 11.2674 24.1061 +182.807 10.5599 22.081 +182.168 9.85244 22.0025 +181.529 9.14498 18.8252 +180.89 8.43752 18.627 +180.251 7.73006 15.4479 +179.612 7.02259 13.4735 +178.973 6.31513 13.341 +178.334 5.60767 12.484 +177.695 4.90021 11.2199 +177.056 4.19275 8.06744 +176.417 3.48528 8.83593 +175.778 2.77782 6.79326 +175.139 2.07036 5.48058 +174.5 1.3629 5.35411 +173.861 0.655436 4.46929 +173.222 -0.052026 2.65267 +172.583 -0.759488 3.36558 +171.944 -1.46695 0.966188 +171.305 -2.17441 2.382 +170.666 -2.88187 0.178251 +170.027 -3.58934 0.226125 +169.388 -4.2968 -0.163427 +168.749 -5.00426 -0.837325 +168.11 -5.71172 -0.426252 +167.471 -6.41918 0.961364 +166.832 -7.12665 -0.767433 +166.193 -7.83411 0.811912 +165.554 -8.54157 0.962866 +164.915 -9.24903 -0.359123 +164.276 -9.95649 0.0541138 +163.637 -10.664 0.470129 +162.998 -11.3714 2.93062 +162.359 -12.0789 1.86869 +161.72 -12.7863 4.2317 +161.081 -13.4938 3.45788 +160.442 -14.2013 4.02394 +159.803 -14.9087 5.23041 +159.164 -15.6162 5.85709 +158.525 -16.3237 7.58589 +157.886 -17.0311 8.54698 +157.247 -17.7386 9.86812 +156.608 -18.446 12.5415 +155.969 -19.1535 13.309 +155.33 -19.861 15.3259 +154.691 -20.5684 16.9998 +154.052 -21.2759 16.9296 +153.413 -21.9833 19.1049 +152.774 -22.6908 20.5105 +152.135 -23.3983 22.5967 +151.496 -24.1057 24.5649 + +197.367 8.98523 25.9682 +196.874 8.18192 22.5336 +196.381 7.37861 22.0295 +195.888 6.5753 18.383 +195.395 5.77198 18.5416 +194.902 4.96867 16.8523 +194.409 4.16536 14.9075 +193.916 3.36205 12.9344 +193.424 2.55874 10.7594 +192.931 1.75543 10.9836 +192.438 0.952114 8.73028 +191.945 0.148802 7.21161 +191.452 -0.65451 6.13645 +190.959 -1.45782 6.75054 +190.466 -2.26113 5.4961 +189.973 -3.06444 3.51523 +189.48 -3.86776 3.90359 +188.987 -4.67107 3.21601 +188.494 -5.47438 1.97993 +188.001 -6.27769 0.821896 +187.508 -7.081 8.64267e-06 +187.015 -7.88432 0.877745 +186.522 -8.68763 -0.436244 +186.029 -9.49094 -0.691868 +185.536 -10.2943 -0.756244 +185.044 -11.0976 -0.087618 +184.551 -11.9009 0.941084 +184.058 -12.7042 0.263949 +183.565 -13.5075 -0.278642 +183.072 -14.3108 0.791308 +182.579 -15.1141 0.193938 +182.086 -15.9174 2.28561 +181.593 -16.7207 1.44688 +181.1 -17.5241 1.92266 +180.607 -18.3274 3.11771 +180.114 -19.1307 3.00541 +179.621 -19.934 5.71791 +179.128 -20.7373 4.95303 +178.635 -21.5406 7.65126 +178.142 -22.3439 8.73332 +177.649 -23.1472 9.85214 +177.156 -23.9505 9.7113 +176.664 -24.7539 10.5621 +176.171 -25.5572 12.1333 +175.678 -26.3605 15.099 +175.185 -27.1638 15.0236 +174.692 -27.9671 17.4293 +174.199 -28.7704 18.6911 +173.706 -29.5737 20.9487 +173.213 -30.377 22.9893 +172.72 -31.1804 25.2728 + +214.027 9.66987 25.9926 +213.703 8.70681 23.3678 +213.379 7.74375 20.1637 +213.054 6.78069 18.9813 +212.73 5.81763 17.4789 +212.406 4.85457 15.3512 +212.082 3.8915 13.595 +211.758 2.92844 12.0325 +211.434 1.96538 10.9583 +211.11 1.00232 10.0707 +210.786 0.0392598 8.1229 +210.462 -0.923801 6.90692 +210.138 -1.88686 6.17296 +209.814 -2.84992 5.78851 +209.49 -3.81299 4.42961 +209.166 -4.77605 4.99464 +208.842 -5.73911 4.12602 +208.518 -6.70217 1.66274 +208.194 -7.66523 2.95974 +207.869 -8.62829 0.872675 +207.545 -9.59135 0.843789 +207.221 -10.5544 1.63998 +206.897 -11.5175 0.33366 +206.573 -12.4805 0.709187 +206.249 -13.4436 -0.30631 +205.925 -14.4067 0.973063 +205.601 -15.3697 -0.641543 +205.277 -16.3328 -0.705399 +204.953 -17.2958 -0.368734 +204.629 -18.2589 -0.308186 +204.305 -19.222 0.990064 +203.981 -20.185 1.14985 +203.657 -21.1481 1.97731 +203.333 -22.1111 3.55573 +203.009 -23.0742 3.8831 +202.684 -24.0373 3.01453 +202.36 -25.0003 3.93833 +202.036 -25.9634 5.22567 +201.712 -26.9265 6.05895 +201.388 -27.8895 7.10628 +201.064 -28.8526 8.06914 +200.74 -29.8156 9.60261 +200.416 -30.7787 12.4541 +200.092 -31.7418 13.8802 +199.768 -32.7048 14.7252 +199.444 -33.6679 16.0439 +199.12 -34.6309 16.6844 +198.796 -35.594 19.7175 +198.472 -36.5571 22.0466 +198.148 -37.5201 22.9599 +197.824 -38.4832 24.0915 + +235.707 9.89809 24.1439 +235.41 8.75702 23.5824 +235.114 7.61596 21.3293 +234.817 6.47489 18.3643 +234.52 5.33382 17.8436 +234.224 4.19275 15.7105 +233.927 3.05168 15.4383 +233.63 1.91062 13.7407 +233.334 0.769548 11.0215 +233.037 -0.37152 11.194 +232.74 -1.51259 8.11086 +232.444 -2.65366 7.34304 +232.147 -3.79472 5.76158 +231.85 -4.93579 4.93884 +231.553 -6.07686 4.1708 +231.257 -7.21793 4.18268 +230.96 -8.359 2.71917 +230.663 -9.50006 3.26777 +230.367 -10.6411 2.84497 +230.07 -11.7822 2.153 +229.773 -12.9233 1.63534 +229.477 -14.0643 1.33024 +229.18 -15.2054 -0.197463 +228.883 -16.3465 -0.835651 +228.587 -17.4875 0.7597 +228.29 -18.6286 -0.516046 +227.993 -19.7697 0.120931 +227.697 -20.9107 -0.757292 +227.4 -22.0518 0.401773 +227.103 -23.1929 0.0588245 +226.807 -24.3339 1.61098 +226.51 -25.475 0.559155 +226.213 -26.6161 2.79035 +225.917 -27.7571 3.54247 +225.62 -28.8982 2.38525 +225.323 -30.0393 3.12557 +225.027 -31.1804 3.90694 +224.73 -32.3214 6.44896 +224.433 -33.4625 6.86527 +224.137 -34.6036 7.92009 +223.84 -35.7446 9.96622 +223.543 -36.8857 11.1847 +223.247 -38.0268 12.4026 +222.95 -39.1678 12.4171 +222.653 -40.3089 14.2613 +222.356 -41.45 16.1336 +222.06 -42.591 18.6078 +221.763 -43.7321 18.5901 +221.466 -44.8732 22.0062 +221.17 -46.0142 22.053 +220.873 -47.1553 24.432 + +266.744 9.21345 24.2902 +266.383 7.85786 22.5954 +266.023 6.50227 21.7675 +265.662 5.14668 19.4016 +265.302 3.79109 17.2619 +264.941 2.4355 16.468 +264.581 1.07991 15.1232 +264.22 -0.275674 13.9342 +263.859 -1.63126 11.6937 +263.499 -2.98685 11.1755 +263.138 -4.34244 8.6185 +262.778 -5.69803 7.28684 +262.417 -7.05362 7.13922 +262.057 -8.40921 6.33249 +261.696 -9.76479 5.83375 +261.335 -11.1204 4.19427 +260.975 -12.476 2.26123 +260.614 -13.8316 2.77143 +260.254 -15.1871 1.34486 +259.893 -16.5427 2.37111 +259.532 -17.8983 0.705993 +259.172 -19.2539 -0.355908 +258.811 -20.6095 -0.615132 +258.451 -21.9651 1.11399 +258.09 -23.3207 -0.958331 +257.73 -24.6763 0.227436 +257.369 -26.0319 -0.932504 +257.008 -27.3874 -0.46379 +256.648 -28.743 0.078993 +256.287 -30.0986 -0.161838 +255.927 -31.4542 0.0230538 +255.566 -32.8098 1.97667 +255.206 -34.1654 1.38758 +254.845 -35.521 1.7578 +254.484 -36.8766 4.00806 +254.124 -38.2322 3.11769 +253.763 -39.5877 5.79437 +253.403 -40.9433 5.4316 +253.042 -42.2989 7.09084 +252.681 -43.6545 7.73203 +252.321 -45.0101 9.19146 +251.96 -46.3657 10.196 +251.6 -47.7213 12.4535 +251.239 -49.0769 11.9629 +250.879 -50.4325 13.5383 +250.518 -51.788 15.7527 +250.157 -53.1436 16.6451 +249.797 -54.4992 19.9196 +249.436 -55.8548 20.1617 +249.076 -57.2104 24.0391 +248.715 -58.566 24.4391 + +307.366 10.3545 25.9098 +306.791 8.78897 23.1572 +306.216 7.22342 20.4831 +305.641 5.65788 20.2905 +305.066 4.09233 16.7713 +304.491 2.52679 15.9381 +303.915 0.961244 14.3876 +303.34 -0.604301 12.0408 +302.765 -2.16985 11.9323 +302.19 -3.73539 11.1669 +301.615 -5.30094 8.96701 +301.04 -6.86648 8.61389 +300.465 -8.43203 6.36358 +299.89 -9.99757 5.76048 +299.315 -11.5631 4.38248 +298.74 -13.1287 4.05981 +298.164 -14.6942 3.28536 +297.589 -16.2598 1.92408 +297.014 -17.8253 1.81858 +296.439 -19.3908 0.845358 +295.864 -20.9564 0.0117692 +295.289 -22.5219 -0.356656 +294.714 -24.0875 0.476222 +294.139 -25.653 -0.554834 +293.564 -27.2186 -0.624716 +292.989 -28.7841 0.919019 +292.413 -30.3497 0.429726 +291.838 -31.9152 -0.27771 +291.263 -33.4807 -0.303634 +290.688 -35.0463 0.0383372 +290.113 -36.6118 1.48947 +289.538 -38.1774 1.15276 +288.963 -39.7429 1.38155 +288.388 -41.3085 1.8078 +287.813 -42.874 2.25218 +287.238 -44.4396 4.99048 +286.663 -46.0051 5.42672 +286.087 -47.5707 6.14648 +285.512 -49.1362 7.34692 +284.937 -50.7017 7.50099 +284.362 -52.2673 8.46389 +283.787 -53.8328 9.70111 +283.212 -55.3984 10.587 +282.637 -56.9639 12.034 +282.062 -58.5295 14.5903 +281.487 -60.095 15.1626 +280.912 -61.6606 16.8189 +280.336 -63.2261 19.3156 +279.761 -64.7916 20.7748 +279.186 -66.3572 23.8183 +278.611 -67.9227 24.0578 + +342.511 7.15952 24.8051 +342 5.32012 22.6465 +341.489 3.48072 21.2896 +340.977 1.64132 19.9952 +340.466 -0.19808 18.0351 +339.955 -2.03748 15.2158 +339.444 -3.87688 13.5452 +338.933 -5.71628 12.1152 +338.421 -7.55568 11.6104 +337.91 -9.39509 9.64657 +337.399 -11.2345 9.89749 +336.888 -13.0739 8.5863 +336.377 -14.9133 6.25566 +335.865 -16.7527 6.75831 +335.354 -18.5921 5.8329 +334.843 -20.4315 4.40619 +334.332 -22.2709 3.8904 +333.821 -24.1103 3.34474 +333.309 -25.9497 1.00296 +332.798 -27.7891 2.43169 +332.287 -29.6285 1.99476 +331.776 -31.4679 0.722253 +331.265 -33.3073 0.385105 +330.753 -35.1467 1.03371 +330.242 -36.9861 -0.20645 +329.731 -38.8255 -0.103739 +329.22 -40.6649 0.0223584 +328.709 -42.5043 -0.636973 +328.197 -44.3437 -0.60572 +327.686 -46.1831 1.1823 +327.175 -48.0225 0.0007658 +326.664 -49.8619 0.440002 +326.153 -51.7013 2.89305 +325.641 -53.5407 1.95853 +325.13 -55.3801 3.84111 +324.619 -57.2195 4.99578 +324.108 -59.0589 5.80634 +323.597 -60.8983 6.13793 +323.085 -62.7377 7.21065 +322.574 -64.5771 7.15815 +322.063 -66.4165 8.17414 +321.552 -68.2559 10.0834 +321.041 -70.0953 10.9365 +320.529 -71.9347 13.2564 +320.018 -73.7741 15.2352 +319.507 -75.6135 16.8767 +318.996 -77.4529 16.6481 +318.485 -79.2923 20.3087 +317.973 -81.1317 21.0172 +317.462 -82.9711 23.8615 +316.951 -84.8105 24.0362 + +384.659 -4.55408 25.9419 +383.984 -6.46359 23.9382 +383.31 -8.37311 22.1113 +382.635 -10.2826 20.3565 +381.96 -12.1921 18.0658 +381.285 -14.1017 16.0797 +380.61 -16.0112 13.5234 +379.935 -17.9207 13.4507 +379.26 -19.8302 12.2634 +378.585 -21.7397 9.32594 +377.91 -23.6492 8.99311 +377.235 -25.5587 8.45597 +376.56 -27.4683 6.80189 +375.885 -29.3778 6.16213 +375.211 -31.2873 3.85079 +374.536 -33.1968 3.20394 +373.861 -35.1063 3.35308 +373.186 -37.0158 3.5213 +372.511 -38.9254 2.04225 +371.836 -40.8349 1.50285 +371.161 -42.7444 1.52165 +370.486 -44.6539 1.31786 +369.811 -46.5634 1.01555 +369.136 -48.4729 0.420658 +368.461 -50.3824 0.949046 +367.787 -52.292 -0.992663 +367.112 -54.2015 0.773211 +366.437 -56.111 -0.680786 +365.762 -58.0205 0.77069 +365.087 -59.93 0.444575 +364.412 -61.8395 0.219101 +363.737 -63.749 2.3221 +363.062 -65.6586 1.3844 +362.387 -67.5681 3.03337 +361.712 -69.4776 2.26544 +361.037 -71.3871 4.93566 +360.362 -73.2966 4.71391 +359.688 -75.2061 5.99763 +359.013 -77.1156 6.80147 +358.338 -79.0252 7.5769 +357.663 -80.9347 8.25085 +356.988 -82.8442 9.5194 +356.313 -84.7537 10.5966 +355.638 -86.6632 13.7234 +354.963 -88.5727 14.2107 +354.288 -90.4823 15.1021 +353.613 -92.3918 17.9353 +352.938 -94.3013 19.7957 +352.263 -96.2108 20.7336 +351.589 -98.1203 22.171 +350.914 -100.03 25.9608 + +443.097 -21.0154 25.9918 +442.06 -22.9743 22.7076 +441.023 -24.9332 20.1693 +439.986 -26.8921 20.232 +438.949 -28.851 17.1424 +437.912 -30.8099 15.6618 +436.875 -32.7688 13.5138 +435.838 -34.7277 12.0358 +434.801 -36.6866 10.6437 +433.764 -38.6455 11.0463 +432.726 -40.6044 8.13884 +431.689 -42.5633 8.26008 +430.652 -44.5222 5.95838 +429.615 -46.4811 5.8674 +428.578 -48.44 5.82509 +427.541 -50.3989 3.56454 +426.504 -52.3578 2.53596 +425.467 -54.3167 2.68498 +424.43 -56.2756 1.90034 +423.393 -58.2345 1.01067 +422.356 -60.1934 0.554214 +421.319 -62.1523 1.55363 +420.282 -64.1112 -0.445883 +419.245 -66.0701 1.13241 +418.208 -68.029 1.03949 +417.171 -69.9879 -0.999929 +416.133 -71.9468 0.325766 +415.096 -73.9057 -0.725295 +414.059 -75.8646 -0.40754 +413.022 -77.8235 -0.246316 +411.985 -79.7824 1.10752 +410.948 -81.7413 1.88657 +409.911 -83.7002 2.95658 +408.874 -85.6591 3.39809 +407.837 -87.618 2.87644 +406.8 -89.5769 4.49884 +405.763 -91.5358 4.85891 +404.726 -93.4947 5.17099 +403.689 -95.4536 6.6973 +402.652 -97.4125 7.63122 +401.615 -99.3714 9.97063 +400.577 -101.33 9.74304 +399.54 -103.289 10.5679 +398.503 -105.248 12.9573 +397.466 -107.207 13.7007 +396.429 -109.166 16.6298 +395.392 -111.125 18.5406 +394.355 -113.084 20.3003 +393.318 -115.043 20.2967 +392.281 -117.001 22.3392 +391.244 -118.96 24.344 + +500.712 -34.1845 25.2638 +499.51 -36.4561 24.0163 +498.308 -38.7278 20.8976 +497.107 -40.9995 18.759 +495.905 -43.2711 18.2885 +494.703 -45.5428 15.0006 +493.502 -47.8145 14.3356 +492.3 -50.0861 12.7074 +491.098 -52.3578 10.9422 +489.897 -54.6295 9.33511 +488.695 -56.9011 8.55645 +487.493 -59.1728 7.86712 +486.292 -61.4445 6.6541 +485.09 -63.7161 6.41091 +483.888 -65.9878 5.68238 +482.687 -68.2594 3.01197 +481.485 -70.5311 2.42924 +480.283 -72.8028 2.18904 +479.082 -75.0744 2.86554 +477.88 -77.3461 0.809948 +476.678 -79.6178 0.611024 +475.477 -81.8894 -0.359993 +474.275 -84.1611 0.605427 +473.073 -86.4328 -0.65243 +471.872 -88.7044 -0.915678 +470.67 -90.9761 0.288625 +469.468 -93.2478 0.941084 +468.267 -95.5194 1.15306 +467.065 -97.7911 -0.49171 +465.863 -100.063 0.860043 +464.661 -102.334 0.140762 +463.46 -104.606 0.737785 +462.258 -106.878 2.56149 +461.056 -109.149 2.94214 +459.855 -111.421 2.4129 +458.653 -113.693 4.93425 +457.451 -115.964 5.74534 +456.25 -118.236 6.18952 +455.048 -120.508 7.74656 +453.846 -122.779 8.0621 +452.645 -125.051 9.3537 +451.443 -127.323 9.62491 +450.241 -129.594 10.7631 +449.04 -131.866 13.5206 +447.838 -134.138 13.5432 +446.636 -136.409 15.9356 +445.435 -138.681 17.5337 +444.233 -140.953 18.5388 +443.031 -143.224 20.3604 +441.83 -145.496 22.4385 +440.628 -147.768 25.132 + +547.627 -52.292 24.0132 +546.326 -54.6459 22.8057 +545.026 -56.9999 21.14 +543.725 -59.3539 18.3601 +542.425 -61.7078 18.5936 +541.124 -64.0618 15.0897 +539.824 -66.4158 13.4912 +538.523 -68.7698 12.3155 +537.223 -71.1237 10.5941 +535.923 -73.4777 10.4698 +534.622 -75.8317 9.70811 +533.322 -78.1856 8.61856 +532.021 -80.5396 7.75289 +530.721 -82.8936 4.85362 +529.42 -85.2475 5.64802 +528.12 -87.6015 4.81217 +526.819 -89.9555 3.77584 +525.519 -92.3095 3.28148 +524.219 -94.6634 2.91935 +522.918 -97.0174 2.41682 +521.618 -99.3714 0.419585 +520.317 -101.725 0.629039 +519.017 -104.079 0.603761 +517.716 -106.433 -0.801447 +516.416 -108.787 0.856395 +515.115 -111.141 -0.956332 +513.815 -113.495 0.95992 +512.515 -115.849 -0.187978 +511.214 -118.203 -0.559363 +509.914 -120.557 1.4828 +508.613 -122.911 1.55163 +507.313 -125.265 0.619283 +506.012 -127.619 2.79769 +504.712 -129.973 2.62934 +503.411 -132.327 3.39707 +502.111 -134.681 4.84729 +500.811 -137.035 5.54674 +499.51 -139.389 6.1957 +498.21 -141.743 6.01974 +496.909 -144.097 8.8186 +495.609 -146.451 9.92279 +494.308 -148.805 10.027 +493.008 -151.159 12.5572 +491.707 -153.513 12.3488 +490.407 -155.867 15.2809 +489.107 -158.221 15.2005 +487.806 -160.575 16.6434 +486.506 -162.929 18.8233 +485.205 -165.283 20.2907 +483.905 -167.637 23.9381 +482.604 -169.991 25.5297 + +589.603 -68.7533 25.9304 +588.5 -71.2554 22.1987 +587.397 -73.7575 21.8151 +586.294 -76.2597 18.998 +585.191 -78.7618 16.6763 +584.088 -81.2639 16.752 +582.986 -83.766 15.1802 +581.883 -86.2681 11.9955 +580.78 -88.7703 10.8779 +579.677 -91.2724 9.94245 +578.574 -93.7745 8.07655 +577.471 -96.2766 7.89326 +576.368 -98.7788 5.77237 +575.265 -101.281 5.31002 +574.162 -103.783 5.83876 +573.059 -106.285 4.9973 +571.956 -108.787 3.80611 +570.854 -111.289 1.56837 +569.751 -113.791 2.78663 +568.648 -116.294 0.59008 +567.545 -118.796 0.250528 +566.442 -121.298 1.00261 +565.339 -123.8 -0.177666 +564.236 -126.302 -0.694222 +563.133 -128.804 0.120089 +562.03 -131.306 0.799816 +560.927 -133.808 0.90493 +559.824 -136.311 0.539106 +558.722 -138.813 0.395067 +557.619 -141.315 1.13751 +556.516 -143.817 1.9903 +555.413 -146.319 2.38588 +554.31 -148.821 2.90494 +553.207 -151.323 2.46009 +552.104 -153.825 3.15115 +551.001 -156.328 4.90991 +549.898 -158.83 3.97232 +548.795 -161.332 6.22761 +547.692 -163.834 6.09179 +546.59 -166.336 8.52939 +545.487 -168.838 9.87444 +544.384 -171.34 9.28071 +543.281 -173.842 12.0301 +542.178 -176.345 13.7274 +541.075 -178.847 15.0897 +539.972 -181.349 16.6216 +538.869 -183.851 17.0171 +537.766 -186.353 19.2203 +536.663 -188.855 21.3858 +535.56 -191.357 23.4009 +534.458 -193.859 25.0293 + +633.226 -97.5606 24.9286 +631.942 -99.7335 22.2436 +630.658 -101.906 20.162 +629.374 -104.079 20.3584 +628.09 -106.252 18.5629 +626.806 -108.425 15.7123 +625.522 -110.598 14.7717 +624.238 -112.771 12.2688 +622.954 -114.944 11.2158 +621.67 -117.117 10.0396 +620.386 -119.29 9.65049 +619.102 -121.462 7.61063 +617.818 -123.635 7.51769 +616.534 -125.808 6.62998 +615.25 -127.981 4.03955 +613.966 -130.154 4.85678 +612.682 -132.327 2.65912 +611.398 -134.5 3.50768 +610.114 -136.673 1.82783 +608.83 -138.846 0.718211 +607.546 -141.019 0.886713 +606.262 -143.191 1.63998 +604.978 -145.364 0.12963 +603.694 -147.537 -0.624233 +602.41 -149.71 0.434873 +601.126 -151.883 -0.261095 +599.842 -154.056 0.895848 +598.558 -156.229 0.4206 +597.274 -158.402 1.35186 +595.99 -160.575 1.18989 +594.706 -162.748 0.0383706 +593.422 -164.92 0.903249 +592.138 -167.093 1.06675 +590.854 -169.266 2.47115 +589.57 -171.439 4.23972 +588.286 -173.612 4.3737 +587.002 -175.785 5.79087 +585.718 -177.958 6.44405 +584.434 -180.131 7.49737 +583.15 -182.304 8.83307 +581.866 -184.476 8.34903 +580.582 -186.649 9.2937 +579.298 -188.822 12.5082 +578.014 -190.995 12.2966 +576.73 -193.168 14.2354 +575.446 -195.341 16.9727 +574.162 -197.514 17.7792 +572.878 -199.687 19.465 +571.594 -201.86 22.1422 +570.31 -204.033 22.8006 +569.026 -206.205 24.0385 + +673.556 -120.606 25.5743 +672.124 -122.681 23.5374 +670.692 -124.755 22.0652 +669.259 -126.829 18.832 +667.827 -128.903 18.5302 +666.395 -130.977 16.595 +664.963 -133.051 14.222 +663.531 -135.125 13.6482 +662.099 -137.2 12.4143 +660.667 -139.274 11.0081 +659.234 -141.348 9.01957 +657.802 -143.422 8.44828 +656.37 -145.496 7.69087 +654.938 -147.57 6.73794 +653.506 -149.644 5.14458 +652.074 -151.718 3.66277 +650.642 -153.793 3.08391 +649.209 -155.867 2.12272 +647.777 -157.941 2.07664 +646.345 -160.015 1.18726 +644.913 -162.089 1.27105 +643.481 -164.163 0.602222 +642.049 -166.237 1.30762 +640.617 -168.311 1.13522 +639.185 -170.386 0.353143 +637.752 -172.46 0.944726 +636.32 -174.534 -0.12474 +634.888 -176.608 -0.27809 +633.456 -178.682 0.57084 +632.024 -180.756 0.221475 +630.592 -182.83 0.0145192 +629.16 -184.904 0.441653 +627.727 -186.979 2.8011 +626.295 -189.053 2.98584 +624.863 -191.127 2.85355 +623.431 -193.201 3.75273 +621.999 -195.275 5.69217 +620.567 -197.349 6.65035 +619.135 -199.423 5.94446 +617.702 -201.498 8.71837 +616.27 -203.572 9.79464 +614.838 -205.646 10.7896 +613.406 -207.72 12.4756 +611.974 -209.794 12.3364 +610.542 -211.868 14.9454 +609.11 -213.942 16.8221 +607.678 -216.016 17.1878 +606.245 -218.091 20.3077 +604.813 -220.165 21.1133 +603.381 -222.239 23.8354 +601.949 -224.313 24.0544 + +719.648 -148.591 25.8505 +718.347 -150.583 24.0316 +717.047 -152.574 22.0169 +715.746 -154.566 18.6852 +714.446 -156.558 17.1701 +713.145 -158.55 15.4344 +711.845 -160.542 15.1024 +710.544 -162.534 13.2334 +709.244 -164.525 10.5817 +707.944 -166.517 9.97821 +706.643 -168.509 8.60214 +705.343 -170.501 7.54113 +704.042 -172.493 6.15692 +702.742 -174.484 6.64522 +701.441 -176.476 5.44397 +700.141 -178.468 4.23643 +698.84 -180.46 4.03963 +697.54 -182.452 1.66952 +696.24 -184.444 2.84171 +694.939 -186.435 0.469939 +693.639 -188.427 1.60145 +692.338 -190.419 1.62247 +691.038 -192.411 -0.514075 +689.737 -194.403 0.754909 +688.437 -196.394 0.723064 +687.136 -198.386 0.320423 +685.836 -200.378 0.191308 +684.536 -202.37 0.680702 +683.235 -204.362 0.393139 +681.935 -206.354 0.258441 +680.634 -208.345 1.47003 +679.334 -210.337 2.0488 +678.033 -212.329 1.62328 +676.733 -214.321 2.18611 +675.432 -216.313 2.92663 +674.132 -218.305 4.52719 +672.832 -220.296 5.80878 +671.531 -222.288 5.07008 +670.231 -224.28 5.77967 +668.93 -226.272 8.8161 +667.63 -228.264 9.99916 +666.329 -230.255 10.8894 +665.029 -232.247 12.4876 +663.728 -234.239 12.6548 +662.428 -236.231 13.7364 +661.128 -238.223 16.3397 +659.827 -240.215 18.5313 +658.527 -242.206 19.3613 +657.226 -244.198 20.6292 +655.926 -246.19 23.0209 +654.625 -248.182 24.073 + +770.678 -183.983 25.9964 +769.443 -185.876 23.8675 +768.208 -187.769 21.0339 +766.974 -189.662 20.1092 +765.739 -191.555 18.6373 +764.505 -193.448 16.3968 +763.27 -195.341 15.1029 +762.035 -197.234 12.2314 +760.801 -199.127 11.9382 +759.566 -201.02 9.81888 +758.332 -202.913 9.96063 +757.097 -204.806 6.8508 +755.862 -206.699 6.00945 +754.628 -208.592 4.78947 +753.393 -210.485 4.78683 +752.159 -212.378 3.72994 +750.924 -214.271 2.34696 +749.689 -216.165 3.25142 +748.455 -218.058 1.55778 +747.22 -219.951 0.854035 +745.986 -221.844 0.00489831 +744.751 -223.737 1.42455 +743.516 -225.63 -0.191276 +742.282 -227.523 0.776895 +741.047 -229.416 0.858288 +739.813 -231.309 -0.983837 +738.578 -233.202 0.744315 +737.343 -235.095 1.10851 +736.109 -236.988 -0.298961 +734.874 -238.881 0.370981 +733.64 -240.774 0.0489919 +732.405 -242.667 1.86742 +731.17 -244.56 2.88059 +729.936 -246.453 1.60548 +728.701 -248.346 2.25185 +727.467 -250.24 4.75274 +726.232 -252.133 5.8127 +724.997 -254.026 6.3484 +723.763 -255.919 7.6452 +722.528 -257.812 7.02208 +721.294 -259.705 8.79664 +720.059 -261.598 10.407 +718.824 -263.491 10.7392 +717.59 -265.384 13.3003 +716.355 -267.277 14.6428 +715.121 -269.17 16.9877 +713.886 -271.063 17.0666 +712.651 -272.956 19.3751 +711.417 -274.849 22.0024 +710.182 -276.742 22.2025 +708.948 -278.635 25.7461 + +824.177 -225.959 25.0879 +822.547 -227.72 22.4325 +820.918 -229.482 20.8223 +819.288 -231.243 20.1122 +817.658 -233.004 17.2427 +816.029 -234.766 16.356 +814.399 -236.527 13.5229 +812.769 -238.289 13.9213 +811.14 -240.05 11.1643 +809.51 -241.811 10.6535 +807.88 -243.573 9.97972 +806.251 -245.334 8.77861 +804.621 -247.095 6.87458 +802.991 -248.857 5.01077 +801.362 -250.618 3.93529 +799.732 -252.379 3.44928 +798.102 -254.141 3.26023 +796.473 -255.902 3.38601 +794.843 -257.664 2.42569 +793.213 -259.425 1.45945 +791.584 -261.186 0.806172 +789.954 -262.948 -0.0806826 +788.324 -264.709 1.18025 +786.695 -266.47 1.05768 +785.065 -268.232 -0.604944 +783.435 -269.993 -0.878326 +781.806 -271.754 -0.889229 +780.176 -273.516 -0.203845 +778.546 -275.277 -0.281552 +776.917 -277.039 -0.110071 +775.287 -278.8 1.49699 +773.657 -280.561 1.41158 +772.028 -282.323 2.95973 +770.398 -284.084 3.35953 +768.768 -285.845 4.0965 +767.138 -287.607 4.49688 +765.509 -289.368 4.07885 +763.879 -291.129 6.72195 +762.249 -292.891 7.69631 +760.62 -294.652 7.6488 +758.99 -296.414 8.42603 +757.36 -298.175 11.0719 +755.731 -299.936 11.3067 +754.101 -301.698 11.9605 +752.471 -303.459 15.3911 +750.842 -305.22 15.0252 +749.212 -306.982 18.4304 +747.582 -308.743 20.2301 +745.953 -310.504 21.7912 +744.323 -312.266 22.0402 + +855.937 -260.369 25.988 +854.68 -261.999 22.0815 +853.422 -263.628 20.7718 +852.165 -265.258 19.5072 +850.907 -266.888 16.6649 +849.65 -268.517 15.1181 +848.392 -270.147 14.8206 +847.134 -271.777 13.8407 +845.877 -273.407 11.2057 +844.619 -275.036 9.24008 +843.362 -276.666 8.84831 +842.104 -278.296 7.89137 +840.847 -279.925 6.91678 +839.589 -281.555 5.13517 +838.331 -283.185 4.05407 +837.074 -284.814 4.99888 +835.816 -286.444 3.97489 +834.559 -288.074 2.38191 +833.301 -289.703 0.98916 +832.044 -291.333 2.41658 +830.786 -292.963 1.80572 +829.529 -294.593 0.268512 +828.271 -296.222 -0.435568 +827.013 -297.852 -0.821447 +825.756 -299.482 0.867523 +824.498 -301.111 0.890654 +823.241 -302.741 0.736816 +821.983 -304.371 1.13468 +820.726 -306 1.04379 +819.468 -307.63 0.302433 +818.211 -309.26 0.3851 +816.953 -310.889 2.02618 +815.695 -312.519 1.86147 +814.438 -314.149 2.61477 +813.18 -315.779 4.19634 +811.923 -317.408 4.58701 +810.665 -319.038 4.75172 +809.408 -320.668 5.85571 +808.15 -322.297 7.71952 +806.892 -323.927 8.71322 +805.635 -325.557 8.01354 +804.377 -327.186 9.36971 +803.12 -328.816 11.1906 +801.862 -330.446 12.2651 +800.605 -332.075 15.4399 +799.347 -333.705 15 +798.09 -335.335 16.8949 +796.832 -336.965 19.7805 +795.574 -338.594 20.1623 +794.317 -340.224 23.2962 +793.059 -341.854 24.1544 + +884.168 -294.374 25.1698 +883.257 -295.606 24.0161 +882.346 -296.838 21.7017 +881.435 -298.07 18.5747 +880.524 -299.302 18.4512 +879.613 -300.534 16.6388 +878.702 -301.766 14.0417 +877.791 -302.998 13.9242 +876.88 -304.23 10.7856 +875.968 -305.461 11.1769 +875.057 -306.693 9.7786 +874.146 -307.925 8.66722 +873.235 -309.157 6.8744 +872.324 -310.389 6.57601 +871.413 -311.621 4.82052 +870.502 -312.853 3.01301 +869.591 -314.085 2.87571 +868.68 -315.317 3.55388 +867.769 -316.548 2.53892 +866.858 -317.78 0.824862 +865.946 -319.012 0.822916 +865.035 -320.244 0.284667 +864.124 -321.476 -0.32194 +863.213 -322.708 1.12662 +862.302 -323.94 -0.953955 +861.391 -325.172 -0.988157 +860.48 -326.404 -0.638191 +859.569 -327.636 0.272718 +858.658 -328.867 -0.484885 +857.747 -330.099 -0.106398 +856.836 -331.331 0.541516 +855.924 -332.563 1.81777 +855.013 -333.795 0.96911 +854.102 -335.027 2.03025 +853.191 -336.259 2.60284 +852.28 -337.491 4.08918 +851.369 -338.723 4.69637 +850.458 -339.954 6.66859 +849.547 -341.186 5.76444 +848.636 -342.418 7.93856 +847.725 -343.65 9.42919 +846.814 -344.882 11.0039 +845.902 -346.114 12.2502 +844.991 -347.346 11.9938 +844.08 -348.578 14.5822 +843.169 -349.81 15.4769 +842.258 -351.042 18.5493 +841.347 -352.273 18.4084 +840.436 -353.505 21.8977 +839.525 -354.737 22.8365 + +915.607 -327.097 24.1129 +914.799 -327.879 22.9087 +913.99 -328.662 22.1548 +913.182 -329.445 19.0052 +912.373 -330.228 18.5916 +911.565 -331.01 15.2315 +910.757 -331.793 13.7779 +909.948 -332.576 13.5113 +909.14 -333.359 11.1701 +908.331 -334.141 9.25838 +907.523 -334.924 9.91366 +906.714 -335.707 7.62951 +905.906 -336.49 6.38226 +905.098 -337.273 6.41555 +904.289 -338.055 4.2471 +903.481 -338.838 3.57195 +902.672 -339.621 4.05749 +901.864 -340.404 3.42859 +901.055 -341.186 1.05015 +900.247 -341.969 0.743293 +899.439 -342.752 1.6001 +898.63 -343.535 -0.176882 +897.822 -344.317 -0.633825 +897.013 -345.1 -0.837974 +896.205 -345.883 1.02648 +895.396 -346.666 -0.872385 +894.588 -347.449 0.862915 +893.78 -348.231 -0.839999 +892.971 -349.014 1.35293 +892.163 -349.797 1.6126 +891.354 -350.58 1.29478 +890.546 -351.362 2.37729 +889.737 -352.145 1.02293 +888.929 -352.928 1.56289 +888.121 -353.711 3.00963 +887.312 -354.493 3.13653 +886.504 -355.276 4.00846 +885.695 -356.059 6.59139 +884.887 -356.842 6.22516 +884.078 -357.624 7.52474 +883.27 -358.407 8.00217 +882.462 -359.19 10.1981 +881.653 -359.973 10.728 +880.845 -360.756 13.6418 +880.036 -361.538 14.1773 +879.228 -362.321 16.8429 +878.419 -363.104 16.6763 +877.611 -363.887 19.9681 +876.803 -364.669 21.6267 +875.994 -365.452 22.9681 +875.186 -366.235 24.0092 + +940.63 -348.27 25.2034 +939.886 -348.937 23.4861 +939.142 -349.604 20.586 +938.397 -350.272 20.2018 +937.653 -350.939 18.5595 +936.909 -351.606 16.6219 +936.164 -352.273 14.1499 +935.42 -352.941 12.2633 +934.676 -353.608 11.8241 +933.932 -354.275 10.7991 +933.187 -354.943 8.05447 +932.443 -355.61 7.527 +931.699 -356.277 7.46329 +930.955 -356.944 5.81489 +930.21 -357.612 4.50998 +929.466 -358.279 3.51885 +928.722 -358.946 3.33802 +927.977 -359.613 1.56152 +927.233 -360.281 2.90204 +926.489 -360.948 0.491269 +925.745 -361.615 1.73262 +925 -362.283 1.57696 +924.256 -362.95 0.481539 +923.512 -363.617 1.09952 +922.768 -364.284 -0.389272 +922.023 -364.952 -0.603852 +921.279 -365.619 -0.954184 +920.535 -366.286 1.11962 +919.791 -366.954 -0.538577 +919.046 -367.621 0.852608 +918.302 -368.288 0.2609 +917.558 -368.955 1.97688 +916.813 -369.623 1.16263 +916.069 -370.29 3.55994 +915.325 -370.957 2.58953 +914.581 -371.624 4.46559 +913.836 -372.292 4.89573 +913.092 -372.959 6.72118 +912.348 -373.626 5.77322 +911.604 -374.294 8.16228 +910.859 -374.961 8.34996 +910.115 -375.628 9.42743 +909.371 -376.295 12.4825 +908.626 -376.963 13.1017 +907.882 -377.63 15.3881 +907.138 -378.297 16.921 +906.394 -378.964 16.7236 +905.649 -379.632 20.2027 +904.905 -380.299 21.4051 +904.161 -380.966 22.1655 +903.417 -381.634 24.9643 + +963.728 -370.726 24.003 +963.189 -371.252 24.0101 +962.65 -371.778 20.4645 +962.111 -372.305 18.3873 +961.572 -372.831 16.7449 +961.033 -373.357 15.0011 +960.494 -373.883 15.391 +959.955 -374.409 12.104 +959.416 -374.935 12.3955 +958.878 -375.461 9.28111 +958.339 -375.987 8.03822 +957.8 -376.514 7.63634 +957.261 -377.04 7.16368 +956.722 -377.566 6.6573 +956.183 -378.092 4.10143 +955.644 -378.618 4.01568 +955.105 -379.144 2.28839 +954.566 -379.67 3.55571 +954.027 -380.196 0.961649 +953.488 -380.722 1.06142 +952.949 -381.249 1.71538 +952.41 -381.775 -0.0925546 +951.871 -382.301 -0.470299 +951.332 -382.827 0.985776 +950.793 -383.353 -0.917043 +950.254 -383.879 -0.999943 +949.715 -384.405 1.03881 +949.176 -384.931 -0.766047 +948.637 -385.458 -0.349424 +948.098 -385.984 1.56718 +947.559 -386.51 0.660475 +947.021 -387.036 1.43024 +946.482 -387.562 1.53981 +945.943 -388.088 2.56277 +945.404 -388.614 3.32159 +944.865 -389.14 3.16259 +944.326 -389.667 5.4119 +943.787 -390.193 6.5616 +943.248 -390.719 5.83276 +942.709 -391.245 6.84234 +942.17 -391.771 8.27447 +941.631 -392.297 9.27165 +941.092 -392.823 10.8409 +940.553 -393.349 13.6477 +940.014 -393.876 14.253 +939.475 -394.402 16.33 +938.936 -394.928 16.7945 +938.397 -395.454 18.4963 +937.858 -395.98 21.7535 +937.319 -396.506 23.8849 +936.78 -397.032 24.2277 + +983.618 -390.616 25.8829 +983.143 -391.04 23.8616 +982.668 -391.463 21.5877 +982.194 -391.887 19.0614 +981.719 -392.31 18.6142 +981.244 -392.733 16.3305 +980.769 -393.157 15.4302 +980.294 -393.58 13.8874 +979.82 -394.004 10.9457 +979.345 -394.427 11.1178 +978.87 -394.851 9.62386 +978.395 -395.274 8.4139 +977.921 -395.698 7.60048 +977.446 -396.121 6.43206 +976.971 -396.545 3.97577 +976.496 -396.968 4.56819 +976.021 -397.392 4.16001 +975.547 -397.815 2.43652 +975.072 -398.238 1.00372 +974.597 -398.662 2.19578 +974.122 -399.085 0.0339367 +973.647 -399.509 1.52913 +973.173 -399.932 1.27036 +972.698 -400.356 -0.834541 +972.223 -400.779 -0.959944 +971.748 -401.203 -0.514806 +971.273 -401.626 0.452311 +970.799 -402.05 0.378013 +970.324 -402.473 -0.545297 +969.849 -402.897 -0.31339 +969.374 -403.32 0.344606 +968.899 -403.744 2.08864 +968.425 -404.167 1.04713 +967.95 -404.59 2.34736 +967.475 -405.014 2.53682 +967 -405.437 3.58846 +966.526 -405.861 4.25152 +966.051 -406.284 5.21547 +965.576 -406.708 7.28698 +965.101 -407.131 7.1978 +964.626 -407.555 9.62134 +964.152 -407.978 11.1846 +963.677 -408.402 11.2712 +963.202 -408.825 11.9635 +962.727 -409.249 14.6315 +962.252 -409.672 16.8379 +961.778 -410.095 17.8864 +961.303 -410.519 19.2999 +960.828 -410.942 20.8205 +960.353 -411.366 22.0401 +959.878 -411.789 25.9781 + +999.658 -407.94 24.901 +999.235 -408.299 23.2237 +998.811 -408.658 21.894 +998.388 -409.018 18.3605 +997.964 -409.377 17.5697 +997.541 -409.736 16.9699 +997.118 -410.095 15.1148 +996.694 -410.455 13.0827 +996.271 -410.814 12.4213 +995.847 -411.173 10.2587 +995.424 -411.533 9.41259 +995 -411.892 6.98079 +994.577 -412.251 5.82395 +994.153 -412.611 4.85854 +993.73 -412.97 5.83365 +993.306 -413.329 4.46159 +992.883 -413.689 2.2436 +992.459 -414.048 3.45827 +992.036 -414.407 1.84447 +991.613 -414.766 0.54311 +991.189 -415.126 1.25283 +990.766 -415.485 -0.359446 +990.342 -415.844 1.35876 +989.919 -416.204 -0.40648 +989.495 -416.563 1.00619 +989.072 -416.922 -0.142015 +988.648 -417.282 -0.957325 +988.225 -417.641 -0.20275 +987.801 -418 -0.264073 +987.378 -418.359 0.430044 +986.954 -418.719 1.61573 +986.531 -419.078 1.92261 +986.107 -419.437 2.1334 +985.684 -419.797 1.71718 +985.261 -420.156 3.93112 +984.837 -420.515 4.97288 +984.414 -420.875 4.17156 +983.99 -421.234 6.75994 +983.567 -421.593 7.21423 +983.143 -421.952 7.06023 +982.72 -422.312 9.98495 +982.296 -422.671 11.1957 +981.873 -423.03 10.8565 +981.449 -423.39 12.2316 +981.026 -423.749 13.455 +980.602 -424.108 15.1735 +980.179 -424.468 18.3738 +979.756 -424.827 18.5685 +979.332 -425.186 20.7628 +978.909 -425.545 23.469 +978.485 -425.905 24.0036 + +1018.27 -422.697 25.8896 +1017.83 -423.107 22.0469 +1017.39 -423.518 20.1956 +1016.96 -423.929 18.4503 +1016.52 -424.339 16.6464 +1016.08 -424.75 16.0155 +1015.65 -425.161 14.3242 +1015.21 -425.571 12.5723 +1014.77 -425.982 11.9812 +1014.34 -426.392 10.4618 +1013.9 -426.803 8.8695 +1013.47 -427.214 7.49168 +1013.03 -427.624 7.71038 +1012.59 -428.035 5.22294 +1012.16 -428.446 5.39359 +1011.72 -428.856 4.85198 +1011.28 -429.267 3.59733 +1010.85 -429.677 2.72831 +1010.41 -430.088 1.90752 +1009.98 -430.499 2.30391 +1009.54 -430.909 0.193724 +1009.1 -431.32 -0.353845 +1008.67 -431.731 -0.623243 +1008.23 -432.141 0.767465 +1007.79 -432.552 0.840177 +1007.36 -432.963 0.75218 +1006.92 -433.373 -0.11092 +1006.49 -433.784 -0.810666 +1006.05 -434.194 -0.298508 +1005.61 -434.605 1.63265 +1005.18 -435.016 0.343877 +1004.74 -435.426 2.22617 +1004.3 -435.837 2.94189 +1003.87 -436.248 3.40736 +1003.43 -436.658 3.80665 +1002.99 -437.069 4.75777 +1002.56 -437.479 5.83923 +1002.12 -437.89 4.86311 +1001.69 -438.301 5.85326 +1001.25 -438.711 7.15531 +1000.81 -439.122 8.57299 +1000.38 -439.533 9.36366 +999.941 -439.943 10.5653 +999.504 -440.354 11.9611 +999.068 -440.765 15.4065 +998.632 -441.175 15.5724 +998.195 -441.586 18.3232 +997.759 -441.996 18.5436 +997.323 -442.407 20.6837 +996.887 -442.818 23.7179 + +1040.08 -441.303 24.1324 +1039.63 -441.676 22.2769 +1039.18 -442.048 22.0735 +1038.73 -442.42 19.0469 +1038.28 -442.792 17.2593 +1037.83 -443.164 16.3785 +1037.39 -443.536 13.4782 +1036.94 -443.908 12.308 +1036.49 -444.281 10.6086 +1036.04 -444.653 9.38045 +1035.59 -445.025 8.6555 +1035.14 -445.397 7.34753 +1034.69 -445.769 6.95486 +1034.24 -446.141 6.62541 +1033.79 -446.513 4.27479 +1033.34 -446.885 3.00116 +1032.89 -447.258 2.3998 +1032.44 -447.63 1.57972 +1032 -448.002 1.80938 +1031.55 -448.374 0.449241 +1031.1 -448.746 0.426124 +1030.65 -449.118 -0.139183 +1030.2 -449.49 0.762521 +1029.75 -449.863 -0.733144 +1029.3 -450.235 0.886525 +1028.85 -450.607 -0.999702 +1028.4 -450.979 0.669256 +1027.95 -451.351 0.694715 +1027.5 -451.723 -0.450898 +1027.06 -452.095 0.885164 +1026.61 -452.468 1.20129 +1026.16 -452.84 0.546937 +1025.71 -453.212 2.00219 +1025.26 -453.584 2.06108 +1024.81 -453.956 4.13914 +1024.36 -454.328 3.18889 +1023.91 -454.7 5.53419 +1023.46 -455.072 6.68608 +1023.01 -455.445 6.02843 +1022.56 -455.817 6.88388 +1022.11 -456.189 8.38905 +1021.67 -456.561 9.25099 +1021.22 -456.933 10.8582 +1020.77 -457.305 13.8157 +1020.32 -457.677 13.7256 +1019.87 -458.05 16.9849 +1019.42 -458.422 16.7533 +1018.97 -458.794 19.0038 +1018.52 -459.166 21.8305 +1018.07 -459.538 22.6304 +1017.62 -459.91 25.459 + +1055.48 -456.061 25.7683 +1055.07 -456.458 22.1228 +1054.66 -456.856 22.1243 +1054.25 -457.254 18.5224 +1053.84 -457.652 17.1205 +1053.43 -458.05 15.7812 +1053.01 -458.447 13.7523 +1052.6 -458.845 13.7268 +1052.19 -459.243 12.5305 +1051.78 -459.641 10.5113 +1051.37 -460.039 8.09441 +1050.96 -460.436 8.42081 +1050.55 -460.834 7.75077 +1050.14 -461.232 5.21641 +1049.73 -461.63 5.42667 +1049.32 -462.028 3.29626 +1048.91 -462.425 2.45659 +1048.5 -462.823 1.56009 +1048.09 -463.221 2.9307 +1047.68 -463.619 1.22096 +1047.27 -464.017 1.51462 +1046.86 -464.414 0.283428 +1046.44 -464.812 -0.0206672 +1046.03 -465.21 0.320676 +1045.62 -465.608 0.79025 +1045.21 -466.006 -0.820338 +1044.8 -466.403 1.02767 +1044.39 -466.801 0.430325 +1043.98 -467.199 1.35947 +1043.57 -467.597 -0.233694 +1043.16 -467.995 1.95847 +1042.75 -468.392 2.14116 +1042.34 -468.79 1.46236 +1041.93 -469.188 1.68299 +1041.52 -469.586 3.9113 +1041.11 -469.984 3.01507 +1040.7 -470.381 3.84271 +1040.29 -470.779 6.46329 +1039.87 -471.177 7.47517 +1039.46 -471.575 7.17515 +1039.05 -471.973 9.04165 +1038.64 -472.37 10.5549 +1038.23 -472.768 11.8409 +1037.82 -473.166 11.9643 +1037.41 -473.564 13.6535 +1037 -473.962 15.1051 +1036.59 -474.359 16.7929 +1036.18 -474.757 18.8176 +1035.77 -475.155 21.3635 +1035.36 -475.553 22.0422 +1034.95 -475.95 25.9838 + +1074.09 -474.026 24.0279 +1073.76 -474.411 22.6788 +1073.44 -474.796 22.122 +1073.12 -475.181 18.5183 +1072.8 -475.566 17.4726 +1072.48 -475.951 16.9991 +1072.16 -476.335 13.4598 +1071.84 -476.72 12.3506 +1071.52 -477.105 12.4655 +1071.2 -477.49 11.1082 +1070.88 -477.875 9.30418 +1070.56 -478.26 6.84703 +1070.24 -478.645 7.49138 +1069.91 -479.03 6.34697 +1069.59 -479.415 4.20845 +1069.27 -479.8 3.59789 +1068.95 -480.185 2.97879 +1068.63 -480.57 3.38712 +1068.31 -480.955 1.46675 +1067.99 -481.34 1.44109 +1067.67 -481.725 0.618775 +1067.35 -482.11 -0.33868 +1067.03 -482.495 1.25104 +1066.71 -482.88 1.01502 +1066.39 -483.265 -0.959108 +1066.07 -483.65 -0.0618301 +1065.74 -484.035 -0.740786 +1065.42 -484.42 0.927869 +1065.1 -484.805 0.680138 +1064.78 -485.19 -0.0478841 +1064.46 -485.575 0.0469202 +1064.14 -485.96 0.44299 +1063.82 -486.345 1.12343 +1063.5 -486.73 3.18883 +1063.18 -487.115 2.92752 +1062.86 -487.5 3.57964 +1062.54 -487.884 5.10331 +1062.22 -488.269 5.20719 +1061.89 -488.654 5.86994 +1061.57 -489.039 8.47078 +1061.25 -489.424 8.13457 +1060.93 -489.809 9.58342 +1060.61 -490.194 12.0762 +1060.29 -490.579 13.9242 +1059.97 -490.964 13.7955 +1059.65 -491.349 15.1672 +1059.33 -491.734 17.1496 +1059.01 -492.119 20.3158 +1058.69 -492.504 20.2084 +1058.37 -492.889 22.8141 +1058.04 -493.274 24 + diff --git a/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png index 9aba0e4a..fd1d1233 100644 Binary files a/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png and b/src/HYDRO_tests/reference_data/Shape_preview_im_zone.png differ diff --git a/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png b/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png index 67aca119..1915908f 100644 Binary files a/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png and b/src/HYDRO_tests/reference_data/Split_Polylines_Colors.png differ diff --git a/src/HYDRO_tests/reference_data/Split_Straight.png b/src/HYDRO_tests/reference_data/Split_Straight.png index 8e109a55..c93ac469 100644 Binary files a/src/HYDRO_tests/reference_data/Split_Straight.png and b/src/HYDRO_tests/reference_data/Split_Straight.png differ diff --git a/src/HYDRO_tests/reference_data/StreamDlg.png b/src/HYDRO_tests/reference_data/StreamDlg.png new file mode 100644 index 00000000..8371a7bc Binary files /dev/null and b/src/HYDRO_tests/reference_data/StreamDlg.png differ diff --git a/src/HYDRO_tests/reference_data/cc_int_w_1.png b/src/HYDRO_tests/reference_data/cc_int_w_1.png new file mode 100644 index 00000000..47629445 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cc_int_w_1.png differ diff --git a/src/HYDRO_tests/reference_data/cc_int_w_2.png b/src/HYDRO_tests/reference_data/cc_int_w_2.png new file mode 100644 index 00000000..70ef70e6 Binary files /dev/null and b/src/HYDRO_tests/reference_data/cc_int_w_2.png differ diff --git a/src/HYDRO_tests/reference_data/cc_int_w_3.png b/src/HYDRO_tests/reference_data/cc_int_w_3.png new file mode 100644 index 00000000..cdeffb4a Binary files /dev/null and b/src/HYDRO_tests/reference_data/cc_int_w_3.png differ diff --git a/src/HYDRO_tests/reference_data/clc_dec_150_350.png b/src/HYDRO_tests/reference_data/clc_dec_150_350.png index 2e143f82..cca57191 100644 Binary files a/src/HYDRO_tests/reference_data/clc_dec_150_350.png and b/src/HYDRO_tests/reference_data/clc_dec_150_350.png differ diff --git a/src/HYDRO_tests/reference_data/cyprus_natural_all.png b/src/HYDRO_tests/reference_data/cyprus_natural_all.png index 4edc22e9..edd084aa 100644 Binary files a/src/HYDRO_tests/reference_data/cyprus_natural_all.png and b/src/HYDRO_tests/reference_data/cyprus_natural_all.png differ diff --git a/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png b/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png index a98e002e..7b7d7fcb 100644 Binary files a/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png and b/src/HYDRO_tests/reference_data/lcm_poly_2_sections.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png index 1ae7be53..437fd504 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_11.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png index e2d0747f..ee6ecb05 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_12.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png index b7d0a3f1..341f77fa 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_13.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png index 99d05dfc..96d4902e 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_14.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png index 8c8d74d2..20a858ea 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_21.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png index e2d0747f..ee6ecb05 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_22.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png index 09788d1e..10a0acda 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_23.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png b/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png index a2889ae7..21de11a3 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png and b/src/HYDRO_tests/reference_data/merge_faces_boxes_24.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_11.png b/src/HYDRO_tests/reference_data/merge_faces_circles_11.png index 81257c87..2ac1f68b 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_11.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_11.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_12.png b/src/HYDRO_tests/reference_data/merge_faces_circles_12.png index dd7a7c20..9fcbd304 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_12.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_12.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_13.png b/src/HYDRO_tests/reference_data/merge_faces_circles_13.png index 417ef34b..e9c116f9 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_13.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_13.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_14.png b/src/HYDRO_tests/reference_data/merge_faces_circles_14.png index 417ef34b..e9c116f9 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_14.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_14.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_21.png b/src/HYDRO_tests/reference_data/merge_faces_circles_21.png index 86a8172c..d1be8809 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_21.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_21.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_22.png b/src/HYDRO_tests/reference_data/merge_faces_circles_22.png index dd7a7c20..9fcbd304 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_22.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_22.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_23.png b/src/HYDRO_tests/reference_data/merge_faces_circles_23.png index f9d0686d..d0f68c44 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_23.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_23.png differ diff --git a/src/HYDRO_tests/reference_data/merge_faces_circles_24.png b/src/HYDRO_tests/reference_data/merge_faces_circles_24.png index f9d0686d..d0f68c44 100644 Binary files a/src/HYDRO_tests/reference_data/merge_faces_circles_24.png and b/src/HYDRO_tests/reference_data/merge_faces_circles_24.png differ diff --git a/src/HYDRO_tests/reference_data/p1.brep b/src/HYDRO_tests/reference_data/p1.brep new file mode 100644 index 00000000..cbd0f8a4 --- /dev/null +++ b/src/HYDRO_tests/reference_data/p1.brep @@ -0,0 +1,42 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +1 89031.267742040858 37460.250754226363 0 0.97739578940238125 0.21141776381963695 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +89031.2677420409 37460.2507542264 0 +0 0 + +0101101 +* +Ve +1e-007 +89601 37583.4879537925 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 582.908443167633 +0 + +0101000 ++4 0 -3 0 * +Wi + +1101000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/p2.brep b/src/HYDRO_tests/reference_data/p2.brep new file mode 100644 index 00000000..92568f43 --- /dev/null +++ b/src/HYDRO_tests/reference_data/p2.brep @@ -0,0 +1,42 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +1 89401 37503 0 -0.9685594775963311 -0.24878211020554142 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +89401 37503 0 +0 0 + +0101101 +* +Ve +1e-007 +89000 37400 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 414.0169078673 +0 + +0101000 ++4 0 -3 0 * +Wi + +1101000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/p3.brep b/src/HYDRO_tests/reference_data/p3.brep new file mode 100644 index 00000000..c2bb8514 --- /dev/null +++ b/src/HYDRO_tests/reference_data/p3.brep @@ -0,0 +1,42 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 0 +Curves 1 +1 89401 37503 0 0.70710678118654746 0.70710678118654746 0 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 0 +Triangulations 0 + +TShapes 4 +Ve +1e-007 +89401 37503 0 +0 0 + +0101101 +* +Ve +1e-007 +89421 37523 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 0 28.2842712474619 +0 + +0101000 ++4 0 -3 0 * +Wi + +1101000 ++2 0 * + ++1 0 +0 + diff --git a/src/HYDRO_tests/reference_data/profiles1.xyz b/src/HYDRO_tests/reference_data/profiles1.xyz new file mode 100644 index 00000000..87d75afc --- /dev/null +++ b/src/HYDRO_tests/reference_data/profiles1.xyz @@ -0,0 +1,6 @@ +1 2 5 +2 4.1 4 +3 5.9 3 +4 8.2 3 +5 9.8 4 +6 12 5 diff --git a/src/HYDRO_tests/reference_data/r2.brep b/src/HYDRO_tests/reference_data/r2.brep new file mode 100644 index 00000000..28a36494 --- /dev/null +++ b/src/HYDRO_tests/reference_data/r2.brep @@ -0,0 +1,1190 @@ +DBRep_DrawableShape + +CASCADE Topology V1, (c) Matra-Datavision +Locations 7 +1 + 1 0 0 89318.1771346115 + 0 1 0 37523.2269884235 + 0 0 1 0 +1 + 1 0 0 -89318.1771346115 + 0 1 0 -37523.2269884235 + 0 0 1 -0 +2 2 -1 0 +1 + 1 0 0 -89318.1771346115 + 0 1 0 -37523.2269884235 + 0 0 1 -0 +2 4 -1 0 +1 + 1 0 0 -89318.1771346115 + 0 1 0 -37523.2269884235 + 0 0 1 -0 +2 6 -1 0 +Curve2ds 74 +7 0 0 1 2 2 -25.000000000007276 -16.075344349635998 -24.999999999992724 16.075344349621446 + 0 2 32.420343677464707 2 +7 0 0 5 6 2 -25.015749468555441 -3.7778594480332686 -24.995987322803558 -2.2771561305416981 -24.986036661179241 -0.76287640562804881 -24.98604795879146 0.75731200315931346 -24.996027718407277 2.2757567960361484 -25.015842100805457 3.7847976761840982 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 5 6 2 -25 16.075344349592342 -24.999999999978172 17.576177781258593 -25.009989400117774 19.090457251106272 -25.030017698125448 20.610513719002483 -25.059990634959831 22.128695462961332 -25.099673516437178 23.637344612565357 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 1 2 2 -25.000000001076842 -20.271189721228438 -24.999999998923158 20.27118972298922 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 1 2 2 -25.099673515505856 23.637344613278401 -26.165714725670114 64.165706128856982 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 5 6 2 -24.926615566866531 -3.3812512257427443 -24.999981777997164 -2.0300028295750963 -25.036677842625068 -0.67681951883423608 -25.036655735835666 0.67697007555398159 -24.999939844368782 2.0300390451739077 -24.926625549953314 3.3810667877696687 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 5 6 2 -26.165714725662838 64.165706128886086 -26.201297446255921 65.518476877798093 -26.200170274125412 66.872157195699401 -26.162322326017602 68.225417628578725 -26.087815053913801 69.576932467432925 -25.976780700890231 70.925384290632792 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 1 2 2 -25.000000009851647 -23.251444535490009 -24.999999990148353 23.251444553825422 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 1 2 2 -25.976780705350393 70.925384290909278 -22.16055080951628 117.27142061589984 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 5 6 2 -24.999706968650571 -1.5207693030679366 -25.000057282137277 -0.91340194822987542 -25.000232424521528 -0.3050903657276649 -25.000232235026488 0.30384726006013807 -25.000056722499721 0.91309150906454306 -24.999706071495893 1.5223229557886953 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 5 6 2 -22.160550809509004 117.27142061589984 -22.110707587235083 117.87673944066046 -22.060611762834014 118.48298478742072 -22.010289470556017 119.08983954682481 -21.959767115855357 119.69698539207457 -21.909071279704222 120.30410400556866 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 1 2 2 -25.000000001986336 -22.681891918095062 -24.999999997999112 22.681891921718488 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 1 2 2 -21.909071279747877 120.30410400555411 -18.134225797846739 165.51055737068236 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 5 6 2 -24.967151465003553 -2.326332990109222 -25.000239834713284 -1.3962027643283363 -25.016793643015262 -0.46548328360950109 -25.016798895798274 0.46544281060050707 -25.000249966789852 1.3961927893396933 -24.96714969274035 2.3263829582283506 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 5 6 2 -18.134225797854015 165.51055737068236 -18.056778139456583 166.43804803767125 -17.962842716864543 167.36416299636767 -17.85245101145847 168.28852064591774 -17.725642823854287 169.21074029085867 -17.58246647244232 170.13044128078036 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 1 2 2 -24.999999993306119 -22.354008205249556 -25.000000006708433 22.354008193316986 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 1 2 2 -17.582466475236288 170.13044128123147 -10.705290171099477 214.30635300217546 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 5 6 2 -25.012772328176652 -1.5200271449284628 -24.991171838853916 -0.91245035686006304 -24.98032191699167 -0.30315607837110292 -24.980328572935832 0.30600212080753408 -24.991160400481021 0.91316548560280353 -25.012645691989746 1.5164776122255716 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 5 6 2 -10.705290171092201 214.30635300217546 -10.61177109304117 214.90707782818936 -10.528722950111842 215.51078325680282 -10.456470875637024 216.11564138016547 -10.395204171691148 216.71980284123856 -10.344972550636157 217.32140397500189 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 1 2 2 -24.999999994448444 -22.373434601599001 -25.000000005558832 22.373434591689147 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 1 2 2 -10.344972546961799 217.3214039751183 -6.6217193098855205 261.91310374012392 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 5 6 2 -25.00295420744078 -0.72195692671812139 -24.997817074108752 -0.43411404147627763 -24.995239315183426 -0.14540764412959106 -24.995237395487493 0.14395069747115485 -24.997819696887746 0.43374939476780128 -25.002986683342897 0.72377711183798965 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 5 6 2 -6.6217193098855205 261.91310374012392 -6.5977649497144739 262.19999414663471 -6.576307999137498 262.48791362839984 -6.5573787266694126 262.7766521476733 -6.5409993365392438 263.06599911725789 -6.5271841155336006 263.3557436842384 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 1 2 2 -24.999999999345164 -18.393725742600509 -25.000000000654836 18.393725741640083 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 1 2 2 -6.5271841155336006 263.3557436842384 -4.7751235096075106 300.10144915220735 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 5 6 2 -25.001019058807287 -0.61301551254291553 -24.990394303924404 -0.36822476107045077 -24.985069059490343 -0.12294239498442039 -24.985066459776135 0.1225924914033385 -24.990392933417752 0.36813759962387849 -25.001038008340402 0.61345198439084925 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 5 6 2 -4.7751235096002347 300.1014491521928 -4.7634539862629026 300.346192322977 -4.7570818266976858 300.59144972435024 -4.7560311855049804 300.8369823628891 -4.7603095254889922 301.08254796981055 -4.7699074031261262 301.32790555730753 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 1 2 2 -24.999999995809048 -18.911991958171711 -25.000000004183676 18.911991951841628 + 1.6990614677072315 2 39.523045377700264 2 +7 0 0 1 2 2 -4.7699074004194699 301.32790555738029 -6.2483720993404859 339.12298329191981 + 1.6990614677072315 2 39.523045377700264 2 +1 -31.03125 -21.42578125 0.51445130432288266 0.85751959480847129 +1 -3.6168271508652481 334.07238175608336 -0.83204493284837588 0.55470823837522165 +1 -33.984375 -39.16015625 0.16425805207772101 0.9864174026889595 +1 13.95677581286599 330.27798025131517 -0.97747497678214024 0.21105134390653499 +1 -30.296875 -53.93359375 -0.24217343450463402 0.97023297594970959 +1 28.889071594325497 333.25768736971003 -0.98066585882985935 -0.19568973740463366 +1 -23.640625 -62.80078125 -0.60033816506334725 0.79974626449166564 +1 38.063211144520579 339.484070086521 -0.82743077612757954 -0.56156772585050807 +1 -8.8671875 -68.7109375 -0.92845975927333024 0.37143300258607842 +1 44.670268955910672 353.95926229743031 -0.41523086993587066 -0.90971606815110184 +7 0 0 1 2 2 24.999999993360689 -11.955651295284042 25.000000006642949 11.955651288924855 + 0.29070807495669032 2 24.202010659164024 2 +7 0 0 1 2 2 43.707342632485961 341.27108873605903 43.143235001261928 365.17573627275124 + 0.29070807495669032 2 24.202010659164024 2 +7 0 0 4 5 2 24.999999999257852 -0.09689978499955032 24.999624412706908 -0.048450850663357414 24.99949921235384 -1.9063008949160576e-009 24.999624412754201 0.048450849499204196 24.999999999345164 0.09689978814276401 + 0.071238468338566924 5 0.086742588425107264 5 +7 0 0 4 5 2 43.713416463950125 341.07738436566433 43.711522634075664 341.125797728615 43.709879007394193 341.17422085236467 43.708485658382415 341.22265182647971 43.707342632493237 341.27108873610268 + 0.071238468338566924 5 0.086742588425107264 5 +7 0 0 1 2 2 25.000000004187314 -18.911991951841628 24.999999995816324 18.911991958171711 + 1.6990614677072315 2 39.523045377700264 2 +7 0 0 1 2 2 45.191881162871141 303.28230663113936 43.713416463942849 341.07738436566433 + 1.6990614677072315 2 39.523045377700264 2 +7 0 0 5 6 2 24.951950965260039 -2.7811450689769117 25.000206541692023 -1.6693529439653503 25.024339916075405 -0.55654572838102467 25.024333981353266 0.55658866016892716 25.000195168358914 1.6693634410912637 24.951953250958468 2.7810922330536414 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 5 6 2 45.168137011824001 297.72012000893301 45.221137723965512 298.831696031717 45.250020786595996 299.94439009904454 45.254766156554979 301.05751437264553 45.235377333134238 302.17038205071003 45.191881160164485 303.28230663108116 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 1 2 2 25.000000000654836 -18.393725741640083 24.999999999345164 18.393725742600509 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 1 2 2 43.416076405890635 260.97441454096406 45.168137011824001 297.72012000893301 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 5 6 2 24.989084804932645 -1.6141650779609336 25.000604622829997 -0.96868881123373285 25.006354355347867 -0.32300137873971835 25.006345059446176 0.32280577256460674 25.000585118883464 0.96864052099408582 24.989080411112809 1.6144103825790808 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 5 6 2 43.204894896589394 257.75275318778586 43.258611600191216 258.39609355872381 43.306584388425108 259.04002207299345 43.348818312908406 259.68444675624778 43.385315713610908 260.32927513569302 43.416076405890635 260.97441454097861 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 1 2 2 25.000000005551556 -22.373434591660043 24.999999994448444 22.373434601613553 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 1 2 2 39.481641659520392 213.16105342276569 43.20489489659667 257.7527531877713 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 5 6 2 24.955659212108003 -3.2964981986297062 25.002517148801417 -1.9784820100030629 25.025958189733501 -0.65943168569356203 25.025994101561082 0.65985624228778761 25.002593439909106 1.9785828435851727 24.955678657221142 3.2959611699479865 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 5 6 2 38.699621161475079 206.61514137974882 38.902492076391354 207.91829360861448 39.082234096567845 209.22525039696484 39.23876442056644 210.53521944081876 39.371957056413521 211.84741118052625 39.481641655853309 213.16105342263472 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 1 2 2 25.000000006701157 -22.35400819327333 24.999999993298843 22.354008205293212 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 1 2 2 31.822444857330993 162.43922965880483 38.699621161467803 206.61514137976337 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 5 6 2 25.001240952995431 -0.54876184937893413 24.993431991169928 -0.32924811841803603 24.989525598124601 -0.10960542116663419 24.989527828300197 0.10998540358559694 24.99343305506045 0.32934290848788805 25.001224072504556 0.54828755681228358 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 5 6 2 31.692364423113759 161.34991956481826 31.710642320162151 161.56881035138213 31.732810541448998 161.78736639529234 31.758853653351252 162.00540741585428 31.788744551384298 162.22275391333096 31.822444860124961 162.43922965833917 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 1 2 2 24.999999998013664 -22.681891921718488 25.000000002000888 22.681891918095062 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 1 2 2 27.917518941219896 116.14346619971911 31.692364423128311 161.34991956484737 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 5 6 2 25.000284714660665 -1.4919306323863566 24.999941075700917 -0.89613554361858405 24.999769238696899 -0.29935915273381397 24.999769414236653 0.29806758044287562 24.999941614361887 0.89581282647850458 25.000285646696284 1.4935448136966443 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 5 6 2 27.670800782616425 113.16820254930644 27.719694334053202 113.76198813898372 27.768840193813958 114.35673747671535 27.818211221499951 114.95212071726564 27.867780006999965 115.54780716526147 27.917518941270828 116.14346619970456 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 1 2 2 24.999999990148353 -23.25144455381087 25.000000009851647 23.251444535504561 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 1 2 2 23.854570886775036 66.822166224359535 27.670800782609149 113.16820254932099 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 5 6 2 24.999847943945497 -0.67048725539643783 24.985328577371547 -0.4030716346896952 24.97804473197175 -0.13487531189457513 24.978034619016398 0.13384240209416021 24.985322611282754 0.40281515446258709 24.999917834044027 0.67177431093296036 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 5 6 2 23.816997279820498 65.480430653595249 23.809955365650239 65.74814755191619 23.810167961164552 66.016442681881017 23.817666017363081 66.285055766202277 23.832466455431131 66.553719875053503 23.854570891235198 66.822166224053944 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 1 2 2 24.999999998923158 -20.27118972298922 25.000000001076842 20.27118972124299 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 1 2 2 24.883038489992032 24.952069137987564 23.816997279820498 65.480430653580697 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 5 6 2 24.979915801588504 -4.4362318334169686 25.003183596887538 -2.6693155255488819 25.014818422107055 -0.89256589440628886 25.014797551619267 0.88854284751869272 25.003127618256258 2.6683324398763943 24.979848240029241 4.4412634747714037 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 5 6 2 25.000000000014552 16.075344349606894 25.000000000029104 17.842413852849859 24.988238558726152 19.619162650342332 24.964765033822914 21.400116704957327 24.929660825800966 23.179598335933406 24.883038489075261 24.952069137289072 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 1 2 2 25 -16.07534434965055 25 16.075344349621446 + 0 2 32.420343677464707 2 +7 0 1 3 9 9 0 0 25.718367738547386 39.034081160214555 42.359798484074418 49.68072981837031 71.259510071162367 52.101826874022663 100.95941124598903 45.721963559466531 126.68558085264522 22.253989253025793 145.58084922052512 -14.9888774436331 109.53571874478075 -60.626949509118276 18.016370012730476 -88.256613033467147 + 0 2 36.262906006700305 1 57.454088681212156 1 85.572945703489182 1 124.44586692001535 1 160.46619436519291 1 195.55253740483596 1 283.60428771698037 1 373.36099733802803 2 +7 0 1 3 9 9 -14.716470227200961 -138.31529277042702 -52.48137794736553 -110.76705006703796 -62.323370419528231 -93.637440349175876 -63.365325531267601 -64.655215273884068 -55.578197215142566 -35.292868325877805 -30.91160457302097 -10.713591930795815 7.1889163713134172 6.3864838073301655 51.058492435676044 -31.791328450589447 74.298048261311834 -124.52272843912905 + 0 2 36.262906006700305 1 57.454088681212156 1 85.572945703489182 1 124.44586692001535 1 160.46619436519291 1 195.55253740483596 1 283.60428771698037 1 373.36099733802803 2 +Curves 38 +7 0 0 1 2 2 89147.57496042877 37547.866161510719 0 89179.689164861818 37549.397388949707 0 + 0 2 32.420343677464707 2 +7 0 0 5 6 2 89179.689164861789 37549.397388949714 0 89181.188295163316 37549.468868517462 0 89182.700380483628 37549.550966538365 0 89184.21775812791 37549.643367203775 0 89185.732789546484 37549.74561193624 0 89187.237836736735 37549.857101589711 0 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 1 2 2 89187.237836737491 37549.857101588816 0 89227.669435191099 37552.852160434006 0 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 5 6 2 89227.669435191128 37552.852160433999 0 89229.018976146501 37552.952130623838 0 89230.371174005457 37553.015475898625 0 89231.724701340951 37553.042122070096 0 89233.078231021616 37553.032067381515 0 89234.430440822573 37552.985381181585 0 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 1 2 2 89234.430440822645 37552.985381186059 0 89280.905638138269 37551.380785246882 0 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 5 6 2 89280.905638138269 37551.380785246874 0 89281.512643915907 37551.359827853325 0 89282.120587194688 37551.338662271381 0 89282.729149980471 37551.317299502793 0 89283.338013050059 37551.295750762234 0 89283.946857181116 37551.274027440129 0 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 1 2 2 89283.946857181101 37551.27402744018 0 89329.281793725517 37549.656494510076 0 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 5 6 2 89329.281793725517 37549.656494510084 0 89330.211920453075 37549.62330794958 0 89331.141458289363 37549.573586814724 0 89332.070024567205 37549.507344376856 0 89332.997237127565 37549.424602260187 0 89333.922713450753 37549.325390599195 0 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 1 2 2 89333.922713451073 37549.325390602011 0 89378.376031215143 37544.55996616534 0 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 5 6 2 89378.376031215143 37544.559966165332 0 89378.980528339001 37544.495163682455 0 89379.587503988267 37544.440962208304 0 89380.195116844348 37544.397599450254 0 89380.801510633042 37544.365176417006 0 89381.404821436561 37544.343654004508 0 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 1 2 2 89381.404821436852 37544.343654000848 0 89426.123244834802 37542.748376155963 0 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 5 6 2 89426.123244834802 37542.748376155963 0 89426.410950545396 37542.738112588668 0 89426.699565220377 37542.73039260826 0 89426.988877618744 37542.725236445542 0 89427.278676334798 37542.72265625 0 89427.568750074424 37542.722656249985 0 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 1 2 2 89427.568750074424 37542.722656249985 0 89464.356201558665 37542.722656249985 0 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 5 6 2 89464.35620155865 37542.722656249978 0 89464.601222776968 37542.72265625 0 89464.846505346984 37542.727972093438 0 89465.091809396094 37542.73861652505 0 89465.336892575011 37542.754585460738 0 89465.58151461916 37542.775857990273 0 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 1 2 2 89465.581514619364 37542.775857987581 0 89503.263288672388 37546.052695341205 0 + 1.6990614677072315 2 39.523045377700264 2 +1 89498.34375 37543.18359375 0 0.51445130432288266 0.85751959480847129 0 +1 89495.390625 37525.44921875 0 0.16425805207772101 0.9864174026889595 0 +1 89499.078125 37510.67578125 0 -0.24217343450463402 0.97023297594970959 0 +1 89505.734375 37501.80859375 0 -0.60033816506334725 0.79974626449166564 0 +1 89520.5078125 37495.8984375 0 -0.92845975927333024 0.37143300258607842 0 +7 0 0 1 2 2 89507.788176455346 37496.255976755347 0 89531.638830728494 37497.957940919499 0 + 0.29070807495669032 2 24.202010659164024 2 +7 0 0 4 5 2 89507.594981174494 37496.240684339158 0 89507.643249401823 37496.244881782979 0 89507.691539295178 37496.248829772405 0 89507.739848949888 37496.25252814206 0 89507.788176455389 37496.255976755339 0 + 0.071238468338566924 5 0.086742588425107264 5 +7 0 0 1 2 2 89469.91320712147 37492.963846985542 0 89507.594981174494 37496.240684339165 0 + 1.6990614677072315 2 39.523045377700264 2 +7 0 0 5 6 2 89464.35620155785 37492.722656249985 0 89465.469040418568 37492.722656250044 0 89466.58184741385 37492.746799779787 0 89467.693934531402 37492.795074100264 0 89468.804615915418 37492.867443006129 0 89469.913207121281 37492.963846988241 0 + 6.2000958873176266 6 6.290650569642092 6 +7 0 0 1 2 2 89427.568750073609 37492.722656249985 0 89464.35620155785 37492.722656249985 0 + 1.1707091734476303 2 37.970627312103517 2 +7 0 0 5 6 2 89424.340686774492 37492.780161391362 0 89424.985855432518 37492.757145748394 0 89425.631338003397 37492.739895513914 0 89426.27704285775 37492.728401261615 0 89426.922877739155 37492.722656250022 0 89427.568750073624 37492.722656249993 0 + 3.162984811269054 6 3.2254023613222773 6 +7 0 0 1 2 2 89379.622263376528 37494.375439236239 0 89424.340686774478 37492.780161391354 0 + 2.4129011012208772 2 47.293774521690104 2 +7 0 0 5 6 2 89373.046534602196 37494.844812883333 0 89374.357870075939 37494.704236871818 0 89375.671904241579 37494.586944706767 0 89376.98784175067 37494.492981360949 0 89378.304887938968 37494.422435079323 0 89379.622263376223 37494.375439239899 0 + 6.1992706349623292 6 6.3277815401364137 6 +7 0 0 1 2 2 89328.593216838141 37499.610237320012 0 89373.04653460221 37494.844812883341 0 + 1.4386699403681846 2 46.166503508015197 2 +7 0 0 5 6 2 89327.49894759529 37499.688290022874 0 89327.718460500662 37499.680457887574 0 89327.937824326073 37499.668723900082 0 89328.15685826038 37499.653094890367 0 89328.375381716658 37499.633589383178 0 89328.593216837791 37499.610237317203 0 + 6.1730258926905792 6 6.2497173472860759 6 +7 0 0 1 2 2 89282.164011050903 37501.305822952963 0 89327.498947595319 37499.688290022859 0 + 1.5095198913739187 2 46.873329477009811 2 +7 0 0 5 6 2 89279.180373355848 37501.410559497628 0 89279.775813756612 37501.390001408661 0 89280.372228828346 37501.369237197723 0 89280.969287807558 37501.348278265003 0 89281.566659068645 37501.327136239604 0 89282.164011050903 37501.305822952912 0 + 4.6329902037804702 6 4.7134544916582994 6 +7 0 0 1 2 2 89232.705176040239 37503.015155436813 0 89279.180373355863 37501.410559497635 0 + 2.0363688587054649 2 48.686194767358877 2 +7 0 0 5 6 2 89231.363173554506 37502.988784125308 0 89231.630251268172 37503.008568489422 0 89231.898252064828 37503.021134115399 0 89232.166917436625 37503.026437691231 0 89232.435981562521 37503.024449601988 0 89232.705176040152 37503.015155432346 0 + 3.0601329938793498 6 3.168632769656555 6 +7 0 0 1 2 2 89190.931575100883 37499.993725280117 0 89231.363173554491 37502.988784125308 0 + 4.1357864557881516 2 44.839442635187361 2 +7 0 0 5 6 2 89182.070494004263 37499.454128428224 0 89183.835558255465 37499.538287910305 0 89185.609730659693 37499.634656478658 0 89187.387545742444 37499.742924121885 0 89189.163336142752 37499.862739123346 0 89190.931575100141 37499.993725280998 0 + 3.0443579100651261 6 3.2640453476566313 6 +7 0 0 1 2 2 89149.95628957123 37497.922900989252 0 89182.070494004278 37499.454128428239 0 + 0 2 32.420343677464707 2 +7 0 1 3 9 9 89025.963498009267 37531.772430349287 0 89051.681865747814 37570.806511509501 0 89068.323296493341 37581.453160167657 0 89097.223008080429 37583.87425722331 0 89126.922909255256 37577.494393908753 0 89152.649078861912 37554.026419602313 0 89171.544347229792 37516.783552905654 0 89135.499216754048 37471.145480840169 0 89043.979868021997 37443.51581731582 0 + 0 2 36.262906006700305 1 57.454088681212156 1 85.572945703489182 1 124.44586692001535 1 160.46619436519291 1 195.55253740483596 1 283.60428771698037 1 373.36099733802803 2 +Polygon3D 0 +PolygonOnTriangulations 99 +2 2 52 +p 1.5362554819989 1 3.04435791006513 3.26404534765663 +2 2 3 +p 1.4583468921677 1 3.04435791006513 3.26404534765663 +2 2 3 +p 1.4583468921677 1 3.04435791006513 3.26404534765663 +2 52 49 +p 1.5362554819989 1 4.13578645578815 44.8394426351874 +2 3 4 +p 1.4583468921677 1 4.13578645578815 44.8394426351874 +2 3 4 +p 1.4583468921677 1 4.13578645578815 44.8394426351874 +4 49 50 51 48 +p 1.5362554819989 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +4 4 6 7 5 +p 1.4583468921677 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +4 4 6 7 5 +p 1.4583468921677 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +2 48 47 +p 1.5362554819989 1 2.03636885870546 48.6861947673589 +2 5 8 +p 1.4583468921677 1 2.03636885870546 48.6861947673589 +2 5 8 +p 1.4583468921677 1 2.03636885870546 48.6861947673589 +2 47 46 +p 1.5362554819989 1 4.63299020378047 4.7134544916583 +2 8 9 +p 1.4583468921677 1 4.63299020378047 4.7134544916583 +2 8 9 +p 1.4583468921677 1 4.63299020378047 4.7134544916583 +2 46 43 +p 1.5362554819989 1 1.50951989137392 46.8733294770098 +2 9 10 +p 1.4583468921677 1 1.50951989137392 46.8733294770098 +2 9 10 +p 1.4583468921677 1 1.50951989137392 46.8733294770098 +4 43 44 45 42 +p 1.5362554819989 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +4 10 12 13 11 +p 1.4583468921677 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +4 10 12 13 11 +p 1.4583468921677 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +2 42 39 +p 1.5362554819989 1 1.43866994036818 46.1665035080152 +2 11 14 +p 1.4583468921677 1 1.43866994036818 46.1665035080152 +2 11 14 +p 1.4583468921677 1 1.43866994036818 46.1665035080152 +4 39 40 41 38 +p 1.5362554819989 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +4 14 16 17 15 +p 1.4583468921677 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +4 14 16 17 15 +p 1.4583468921677 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +2 38 37 +p 1.5362554819989 1 2.41290110122088 47.2937745216901 +2 15 18 +p 1.4583468921677 1 2.41290110122088 47.2937745216901 +2 15 18 +p 1.4583468921677 1 2.41290110122088 47.2937745216901 +2 37 36 +p 1.5362554819989 1 3.16298481126905 3.22540236132228 +2 18 19 +p 1.4583468921677 1 3.16298481126905 3.22540236132228 +2 18 19 +p 1.4583468921677 1 3.16298481126905 3.22540236132228 +2 36 33 +p 1.5362554819989 1 1.17070917344763 37.9706273121035 +2 19 20 +p 1.4583468921677 1 1.17070917344763 37.9706273121035 +2 19 20 +p 1.4583468921677 1 1.17070917344763 37.9706273121035 +4 33 34 35 32 +p 1.5362554819989 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +4 20 22 23 21 +p 1.4583468921677 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +4 20 22 23 21 +p 1.4583468921677 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +2 19 20 +p 0.425562500800006 1 0 17.978570685854 +2 26 25 +p 1.4583468921677 1 0 17.978570685854 +2 9 10 +p 0.203435998463916 1 0 17.978570685854 +2 9 10 +p 0.203435998463916 1 0 17.978570685854 +2 26 25 +p 1.4583468921677 1 0 17.978570685854 +2 18 19 +p 0.425562500800006 1 0 15.2266907703679 +2 27 26 +p 1.4583468921677 1 0 15.2266907703679 +2 8 9 +p 0.203435998463916 1 0 15.2266907703679 +2 8 9 +p 0.203435998463916 1 0 15.2266907703679 +2 27 26 +p 1.4583468921677 1 0 15.2266907703679 +2 17 18 +p 0.425562500800006 1 0 11.0875009908751 +2 28 27 +p 1.4583468921677 1 0 11.0875009908751 +2 7 8 +p 0.203435998463916 1 0 11.0875009908751 +2 7 8 +p 0.203435998463916 1 0 11.0875009908751 +2 28 27 +p 1.4583468921677 1 0 11.0875009908751 +2 26 27 +p 1.5362554819989 1 0.0712384683385669 0.0867425884251073 +2 31 30 +p 1.4583468921677 1 0.0712384683385669 0.0867425884251073 +2 31 30 +p 1.4583468921677 1 0.0712384683385669 0.0867425884251073 +2 23 26 +p 1.5362554819989 1 1.69906146770723 39.5230453777003 +2 32 31 +p 1.4583468921677 1 1.69906146770723 39.5230453777003 +2 32 31 +p 1.4583468921677 1 1.69906146770723 39.5230453777003 +4 22 24 25 23 +p 1.5362554819989 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +4 33 34 35 32 +p 1.4583468921677 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +4 33 34 35 32 +p 1.4583468921677 1 6.20009588731763 6.23028078142578 6.26046567553394 6.29065056964209 +2 21 22 +p 1.5362554819989 1 1.17070917344763 37.9706273121035 +2 36 33 +p 1.4583468921677 1 1.17070917344763 37.9706273121035 +2 36 33 +p 1.4583468921677 1 1.17070917344763 37.9706273121035 +2 20 21 +p 1.5362554819989 1 3.16298481126905 3.22540236132228 +2 37 36 +p 1.4583468921677 1 3.16298481126905 3.22540236132228 +2 37 36 +p 1.4583468921677 1 3.16298481126905 3.22540236132228 +2 17 20 +p 1.5362554819989 1 2.41290110122088 47.2937745216901 +2 38 37 +p 1.4583468921677 1 2.41290110122088 47.2937745216901 +2 38 37 +p 1.4583468921677 1 2.41290110122088 47.2937745216901 +4 16 18 19 17 +p 1.5362554819989 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +4 39 40 41 38 +p 1.4583468921677 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +4 39 40 41 38 +p 1.4583468921677 1 6.19927063496233 6.25638659281748 6.29208406647695 6.32778154013641 +2 13 16 +p 1.5362554819989 1 1.43866994036818 46.1665035080152 +2 42 39 +p 1.4583468921677 1 1.43866994036818 46.1665035080152 +2 42 39 +p 1.4583468921677 1 1.43866994036818 46.1665035080152 +4 12 14 15 13 +p 1.5362554819989 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +4 43 44 45 42 +p 1.4583468921677 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +4 43 44 45 42 +p 1.4583468921677 1 6.17302589269058 6.20711098362191 6.22841416545399 6.24971734728608 +2 11 12 +p 1.5362554819989 1 1.50951989137392 46.8733294770098 +2 46 43 +p 1.4583468921677 1 1.50951989137392 46.8733294770098 +2 46 43 +p 1.4583468921677 1 1.50951989137392 46.8733294770098 +2 10 11 +p 1.5362554819989 1 4.63299020378047 4.7134544916583 +2 47 46 +p 1.4583468921677 1 4.63299020378047 4.7134544916583 +2 47 46 +p 1.4583468921677 1 4.63299020378047 4.7134544916583 +2 7 10 +p 1.5362554819989 1 2.03636885870546 48.6861947673589 +2 48 47 +p 1.4583468921677 1 2.03636885870546 48.6861947673589 +2 48 47 +p 1.4583468921677 1 2.03636885870546 48.6861947673589 +4 6 8 9 7 +p 1.5362554819989 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +4 49 50 51 48 +p 1.4583468921677 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +4 49 50 51 48 +p 1.4583468921677 1 3.06013299387935 3.09629958580509 3.13246617773082 3.16863276965656 +2 5 6 +p 1.5362554819989 1 4.13578645578815 44.8394426351874 +2 52 49 +p 1.4583468921677 1 4.13578645578815 44.8394426351874 +2 52 49 +p 1.4583468921677 1 4.13578645578815 44.8394426351874 +2 4 5 +p 1.5362554819989 1 3.04435791006513 3.26404534765663 +2 53 52 +p 1.4583468921677 1 3.04435791006513 3.26404534765663 +2 53 52 +p 1.4583468921677 1 3.04435791006513 3.26404534765663 +Surfaces 19 +1 89164.822727216524 37523.660144969479 0 0 -0 1 0.047626582849348696 -0.99886521042936227 -0 0.99886521042936227 0.047626582849348696 0 +1 89184.98037206872 37524.657480506554 0 0 -0 1 0.060774959307161786 -0.99815149367278555 -0 0.99815149367278555 0.060774959307161786 0 +1 89209.300505145991 37526.422942857062 0 0 -0 1 0.073874767302730585 -0.99726752617137171 -0 0.99726752617137171 0.073874767302730585 0 +1 89231.541059204596 37527.996988920444 0 0 -0 1 0.019698979872157633 -0.99980595626951352 -0 0.99980595626951352 0.019698979872157633 0 +1 89256.805407089254 37527.197970341847 0 -0 0 1 -0.034505295281782332 -0.99940451499756444 0 0.99940451499756444 -0.034505295281782332 0 +1 89281.548438610727 37526.343115719857 0 -0 0 1 -0.035081719862620604 -0.99938444701300044 0 0.99938444701300044 -0.035081719862620604 0 +1 89305.72290238821 37525.48115873152 0 -0 0 1 -0.035656922531625015 -0.99936408974686186 0 0.99936408974686186 -0.035656922531625015 0 +1 89329.825486404196 37524.587093325994 0 -0 0 1 -0.071163197322485147 -0.9974646857642836 0 0.9974646857642836 -0.071163197322485147 0 +1 89353.484624026634 37522.085101742676 0 -0 0 1 -0.10658993249692038 -0.99430306561445436 0 0.99430306561445436 -0.10658993249692038 0 +1 89378.111401203496 37519.502447672487 0 -0 0 1 -0.071195622364936609 -0.99746237189984732 0 0.99746237189984732 -0.071195622364936609 0 +1 89402.872754105658 37518.561907696101 0 -0 0 1 -0.035651161405180341 -0.99936429528498849 0 0.99936429528498849 -0.035651161405180341 0 +1 89426.399717959124 37517.736528892812 0 -0 0 1 -0.017812665430832073 -0.99984134188892659 0 0.99984134188892659 -0.017812665430832073 0 +1 89445.962475816137 37517.722656249985 0 -0 0 1 -3.553322753867855e-011 -1 0 1 -3.553322753867855e-011 0 +1 89466.052749435941 37517.771735078662 0 0 -0 1 0.043362591112618018 -0.9990594004822736 -0 0.9990594004822736 0.043362591112618018 0 +1 89486.588247896929 37519.508271163373 0 0 -0 1 0.086633849915938671 -0.99624022005174162 -0 0.99624022005174162 0.086633849915938671 0 +1 89529.375 37564.609375 0 0 0 1 1 0 -0 -0 1 0 +1 89517.934047863426 37522.043549167909 0 0 -0 1 0.071178229266440254 -0.99746361321027355 -0 0.99746361321027355 0.071178229266440254 0 +1 89505.718868551063 37521.170377296658 0 0 -0 1 0.07890841049482307 -0.99688187000927075 -0 0.99688187000927075 0.07890841049482307 0 +1 89025.963498009267 37531.772430349287 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 6 +52 50 1 7.37443883735978e-010 +89147.5749604288 37547.8661615107 0 89179.6891648618 37549.3973889497 0 89149.9562895712 37497.9229009893 0 89182.0704940043 37499.4541284282 0 89190.9315751005 37499.9937252806 0 89231.3631735545 37502.9887841253 0 89232.7051760402 37503.0151554346 0 89231.8092325494 37503.0137220555 0 89232.2567626422 37503.022534119 0 89279.1803733559 37501.4105594976 0 89282.1640110509 37501.3058229529 0 89327.4989475953 37499.6882900229 0 89328.593216838 37499.6102373186 0 89327.9863009231 37499.6631861882 0 89328.2901751337 37499.6396966418 0 89373.0465346022 37494.8448128833 0 89379.6222633764 37494.3754392381 0 89375.9652463197 37494.5784624864 0 89377.7929968074 37494.4588556295 0 89424.3406867745 37492.7801613914 0 89427.5687500736 37492.72265625 0 89464.3562015579 37492.72265625 0 89469.9132071214 37492.9638469869 0 89466.210642897 37492.7494762282 0 89468.0634862795 37492.8298999262 0 89507.5949811745 37496.2406843392 0 89507.7881764553 37496.2559767553 0 89531.6388307285 37497.9579409195 0 89528.0799192715 37547.8311215805 0 89504.2292649984 37546.1291574163 0 89503.2632886724 37546.0526953412 0 89465.5815146193 37542.7758579889 0 89464.3562015587 37542.72265625 0 89464.7647716708 37542.7285664242 0 89465.1733879371 37542.7463033623 0 89427.5687500744 37542.72265625 0 89426.1232448348 37542.748376156 0 89381.4048214367 37544.3436540027 0 89378.3760312151 37544.5599661653 0 89379.7226346977 37544.4370828708 0 89380.5649101811 37544.3819614329 0 89333.9227134509 37549.3253906006 0 89329.2817937255 37549.6564945101 0 89331.3472429018 37549.5500989937 0 89332.6360719573 37549.4504703853 0 89283.9468571811 37551.2740274402 0 89280.9056381383 37551.3807852469 0 89234.4304408226 37552.9853811838 0 89227.6694351911 37552.852160434 0 89229.9211306294 37552.9780600555 0 89232.1757812848 37553.0224685455 0 89187.2378367371 37549.8571015893 0 -25.0000000000073 -16.075344349636 -24.9999999999927 16.0753443496214 24.9999999999868 -16.0753443496511 25 16.0753443496214 24.8830384890753 24.9520691372891 23.8169972798205 65.4804306535807 23.8545708912352 66.8221662240539 23.8133319145659 65.9271711738334 23.8258441799423 66.374613102544 27.6708007826091 113.168202549321 27.9175189412708 116.143466199705 31.6923644231283 161.349919564847 31.822444860125 162.439229658339 31.7406507438311 161.835524239315 31.7785861248792 162.137934889789 38.6996211614678 206.615141379763 39.4816416558533 213.161053422635 39.1046775722123 209.517855614353 39.3111982104701 211.337835524054 43.2048948965967 257.752753187771 43.4160764058906 260.974414540979 45.168137011824 297.720120008933 45.1918811601645 303.282306631081 45.2296681727448 299.57373429132 45.2375803375133 301.428305392391 43.7134164639428 341.077384365664 43.7073426324932 341.271088736103 43.1432350012619 365.175736272751 -6.84284888580114 363.996152602092 -6.27874125457311 340.091505065386 -6.24837209933321 339.122983291978 -4.76990740041947 301.32790555738 -4.77512350960023 300.101449152193 -4.76156817869247 300.509837104639 -4.75982399267362 300.918834427184 -6.5271841155336 263.355743684238 -6.62171930988552 261.913103740124 -10.3449725469618 217.321403975118 -10.7052901710922 214.306353002175 -10.5184122008973 215.645575861694 -10.423238611169 216.484270293931 -17.5824664752363 170.130441281231 -18.134225797854 165.510557370682 -17.9295807316394 167.56859544191 -17.7686826569724 168.851216977485 -21.9090712797479 120.304104005554 -22.160550809509 117.2714206159 -25.9767807053504 70.9253842909093 -26.1657147256628 64.1657061288861 -26.1842309182405 66.4208425354414 -26.1212077077211 68.6750496613828 -25.0996735155059 23.6373446132784 20 38 17 20 37 38 21 36 37 21 37 20 4 2 1 4 1 3 22 33 36 22 36 21 24 33 22 5 49 52 5 52 2 24 34 33 5 2 4 6 50 49 25 35 34 25 34 24 6 49 5 8 51 50 23 35 25 8 50 6 23 32 35 9 48 51 9 51 8 26 32 23 26 31 32 7 48 9 27 29 30 27 30 31 27 31 26 10 46 47 10 47 48 28 29 27 10 48 7 11 46 10 43 46 11 12 43 11 14 44 43 14 43 12 15 45 44 15 44 14 13 42 45 13 45 15 16 42 13 16 39 42 18 39 16 18 40 39 18 41 40 19 41 18 19 38 41 17 38 19 +89 87 1 7.64195817737345e-010 +-164.284909447393 24.9403846312125 0 -138.487969749665 26.1704005261854 0 -130.939297874356 26.6301131657383 0 -90.50769942037 29.6251720104847 0 -83.7466937888821 29.7583927603046 0 -88.2560039820673 29.7510716319739 0 -86.0013533267047 29.7954801219821 0 -37.2714964732149 28.1537968233606 0 -34.230277430368 28.0470390166374 0 11.1046591140184 26.4295060865625 0 15.7455788394291 26.0984021770782 0 13.1701082903164 26.3231105701416 0 14.4589373458293 26.2234819617588 0 60.1988966036588 21.3329777418185 0 63.2276868252229 21.1166655791603 0 61.5455000861839 21.2100944472622 0 62.3877755695721 21.1549730093975 0 107.946110223318 19.5213877324422 0 109.391615462941 19.4956678264643 0 146.179066947181 19.4956678264643 0 147.404380007778 19.5488695654276 0 146.587637059318 19.5015780006506 0 146.996253325589 19.5193149387778 0 181.711834649745 22.532273390003 0 180.166615388516 19.9566053264789 0 177.213490388516 2.22223032647889 0 180.900990388516 -12.5512071735211 0 187.557240388516 -21.4183946735211 0 199.646821047034 -26.2548662590125 0 189.611041843862 -26.9710116681745 0 189.417846563025 -26.9863040843557 0 151.736072509884 -30.2631414366115 0 146.179066946366 -30.5043321735357 0 148.033508285531 -30.4775121953498 0 149.886351668043 -30.3970884972805 0 109.391615462126 -30.5043321735357 0 106.163552162994 -30.4468270321668 0 61.445128764899 -28.8515491854487 0 54.8693999907264 -28.3821755401805 0 57.7881117081852 -28.6485259371475 0 59.6158621959476 -28.768132793979 0 10.4160822264821 -23.6167511049207 0 9.32181298382056 -23.5386984006545 0 9.80916631163564 -23.5638022352869 0 10.1130405222357 -23.5872917817615 0 -36.0131235605659 -21.9211654705796 0 -38.9967612556211 -21.8164289258857 0 -85.4719585712883 -20.2118329889418 0 -86.8139610569779 -20.2382042982135 0 -86.3679020620475 -20.2132663679804 0 -85.9203719693178 -20.2044543044758 0 -127.245559510964 -23.2332631429599 0 -136.106640607206 -23.7728599952825 0 -162.511862415355 -25.0318792012404 0 -162.13998825445 21.6455804184079 0 -160.342513689044 18.6074700220124 0 -158.998458540475 16.1055316450947 0 -157.88745426583 13.8286640943115 0 -156.880917119997 11.5333313668452 0 -156.073130750912 9.45599654095713 0 -155.432225727665 7.58027028640936 0 -154.929997941566 5.88950194021163 0 -154.541939130373 4.36740307787113 0 -154.21757150082 2.84642522715149 0 -153.959894535583 1.32802149224881 0 -153.787484857297 -0.0351400095096324 0 -153.682387301931 -1.25832078770327 0 -153.626378664601 -2.477229024189 0 -153.621052993403 -3.69109247982124 0 -153.660911306069 -4.77861804659187 0 -153.733948677094 -5.75289719110879 0 -153.842853130103 -6.72253557607473 0 -153.987190602027 -7.6873681696743 0 -154.166208033348 -8.64729103208083 0 -154.379152301655 -9.6022002355312 0 -154.625270284567 -10.5519918522623 0 -154.903808859701 -11.4965619544892 0 -155.214014904661 -12.4358066144487 0 -155.555135297065 -13.3696219043704 0 -155.926416914532 -14.2979038964768 0 -156.32710663465 -15.2205486630046 0 -156.756451335052 -16.1374522761762 0 -157.213697893341 -17.0485108082212 0 -157.698093187122 -17.9536203313692 0 -158.208884094027 -18.8526769178497 0 -158.929696786159 -20.0418237256454 0 -159.79287860055 -21.3662238162215 0 -160.708954863847 -22.6761084222671 0 -161.590347195612 -23.8603372005309 0 -25.0000000000044 -9.75090270389581 -24.9999999999927 16.0753443496214 -25.0996735164372 23.6373446125654 -26.1657147256701 64.165706128857 -25.9767807008902 70.9253842906328 -26.1842309182405 66.4208425354414 -26.1212077077211 68.6750496613828 -22.1605508095163 117.2714206159 -21.9090712797042 120.304104005569 -18.1342257978467 165.510557370682 -17.5824664724423 170.13044128078 -17.9295807316394 167.56859544191 -17.7686826569724 168.851216977485 -10.7052901710995 214.306353002175 -10.3449725506362 217.321403975002 -10.5184122008973 215.645575861694 -10.423238611169 216.484270293931 -6.62171930988552 261.913103740124 -6.5271841155336 263.355743684238 -4.77512350960751 300.101449152207 -4.76990740312613 301.327905557308 -4.76156817869247 300.509837104639 -4.75982399267362 300.918834427184 -6.11597885996557 335.738517787025 -3.61682715086525 334.072381756083 13.956775812866 330.277980251315 28.8890715943255 333.25768736971 38.0632111445206 339.484070086521 43.469979767348 351.329587000331 43.707342632486 341.271088736059 43.7134164639501 341.077384365664 45.1918811628711 303.282306631139 45.168137011824 297.720120008933 45.2296681727448 299.57373429132 45.2375803375133 301.428305392391 43.4160764058906 260.974414540964 43.2048948965894 257.752753187786 39.4816416595204 213.161053422766 38.6996211614751 206.615141379749 39.1046775722123 209.517855614353 39.3111982104701 211.337835524054 31.822444857331 162.439229658805 31.6923644231138 161.349919564818 31.7406507438311 161.835524239315 31.7785861248792 162.137934889789 27.9175189412199 116.143466199719 27.6708007826164 113.168202549306 23.854570886775 66.8221662243595 23.8169972798205 65.4804306535952 23.8133319145659 65.9271711738334 23.8258441799423 66.374613102544 24.883038489992 24.9520691379876 25.0000000000145 16.0753443496069 25 -10.3598758707283 -21.6067794297546 -7.76533581095473 -18.4865090780454 -6.11459581743192 -15.9233971208156 -4.89122466402916 -13.5961999984484 -3.88992056649371 -11.255534065855 -2.99384448282251 -9.14208447343275 -2.28591114046902 -7.23796265728623 -1.73506784142888 -5.52519358411494 -1.3139354969078 -3.98634006856458 -0.998809418377915 -2.45163968586164 -0.747248855445875 -0.922686746350276 -0.56218068061864 0.447139137781718 -0.454889375230739 1.67393730061224 -0.40816700415089 2.89412983274925 -0.410274358957027 4.10686945230915 -0.462766899701116 5.19126259118281 -0.554375108080702 6.16095761348573 -0.673731183459971 7.12430891597563 -0.828692615709114 8.08117232703968 -1.01881797443774 9.03147989047232 -1.24335010437385 9.97516366508433 -1.50153178804003 10.9121557096865 -1.79260580795884 11.8423880830895 -2.11581494665286 12.7657928441041 -2.47040198664466 13.6823020515411 -2.8556097104568 14.5918477642112 -3.27068090061186 15.4943620409252 -3.71485833963241 16.3897769404938 -4.18738481004103 17.2780245217279 -4.68750309436027 18.159036843438 -5.21445597511272 19.0327459644351 -5.76748623482095 20.1862134954393 -6.54411595519225 21.4680002704054 -7.4693948905021 22.7327688510099 -8.44681692771962 23.8736760738974 -9.3836098346864 35 23 22 50 7 6 35 22 34 50 6 49 32 21 23 32 26 21 51 5 7 32 23 35 51 7 50 27 26 32 48 5 51 28 27 32 31 28 32 47 8 5 47 9 8 47 5 48 30 28 31 46 9 47 29 28 30 2 1 55 2 55 56 2 56 57 2 57 58 43 10 9 2 58 59 2 59 60 2 60 61 43 9 46 44 10 43 44 12 10 45 12 44 62 2 61 45 13 12 63 2 62 42 13 45 42 11 13 64 2 63 39 11 42 39 14 11 40 16 14 40 17 16 3 64 65 40 14 39 3 2 64 41 17 40 66 3 65 41 15 17 38 15 41 53 69 70 37 18 15 53 70 71 53 71 72 53 72 73 53 73 74 53 74 75 37 15 38 53 75 76 53 76 77 53 77 78 36 19 18 53 78 79 53 79 80 53 80 81 53 81 82 53 82 83 36 18 37 53 83 84 53 84 85 53 85 86 53 86 87 53 87 88 53 88 89 53 89 54 25 24 21 33 20 19 33 19 36 52 4 3 52 69 53 52 3 66 26 25 21 52 66 67 52 67 68 34 22 20 52 68 69 34 20 33 49 6 4 49 4 52 +89 87 1 7.64195817737345e-010 +-164.284909447393 24.9403846312125 0 -138.487969749665 26.1704005261854 0 -130.939297874356 26.6301131657383 0 -90.50769942037 29.6251720104847 0 -83.7466937888821 29.7583927603046 0 -88.2560039820673 29.7510716319739 0 -86.0013533267047 29.7954801219821 0 -37.2714964732149 28.1537968233606 0 -34.230277430368 28.0470390166374 0 11.1046591140184 26.4295060865625 0 15.7455788394291 26.0984021770782 0 13.1701082903164 26.3231105701416 0 14.4589373458293 26.2234819617588 0 60.1988966036588 21.3329777418185 0 63.2276868252229 21.1166655791603 0 61.5455000861839 21.2100944472622 0 62.3877755695721 21.1549730093975 0 107.946110223318 19.5213877324422 0 109.391615462941 19.4956678264643 0 146.179066947181 19.4956678264643 0 147.404380007778 19.5488695654276 0 146.587637059318 19.5015780006506 0 146.996253325589 19.5193149387778 0 181.711834649745 22.532273390003 0 180.166615388516 19.9566053264789 0 177.213490388516 2.22223032647889 0 180.900990388516 -12.5512071735211 0 187.557240388516 -21.4183946735211 0 199.646821047034 -26.2548662590125 0 189.611041843862 -26.9710116681745 0 189.417846563025 -26.9863040843557 0 151.736072509884 -30.2631414366115 0 146.179066946366 -30.5043321735357 0 148.033508285531 -30.4775121953498 0 149.886351668043 -30.3970884972805 0 109.391615462126 -30.5043321735357 0 106.163552162994 -30.4468270321668 0 61.445128764899 -28.8515491854487 0 54.8693999907264 -28.3821755401805 0 57.7881117081852 -28.6485259371475 0 59.6158621959476 -28.768132793979 0 10.4160822264821 -23.6167511049207 0 9.32181298382056 -23.5386984006545 0 9.80916631163564 -23.5638022352869 0 10.1130405222357 -23.5872917817615 0 -36.0131235605659 -21.9211654705796 0 -38.9967612556211 -21.8164289258857 0 -85.4719585712883 -20.2118329889418 0 -86.8139610569779 -20.2382042982135 0 -86.3679020620475 -20.2132663679804 0 -85.9203719693178 -20.2044543044758 0 -127.245559510964 -23.2332631429599 0 -136.106640607206 -23.7728599952825 0 -162.511862415355 -25.0318792012404 0 -162.13998825445 21.6455804184079 0 -160.342513689044 18.6074700220124 0 -158.998458540475 16.1055316450947 0 -157.88745426583 13.8286640943115 0 -156.880917119997 11.5333313668452 0 -156.073130750912 9.45599654095713 0 -155.432225727665 7.58027028640936 0 -154.929997941566 5.88950194021163 0 -154.541939130373 4.36740307787113 0 -154.21757150082 2.84642522715149 0 -153.959894535583 1.32802149224881 0 -153.787484857297 -0.0351400095096324 0 -153.682387301931 -1.25832078770327 0 -153.626378664601 -2.477229024189 0 -153.621052993403 -3.69109247982124 0 -153.660911306069 -4.77861804659187 0 -153.733948677094 -5.75289719110879 0 -153.842853130103 -6.72253557607473 0 -153.987190602027 -7.6873681696743 0 -154.166208033348 -8.64729103208083 0 -154.379152301655 -9.6022002355312 0 -154.625270284567 -10.5519918522623 0 -154.903808859701 -11.4965619544892 0 -155.214014904661 -12.4358066144487 0 -155.555135297065 -13.3696219043704 0 -155.926416914532 -14.2979038964768 0 -156.32710663465 -15.2205486630046 0 -156.756451335052 -16.1374522761762 0 -157.213697893341 -17.0485108082212 0 -157.698093187122 -17.9536203313692 0 -158.208884094027 -18.8526769178497 0 -158.929696786159 -20.0418237256454 0 -159.79287860055 -21.3662238162215 0 -160.708954863847 -22.6761084222671 0 -161.590347195612 -23.8603372005309 0 -25.0000000000044 -9.75090270389581 -24.9999999999927 16.0753443496214 -25.0996735164372 23.6373446125654 -26.1657147256701 64.165706128857 -25.9767807008902 70.9253842906328 -26.1842309182405 66.4208425354414 -26.1212077077211 68.6750496613828 -22.1605508095163 117.2714206159 -21.9090712797042 120.304104005569 -18.1342257978467 165.510557370682 -17.5824664724423 170.13044128078 -17.9295807316394 167.56859544191 -17.7686826569724 168.851216977485 -10.7052901710995 214.306353002175 -10.3449725506362 217.321403975002 -10.5184122008973 215.645575861694 -10.423238611169 216.484270293931 -6.62171930988552 261.913103740124 -6.5271841155336 263.355743684238 -4.77512350960751 300.101449152207 -4.76990740312613 301.327905557308 -4.76156817869247 300.509837104639 -4.75982399267362 300.918834427184 -6.11597885996557 335.738517787025 -3.61682715086525 334.072381756083 13.956775812866 330.277980251315 28.8890715943255 333.25768736971 38.0632111445206 339.484070086521 43.469979767348 351.329587000331 43.707342632486 341.271088736059 43.7134164639501 341.077384365664 45.1918811628711 303.282306631139 45.168137011824 297.720120008933 45.2296681727448 299.57373429132 45.2375803375133 301.428305392391 43.4160764058906 260.974414540964 43.2048948965894 257.752753187786 39.4816416595204 213.161053422766 38.6996211614751 206.615141379749 39.1046775722123 209.517855614353 39.3111982104701 211.337835524054 31.822444857331 162.439229658805 31.6923644231138 161.349919564818 31.7406507438311 161.835524239315 31.7785861248792 162.137934889789 27.9175189412199 116.143466199719 27.6708007826164 113.168202549306 23.854570886775 66.8221662243595 23.8169972798205 65.4804306535952 23.8133319145659 65.9271711738334 23.8258441799423 66.374613102544 24.883038489992 24.9520691379876 25.0000000000145 16.0753443496069 25 -10.3598758707283 -21.6067794297546 -7.76533581095473 -18.4865090780454 -6.11459581743192 -15.9233971208156 -4.89122466402916 -13.5961999984484 -3.88992056649371 -11.255534065855 -2.99384448282251 -9.14208447343275 -2.28591114046902 -7.23796265728623 -1.73506784142888 -5.52519358411494 -1.3139354969078 -3.98634006856458 -0.998809418377915 -2.45163968586164 -0.747248855445875 -0.922686746350276 -0.56218068061864 0.447139137781718 -0.454889375230739 1.67393730061224 -0.40816700415089 2.89412983274925 -0.410274358957027 4.10686945230915 -0.462766899701116 5.19126259118281 -0.554375108080702 6.16095761348573 -0.673731183459971 7.12430891597563 -0.828692615709114 8.08117232703968 -1.01881797443774 9.03147989047232 -1.24335010437385 9.97516366508433 -1.50153178804003 10.9121557096865 -1.79260580795884 11.8423880830895 -2.11581494665286 12.7657928441041 -2.47040198664466 13.6823020515411 -2.8556097104568 14.5918477642112 -3.27068090061186 15.4943620409252 -3.71485833963241 16.3897769404938 -4.18738481004103 17.2780245217279 -4.68750309436027 18.159036843438 -5.21445597511272 19.0327459644351 -5.76748623482095 20.1862134954393 -6.54411595519225 21.4680002704054 -7.4693948905021 22.7327688510099 -8.44681692771962 23.8736760738974 -9.3836098346864 35 23 22 50 7 6 35 22 34 50 6 49 32 21 23 32 26 21 51 5 7 32 23 35 51 7 50 27 26 32 48 5 51 28 27 32 31 28 32 47 8 5 47 9 8 47 5 48 30 28 31 46 9 47 29 28 30 2 1 55 2 55 56 2 56 57 2 57 58 43 10 9 2 58 59 2 59 60 2 60 61 43 9 46 44 10 43 44 12 10 45 12 44 62 2 61 45 13 12 63 2 62 42 13 45 42 11 13 64 2 63 39 11 42 39 14 11 40 16 14 40 17 16 3 64 65 40 14 39 3 2 64 41 17 40 66 3 65 41 15 17 38 15 41 53 69 70 37 18 15 53 70 71 53 71 72 53 72 73 53 73 74 53 74 75 37 15 38 53 75 76 53 76 77 53 77 78 36 19 18 53 78 79 53 79 80 53 80 81 53 81 82 53 82 83 36 18 37 53 83 84 53 84 85 53 85 86 53 86 87 53 87 88 53 88 89 53 89 54 25 24 21 33 20 19 33 19 36 52 4 3 52 69 53 52 3 66 26 25 21 52 66 67 52 67 68 34 22 20 52 68 69 34 20 33 49 6 4 49 4 52 +22 20 1 1.77635683940025e-015 +89529.375 37564.609375 0 89537.5 37572.734375 0 89545.625 37577.90625 0 89550.8046875 37575.69140625 0 89563.359375 37575.69140625 0 89576.6640625 37569.78125 0 89579.6171875 37560.17578125 0 89589.9609375 37546.875 0 89597.3515625 37538.01171875 0 89601.78125 37523.97265625 0 89594.390625 37514.3671875 0 89584.046875 37504.76171875 0 89573.703125 37498.11328125 0 89560.40625 37493.6796875 0 89541.9375 37491.46484375 0 89520.5078125 37495.8984375 0 89505.734375 37501.80859375 0 89499.078125 37510.67578125 0 89495.390625 37525.44921875 0 89498.34375 37543.18359375 0 89504.9921875 37554.265625 0 89510.1640625 37561.65234375 0 0 0 8.125 8.125 16.25 13.296875 21.4296875 11.08203125 33.984375 11.08203125 47.2890625 5.171875 50.2421875 -4.43359375 60.5859375 -17.734375 67.9765625 -26.59765625 72.40625 -40.63671875 65.015625 -50.2421875 54.671875 -59.84765625 44.328125 -66.49609375 31.03125 -70.9296875 12.5625 -73.14453125 -8.8671875 -68.7109375 -23.640625 -62.80078125 -30.296875 -53.93359375 -33.984375 -39.16015625 -31.03125 -21.42578125 -24.3828125 -10.34375 -19.2109375 -2.95703125 16 18 17 19 18 16 20 19 16 1 15 14 1 16 15 1 21 20 1 22 21 1 20 16 4 2 1 4 3 2 9 11 10 8 12 11 8 13 12 8 11 9 7 5 4 7 14 13 7 1 14 7 13 8 7 4 1 6 5 7 +10 8 1 1.42650335988037e-011 +181.711834649745 22.532273390003 0 185.086154060918 22.8257069176834 0 186.052130386874 22.9021689927977 0 209.902784660022 24.6041331569577 0 213.461696117025 -25.2690475040145 0 199.646821047034 -26.2548662590125 0 187.557240388516 -21.4183946735211 0 180.900990388516 -12.5512071735211 0 177.213490388516 2.22223032647889 0 180.166615388516 19.9566053264789 0 -6.11597885996557 335.738517787025 -6.24837209934049 339.12298329192 -6.27874125455855 340.091505065371 -6.84284888579714 363.996152602078 43.1432350012555 365.175736272772 43.4699797673438 351.329587000319 38.0632111445206 339.484070086521 28.8890715943255 333.25768736971 13.956775812866 330.277980251315 -3.61682715086525 334.072381756083 2 1 10 3 2 10 9 3 10 4 3 9 8 4 9 6 8 7 6 4 8 5 4 6 +10 8 1 7.97228949522832e-012 +181.711834649745 22.532273390003 0 185.086154060918 22.8257069176834 0 186.052130386874 22.9021689927977 0 209.902784660022 24.6041331569577 0 213.461696117025 -25.2690475040145 0 199.646821047034 -26.2548662590125 0 187.557240388516 -21.4183946735211 0 180.900990388516 -12.5512071735211 0 177.213490388516 2.22223032647889 0 180.166615388516 19.9566053264789 0 -29.4860307387652 -18.8501131864729 -26.1117113275541 -18.5566796588028 -25.1457350016426 -18.4802175836812 -1.29508072849421 -16.7782534195212 2.26383072849421 -66.6514340805006 -11.5510443414805 -67.6372528354945 -23.640625 -62.80078125 -30.296875 -53.93359375 -33.984375 -39.16015625 -31.03125 -21.42578125 6 8 7 2 1 10 3 10 9 3 2 10 4 6 5 4 9 8 4 8 6 4 3 9 + +TShapes 78 +Ve +1.00000001776357e-007 +-164.28490944739 24.9403846312127 0 +0 0 + +0101101 +* +Ve +1.01e-007 +89179.6891648618 37549.3973889497 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 1 0 6.37748614472768 32.4203436774647 +2 1 1 0 6.37748614472768 32.4203436774647 +0 + +0101000 ++78 3 -77 0 * +Ve +2.19534980935138e-007 +89187.2378367371 37549.8571015893 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 2 0 3.04435791006513 3.26404534765663 +2 2 2 0 3.04435791006513 3.26404534765663 +2 3 1 0 3.04435791006513 3.26404534765663 +6 1 1 0 +6 2 2 5 +6 3 3 7 +0 + +0101000 +-75 0 +77 0 * +Ve +1.01e-007 +89227.6694351911 37552.852160434 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 3 0 4.13578645578815 44.8394426351874 +2 4 3 0 4.13578645578815 44.8394426351874 +2 5 1 0 4.13578645578815 44.8394426351874 +6 4 1 0 +6 5 2 5 +6 6 3 7 +0 + +0101000 +-73 0 +75 0 * +Ve +1.06940469647803e-007 +89234.4304408226 37552.9853811838 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 4 0 3.06013299387935 3.16863276965656 +2 6 4 0 3.06013299387935 3.16863276965656 +2 7 1 0 3.06013299387935 3.16863276965656 +6 7 1 0 +6 8 2 5 +6 9 3 7 +0 + +0101000 +-71 0 +73 0 * +Ve +1.01e-007 +89280.9056381383 37551.3807852469 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 5 0 2.03636885870546 48.6861947673589 +2 8 5 0 2.03636885870546 48.6861947673589 +2 9 1 0 2.03636885870546 48.6861947673589 +6 10 1 0 +6 11 2 5 +6 12 3 7 +0 + +0101000 +-69 0 +71 0 * +Ve +1.01e-007 +89283.9468571811 37551.2740274402 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 6 0 4.63299020378047 4.7134544916583 +2 10 6 0 4.63299020378047 4.7134544916583 +2 11 1 0 4.63299020378047 4.7134544916583 +6 13 1 0 +6 14 2 5 +6 15 3 7 +0 + +0101000 +-67 0 +69 0 * +Ve +1.01e-007 +89329.2817937255 37549.6564945101 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 7 0 1.50951989137392 46.8733294770098 +2 12 7 0 1.50951989137392 46.8733294770098 +2 13 1 0 1.50951989137392 46.8733294770098 +6 16 1 0 +6 17 2 5 +6 18 3 7 +0 + +0101000 +-65 0 +67 0 * +Ve +1.02700581647779e-007 +89333.9227134509 37549.3253906006 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 8 0 6.17302589269058 6.24971734728608 +2 14 8 0 6.17302589269058 6.24971734728608 +2 15 1 0 6.17302589269058 6.24971734728608 +6 19 1 0 +6 20 2 5 +6 21 3 7 +0 + +0101000 +-63 0 +65 0 * +Ve +1.01e-007 +89378.3760312151 37544.5599661653 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 9 0 1.43866994036818 46.1665035080152 +2 16 9 0 1.43866994036818 46.1665035080152 +2 17 1 0 1.43866994036818 46.1665035080152 +6 22 1 0 +6 23 2 5 +6 24 3 7 +0 + +0101000 +-61 0 +63 0 * +Ve +1.32781756908256e-007 +89381.4048214367 37544.3436540027 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 10 0 6.19927063496233 6.32778154013641 +2 18 10 0 6.19927063496233 6.32778154013641 +2 19 1 0 6.19927063496233 6.32778154013641 +6 25 1 0 +6 26 2 5 +6 27 3 7 +0 + +0101000 +-59 0 +61 0 * +Ve +1.01e-007 +89426.1232448348 37542.748376156 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 11 0 2.41290110122088 47.2937745216901 +2 20 11 0 2.41290110122088 47.2937745216901 +2 21 1 0 2.41290110122088 47.2937745216901 +6 28 1 0 +6 29 2 5 +6 30 3 7 +0 + +0101000 +-57 0 +59 0 * +Ve +1.01e-007 +89427.5687500744 37542.72265625 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 12 0 3.16298481126905 3.22540236132228 +2 22 12 0 3.16298481126905 3.22540236132228 +2 23 1 0 3.16298481126905 3.22540236132228 +6 31 1 0 +6 32 2 5 +6 33 3 7 +0 + +0101000 +-55 0 +57 0 * +Ve +1.01e-007 +89464.3562015587 37542.72265625 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 13 0 1.17070917344763 37.9706273121035 +2 24 13 0 1.17070917344763 37.9706273121035 +2 25 1 0 1.17070917344763 37.9706273121035 +6 34 1 0 +6 35 2 5 +6 36 3 7 +0 + +0101000 +-53 0 +55 0 * +Ve +1.04412372155159e-007 +89465.5815146193 37542.7758579889 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 14 0 6.20009588731763 6.29065056964209 +2 26 14 0 6.20009588731763 6.29065056964209 +2 27 1 0 6.20009588731763 6.29065056964209 +6 37 1 0 +6 38 2 5 +6 39 3 7 +0 + +0101000 +-51 0 +53 0 * +Ve +1.00000017763568e-007 +181.711834649751 22.532273390006 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 15 0 1.69906146770723 36.1359913888135 +2 28 15 0 1.69906146770723 36.1359913888135 +2 29 1 0 1.69906146770723 36.1359913888135 +0 + +0101000 ++51 0 -49 3 * +Ve +1e-007 +89498.34375 37543.18359375 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 16 0 0 3.00362589860391 +2 30 16 0 0 3.00362589860391 +2 31 1 0 0 3.00362589860391 +0 + +0101000 ++47 0 -49 3 * +Ve +1e-007 +89495.390625 37525.44921875 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 17 0 0 17.978570685854 +6 40 4 0 +2 32 16 0 0 17.978570685854 +2 33 1 0 0 17.978570685854 +6 41 2 5 +6 42 5 5 +6 43 6 7 +6 44 3 7 +0 + +0101000 ++45 0 -47 0 * +Ve +1e-007 +89499.078125 37510.67578125 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 18 0 0 15.2266907703679 +6 45 4 0 +2 34 16 0 0 15.2266907703679 +2 35 1 0 0 15.2266907703679 +6 46 2 5 +6 47 5 5 +6 48 6 7 +6 49 3 7 +0 + +0101000 ++43 0 -45 0 * +Ve +1e-007 +89505.734375 37501.80859375 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 19 0 0 11.0875009908751 +6 50 4 0 +2 36 16 0 0 11.0875009908751 +2 37 1 0 0 11.0875009908751 +6 51 2 5 +6 52 5 5 +6 53 6 7 +6 54 3 7 +0 + +0101000 ++41 0 -43 0 * +Ve +1.00000012434498e-007 +199.646821047036 -26.2548662590156 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 20 0 2.89065499573297 15.91176930658 +2 38 16 0 2.89065499573297 15.91176930658 +2 39 1 0 2.89065499573297 15.91176930658 +0 + +0101000 ++39 3 -41 0 * +Ve +1.01e-007 +89507.7881764553 37496.2559767553 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 21 0 0.29070807495669 10.3520066224579 +2 40 17 0 0.29070807495669 10.3520066224579 +2 41 1 0 0.29070807495669 10.3520066224579 +0 + +0101000 ++37 0 -39 3 * +Ve +1.01e-007 +89507.5949811745 37496.2406843392 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 22 0 0.0712384683385669 0.0867425884251073 +2 42 18 0 0.0712384683385669 0.0867425884251073 +2 43 1 0 0.0712384683385669 0.0867425884251073 +6 55 1 0 +6 56 2 5 +6 57 3 7 +0 + +0101000 ++35 0 -37 0 * +Ve +1.04412372155159e-007 +89469.9132071214 37492.9638469869 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 23 0 1.69906146770723 39.5230453777003 +2 44 15 0 1.69906146770723 39.5230453777003 +2 45 1 0 1.69906146770723 39.5230453777003 +6 58 1 0 +6 59 2 5 +6 60 3 7 +0 + +0101000 ++33 0 -35 0 * +Ve +1.01e-007 +89464.3562015579 37492.72265625 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 24 0 6.20009588731763 6.29065056964209 +2 46 14 0 6.20009588731763 6.29065056964209 +2 47 1 0 6.20009588731763 6.29065056964209 +6 61 1 0 +6 62 2 5 +6 63 3 7 +0 + +0101000 ++31 0 -33 0 * +Ve +1.01e-007 +89427.5687500736 37492.72265625 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 25 0 1.17070917344763 37.9706273121035 +2 48 13 0 1.17070917344763 37.9706273121035 +2 49 1 0 1.17070917344763 37.9706273121035 +6 64 1 0 +6 65 2 5 +6 66 3 7 +0 + +0101000 ++29 0 -31 0 * +Ve +1.01e-007 +89424.3406867745 37492.7801613914 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 26 0 3.16298481126905 3.22540236132228 +2 50 12 0 3.16298481126905 3.22540236132228 +2 51 1 0 3.16298481126905 3.22540236132228 +6 67 1 0 +6 68 2 5 +6 69 3 7 +0 + +0101000 ++27 0 -29 0 * +Ve +1.32781756908256e-007 +89379.6222633764 37494.3754392381 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 27 0 2.41290110122088 47.2937745216901 +2 52 11 0 2.41290110122088 47.2937745216901 +2 53 1 0 2.41290110122088 47.2937745216901 +6 70 1 0 +6 71 2 5 +6 72 3 7 +0 + +0101000 ++25 0 -27 0 * +Ve +1.01e-007 +89373.0465346022 37494.8448128833 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 28 0 6.19927063496233 6.32778154013641 +2 54 10 0 6.19927063496233 6.32778154013641 +2 55 1 0 6.19927063496233 6.32778154013641 +6 73 1 0 +6 74 2 5 +6 75 3 7 +0 + +0101000 ++23 0 -25 0 * +Ve +1.02700581647779e-007 +89328.593216838 37499.6102373186 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 29 0 1.43866994036818 46.1665035080152 +2 56 9 0 1.43866994036818 46.1665035080152 +2 57 1 0 1.43866994036818 46.1665035080152 +6 76 1 0 +6 77 2 5 +6 78 3 7 +0 + +0101000 ++21 0 -23 0 * +Ve +1.01e-007 +89327.4989475953 37499.6882900229 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 30 0 6.17302589269058 6.24971734728608 +2 58 8 0 6.17302589269058 6.24971734728608 +2 59 1 0 6.17302589269058 6.24971734728608 +6 79 1 0 +6 80 2 5 +6 81 3 7 +0 + +0101000 ++19 0 -21 0 * +Ve +1.01e-007 +89282.1640110509 37501.3058229529 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 31 0 1.50951989137392 46.8733294770098 +2 60 7 0 1.50951989137392 46.8733294770098 +2 61 1 0 1.50951989137392 46.8733294770098 +6 82 1 0 +6 83 2 5 +6 84 3 7 +0 + +0101000 ++17 0 -19 0 * +Ve +1.01e-007 +89279.1803733559 37501.4105594976 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 32 0 4.63299020378047 4.7134544916583 +2 62 6 0 4.63299020378047 4.7134544916583 +2 63 1 0 4.63299020378047 4.7134544916583 +6 85 1 0 +6 86 2 5 +6 87 3 7 +0 + +0101000 ++15 0 -17 0 * +Ve +1.06940469647803e-007 +89232.7051760402 37503.0151554346 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 33 0 2.03636885870546 48.6861947673589 +2 64 5 0 2.03636885870546 48.6861947673589 +2 65 1 0 2.03636885870546 48.6861947673589 +6 88 1 0 +6 89 2 5 +6 90 3 7 +0 + +0101000 ++13 0 -15 0 * +Ve +1.01e-007 +89231.3631735545 37502.9887841253 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 34 0 3.06013299387935 3.16863276965656 +2 66 4 0 3.06013299387935 3.16863276965656 +2 67 1 0 3.06013299387935 3.16863276965656 +6 91 1 0 +6 92 2 5 +6 93 3 7 +0 + +0101000 ++11 0 -13 0 * +Ve +2.19534980935138e-007 +89190.9315751005 37499.9937252806 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 35 0 4.13578645578815 44.8394426351874 +2 68 3 0 4.13578645578815 44.8394426351874 +2 69 1 0 4.13578645578815 44.8394426351874 +6 94 1 0 +6 95 2 5 +6 96 3 7 +0 + +0101000 ++9 0 -11 0 * +Ve +1.01e-007 +89182.0704940043 37499.4541284282 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 36 0 3.04435791006513 3.26404534765663 +2 70 2 0 3.04435791006513 3.26404534765663 +2 71 1 0 3.04435791006513 3.26404534765663 +6 97 1 0 +6 98 2 5 +6 99 3 7 +0 + +0101000 ++7 0 -9 0 * +Ve +1.00000014210855e-007 +-162.511862415353 -25.0318792012376 0 +0 0 + +0101101 +* +Ed + 1e-007 1 1 0 +1 37 0 5.76340538448784 32.4203436774647 +2 72 1 0 5.76340538448784 32.4203436774647 +0 + +0101000 ++5 3 -7 0 * +Ed + 1e-007 1 1 0 +1 38 0 127.86160731237 182.257163443736 +2 73 19 0 127.86160731237 182.257163443736 +2 74 1 0 127.86160731237 182.257163443736 +0 + +0101000 ++78 3 -5 3 * +Wi + +0101100 +-76 2 -74 2 -72 2 -70 2 -68 2 -66 2 -64 2 -62 2 -60 2 -58 2 +-56 2 -54 2 -52 2 -50 2 -48 2 +46 2 +44 2 +42 2 +40 2 +38 2 ++36 2 +34 2 +32 2 +30 2 +28 2 +26 2 +24 2 +22 2 +20 2 +18 2 ++16 2 +14 2 +12 2 +10 2 +8 2 +6 2 +4 2 +3 2 * +Fa +0 1e-007 1 2 + +0111000 ++2 0 * + ++1 1 +0 + diff --git a/src/HYDRO_tests/reference_data/st_dump.py b/src/HYDRO_tests/reference_data/st_dump.py index 9051a8ef..bedd58fa 100644 --- a/src/HYDRO_tests/reference_data/st_dump.py +++ b/src/HYDRO_tests/reference_data/st_dump.py @@ -1,4 +1,4 @@ -from HYDROPy import * +from HYDROPy import * from PyQt4.QtCore import * from PyQt4.QtGui import * diff --git a/src/HYDRO_tests/reference_data/stream_dtm_2d.png b/src/HYDRO_tests/reference_data/stream_dtm_2d.png new file mode 100644 index 00000000..83044a05 Binary files /dev/null and b/src/HYDRO_tests/reference_data/stream_dtm_2d.png differ diff --git a/src/HYDRO_tests/reference_data/stream_dtm_3d.png b/src/HYDRO_tests/reference_data/stream_dtm_3d.png new file mode 100644 index 00000000..caa7ef13 Binary files /dev/null and b/src/HYDRO_tests/reference_data/stream_dtm_3d.png differ diff --git a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index 4a25258f..1c0fc6ed 100644 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@ -125,10 +125,10 @@ void test_HYDROData_Bathymetry::testFileImport() if ( !createTestFile( aFileName ) ) return; // No file has been created - CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName.toStdString().c_str() ) ); + CPPUNIT_ASSERT( aBathymetry->ImportFromFiles( QStringList(aFileName)) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints(); - CPPUNIT_ASSERT_EQUAL( 2300, anAltitudePoints.Length() ); + CPPUNIT_ASSERT_EQUAL( 2300, (int)anAltitudePoints.size() ); gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); @@ -136,7 +136,7 @@ void test_HYDROData_Bathymetry::testFileImport() aTestPoint = gp_XY( 0.5, 0.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.7127, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, 1 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); @@ -144,15 +144,15 @@ void test_HYDROData_Bathymetry::testFileImport() aTestPoint = gp_XY( 1.5, 0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.4116, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.591602, anAltitude, EPS ); aTestPoint = gp_XY( 1.5, -0.7 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.0479, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.271267, anAltitude, EPS ); aTestPoint = gp_XY( 2, 3.5 ); anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); - CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.2525, anAltitude, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.9454, anAltitude, EPS ); aDoc->Close(); } @@ -171,10 +171,10 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { - CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName.toStdString().c_str() ) ); + CPPUNIT_ASSERT( aBathymetry1->ImportFromFiles( QStringList(aFileName ) ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints(); - CPPUNIT_ASSERT_EQUAL( 2300, anAltitudePoints.Length() ); + CPPUNIT_ASSERT_EQUAL( 2300, (int)anAltitudePoints.size() ); } Handle(HYDROData_Bathymetry) aBathymetry2 = @@ -185,7 +185,7 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry2->GetAltitudePoints(); - CPPUNIT_ASSERT_EQUAL( 2300, anAltitudePoints.Length() ); + CPPUNIT_ASSERT_EQUAL( 2300, (int)anAltitudePoints.size() ); } aDoc->Close(); diff --git a/src/HYDRO_tests/test_HYDROData_CalcCase.cxx b/src/HYDRO_tests/test_HYDROData_CalcCase.cxx new file mode 100644 index 00000000..af0c7427 --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_CalcCase.cxx @@ -0,0 +1,107 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; + + +void test_HYDROData_CalcCase::test_add_int_wires() +{ + { + TopoDS_Shape out; + TopTools_ListOfShape Wires; + + BRep_Builder B; + TopoDS_Shape InF; + TopoDS_Shape InP; + BRepTools::Read(InP, (REF_DATA_PATH + "/p1.brep").toStdString().c_str(), B); + BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B); + Wires.Append(InP); + + TopTools_ListOfShape OutSh; + TopTools_IndexedDataMapOfShapeShape ls; + HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL); + + CPPUNIT_ASSERT_EQUAL(2, OutSh.Extent()); + TopoDS_Compound cmp; + B.MakeCompound(cmp); + B.Add(cmp, OutSh.First()); + B.Add(cmp, OutSh.Last()); + TestViewer::show( cmp, AIS_Shaded, true, "cc_int_w_1" ); + //CPPUNIT_ASSERT_IMAGES + } + + { + TopoDS_Shape out; + TopTools_ListOfShape Wires; + + BRep_Builder B; + TopoDS_Shape InF; + TopoDS_Shape InP; + BRepTools::Read(InP, (REF_DATA_PATH + "/p2.brep").toStdString().c_str(), B); + BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B); + Wires.Append(InP); + + TopTools_ListOfShape OutSh; + TopTools_IndexedDataMapOfShapeShape ls; + HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL); + CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent()); + TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_2" ); + //CPPUNIT_ASSERT_IMAGES + } + + { + TopoDS_Shape out; + TopTools_ListOfShape Wires; + + BRep_Builder B; + TopoDS_Shape InF; + TopoDS_Shape InP; + BRepTools::Read(InP, (REF_DATA_PATH + "/p3.brep").toStdString().c_str(), B); + BRepTools::Read(InF, (REF_DATA_PATH + "/r2.brep").toStdString().c_str(), B); + Wires.Append(InP); + + TopTools_ListOfShape OutSh; + TopTools_IndexedDataMapOfShapeShape ls; + HYDROData_SplitToZonesTool::CutByEdges(InF, Wires, OutSh, &ls, NULL); + CPPUNIT_ASSERT_EQUAL(1, OutSh.Extent()); + TestViewer::show( OutSh.First(), AIS_WireFrame, true, "cc_int_w_3" ); + CPPUNIT_ASSERT_IMAGES + } + +} + + + diff --git a/src/HYDRO_tests/test_HYDROData_CalcCase.h b/src/HYDRO_tests/test_HYDROData_CalcCase.h new file mode 100644 index 00000000..c4dbda7f --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_CalcCase.h @@ -0,0 +1,43 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifdef WIN32 + #pragma warning( disable: 4251 ) +#endif + +#include +#define SHP_TESTS + +class test_HYDROData_CalcCase : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( test_HYDROData_CalcCase ); + CPPUNIT_TEST( test_add_int_wires ); + + CPPUNIT_TEST_SUITE_END(); + +public: + void test_add_int_wires(); + +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_CalcCase ); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_CalcCase, "HYDROData_CalcCase" ); + +#ifdef WIN32 + #pragma warning( default: 4251 ) +#endif diff --git a/src/HYDRO_tests/test_HYDROData_DTM.cxx b/src/HYDRO_tests/test_HYDROData_DTM.cxx new file mode 100644 index 00000000..0436c8fb --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_DTM.cxx @@ -0,0 +1,624 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const double EPS = 1E-3; + +extern QString REF_DATA_PATH; +NCollection_Sequence points; + +class DTM_item : public QGraphicsItem +{ +public: + DTM_item( HYDROGUI_ShapeBathymetry* theDTM, double d ) + { + Handle(AIS_PointCloud) pc = Handle(AIS_PointCloud)::DownCast( theDTM->getAISObject() ); + Handle(Graphic3d_ArrayOfPoints) pp = pc->GetPoints(); + myBB = QRectF(); + double xmin, xmax, ymin, ymax; + myD = d; + + int n = pp->VertexNumber(); + + for( int i=1; i<=n; i++ ) + { + gp_Pnt pnt = pp->Vertice( i ); + Quantity_Color col = pp->VertexColor( i ); + + int r = col.Red()*255; + int g = col.Green()*255; + int b = col.Blue()*255; + int val = ( r << 16 ) + ( g << 8 ) + b; + double x = pnt.X(); + double y = -pnt.Y(); + QPointF aPnt( x, y ); + myPoints[val].append( aPnt ); + if( i==1 ) + { + xmin = x; + xmax = x; + ymin = y; + ymax = y; + } + else + { + if( x>xmax ) + xmax = x; + if( xymax ) + ymax = y; + if( y >::const_iterator it = myPoints.begin(), last = myPoints.end(); + for( ; it!=last; it++ ) + { + int r = ( it.key() >> 16 ) % 256; + int g = ( it.key() >> 8 ) % 256; + int b = ( it.key() >> 0 ) % 256; + QColor aColor( r, g, b ); + QBrush aBrush( aColor ); + foreach( QPointF pnt, it.value() ) + { + QRectF r( pnt.x()-myD/2, pnt.y()-myD/2, myD, myD ); + p->fillRect( r, aBrush ); + } + } + } + +private: + QRectF myBB; + double myD; + QMap > myPoints; +}; + +QImage draw_DTM( HYDROGUI_ShapeBathymetry* theDTM, double theD, int theWidth, int theHeight ) +{ + QGraphicsScene aScene; + QGraphicsView aView; + DTM_item anItem( theDTM, theD ); + + aView.setScene( &aScene ); + aView.setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + aView.setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + aScene.addItem( &anItem ); + + aView.resize( theWidth, theHeight ); + QRectF bb = anItem.boundingRect(); + aView.fitInView( bb, Qt::KeepAspectRatio ); + QApplication::processEvents(); + + QPixmap aPixmap = QPixmap::grabWidget( &aView ); + return aPixmap.toImage(); +} + + +void test_HYDROData_DTM::setUp() +{ + points.Clear(); + points.Append( gp_XY( 0.0, 5.0 ) ); + points.Append( gp_XY( 1.0, 1.0 ) ); + points.Append( gp_XY( 1.5, 0.0 ) ); + points.Append( gp_XY( 4.0, 4.0 ) ); +} + +void test_HYDROData_DTM::test_creation() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_DTM) DTM = + Handle(HYDROData_DTM)::DownCast( aDoc->CreateObject( KIND_DTM ) ); + + CPPUNIT_ASSERT_EQUAL( false, (bool)DTM.IsNull() ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_hydraulic_axis() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile3 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile1->SetParametricPoints( points ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile1->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile1->SetRightPoint( gp_XY( 20, 0 ) ); + + aProfile2->SetParametricPoints( points ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile2->SetLeftPoint( gp_XY( 50, 0 ) ); + aProfile2->SetRightPoint( gp_XY( 60, 10 ) ); + + aProfile3->SetParametricPoints( points ); + aProfile3->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile3->SetLeftPoint( gp_XY( 200, 50 ) ); + aProfile3->SetRightPoint( gp_XY( 210, 40 ) ); + + std::vector distances; + std::vector profiles; + profiles.push_back( aProfile1 ); + profiles.push_back( aProfile2 ); + profiles.push_back( aProfile3 ); + + Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances ); + CPPUNIT_ASSERT_EQUAL( false, (bool)HA.IsNull() ); + CPPUNIT_ASSERT_EQUAL( 3, (int)distances.size() ); + + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, distances[0], EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 43.499, distances[1], EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 211.474, distances[2], EPS ); + + gp_Pnt2d p; + gp_Vec2d q; + HA->D1( 0, p, q ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, p.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 6.25, p.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.568, q.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.568, q.Y(), EPS ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_profile_conversion_to_2d() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile1->SetParametricPoints( points ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile1->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile1->SetRightPoint( gp_XY( 20, 20 ) ); + + aProfile2->SetParametricPoints( points ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE ); + aProfile2->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile2->SetRightPoint( gp_XY( 20, 20 ) ); + + double aUMin1 = std::numeric_limits::max(), + aUMax1 = -aUMin1, + aUMin2 = aUMin1, + aUMax2 = aUMax1; + gp_Vec2d aProfileDir; + std::vector curves1 = HYDROData_DTM::ProfileToParametric( aProfile1, aUMin1, aUMax1, aProfileDir ); + std::vector curves2 = HYDROData_DTM::ProfileToParametric( aProfile2, aUMin2, aUMax2, aProfileDir ); + + gp_Pnt2d aFirst, aLast; + CPPUNIT_ASSERT_EQUAL( 3, (int)curves1.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aUMin1, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aUMax1, EPS ); + curves1[0]->D0( curves1[0]->FirstParameter(), aFirst ); + curves1[0]->D0( curves1[0]->LastParameter(), aLast ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aFirst.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aFirst.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.768, aLast.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, aLast.Y(), EPS ); + curves1[1]->D0( curves1[1]->FirstParameter(), aFirst ); + curves1[1]->D0( curves1[1]->LastParameter(), aLast ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.768, aFirst.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, aFirst.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aLast.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aLast.Y(), EPS ); + curves1[2]->D0( curves1[2]->FirstParameter(), aFirst ); + curves1[2]->D0( curves1[2]->LastParameter(), aLast ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aFirst.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aFirst.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aLast.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 4.0, aLast.Y(), EPS ); + + CPPUNIT_ASSERT_EQUAL( 1, (int)curves2.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, aUMin2, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.839, aUMax2, EPS ); + Handle(Geom2d_BSplineCurve) aBSpline = Handle(Geom2d_BSplineCurve)::DownCast( curves2[0] ); + CPPUNIT_ASSERT_EQUAL( false, (bool)aBSpline.IsNull() ); + const TColgp_Array1OfPnt2d& poles = aBSpline->Poles(); + CPPUNIT_ASSERT_EQUAL( 1, (int)poles.Lower() ); + CPPUNIT_ASSERT_EQUAL( 8, (int)poles.Upper() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -5.303, poles.Value( 1 ).X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, poles.Value( 1 ).Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -4.125, poles.Value( 2 ).X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.667, poles.Value( 2 ).Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -3.150, poles.Value( 3 ).X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.120, poles.Value( 3 ).Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -1.242, poles.Value( 4 ).X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.574, poles.Value( 4 ).Y(), EPS ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_profile_properties() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile->SetParametricPoints( points ); + aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile->SetRightPoint( gp_XY( 20, 25 ) ); + + gp_Pnt lp; + gp_Vec2d dd; + double zmin, zmax; + HYDROData_DTM::GetProperties( aProfile, lp, dd, false, zmin, zmax ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 15, dd.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS ); + + HYDROData_DTM::GetProperties( aProfile, lp, dd, true, zmin, zmax ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 13.75, lp.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 15.625, lp.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0, lp.Z(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( -15, dd.X(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 10, dd.Y(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, zmin, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, zmax, EPS ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_profile_discretization_polyline() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile->SetParametricPoints( points ); + aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile->SetRightPoint( gp_XY( 20, 20 ) ); + + HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 ); + int dummy = 0; + HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy ); + CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.11, aMid[1].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMid[1].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.215, aMid[5].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aMid[5].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.768, aMid[10].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aMid[10].Z, EPS ); + + CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.989, aWid[1].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aWid[1].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 8.618, aWid[5].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aWid[5].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 14.142, aWid[10].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aWid[10].Z, EPS ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_profile_discretization_spline() +{ +Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile->SetParametricPoints( points ); + aProfile->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE ); + aProfile->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile->SetRightPoint( gp_XY( 20, 20 ) ); + + HYDROData_DTM::CurveUZ aMid( 0.0, gp_Vec2d(), 0 ), aWid( 0.0, gp_Vec2d(), 0 ); + int dummy = 0 ; + HYDROData_DTM::ProfileDiscretization( aProfile, 0.0, 0.0, 5.0, 0.5, aMid, aWid, dummy ); + CPPUNIT_ASSERT_EQUAL( 11, (int)aMid.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.242, aMid[0].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aMid[0].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.755, aMid[1].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aMid[1].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.473, aMid[5].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aMid[5].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.768, aMid[10].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aMid[10].Z, EPS ); + + CPPUNIT_ASSERT_EQUAL( 11, (int)aWid.size() ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.484, aWid[0].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, aWid[0].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.809, aWid[1].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.5, aWid[1].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 9.472, aWid[5].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 2.5, aWid[5].Z, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 14.142, aWid[10].U, EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.0, aWid[10].Z, EPS ); + + aDoc->Close(); +} + +void operator << ( std::ostream& s, const HYDROData_DTM::PointUZ& p ) +{ + s << "(" << p.U << "; " << p.Z << ") "; +} + +void operator << ( std::ostream& s, const HYDROData_DTM::AltitudePoint& p ) +{ + s << "(" << p.X << "; " << p.Y << "; " << p.Z << ") "; +} + +bool operator == ( const HYDROData_DTM::PointUZ& p1, const HYDROData_DTM::PointUZ& p2 ) +{ + return fabs(p1.U-p2.U) i1; + HYDROData_DTM::Interpolate( A, B, 1, i1, false ); + + CPPUNIT_ASSERT_EQUAL( 2, (int)i1.size() ); + CPPUNIT_ASSERT_EQUAL( A, i1[0] ); + CPPUNIT_ASSERT_EQUAL( 3, (int)i1[1].size() ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 5, 0 ), i1[1][0] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 8, 1 ), i1[1][1] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 11, 2 ), i1[1][2] ); + + std::vector i2; + HYDROData_DTM::Interpolate( A, B, 1, i2, true ); + + CPPUNIT_ASSERT_EQUAL( 3, (int)i2.size() ); + CPPUNIT_ASSERT_EQUAL( A, i2[0] ); + CPPUNIT_ASSERT_EQUAL( 3, (int)i2[1].size() ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 5, 0 ), i2[1][0] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 8, 1 ), i2[1][1] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 11, 2 ), i2[1][2] ); + CPPUNIT_ASSERT_EQUAL( B, i2[2] ); + + std::vector i3; + HYDROData_DTM::Interpolate( A, B, 3, i3, false ); + + CPPUNIT_ASSERT_EQUAL( 4, (int)i3.size() ); + CPPUNIT_ASSERT_EQUAL( A, i3[0] ); + CPPUNIT_ASSERT_EQUAL( 3, (int)i3[1].size() ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 2.5, 0 ), i3[1][0] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 4.5, 1 ), i3[1][1] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::PointUZ( 6.5, 2 ), i3[1][2] ); +} + +void test_HYDROData_DTM::test_curve_to_3d() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile1->SetParametricPoints( points ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile1->SetLeftPoint( gp_XY( 20, 0 ) ); + aProfile1->SetRightPoint( gp_XY( 10, 10 ) ); + + aProfile2->SetParametricPoints( points ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile2->SetLeftPoint( gp_XY( 100, 0 ) ); + aProfile2->SetRightPoint( gp_XY( 110, 0 ) ); + + std::vector distances; + std::vector profiles; + profiles.push_back( aProfile1 ); + profiles.push_back( aProfile2 ); + + Handle_Geom2d_BSplineCurve HA = HYDROData_DTM::CreateHydraulicAxis( profiles, distances ); + HYDROData_DTM::AltitudePoints points; + HYDROData_DTM::CurveUZ mid( 5.0, gp_Vec2d(-10,10), 0 ); + mid.push_back( HYDROData_DTM::PointUZ( 0, 5 ) ); + mid.push_back( HYDROData_DTM::PointUZ( 1, 6 ) ); + HYDROData_DTM::CurveUZ wid( 5.0, gp_Vec2d(-10,10), 0 ); + wid.push_back( HYDROData_DTM::PointUZ( 2, 5 ) ); + wid.push_back( HYDROData_DTM::PointUZ( 6, 6 ) ); + HYDROData_DTM::CurveTo3D( HA, mid, wid, points ); + + CPPUNIT_ASSERT_EQUAL( 4, (int)points.size() ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 16.380, -2.186, 6.0 ), points[0] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 15.673, -1.479, 5.0 ), points[1] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 14.259, -0.065, 5.0 ), points[2] ); + CPPUNIT_ASSERT_EQUAL( HYDROData_DTM::AltitudePoint( 12.137, 2.056, 6.0 ), points[3] ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_presentation() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_DTM) DTM = Handle(HYDROData_DTM)::DownCast( aDoc->CreateObject( KIND_DTM ) ); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile1->SetParametricPoints( points ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE ); + aProfile1->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile1->SetRightPoint( gp_XY( 20, 0 ) ); + + aProfile2->SetParametricPoints( points ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_SPLINE ); + aProfile2->SetLeftPoint( gp_XY( 110, 10 ) ); + aProfile2->SetRightPoint( gp_XY( 100, 0 ) ); + + HYDROData_SequenceOfObjects seq; + seq.Append( aProfile1 ); + seq.Append( aProfile2 ); + DTM->SetProfiles( seq ); + DTM->SetDDZ( 0.1 ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.1, DTM->GetDDZ(), EPS ); + DTM->SetSpatialStep( 1.0 ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS ); + DTM->Update(); + + CPPUNIT_ASSERT_EQUAL( 9177, (int)DTM->GetAltitudePoints().size() ); + + Handle_AIS_InteractiveContext aContext = TestViewer::context(); + HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM ); + aBathPrs->update( true, false ); + + bool ColorScaleIsDisp = TestViewer::ColorScaleIsDisplayed(); + TestViewer::showColorScale( true ); + Handle(AIS_ColorScale) aCS = TestViewer::colorScale(); + aCS->SetMin( 0.0 ); + aCS->SetMax( 5.0 ); + aCS->SetNumberOfIntervals( 10 ); + aBathPrs->UpdateWithColorScale( aCS ); + + QImage aDTMPrs = draw_DTM( aBathPrs, 0.5, 600, 600 ); + CPPUNIT_ASSERT_IMAGES2( &aDTMPrs, "DTM_1" ); + delete aBathPrs; + TestViewer::showColorScale( ColorScaleIsDisp ); + + aDoc->Close(); +} + +void test_HYDROData_DTM::test_garonne() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data(); + fname += "/Profiles.xyz"; + NCollection_Sequence bad_ids; + + int aSize = HYDROData_Profile::ImportFromFile( aDoc, fname, bad_ids, true ); + + CPPUNIT_ASSERT_EQUAL( 0, bad_ids.Size() ); + CPPUNIT_ASSERT_EQUAL( 46, aSize ); + + HYDROData_SequenceOfObjects profiles; + HYDROData_Iterator it( aDoc, KIND_PROFILE ); + for( int i=0; it.More(); it.Next(), i++ ) + { + if( i>=25 && i<=35 ) + profiles.Append( Handle(HYDROData_Profile)::DownCast( it.Current() ) ); + } + + CPPUNIT_ASSERT_EQUAL( 11, (int)profiles.Size() ); + + Handle(HYDROData_DTM) DTM = Handle(HYDROData_DTM)::DownCast( aDoc->CreateObject( KIND_DTM ) ); + DTM->SetProfiles( profiles ); + DTM->SetDDZ( 0.1 ); + DTM->SetSpatialStep( 1.0 ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.1, DTM->GetDDZ(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.0, DTM->GetSpatialStep(), EPS ); + DTM->Update(); + + CPPUNIT_ASSERT_EQUAL( 282338, (int)DTM->GetAltitudePoints().size() ); + + Handle_AIS_InteractiveContext aContext = TestViewer::context(); + HYDROGUI_ShapeBathymetry* aBathPrs = new HYDROGUI_ShapeBathymetry( 0, aContext, DTM ); + aBathPrs->update( true, false ); + + bool ColorScaleIsDisp = TestViewer::ColorScaleIsDisplayed(); + + TestViewer::showColorScale( true ); + Handle(AIS_ColorScale) aCS = TestViewer::colorScale(); + aCS->SetMin( 0.0 ); + aCS->SetMax( 25.0 ); + aCS->SetNumberOfIntervals( 30 ); + aBathPrs->UpdateWithColorScale( aCS ); + + QImage aDTMPrs = draw_DTM( aBathPrs, 0.5, 600, 600 ); + CPPUNIT_ASSERT_IMAGES2( &aDTMPrs, "DTM_2" ); + TestViewer::showColorScale( ColorScaleIsDisp ); + delete aBathPrs; + aDoc->Close(); + +} diff --git a/src/HYDRO_tests/test_HYDROData_DTM.h b/src/HYDRO_tests/test_HYDROData_DTM.h new file mode 100644 index 00000000..5eb53be1 --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_DTM.h @@ -0,0 +1,53 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +class test_HYDROData_DTM : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( test_HYDROData_DTM ); + CPPUNIT_TEST( test_creation ); + CPPUNIT_TEST( test_hydraulic_axis ); + CPPUNIT_TEST( test_profile_conversion_to_2d ); + CPPUNIT_TEST( test_profile_properties ); + CPPUNIT_TEST( test_profile_discretization_polyline ); + CPPUNIT_TEST( test_profile_discretization_spline ); + CPPUNIT_TEST( test_curves_interpolation ); + CPPUNIT_TEST( test_curve_to_3d ); + CPPUNIT_TEST( test_presentation ); + CPPUNIT_TEST( test_garonne ); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp(); + void tearDown() {} + + void test_creation(); + void test_hydraulic_axis(); + void test_profile_conversion_to_2d(); + void test_profile_properties(); + void test_profile_discretization_polyline(); + void test_profile_discretization_spline(); + void test_curves_interpolation(); + void test_curve_to_3d(); + void test_presentation(); + void test_garonne(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_DTM ); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_DTM, "HYDROData_DTM" ); diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 831a9955..488c2127 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -42,11 +42,13 @@ #include #include #include +#include +#include #define _DEVDEBUG_ #include "HYDRO_trace.hxx" -const QString REF_DATA_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; +extern QString REF_DATA_PATH; const QString DEF_STR_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/share/salome/resources/hydro/def_strickler_table.txt"; void test_HYDROData_LandCoverMap::test_add_2_objects() @@ -58,11 +60,11 @@ void test_HYDROData_LandCoverMap::test_add_2_objects() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); //DEBTRACE("--- ajout test1 " << aLC1); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 ); + TopoDS_Face aLC2 = Face2d( QList() << 30 << 20 << 60 << 10 << 70 << 35 << 40 << 40 ); //DEBTRACE("--- ajout test2 " << aLC2); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); @@ -104,12 +106,12 @@ void test_HYDROData_LandCoverMap::test_split() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) ); Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); - TopoDS_Wire aWire = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10, false ); aPolyline->SetShape( aWire ); CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); @@ -139,12 +141,12 @@ void test_HYDROData_LandCoverMap::test_incomplete_split() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC, "test1" ) ); Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); - TopoDS_Wire aWire = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10, false ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10, false ); aPolyline->SetShape( aWire ); CPPUNIT_ASSERT_EQUAL( false, aMap->Split( aPolyline ) ); @@ -171,17 +173,17 @@ void test_HYDROData_LandCoverMap::test_merge() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); @@ -276,17 +278,17 @@ void test_HYDROData_LandCoverMap::test_remove() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); @@ -549,11 +551,11 @@ void test_HYDROData_LandCoverMap::test_import_dbf() // aST.size() == aDBFV.size()!! Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); - TopoDS_Wire aWire = Wire( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 ); + TopoDS_Wire aWire = Wire2d( QList() << 10 << 40 << 30 << 10 << 40 << 10 << 60 << 10 ); aPolyline->SetShape( aWire ); for (int i = 0; i < 3; i++) aMap->Add(aPolyline, ""); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 50 << 20 << 30 << 50 << 15 << 30 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); CPPUNIT_ASSERT_EQUAL( true, aMap->Split( aPolyline ) ); @@ -578,16 +580,16 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_types() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) ); @@ -614,16 +616,16 @@ void test_HYDROData_LandCoverMap::test_land_cover_prs_by_coeff() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Zones de champs cultivé à végétation basse")) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Zones de champs cultivé à végétation haute")) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Zones de champs, prairies, sans cultures")) ); @@ -653,17 +655,17 @@ void test_HYDROData_LandCoverMap::test_dump_python() CPPUNIT_ASSERT_EQUAL( KIND_LAND_COVER_MAP, aMap->GetKind() ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, "test1" ) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, "test2" ) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, "test3" ) ); @@ -703,8 +705,8 @@ void test_HYDROData_LandCoverMap::test_transparent_prs() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - aMap->LocalPartition( Face( QList() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); - aMap->LocalPartition( Face( QList() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); + aMap->LocalPartition( Face2d( QList() << 1 << 1 << 10 << 10 << 10 << 20 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); + aMap->LocalPartition( Face2d( QList() << 5 << 5 << 10 << 5 << 10 << 8 << 5 << 12 << 5 << 8 ), QString::fromUtf8("Zones de champs cultivé à végétation haute")); aMap->SetName( "test_LCM" ); TestViewer::show( aZone->GetTopShape(), AIS_Shaded, true, "LandCoverMap_TransparentPrs" ); @@ -1082,22 +1084,23 @@ void test_HYDROData_LandCoverMap::test_export_telemac() Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); - TopoDS_Face aLC1 = Face( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); + TopoDS_Face aLC1 = Face2d( QList() << 12 << 19 << 82 << 9 << 126 << 53 << 107 << 80 << 29 << 75 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêt et végétation arbustive en mutation")) ); - TopoDS_Face aLC2 = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aLC2 = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de conifères")) ); - TopoDS_Face aLC3 = Face( QList() << 4 << 54 << 1 << 47 << 51 << 45 << + TopoDS_Face aLC3 = Face2d( QList() << 4 << 54 << 1 << 47 << 51 << 45 << 127 << 42 << 145 << 43 << 148 << 60 << 90 << 65 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC3, QString::fromUtf8("Forêts de feuillus")) ); QString aTmpFileName = "test.telemac"; QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName; - CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) ); + QString messStat; + CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) ); CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 ); aDoc->Close(); @@ -1111,10 +1114,10 @@ void test_HYDROData_LandCoverMap::test_copy() Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); aMap->SetName( "map_1" ); - TopoDS_Face aLC1 = Face( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); + TopoDS_Face aLC1 = Face2d( QList() << 10 << 10 << 30 << 10 << 20 << 20 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC1, QString::fromUtf8("Forêts de conifères")) ); - TopoDS_Face aLC2 = Face( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); + TopoDS_Face aLC2 = Face2d( QList() << 110 << 10 << 130 << 10 << 120 << 20 ); CPPUNIT_ASSERT_EQUAL( true, aMap->LocalPartition( aLC2, QString::fromUtf8("Forêts de feuillus")) ); Handle(HYDROData_LandCoverMap) aMap2 = @@ -1144,3 +1147,134 @@ void test_HYDROData_LandCoverMap::test_copy() aDoc->Close(); } + +void test_HYDROData_LandCoverMap::test_shp_clc_classification_perf() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + QString aFileName = REF_DATA_PATH + "/CLC_decoupe.shp"; + HYDROData_ShapeFile anImporter; + QStringList PolygonList; + TopTools_SequenceOfShape PolygonFaces; + int Type = -1; + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + CPPUNIT_ASSERT(aStat == 1); + CPPUNIT_ASSERT_EQUAL(5, Type); + CPPUNIT_ASSERT_EQUAL(625, PolygonFaces.Length()); + + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + HYDROData_MapOfFaceToStricklerType aMapFace2ST; + +#ifdef NDEBUG + int SI = 100; + int EI = 300; +#else + int SI = 150; + int EI = 200; +#endif + + for ( int i = SI; i <= EI; i++ ) + { + TopoDS_Shape aShape = PolygonFaces(i); + if ( aShape.IsNull() ) + continue; + aMapFace2ST.Add( TopoDS::Face( aShape ), "ST_" + QString::number(i) ); + } + + LCM->StoreLandCovers(aMapFace2ST); + + std::vector pnts; +#ifdef NDEBUG + int N = 1000; //1000*1000 points; uniform distribution for release mode +#else + int N = 100; +#endif + + pnts.reserve(N); + double x0 = 448646.91897505691; + double x1 = 487420.3990381231; + double y0 = 6373566.5122489957; + double y1 = 6392203.4117361344; + for (size_t i=0; i < N; i++) + { + for (size_t j=0; j < N; j++) + { + double px = x0 + (x1-x0)*((double)i/(double)N); + double py = y0 + (y1-y0)*((double)j/(double)N); + pnts.push_back(gp_XY(px,py)); + } + } + OSD_Timer aTimer; + std::vector > TRes; + aTimer.Start(); + LCM->ClassifyPoints(pnts, TRes); + aTimer.Stop(); +#ifdef NDEBUG + CPPUNIT_ASSERT( aTimer.ElapsedTime() < 1.4); + aTimer.Show(); +#endif +} + +void test_HYDROData_LandCoverMap::test_shp_clc_classification_check() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + QString aFileName = REF_DATA_PATH + "/CLC_decoupe.shp"; + HYDROData_ShapeFile anImporter; + QStringList PolygonList; + TopTools_SequenceOfShape PolygonFaces; + int Type = -1; + int aStat = anImporter.ImportPolygons(aDoc, aFileName, PolygonList, PolygonFaces, Type); + CPPUNIT_ASSERT(aStat == 1); + Handle(HYDROData_LandCoverMap) LCM = Handle(HYDROData_LandCoverMap)::DownCast( aDoc->CreateObject( KIND_LAND_COVER_MAP ) ); + HYDROData_MapOfFaceToStricklerType aMapFace2ST; + + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(172) ), "Tissu urbain continu" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(179) ), "Aéroports" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(185) ), "Rizières" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(187) ), "Vignobles" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(190) ), "Oliveraies" ); + aMapFace2ST.Add( TopoDS::Face( PolygonFaces(196) ), "Estuaires" ); + + LCM->StoreLandCovers(aMapFace2ST); + + TopoDS_Shape Sh = LCM->GetShape(); + + std::vector pnts; + pnts.push_back(gp_XY(0,0)); + + pnts.push_back(gp_XY(468380, 6382300)); + pnts.push_back(gp_XY(468380, 6382900)); + pnts.push_back(gp_XY(468380, 6383200)); + pnts.push_back(gp_XY(468250, 6384700)); + pnts.push_back(gp_XY(470350, 6384700)); + pnts.push_back(gp_XY(469279.642874048, 6385132.45048612 )); + + std::vector > TRes; + LCM->ClassifyPoints(pnts, TRes); + + CPPUNIT_ASSERT (TRes[0].empty()); + CPPUNIT_ASSERT (TRes[1].empty()); + CPPUNIT_ASSERT (TRes[2].empty()); + CPPUNIT_ASSERT_EQUAL (*TRes[3].begin(), QString("Estuaires")); + CPPUNIT_ASSERT_EQUAL (*TRes[4].begin(), QString("Oliveraies")); + CPPUNIT_ASSERT_EQUAL (*TRes[5].begin(), QString("Vignobles")); + + //std::less comparator; so compare first and second elem safely + CPPUNIT_ASSERT_EQUAL (*TRes[6].begin(), QString("Estuaires")); + CPPUNIT_ASSERT_EQUAL (*(++TRes[6].begin()), QString("Tissu urbain continu")); + + /// + Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( aDoc->CreateObject( KIND_STRICKLER_TABLE ) ); + CPPUNIT_ASSERT_EQUAL( true, aTable->Import( DEF_STR_PATH ) ); + std::vector coeffs; + LCM->ClassifyPoints(pnts, aTable, coeffs, 0.0, true); + + CPPUNIT_ASSERT_EQUAL (coeffs[0], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[1], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[2], 0.0); + CPPUNIT_ASSERT_EQUAL (coeffs[3], 1.0522); + CPPUNIT_ASSERT_EQUAL (coeffs[4], 1.0223); + CPPUNIT_ASSERT_EQUAL (coeffs[5], 1.0221); + CPPUNIT_ASSERT_EQUAL (coeffs[6], 1.0522); + +} + diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h index 85d34bc7..c473c4a1 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.h +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.h @@ -50,6 +50,8 @@ class test_HYDROData_LandCoverMap : public CppUnit::TestFixture CPPUNIT_TEST( test_shp_import_clc_dec ); CPPUNIT_TEST( test_shp_import_nld_areas ); CPPUNIT_TEST( test_shp_loop_back ); + CPPUNIT_TEST( test_shp_clc_classification_perf ); + CPPUNIT_TEST( test_shp_clc_classification_check ); #endif CPPUNIT_TEST_SUITE_END(); @@ -77,6 +79,8 @@ public: void test_shp_loop_back(); void test_export_telemac(); void test_copy(); + void test_shp_clc_classification_perf(); + void test_shp_clc_classification_check(); }; CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_LandCoverMap ); diff --git a/src/HYDRO_tests/test_HYDROData_Main.cxx b/src/HYDRO_tests/test_HYDROData_Main.cxx index 0610149e..05f6b9b8 100644 --- a/src/HYDRO_tests/test_HYDROData_Main.cxx +++ b/src/HYDRO_tests/test_HYDROData_Main.cxx @@ -68,8 +68,8 @@ int main( int argc, char* argv[] ) CppUnit::TestFactoryRegistry::getRegistry(); // Add the top suite to the test runner TestLib_Runner runner; - //QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg"; - //runner.Load( aPath.toStdString() ); + QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg"; + runner.Load( aPath.toStdString() ); runner.addTest( registry.makeTest() ); try { diff --git a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx index 1ec755ff..57d6435f 100644 --- a/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx +++ b/src/HYDRO_tests/test_HYDROData_PolylineXY.cxx @@ -102,7 +102,7 @@ void test_HYDROData_PolylineXY::test_split_refs_624() aPolyline->SetName( "test" ); QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; - TopoDS_Wire aWire = Wire( aCoords, true ); + TopoDS_Wire aWire = Wire2d( aCoords, true ); aPolyline->SetShape( aWire ); gp_Pnt2d aPnt( 20, 20 ); @@ -135,7 +135,7 @@ void test_HYDROData_PolylineXY::test_extraction_immersible_zone() aPolyline->SetName( "test" ); QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; - TopoDS_Wire aWire = Wire( aCoords, true ); + TopoDS_Wire aWire = Wire2d( aCoords, true ); aPolyline->SetShape( aWire ); Handle(HYDROData_ImmersibleZone) aZone = @@ -175,7 +175,7 @@ void test_HYDROData_PolylineXY::test_extraction_channel_refs_611() aPolyline3d->SetPolylineXY( aPolyline2d ); QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; - TopoDS_Wire aWire = Wire( aCoords, false ); + TopoDS_Wire aWire = Wire2d( aCoords, false ); aPolyline2d->SetShape( aWire ); aPolyline3d->SetTopShape( aWire ); aPolyline3d->SetShape3D( aWire ); @@ -184,8 +184,8 @@ void test_HYDROData_PolylineXY::test_extraction_channel_refs_611() Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); aProfile->SetName( "profile_1" ); - QList aCoordsPr = QList() << 0.0 << 0.1 << 0.5 << 0.0 << 1.0 << 0.1; - TopoDS_Wire aWirePr = Wire( aCoordsPr, false ); + QList aCoordsPr = QList() << 0.0 << 0.1 << 0.0 << 0.0 << 1.0 << 0.0; + TopoDS_Wire aWirePr = Wire3d( aCoordsPr, false ); aProfile->SetTopShape( aWirePr ); aProfile->SetShape3D( aWirePr ); @@ -273,7 +273,7 @@ void test_HYDROData_PolylineXY::test_split_refs_627() aPolyline->SetName( "test" ); QList aCoords = QList() << 10 << 10 << 20 << 10 << 20 << 20 << 10 << 20; - TopoDS_Wire aWire = Wire( aCoords, false ); + TopoDS_Wire aWire = Wire2d( aCoords, false ); aPolyline->SetShape( aWire ); aPolyline->SetWireColor( Qt::red ); @@ -338,7 +338,7 @@ void test_HYDROData_PolylineXY::test_custom_polylines() CPPUNIT_ASSERT_EQUAL( false, aPolyline1->IsCustom() ); CPPUNIT_ASSERT_EQUAL( false, aPolyline2->IsCustom() ); - aPolyline2->SetShape( Wire( QList() << 0 << 0 << 10 << 10 << 20 << 0 ) ); + aPolyline2->SetShape( Wire2d( QList() << 0 << 0 << 10 << 10 << 20 << 0 ) ); CPPUNIT_ASSERT_EQUAL( true, aPolyline2->IsCustom() ); HYDROData_PolylineXY::PointsList aPointsList = aPolyline2->GetPoints( 0 ); diff --git a/src/HYDRO_tests/test_HYDROData_Profile.cxx b/src/HYDRO_tests/test_HYDROData_Profile.cxx index cc3d3da0..ee40097f 100644 --- a/src/HYDRO_tests/test_HYDROData_Profile.cxx +++ b/src/HYDRO_tests/test_HYDROData_Profile.cxx @@ -31,8 +31,10 @@ #include #include #include +#include const double EPS = 1E-2; +extern QString REF_DATA_PATH; bool test_HYDROData_Profile::createTestFile( const QString& theFileName, const bool theIsParametric ) @@ -87,7 +89,7 @@ void test_HYDROData_Profile::testFileImport() TCollection_AsciiString aFileName( aParamFileName.toStdString().c_str() ); NCollection_Sequence aBadProfilesList; - CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList ) ); + CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList, true ) ); int aProfileCount = 0; HYDROData_Iterator aDocIter( aDoc, KIND_PROFILE ); @@ -110,7 +112,9 @@ void test_HYDROData_Profile::testFileImport() Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); aFileName = TCollection_AsciiString( aGeorefFileName.toStdString().c_str() ); - CPPUNIT_ASSERT( aGeorefProfile->ImportFromFile( aFileName ) ); + bool notEmpty = false; + CPPUNIT_ASSERT( aGeorefProfile->ImportFromFile( aFileName, true, ¬Empty ) ); + CPPUNIT_ASSERT( notEmpty ); // Check validity of imported profile CPPUNIT_ASSERT( aGeorefProfile->IsValid() ); @@ -145,8 +149,10 @@ void test_HYDROData_Profile::testCopy() if ( anIsFileCreated ) { + bool notEmpty = false; TCollection_AsciiString anAsciiFileName( aFileName.toStdString().c_str() ); - CPPUNIT_ASSERT( aProfile1->ImportFromFile( anAsciiFileName ) ); + CPPUNIT_ASSERT( aProfile1->ImportFromFile( anAsciiFileName, true, ¬Empty ) ); + CPPUNIT_ASSERT( notEmpty ); CPPUNIT_ASSERT( aProfile1->IsValid() ); CPPUNIT_ASSERT( aProfile1->NbPoints() == 5 ); @@ -165,3 +171,59 @@ void test_HYDROData_Profile::testCopy() aDoc->Close(); } + +void operator << ( std::ostream& s, const gp_XYZ& p ) +{ + s << "(" << p.X() << "; " << p.Y() << "; " << p.Z() << ") "; +} + +bool operator == ( const gp_XYZ& p1, const gp_XYZ& p2 ) +{ + return fabs(p1.X()-p2.X()) aBadProfilesList; + CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList, false ) ); + CPPUNIT_ASSERT( HYDROData_Profile::ImportFromFile( aDoc, aFileName, aBadProfilesList, true ) ); + + HYDROData_Iterator it( aDoc, KIND_PROFILE ); + CPPUNIT_ASSERT( it.More() ); + Handle(HYDROData_Profile) p1 = Handle(HYDROData_Profile)::DownCast( it.Current() ); it.Next(); + CPPUNIT_ASSERT( it.More() ); + Handle(HYDROData_Profile) p2 = Handle(HYDROData_Profile)::DownCast( it.Current() ); it.Next(); + CPPUNIT_ASSERT( !it.More() ); + + CPPUNIT_ASSERT_EQUAL( QString( "Profile_1" ), p1->GetName() ); + CPPUNIT_ASSERT_EQUAL( QString( "Profile_2" ), p2->GetName() ); + + HYDROData_Profile::ProfilePoints pp1 = p1->GetProfilePoints(); + int low1 = pp1.Lower(), up1 = pp1.Upper(); + CPPUNIT_ASSERT_EQUAL( 1, low1 ); + CPPUNIT_ASSERT_EQUAL( 6, up1 ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 1.0, 2.0, 5.0 ), pp1.Value( 1 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 2.04019, 4.0838, 4.0 ), pp1.Value( 2 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 2.9601, 5.9202, 3.0 ), pp1.Value( 3 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 4.08026, 8.16052, 3.0 ), pp1.Value( 4 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 4.9202, 9.84041, 4.0 ), pp1.Value( 5 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 6.0, 12.0, 5.0 ), pp1.Value( 6 ) ); + + HYDROData_Profile::ProfilePoints pp2 = p2->GetProfilePoints(); + int low2 = pp2.Lower(), up2 = pp2.Upper(); + CPPUNIT_ASSERT_EQUAL( 1, low2 ); + CPPUNIT_ASSERT_EQUAL( 6, up2 ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 1.0, 2.0, 5.0 ), pp2.Value( 1 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 2.04019, 4.0838, 4.0 ), pp2.Value( 2 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 2.9601, 5.9202, 3.0 ), pp2.Value( 3 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 4.08, 8.16, 3.0 ), pp2.Value( 4 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 4.92, 9.84, 4.0 ), pp2.Value( 5 ) ); + CPPUNIT_ASSERT_EQUAL( gp_XYZ( 6.0, 12.0, 5.0 ), pp2.Value( 6 ) ); + + aDoc->Close(); +} diff --git a/src/HYDRO_tests/test_HYDROData_Profile.h b/src/HYDRO_tests/test_HYDROData_Profile.h index e2177bf4..9a22db00 100644 --- a/src/HYDRO_tests/test_HYDROData_Profile.h +++ b/src/HYDRO_tests/test_HYDROData_Profile.h @@ -22,8 +22,9 @@ class QString; class test_HYDROData_Profile : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(test_HYDROData_Profile); - CPPUNIT_TEST(testFileImport); - CPPUNIT_TEST(testCopy); + CPPUNIT_TEST( testFileImport ); + CPPUNIT_TEST( testCopy ); + CPPUNIT_TEST( testProjection ); CPPUNIT_TEST_SUITE_END(); private: @@ -43,6 +44,7 @@ public: // checks the copy/paste mechanism void testCopy(); + void testProjection(); }; CPPUNIT_TEST_SUITE_REGISTRATION(test_HYDROData_Profile); diff --git a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx index b4007cea..75281194 100644 --- a/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx +++ b/src/HYDRO_tests/test_HYDROData_ShapeFile.cxx @@ -21,7 +21,7 @@ #include #include -const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test/HYDRO"; +const QString REF_PATH = qgetenv( "HYDRO_ROOT_DIR" ) + "/bin/salome/test"; bool test_HYDROData_ShapeFile::compare_two_files(const QString& File1, const QString& File2) { diff --git a/src/HYDRO_tests/test_HYDROData_Stream.cxx b/src/HYDRO_tests/test_HYDROData_Stream.cxx new file mode 100644 index 00000000..52388f33 --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_Stream.cxx @@ -0,0 +1,272 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern QString REF_DATA_PATH; +NCollection_Sequence points2; +const double EPS = 1E-3; + +void test_HYDROData_Stream::setUp() +{ + points2.Clear(); + points2.Append( gp_XY( 0.0, 5.0 ) ); + points2.Append( gp_XY( 1.0, 1.0 ) ); + points2.Append( gp_XY( 1.5, 0.0 ) ); + points2.Append( gp_XY( 4.0, 4.0 ) ); +} + +void test_HYDROData_Stream::tearDown() +{ +} + +void test_HYDROData_Stream::test_dialog() +{ + HYDROGUI_StreamDlg* aDlg = new HYDROGUI_StreamDlg( 0, "stream" ); + aDlg->show(); + qApp->processEvents(); + + QImage aStreamDlgImage = QPixmap::grabWidget( aDlg ).toImage(); + CPPUNIT_ASSERT_IMAGES2( &aStreamDlgImage, "StreamDlg" ); + + aDlg->setDDZ( 12.34 ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 12.34, aDlg->getDDZ(), EPS ); + + aDlg->setSpatialStep( 56.78 ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 56.78, aDlg->getSpatialStep(), EPS ); + + delete aDlg; +} + +void test_HYDROData_Stream::test_alt_object() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Stream) aStream = + Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) ); + + CPPUNIT_ASSERT_EQUAL( false, (bool)aStream.IsNull() ); + CPPUNIT_ASSERT_EQUAL( true, (bool)aStream->GetAltitudeObject().IsNull() ); + CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->DTM().IsNull() ); + CPPUNIT_ASSERT_EQUAL( false, (bool)aStream->GetAltitudeObject().IsNull() ); + CPPUNIT_ASSERT_EQUAL( KIND_DTM, aStream->getAltitudeObjectType() ); + + Handle(HYDROData_DTM) aDTM = + Handle(HYDROData_DTM)::DownCast( aStream->GetAltitudeObject() ); + CPPUNIT_ASSERT_EQUAL( false, (bool)aDTM.IsNull() ); + + aDoc->Close(); +} + +void test_HYDROData_Stream::test_params_sync() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Stream) aStream = + Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) ); + Handle(HYDROData_DTM) aDTM = aStream->DTM(); + CPPUNIT_ASSERT_EQUAL( false, (bool)aDTM.IsNull() ); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + + aProfile1->SetParametricPoints( points2 ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile1->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile1->SetRightPoint( gp_XY( 20, 0 ) ); + + aProfile2->SetParametricPoints( points2 ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile2->SetLeftPoint( gp_XY( 50, 0 ) ); + aProfile2->SetRightPoint( gp_XY( 60, 10 ) ); + + HYDROData_SequenceOfObjects profiles; + profiles.Append( aProfile1 ); + profiles.Append( aProfile2 ); + + aStream->SetProfiles( profiles, false ); + aStream->SetDDZ( 3.14 ); + aStream->SetSpatialStep( 4.14 ); + + CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.14, aStream->GetDDZ(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 3.14, aDTM->GetDDZ(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 4.14, aStream->GetSpatialStep(), EPS ); + CPPUNIT_ASSERT_DOUBLES_EQUAL( 4.14, aDTM->GetSpatialStep(), EPS ); + + HYDROData_SequenceOfObjects profiles1 = aStream->GetProfiles(); + CPPUNIT_ASSERT_EQUAL( 2, profiles1.Size() ); + CPPUNIT_ASSERT( profiles.Value(1)->Label() == profiles1.Value(1)->Label() ); + CPPUNIT_ASSERT( profiles.Value(2)->Label() == profiles1.Value(2)->Label() ); + + HYDROData_SequenceOfObjects profiles2 = aDTM->GetProfiles(); + CPPUNIT_ASSERT_EQUAL( 2, profiles2.Size() ); + CPPUNIT_ASSERT( profiles.Value(1)->Label() == profiles2.Value(1)->Label() ); + CPPUNIT_ASSERT( profiles.Value(2)->Label() == profiles2.Value(2)->Label() ); + + aDoc->Close(); +} + +void test_HYDROData_Stream::test_dump() +{ + // Case 1. Without hydraulic axis + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + Handle(HYDROData_Stream) aStream1 = + Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) ); + aStream1->SetName( "stream_1" ); + + Handle(HYDROData_Profile) aProfile1 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + aProfile1->SetName( "p1" ); + + Handle(HYDROData_Profile) aProfile2 = + Handle(HYDROData_Profile)::DownCast( aDoc->CreateObject( KIND_PROFILE ) ); + aProfile2->SetName( "p2" ); + + aProfile1->SetParametricPoints( points2 ); + aProfile1->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile1->SetLeftPoint( gp_XY( 10, 10 ) ); + aProfile1->SetRightPoint( gp_XY( 20, 0 ) ); + + aProfile2->SetParametricPoints( points2 ); + aProfile2->GetProfileUZ()->SetSectionType( 0, HYDROData_IPolyline::SECTION_POLYLINE ); + aProfile2->SetLeftPoint( gp_XY( 50, 0 ) ); + aProfile2->SetRightPoint( gp_XY( 60, 10 ) ); + + HYDROData_SequenceOfObjects profiles; + profiles.Append( aProfile1 ); + profiles.Append( aProfile2 ); + + aStream1->SetProfiles( profiles, false ); + aStream1->SetDDZ( 0.2 ); + aStream1->SetSpatialStep( 3.0 ); + + MapOfTreatedObjects objs; + objs["p1"] = aProfile1; + objs["p2"] = aProfile2; + + QStringList aScript1 = aStream1->DumpToPython( "", objs ); + CPPUNIT_ASSERT_EQUAL( 10, aScript1.size() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1 = hydro_doc.CreateObject( KIND_STREAM )" ), aScript1[0].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.SetName( \"stream_1\" )" ), aScript1[1].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript1[2].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.AddProfile( p1 )" ), aScript1[3].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.AddProfile( p2 )" ), aScript1[4].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.SetDDZ( 0.200 )" ), aScript1[5].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.SetSpatialStep( 3.000 )" ), aScript1[6].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript1[7].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_1.Update()" ), aScript1[8].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript1[9].toStdString() ); + + // Case 2. With hydraulic axis + + Handle(HYDROData_Stream) aStream2 = + Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) ); + aStream2->SetName( "stream_2" ); + + Handle(HYDROData_PolylineXY) anHAxis = + Handle(HYDROData_PolylineXY)::DownCast( aDoc->CreateObject( KIND_POLYLINEXY ) ); + anHAxis->SetName( "axis" ); + + aStream2->SetProfiles( profiles, false ); + aStream2->SetDDZ( 0.2 ); + aStream2->SetSpatialStep( 3.0 ); + aStream2->SetReferenceObject( anHAxis, HYDROData_Stream::DataTag_HydraulicAxis ); + + objs.clear(); + objs["p1"] = aProfile1; + objs["p2"] = aProfile2; + objs["axis"] = anHAxis; + + QStringList aScript2 = aStream2->DumpToPython( "", objs ); + CPPUNIT_ASSERT_EQUAL( 11, aScript2.size() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2 = hydro_doc.CreateObject( KIND_STREAM )" ), aScript2[0].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.SetName( \"stream_2\" )" ), aScript2[1].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript2[2].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.SetHydraulicAxis( axis )" ), aScript2[3].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.AddProfile( p1 )" ), aScript2[4].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.AddProfile( p2 )" ), aScript2[5].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.SetDDZ( 0.200 )" ), aScript2[6].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.SetSpatialStep( 3.000 )" ), aScript2[7].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript2[8].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "stream_2.Update()" ), aScript2[9].toStdString() ); + CPPUNIT_ASSERT_EQUAL( std::string( "" ), aScript2[10].toStdString() ); + + aDoc->Close(); +} + +void test_HYDROData_Stream::test_presentation() +{ + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document(1); + + TCollection_AsciiString fname = REF_DATA_PATH.toLatin1().data(); + fname += "/Profiles.xyz"; + NCollection_Sequence bad_ids; + + int aSize = HYDROData_Profile::ImportFromFile( aDoc, fname, bad_ids, true ); + + CPPUNIT_ASSERT_EQUAL( 0, bad_ids.Size() ); + CPPUNIT_ASSERT_EQUAL( 46, aSize ); + + HYDROData_SequenceOfObjects profiles; + HYDROData_Iterator it( aDoc, KIND_PROFILE ); + for( int i=0; it.More(); it.Next(), i++ ) + { + if( i>=25 && i<=35 ) + { + it.Current()->Update(); + profiles.Append( Handle(HYDROData_Profile)::DownCast( it.Current() ) ); + } + } + + Handle(HYDROData_Stream) aStream = + Handle(HYDROData_Stream)::DownCast( aDoc->CreateObject( KIND_STREAM ) ); + + aStream->SetProfiles( profiles, false ); + aStream->SetDDZ( 0.2 ); + aStream->SetSpatialStep( 10 ); + aStream->Update(); + + TopoDS_Shape aPrs3d = aStream->GetShape3D(); + TopoDS_Shape aPrs2d = aStream->GetTopShape(); + + TestViewer::show( aPrs2d, 0, true, "stream_dtm_2d" ); + CPPUNIT_ASSERT_IMAGES; + + TestViewer::eraseAll( true ); + TestViewer::show( aPrs3d, 0, true, "stream_dtm_3d" ); + CPPUNIT_ASSERT_IMAGES + + aDoc->Close(); +} + diff --git a/src/HYDRO_tests/test_HYDROData_Stream.h b/src/HYDRO_tests/test_HYDROData_Stream.h new file mode 100644 index 00000000..40eb2100 --- /dev/null +++ b/src/HYDRO_tests/test_HYDROData_Stream.h @@ -0,0 +1,43 @@ +// Copyright (C) 2014-2015 EDF-R&D +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include + +class test_HYDROData_Stream : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( test_HYDROData_Stream ); + CPPUNIT_TEST( test_dialog ); + CPPUNIT_TEST( test_alt_object ); + CPPUNIT_TEST( test_params_sync ); + CPPUNIT_TEST( test_dump ); + CPPUNIT_TEST( test_presentation ); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp(); + void tearDown(); + + void test_dialog(); + void test_alt_object(); + void test_params_sync(); + void test_dump(); + void test_presentation(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION( test_HYDROData_Stream ); +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( test_HYDROData_Stream, "HYDROData_Stream" ); diff --git a/src/HYDRO_tests/test_HYDROGUI_Shape.cxx b/src/HYDRO_tests/test_HYDROGUI_Shape.cxx index aa6d9c88..ee5ca41f 100644 --- a/src/HYDRO_tests/test_HYDROGUI_Shape.cxx +++ b/src/HYDRO_tests/test_HYDROGUI_Shape.cxx @@ -26,7 +26,7 @@ void test_HYDROGUI_Shape::test_face_in_preview() { - TopoDS_Face aFace = Face( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << + TopoDS_Face aFace = Face2d( QList() << 21 << 34 << 24 << 25 << 37 << 37 << 40 << 61 << 44 << 95 << 85 << 100 << 104 << 66 << 107 << 33 << 128 << 18 << 140 << 50 << 131 << 89 << 104 << 111 << 31 << 114 );